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:com.apress.prospringintegration.channels.queuechannel.TicketReceiver.java

public void handleTicketMessage() {
    Message<?> ticketMessage;//from   ww  w.  j  a  v  a 2s.co m

    while (true) {
        ticketMessage = channel.receive(RECEIVE_TIMEOUT);
        if (ticketMessage != null) {
            handleTicket((Ticket) ticketMessage.getPayload());
        } else {
            try {
                /** Handle some other tasks **/

                Thread.sleep(1000);
            } catch (InterruptedException ex) {
                ex.printStackTrace();
            }
        }
    }
}

From source file:uk.ac.aber.raf8.mmp.core.jobs.YQLCacheSectorsQueryJob.java

@Override
protected void executeInternal(final JobExecutionContext jobExecutionContext) throws JobExecutionException {
    Boolean success = Boolean.FALSE;
    Integer tries = 0;/*from   w  w w  . j  a  v a 2 s  .c  o m*/
    while (!success && tries < MAX_TRIES) {
        try {
            YQLQueryCache.getInstance()
                    .setYQLSectorsQueryModel(YQLService.getInstance().getYQLSectorsQueryModel());
            success = Boolean.TRUE;
        } catch (final Exception e) {
            e.printStackTrace();
            tries++;
            try {
                Thread.sleep(DELAY_BETWEEN_TRIES);
            } catch (final InterruptedException e1) {
                e1.printStackTrace();
            }
        }
    }
}

From source file:uk.ac.kcl.it.LineFixerPKPartitionWithoutScheduling.java

@Test
@DirtiesContext//from   w  w w  .j ava2 s. c o  m
public void lineFixerTest() {
    jobLauncher.launchJob();
    try {
        Thread.sleep(5000);
    } catch (InterruptedException e) {
        e.printStackTrace();
    }

    assertEquals(75, testUtils.countOutputDocsInES());
    assertEquals(75, dbmsTestUtils.countRowsInOutputTable());

}

From source file:com.interacciones.mxcashmarketdata.mama.queue.QueueReader.java

public void ReadQueue(ConcurrentLinkedQueue<Parser> msgQueue) {

    LOGGER.debug("Reading from queue... Sizing " + msgQueue.size());

    while (true) {
        Iterator<Parser> it = msgQueue.iterator();

        while (it.hasNext()) {
            Parser msg = (Parser) it.next();
            LOGGER.debug("Message Type: " + msg.TypeMessage());
            LOGGER.debug("Symbol (Emisora):" + msg.Emisora());
            sendMessage.sendMessage(msg);
            msgQueue.poll();//ww w . j a  va 2s  .c  om
        }

        try {
            Thread.sleep(100);
        } catch (InterruptedException e) {
            e.printStackTrace();
            LOGGER.error("Error: " + e.getMessage());
        }
    }
}

From source file:com.sec.ose.osi.thread.job.init.AfterLoginTaskThread.java

public void run() {
    log.debug("AfterLoginTask: start");
    while (mBeforeLoginTaskThread.getStatus() != BeforeLoginTaskThread.DONE) {
        log.debug("AfterLoginTask: Waiting for BeforeLoginTaskThread complition");
        try {//from   www  . ja v a  2 s .co  m
            Thread.sleep(1000);
        } catch (InterruptedException e) {
            e.printStackTrace();
        }
    }

    log.debug("AfterLoginTask: init loadLicense");
    LicenseAPIWrapper.getAllLicenseList(); // from API

    log.debug("AfterLoginTask: init IdentifyQueue");
    IdentifyQueue.getInstance();

    log.debug("AfterLoginTask: start IdentifyThread");
    BackgroundJobManager.getInstance().startIdentifyThread();

    log.debug("AfterLoginTask: end");

}

From source file:Main.java

public ThreadGroupDemo() {
    MyThreadGroup pGroup = new MyThreadGroup("ParentThreadGroup");
    MyThreadGroup cGroup = new MyThreadGroup(pGroup, "ChildThreadGroup");

    Thread thr2 = new Thread(pGroup, this);
    System.out.println("Starting " + thr2.getName());

    thr2.start();//from ww  w  .j  a v a2 s . c o m

    // create third thread
    Thread thr3 = new Thread(cGroup, this);
    System.out.println("Starting " + thr3.getName());

    thr3.start();

    try {
        Thread.sleep(500);
    } catch (InterruptedException e) {
        // TODO Auto-generated catch block
        e.printStackTrace();
    }

    thr2.interrupt();
    thr3.interrupt();

}

From source file:cloud.thrift.server.conf.ZooKeeperConfig.java

@PostConstruct
public void init() {
    executor.execute(new Runnable() {
        @Override//w  w  w. j ava2s  .c  o m
        public void run() {
            registService();
            try {
                Thread.sleep(1000 * 60 * 60 * 24 * 360 * 10);
            } catch (InterruptedException e) {
                e.printStackTrace();
            }
        }
    });
}

From source file:org.eclipse.springframework.util.ApplicationContextTracker.java

public ApplicationContext getApplicationContext(int timeout) {
    ApplicationContext applicationContext = null;
    if (applicationContextServiceTracker != null) {
        try {//from w  w  w.j a  v a2 s  . c  o m
            applicationContext = (ApplicationContext) applicationContextServiceTracker.waitForService(timeout);
        } catch (InterruptedException e) {
            e.printStackTrace();
        }
    }
    return applicationContext;
}

From source file:com.ling.spring.task.TestTask.java

@Test
public void testFixedTime() {
    try {/*from  w w  w. j  av  a2  s .com*/
        Thread.currentThread().sleep(20000);
    } catch (InterruptedException e) {
        // TODO Auto-generated catch block
        e.printStackTrace();
    }
}

From source file:uk.ac.kcl.it.FullPipelinePKPartitionWithoutScheduling.java

@Test
@DirtiesContext/*from  www .java 2s. c o m*/
public void fullPipelineTest() {
    jobLauncher.launchJob();
    try {
        Thread.sleep(5000);
    } catch (InterruptedException e) {
        e.printStackTrace();
    }
    assertEquals(31, testUtils.countOutputDocsInES());
    assertEquals(31, dbmsTestUtils.countRowsInOutputTable());
}