Example usage for java.lang InterruptedException printStackTrace

List of usage examples for java.lang InterruptedException printStackTrace

Introduction

In this page you can find the example usage for java.lang InterruptedException printStackTrace.

Prototype

public void printStackTrace() 

Source Link

Document

Prints this throwable and its backtrace to the standard error stream.

Usage

From source file:Main.java

ImagePanel() {
    MediaTracker mt = new MediaTracker(this);
    for (int i = 0; i < images.length; i++) {
        imgs[i] = Toolkit.getDefaultToolkit().getImage(images[i]);
        mt.addImage(imgs[i], i);/*from   ww  w  .  j  a  v  a  2  s. c  om*/
    }
    try {
        mt.waitForAll();
    } catch (InterruptedException e) {
        e.printStackTrace();
    }
}

From source file:Main.java

public void run() {
    try {//from  w w  w  .  j a  v  a 2s. c om
        System.out.printf("%s going to sleep for %d milliseconds.\n", threadName, sleepTime);

        Thread.sleep(sleepTime); // put thread to sleep
    } catch (InterruptedException exception) {
        exception.printStackTrace();
    }
    System.out.printf("%s done sleeping\n", threadName);
}

From source file:Main.java

@Override
public void run() {
    for (int i = 0; i <= 5; i++) {
        try {/*from w w  w  .j ava2  s . c  o  m*/
            Thread.sleep(500);
        } catch (InterruptedException e) {
            e.printStackTrace();
        }
        System.out.println("The current Thread is " + super.getName() + " and thread ID is " + super.getId());
    }
}

From source file:LatchHelperService.java

public void run() {
    try {/*from  w w  w .j a  v  a  2s . c om*/
        System.out.println("waiting for services to start.");
        latch.await();
        System.out.println("started.");
    } catch (InterruptedException e) {
        e.printStackTrace();
    }
}

From source file:LatchHelperService.java

public void run() {
    try {//from ww w . j  a va  2s.c om
        Thread.sleep(1000);
        System.out.println("Service #" + ID + "  has  started...");
    } catch (InterruptedException e) {
        e.printStackTrace();
    } finally {
        this.latch.countDown();
    }
}

From source file:com.anton.dev.tqrbs2.QueueConsumeProcess.java

@Override
public void onMessage(Message msg) {
    LOGGER.info(new String(msg.getBody()));
    try {//  ww w.j a  v a  2s. com
        Thread.sleep(1000);
    } catch (InterruptedException e) {
        e.printStackTrace();
    }
}

From source file:Main.java

public void a() {
    new Thread(new Runnable() {
        @Override/*from  w w  w .ja v  a2s  .c  o  m*/
        public void run() {
            System.out.println("A: I am going to sleep");
            System.out.println("A: I slept one full day. Feels great.");
            System.out.println("A: Hey B, wake up!");
            try {
                Thread.sleep(1000);
            } catch (InterruptedException e) {
                e.printStackTrace();
            }
            latch.countDown();
        }
    }).start();
}

From source file:de.fhg.fokus.diameter.DiameterPeer.peer.StateMachine.java

/**
 * Process the received Diameter message.
 * //from  w  ww  .ja  v a  2  s . c o m
 * @param p
 *            Peer receiving the Diameter message.
 * @param msg
 *            The received Diameter message.
 */
public static void Rcv_Process(Peer p, DiameterMessage msg) {
    boolean done = false;
    if (p.diameterPeer.eventListeners.size() != 0) {
        while (!done) {
            try {
                done = p.diameterPeer.queueTasks.offer(new DiameterTask(p, msg), 1000, TimeUnit.MILLISECONDS);
            } catch (InterruptedException e) {
                e.printStackTrace();
                break;
            }
            // if (!done) LOGGER.debug("ful "+p.diameterPeer.queueTasks.size());
            // else LOGGER.debug("put "+p.diameterPeer.queueTasks.size());
            // //LOGGER.debug("StateMachine: Processing queue is full. Overload...");
        }
    }
    // LOGGER.debug("StateMachine: Received message "+msg.toString()+"---");
}

From source file:Main.java

public void run() {
    System.out.println("Thread started...");
    while (keepRunning) {
        try {//  w w  w .ja  va  2s. c  o m
            System.out.println("Going to sleep...");
            Thread.sleep(1000);
            synchronized (this) {
                while (suspended) {
                    System.out.println("Suspended...");
                    this.wait();
                    System.out.println("Resumed...");
                }
            }
        } catch (InterruptedException e) {
            e.printStackTrace();
        }
    }
}

From source file:com.codemacro.jcm.JCMMain.java

public void onApplicationEvent(ContextClosedEvent event) {
    try {//  ww w .  ja v  a 2s  .c  om
        jcmApp.shutdown();
    } catch (InterruptedException e) {
        e.printStackTrace();
    }
}