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:io.moquette.parser.netty.performance.PublishBomber.java

private void sendMessage(MqttMessage msg) {
    try {//from   ww  w.  j  av a2 s  .  com
        channel.writeAndFlush(msg).await().addListener(CLOSE_ON_FAILURE);
    } catch (InterruptedException e) {
        e.printStackTrace();
    }
}

From source file:io.moquette.parser.netty.performance.PublishBomber.java

public void disconnect() {
    try {//from w  w  w  .java  2 s .  c o  m
        this.channel.disconnect().await().addListener(CLOSE_ON_FAILURE);
    } catch (InterruptedException e) {
        e.printStackTrace();
    }
}

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

@Override
protected void executeInternal(final JobExecutionContext jobExecutionContext) throws JobExecutionException {

    final YQLIndustryQueryModel industryQueryModel = new YQLIndustryQueryModel();
    final YQLSectorsQueryModel sectorsQueryModel = YQLQueryCache.getInstance().getYQLSectorsQueryModel();

    for (final YQLSectorModel sectorModel : sectorsQueryModel.getSectorModels()) {
        Boolean success = Boolean.FALSE;
        Integer tries = 0;//w w  w.ja v a2s  .  c o  m
        while (!success && tries < MAX_TRIES) {
            try {
                final YQLIndustryQueryModel temp = YQLService.getInstance()
                        .getYQLIndustryQueryModel(sectorModel.getIndustryModels());
                industryQueryModel.getIndustryModels().addAll(temp.getIndustryModels());
                success = Boolean.TRUE;
            } catch (final Exception e) {
                e.printStackTrace();
                tries++;
                try {
                    Thread.sleep(DELAY_BETWEEN_TRIES);
                } catch (final InterruptedException e1) {
                    e1.printStackTrace();
                }
            }
        }
    }

    YQLQueryCache.getInstance().setYQLIndustryQueryModel(industryQueryModel);
}

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

@Override
protected void executeInternal(final JobExecutionContext jobExecutionContext) throws JobExecutionException {

    final YQLIndustryQueryModel industryQueryModel = YQLQueryCache.getInstance().getYqlIndustryQueryModel();
    final YQLStocksQueryModel stocksQueryModel = new YQLStocksQueryModel();

    for (final YQLIndustryModel industryModel : industryQueryModel.getIndustryModels()) {
        Boolean success = Boolean.FALSE;
        Integer tries = 0;/*from   w  ww  .  j  a v a 2s  . c  om*/
        while (!success && tries < MAX_TRIES) {
            try {
                final YQLStocksQueryModel temp = YQLService.getInstance()
                        .getYQLStocksQueryModel(industryModel.getCompanyModels());
                stocksQueryModel.getStockModels().addAll(temp.getStockModels());
                success = Boolean.TRUE;
            } catch (final Exception e) {
                e.printStackTrace();
                tries++;
                try {
                    Thread.sleep(DELAY_BETWEEN_TRIES);
                } catch (final InterruptedException e1) {
                    e1.printStackTrace();
                }
            }
        }
    }

    YQLQueryCache.getInstance().setYQLStocksQueryModel(stocksQueryModel);
}

From source file:com.appenginefan.toolkit.common.HttpClientEnvironment.java

@Override
public void execute(final WebConnectionClient client) {
    new Thread(new Runnable() {
        @Override//  w w  w  .j  a va  2  s .  c o  m
        public void run() {
            try {
                client.run();
            } catch (InterruptedException e) {
                e.printStackTrace();
            }
        }
    }).start();
}

From source file:eu.learnpad.simulator.mon.example.MyGlimpseProbe_BPMN_LearnPAd.java

