Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public void notifyEventChange(boolean change){
- Runnable myRunnable = new Runnable() {
- public void run() {
- synchronized(this){
- try {
- // while(!Thread.currentThread().isInterrupted()){
- System.out.println("Entered thread wait");
- wait(duration);
- checkServerConnection();
- //}
- }
- catch(InterruptedException e){
- System.out.println(e);
- System.out.println("Interrupted request");
- }
- }
- }
- };
- Thread th=new Thread(myRunnable);
- System.out.println("Entered thread module");
- if(change)
- {
- System.out.println(th.isInterrupted());
- System.out.println("Thread started");
- th.start();
- }
- else if(!change){
- System.out.println("Entered interrupted module");
- th.interrupt();
- System.out.println(th.isInterrupted());
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement