Example usage for java.lang Runnable interface-usage

List of usage examples for java.lang Runnable interface-usage

Introduction

In this page you can find the example usage for java.lang Runnable interface-usage.

Usage

From source file MyThread.java

class MyThread implements Runnable {
    public void run() {
        try {
            Thread.sleep(30000);
            for (int i = 1; i < 10; i++) {
                if (Thread.interrupted()) {

From source file SleepInterrupt.java

public class SleepInterrupt extends Object implements Runnable {
    public void run() {
        try {
            System.out.println("in run() - sleep for 20 seconds");
            Thread.sleep(20000);
            System.out.println("in run() - woke up");

From source file ThreadDemo.java

class ThreadDemo implements Runnable {
    ThreadDemo(String str) {
        Thread t = new Thread(this, str);
        t.start();
    }

From source file ThreadDemo.java

class ThreadDemo implements Runnable {
    public void run() {
        try {
            while (true) {
                Thread.sleep(1000);
            }

From source file ThreadDemo.java

class ThreadDemo implements Runnable {
    public void run() {
        try {
            while (true) {
                Thread.sleep(1000);
            }

From source file ThreadDemo.java

class ThreadDemo implements Runnable {

    public void run() {
        try {
            while (true) {
                Thread.sleep(1000);

From source file MyThread.java

class MyThread implements Runnable {
    public void run() {
        System.out.println(Thread.currentThread().getName() + " starting.");
        try {
            Thread.sleep(30000);
            for (int i = 1; i < 10; i++) {

From source file MyThread.java

class MyThread implements Runnable {
    int count;

    MyThread() {
        count = 0;
    }

From source file MyDaemon.java

class MyDaemon implements Runnable {
    Thread thrd;

    MyDaemon() {
        thrd = new Thread(this);
        thrd.setDaemon(true);

From source file ThreadDemo.java

class ThreadDemo implements Runnable {

    public void run() {

        System.out.println("This is run() method");
    }