15.05.2013 Views

Clase Thread - docencia de la ETSIT-URJC

Clase Thread - docencia de la ETSIT-URJC

Clase Thread - docencia de la ETSIT-URJC

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

<strong>C<strong>la</strong>se</strong>s e interfaces en java.<strong>la</strong>ng<br />

Interfaz Runnable<br />

public interface Runnable {<br />

void run();<br />

}<br />

Métodos re<strong>la</strong>cionados con threads<br />

<strong>de</strong> <strong>la</strong> c<strong>la</strong>se Object<br />

public c<strong>la</strong>ss Object {<br />

public final void wait() throws InterruptedException;<br />

public final native void wait(long timeout)<br />

throws InterruptedException;<br />

public final void wait(long timeout, int nanos)<br />

throws InterruptedException;<br />

public final native void notify();<br />

public final native void notifyAll();<br />

}<br />

<strong>C<strong>la</strong>se</strong> <strong>Thread</strong><br />

public c<strong>la</strong>ss <strong>Thread</strong> implements Runnable {<br />

public final static int MIN_PRIORITY = 1;<br />

public final static int MAX_PRIORITY = 10;<br />

public final static int NORM_PRIORITY = 5;<br />

public <strong>Thread</strong>();<br />

public <strong>Thread</strong>(String name);<br />

public <strong>Thread</strong>(Runnable runObject);<br />

public <strong>Thread</strong>(Runnable runObject, String name);<br />

public String toString();<br />

public void run();<br />

public final void start()<br />

throws Illegal<strong>Thread</strong>StateException;<br />

public final void stop() throws SecurityException;<br />

public final void suspedn() throws SecurityException;<br />

public final void resume() throws SecurityException;<br />

public final String getName();<br />

public final int getPriority();<br />

public final int setPriority(int newPriority)<br />

throws SecurityException, IllegalArgumentException;<br />

public final void join() throws InterruptedException;<br />

public final void join(long millis)<br />

throws InterruptedException;<br />

public void interrupt();<br />

public boolean isInterrupted();<br />

}<br />

public static <strong>Thread</strong> current<strong>Thread</strong>();<br />

public static void yield();<br />

public static void sleep( long millis )<br />

throws InterruptedException;<br />

public void <strong>de</strong>stroy();

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!