private void generateAndSendExample_GlimpseBaseEvents_StringPayload(String data, int sendingInterval)
        throws UnknownHostException {
    DebugMessages.ok();//from w w w  . ja  v a  2  s . com
    DebugMessages.print(TimeStamp.getCurrentTime(), MyGlimpseProbe_BPMN_LearnPAd.class.getName(),
            "Creating GlimpseBaseEventBPMN message");
    GlimpseBaseEventBPMN<String> message;
    DebugMessages.ok();
    DebugMessages.line();
    try {

        AbstractEvent theEvent = new SessionScoreUpdateEvent();

        for (int i = 0; i < 1000; i++) {
            Vector<Learner> usersInvolved = new Vector<>();
            usersInvolved.add(new Learner(1, 12, "testName1", "testSurname1"));
            usersInvolved.add(new Learner(2, 24, "testName2", "testSurname2"));

            message = new GlimpseBaseEventBPMN<String>(data, "aGenericProbe", System.currentTimeMillis(),
                    "EventGeneratedFromActivitiEngineSimulated", false, "ExtraField", theEvent);

            this.sendEventMessage(message, false);
            DebugMessages.println(TimeStamp.getCurrentTime(), MyGlimpseProbe_BPMN_LearnPAd.class.getName(),
                    "GlimpseBaseEventBPMN message sent: {\n" + "eventName: " + message.getEventName() + "\n"
                            + "eventData: " + message.getEventData() + "\n" + "timestamp: "
                            + message.getTimeStamp() + "\n" + "extraField: " + message.getExtraDataField()
                            + "\n" + "sessionID_Field: " + message.event.simulationsessionid + "\n"
                            + "usersInvolvedSize: " + message.event.involvedusers + "\n" + "eventType: "
                            + message.event.type + "}");
            DebugMessages.line();
            Thread.sleep(sendingInterval);
        }
    } catch (JMSException e1) {
        e1.printStackTrace();
    } catch (NamingException e1) {
        e1.printStackTrace();
    } catch (InterruptedException e) {
        e.printStackTrace();
    }
}

From source file:net.wessendorf.amqp.RabbitPublishService.java

@Override
public void run() {
    try {/* www  .  j a  v  a 2 s  .  com*/
        while (true) {
            sendUpdates();
            Thread.sleep(50L);
        }
    } catch (InterruptedException e) {
        // TODO Auto-generated catch block
        e.printStackTrace();
    }

}

From source file:architecture.common.TaskAndEventContextTest.java

@Test
public void testEventPublish() {

    EventPublisher publisher = context.getBean("eventPublisher", EventPublisher.class);
    publisher.publish("hello");
    try {/*from w w w.j a va  2 s .  c  o m*/
        Thread.currentThread().sleep(1000L);
    } catch (InterruptedException e) {
        // TODO Auto-generated catch block
        e.printStackTrace();
    }
}

From source file:Queue.java

/** 
 * Removes the first runnable object from the queue, blocking until one is available.
 *///  w w  w  .j  av  a2 s  .c o  m
public synchronized Object remove() {
    while (true) {
        Object runnable = removeNoWait();
        if (runnable != null) {
            return runnable;
        }
        try {
            wait(defaultTimeout);
        } catch (InterruptedException e) {
            e.printStackTrace();

        }
    }
}

From source file:com.sixt.service.framework.kafka.KafkaThrottlingTest.java

@Test
public void throttleTest() throws InterruptedException {
    int messageCount = 200;
    CountDownLatch latch = new CountDownLatch(messageCount);

    DockerPort kafka = docker.containers().container("kafka").port(9092);
    ServiceProperties props = new ServiceProperties();
    props.addProperty(KAFKA_SERVER_KEY, kafka.inFormat("$HOST:$EXTERNAL_PORT"));

    String topic = "throttle-test";
    KafkaPublisherFactory publisherFactory = new KafkaPublisherFactory(props);
    KafkaPublisher publisher = publisherFactory.newBuilder(topic).build();

    KafkaSubscriberFactory subscriberFactory = new KafkaSubscriberFactory<String>(props);
    EventReceivedCallback<String> callback = (message, topicInfo) -> {
        latch.countDown();// ww w .j av  a 2  s.  c  o m
        try {
            Thread.sleep(10);
        } catch (InterruptedException e) {
            e.printStackTrace();
        }
    };
    //noinspection unchecked
    subscriberFactory.newBuilder(topic, callback).withPollTime(50).withAutoCommit(true).build();

    for (int i = 0; i < messageCount; i++) {
        publisher.publishSync("message " + i + randomData());
    }
    latch.await();
}