package com.example.domain;

public class MyRunnable implements Runnable {

	int num = 0;
	
	@Override
	public void run() {
		// get currently running thread
		Thread current = Thread.currentThread();
		
		// define the job/task to be
		// executed in threads
		for(int i = 0; i < 5; i++) {
			System.out.println(current.getName() + " - " + i);
			
			// simulate long running process
			// put thread to sleep
			try {
				Thread.sleep(1000);
				
				// get currently running thread's name
				System.out.println(current.getName() 
						+ " - thread wakes up!");
				
			} catch (InterruptedException e) {
				// do nothing
				
			}
		}
	}

}
