List of usage examples for java.lang Runnable interface-usage
From source file Main.java
public class Main implements Runnable { public void run() { System.out.println("Shutting down"); } public static void main(String[] arg) {
From source file Uncaught.java
public class Uncaught implements Runnable { public static void main(String[] args) { Thread thread = new Thread(new Uncaught()); thread.setUncaughtExceptionHandler(new Thread.UncaughtExceptionHandler() { public void uncaughtException(Thread t, Throwable e) {
From source file caller.java
class caller implements Runnable { String msg; public caller(String s) { msg = s; new Thread(this).start();
From source file ThreadDemo.java
class ThreadDemo implements Runnable { public void run() { // returns the state of this thread Thread.State state = Thread.currentThread().getState();
From source file ThreadDemo.java
class ThreadDemo implements Runnable { public void run() { System.out.println("Holds Lock = " + Thread.holdsLock(this));
From source file ThreadDemo.java
class ThreadDemo implements Runnable { public void run() { Thread t = Thread.currentThread(); // tests if this thread is alive
From source file ThreadDemo.java
class ThreadDemo implements Runnable { Thread t; ThreadDemo() { t = new Thread(this);
From source file ThreadDemo.java
class ThreadDemo implements Runnable { public void run() { // returns the identifier of this Thread. System.out.println("Name = " + Thread.currentThread().getName()); System.out.print("Id = " + Thread.currentThread().getId()); }
From source file ThreadDemo.java
class ThreadDemo implements Runnable { public void run() { for (int i = 1; i < 13; i++) { System.out.println(Thread.currentThread().getName() + " " + i); try { // thread to sleep for 1000 milliseconds
From source file ThreadDemo.java
class ThreadDemo implements Runnable { public void run() { for (int i = 1; i < 13; i++) { System.out.println(Thread.currentThread().getName() + " " + i);