List of usage examples for java.lang InterruptedException printStackTrace
public void printStackTrace()
From source file:TQProducer.java
@Override public void run() { while (true) { try {/*from w w w . j a v a 2 s.c o m*/ Thread.sleep(3000); int item = tQueue.take(); System.out.format("%s removed: %d%n", name, item); } catch (InterruptedException e) { e.printStackTrace(); } } }
From source file:Test.java
@Override public void run() { try {/* ww w . jav a 2 s . c om*/ Thread.currentThread().sleep(1000); } catch (InterruptedException ex) { ex.printStackTrace(); } Item item; while ((item = Test.deque.pollFirst()) != null) { if (item == null) { } else { generateOrder(item); } } }
From source file:org.terasoluna.gfw.functionaltest.domain.service.logging.TraceLoggingInterceptorServiceImpl.java
@Override public void sleep(long millis) { try {//from ww w . j a va 2 s .c om Thread.sleep(millis); } catch (InterruptedException e) { e.printStackTrace(); } }
From source file:Test.java
@Override public void run() { String itemName = ""; int itemId = 0; try {//from ww w .jav a 2 s . c o m for (int i = 1; i < 8; i++) { itemName = "Item" + i; itemId = i; Test.deque.add(new Item(itemName, itemId)); System.out.println("New Item Added:" + itemName + " " + itemId); Thread.currentThread().sleep(250); } } catch (InterruptedException ex) { ex.printStackTrace(); } }
From source file:Test.java
@Override public void run() { try {/* www . ja v a2 s. c o m*/ Thread.currentThread().sleep(1000); } catch (InterruptedException ex) { ex.printStackTrace(); } while (true) { try { generateOrder(Test.linkTransQ.take()); } catch (InterruptedException ex) { ex.printStackTrace(); } } }
From source file:MainClass.java
public void init() { MediaTracker mt = new MediaTracker(this); i = getImage(getDocumentBase(), "rosey.jpg"); mt.addImage(i, 0);/*from w w w .j a v a 2 s . c o m*/ try { mt.waitForAll(); int width = i.getWidth(this); int height = i.getHeight(this); j = createImage(new FilteredImageSource(i.getSource(), new CropImageFilter(width / 3, height / 3, width / 3, height / 3))); } catch (InterruptedException e) { e.printStackTrace(); } }
From source file:com.github.liyp.rabbitmq.demo.QueueTwoListener.java
@Override public void onMessage(Message message) { Object obj = rabbitTemplate.getMessageConverter().fromMessage(message); try {// w ww . j a v a 2 s . co m Thread.sleep(1000); } catch (InterruptedException e) { e.printStackTrace(); } System.out.println("TWO# Listener data :" + message.toString() + "obj :" + obj + " " + obj.getClass() + " thread : " + Thread.currentThread().toString()); }
From source file:WaitComm.java
public void run() { while (true) { synchronized (theSender) { while (!theSender.isValid) { try { theSender.wait();//from w w w .j a v a 2s . c om } catch (InterruptedException e) { e.printStackTrace(); } } } System.out.println("received " + theSender.theValue); synchronized (theSender) { theSender.isValid = false; theSender.notify(); } } }
From source file:WaitComm.java
public void run() { for (int i = 0; i < 5; i++) { synchronized (this) { while (isValid) { try { this.wait(); } catch (InterruptedException e) { e.printStackTrace(); }/*from w ww .j av a 2 s. c o m*/ } } theValue = (int) (Math.random() * 256); System.out.println("sending " + theValue); synchronized (this) { isValid = true; this.notify(); } } }
From source file:com.aan.girsang.server.dao.constant.ServerDao.java
public Date tanggalServer() { Date date = new Date(); Thread t = new Thread(() -> { while (true) { try { Thread.sleep(1000); } catch (InterruptedException ex) { ex.printStackTrace(); }/*w w w . j ava 2 s . c om*/ } }); t.start(); return date; }