Example usage for java.lang InterruptedException getMessage

List of usage examples for java.lang InterruptedException getMessage

Introduction

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

Prototype

public String getMessage() 

Source Link

Document

Returns the detail message string of this throwable.

Usage

From source file:io.hops.tensorflow.TestCluster.java

protected void setupInternal(int numNodeManager) throws Exception {

    LOG.info("Starting up YARN cluster");

    conf = new YarnConfiguration();
    conf.setInt(YarnConfiguration.RM_SCHEDULER_MINIMUM_ALLOCATION_MB, 128);
    conf.set("yarn.log.dir", "target");
    conf.set("yarn.log-aggregation-enable", "true");
    conf.setBoolean(YarnConfiguration.TIMELINE_SERVICE_ENABLED, true);
    conf.set(YarnConfiguration.RM_SCHEDULER, CapacityScheduler.class.getName());
    conf.setBoolean(YarnConfiguration.NODE_LABELS_ENABLED, true);
    conf.setBoolean(YarnConfiguration.NM_GPU_RESOURCE_ENABLED, false);

    if (yarnCluster == null) {
        yarnCluster = new MiniYARNCluster(TestCluster.class.getSimpleName(), 1, numNodeManager, 1, 1);
        yarnCluster.init(conf);/*from  www  .j  a va  2  s. com*/

        yarnCluster.start();

        conf.set(YarnConfiguration.TIMELINE_SERVICE_WEBAPP_ADDRESS,
                MiniYARNCluster.getHostname() + ":" + yarnCluster.getApplicationHistoryServer().getPort());

        waitForNMsToRegister();

        URL url = Thread.currentThread().getContextClassLoader().getResource("yarn-site.xml");
        if (url == null) {
            throw new RuntimeException("Could not find 'yarn-site.xml' dummy file in classpath");
        }
        Configuration yarnClusterConfig = yarnCluster.getConfig();
        yarnClusterConfig.set("yarn.application.classpath", new File(url.getPath()).getParent());
        //write the document to a buffer (not directly to the file, as that
        //can cause the file being written to get read -which will then fail.
        ByteArrayOutputStream bytesOut = new ByteArrayOutputStream();
        yarnClusterConfig.writeXml(bytesOut);
        bytesOut.close();
        //write the bytes to the file in the classpath
        OutputStream os = new FileOutputStream(new File(url.getPath()));
        os.write(bytesOut.toByteArray());
        os.close();
    }
    FileContext fsContext = FileContext.getLocalFSFileContext();
    fsContext.delete(new Path(conf.get("yarn.timeline-service.leveldb-timeline-store.path")), true);
    try {
        Thread.sleep(2000);
    } catch (InterruptedException e) {
        LOG.info("setup thread sleep interrupted. message=" + e.getMessage());
    }
}

From source file:com.robustaweb.library.rest.client.implementation.AndroidRestClient.java

/**
 * {@inheritDoc }//from w w w . ja va 2 s .  co m
 */
@Override
public void join() {
    try {
        requestThread.join();
    } catch (InterruptedException ex) {
        throw new HttpException("Can't join the client's thread : " + ex.getMessage(), ex);
    }
}

From source file:ch.cyberduck.core.http.DelayedHttpEntity.java

public void writeTo(final OutputStream out) throws IOException {
    try {/*from  w w w  .java 2 s. c  o  m*/
        stream = new OutputStream() {
            @Override
            public void write(final byte[] b, final int off, final int len) throws IOException {
                out.write(b, off, len);
            }

            @Override
            public void write(final int b) throws IOException {
                out.write(b);
            }

            @Override
            public void write(final byte[] b) throws IOException {
                out.write(b);
            }

            @Override
            public void close() throws IOException {
                try {
                    super.close();
                } finally {
                    // Signal finished writing to stream
                    exit.countDown();
                }
            }
        };
    } finally {
        entry.countDown();
    }
    // Wait for signal when content has been written to the pipe
    try {
        exit.await();
    } catch (InterruptedException e) {
        log.error(String.format("Error waiting for exit signal %s", e.getMessage()));
        throw new IOException(e);
    }
    // Entity written to server
    consumed = true;
}

From source file:ch.cyberduck.core.transfer.TransferQueue.java

/**
 * Idle this transfer until a free slot is available depending on
 * the maximum number of concurrent transfers allowed in the Preferences.
 *
 * @param t This transfer should respect the settings for maximum number of transfers
 *//*from ww  w. j  a  v a 2  s  . com*/
public void add(final Transfer t, final ProgressListener listener) {
    if (log.isDebugEnabled()) {
        log.debug(String.format("Add transfer %s to queue", t));
    }
    if (0 == running.remainingCapacity()) {
        if (log.isInfoEnabled()) {
            log.info(String.format("Queuing transfer %s", t));
        }
        listener.message(
                LocaleFactory.localizedString("Maximum allowed connections exceeded. Waiting", "Status"));
        notification.notify("Transfer queued", t.getName());
    }
    // The maximum number of transfers is already reached. Wait for transfer slot.
    try {
        threads.put(t, Thread.currentThread());
        running.put(t);
    } catch (InterruptedException e) {
        log.error(String.format("Error waiting for slot in queue. %s", e.getMessage()));
    } finally {
        threads.remove(t);
    }
    if (log.isInfoEnabled()) {
        log.info(String.format("Released from queue %s", t));
    }
    label.badge(String.valueOf(running.size()));
}

From source file:com.flexive.core.storage.genericSQL.GenericBinarySQLOutputStream.java

/**
 * {@inheritDoc}//from  ww w.j av  a 2 s .  co  m
 */
@Override
public void close() throws IOException {
    super.close();
    try {
        rcvThread.join();
    } catch (InterruptedException e) {
        LOG.error("Receiving thread got interrupted: " + e.getMessage(), e);
    }
    PreparedStatement ps = null;
    Connection con = null;
    try {
        con = Database.getNonTXDataSource(divisionId).getConnection();
        ps = con.prepareStatement(
                "UPDATE " + DatabaseConst.TBL_BINARY_TRANSIT + " SET TFER_DONE=?, BLOBSIZE=? WHERE BKEY=?");
        ps.setBoolean(1, true);
        ps.setLong(2, count);
        ps.setString(3, handle);
        if (ps.executeUpdate() != 1)
            LOG.error("Failed to update binary transit for handle " + handle);
    } catch (SQLException e) {
        LOG.error("SQL error marking binary as finished: " + e.getMessage(), e);
    } finally {
        Database.closeObjects(GenericBinarySQLOutputStream.class, con, ps);
    }
}

From source file:dk.nsi.sdm4.ydelse.parser.YdelseParser.java

/**
 * @see Parser#process(java.io.File, String)
 *//*w w  w.  ja va2 s. co m*/
@Override
public void process(File dataset, String identifier) throws ParserException {
    File file = findSingleFileOrComplain(dataset);
    SLALogItem slaLogItem = slaLogger.createLogItem(getHome() + ".process", "SDM4." + getHome() + ".process");
    slaLogItem.setMessageId(identifier);
    slaLogItem.addCallParameter(Parser.SLA_INPUT_NAME, dataset.getAbsolutePath());

    countNumberOfLines(file);

    long processed = 0;
    Future<Long> insertionFuture = inserter.readFileAndPerformDatabaseOperations(file);
    try {
        processed = insertionFuture.get();
    } catch (InterruptedException e) {
        slaLogItem.setCallResultError("VitaminParser failed - Cause: " + e.getMessage());
        slaLogItem.store();
        throw new RuntimeException(e);
    } catch (ExecutionException e) {
        slaLogItem.setCallResultError("VitaminParser failed - Cause: " + e.getMessage());
        slaLogItem.store();
        throw new ParserException("Unable to perform insertions for " + file.getAbsolutePath(), e);
    }
    slaLogItem.addCallParameter(Parser.SLA_RECORDS_PROCESSED_MAME, "" + processed);
    slaLogItem.setCallResultOk();
    slaLogItem.store();
}

From source file:hws.channel.net.NetDeliver.java

public void finish() {
    out.println("Waiting server channel to be closed");
    out.flush();/* ww  w.  java2s  . co  m*/
    try {
        this.latch.await(); //await server channel to be closed
    } catch (InterruptedException e) {
        // handle
        out.println("Waiting ERROR: " + e.getMessage());
        out.flush();
    }
    out.println("Finishing channel deliver: " + channelName() + " instance " + instanceId());
    out.close();
    super.finish();
}

From source file:com.hmsinc.epicenter.integrator.stats.StatisticsService.java

/**
 * Called when a duplicate message is received for updating statistics for a
 * specific provider.//ww  w  .j  a va  2 s .c  o m
 * 
 * @param message
 * @param type
 * @param info
 */
public void updateProviderStats(HL7Message message, StatsType type, String info) {
    if (message != null && type != null) {
        try {
            queue.put(new StatisticsEntry(message.getDataSource(), type, message.getId(), info));
        } catch (InterruptedException e) {
            logger.error(e.getMessage(), e);
        }
    }
}

From source file:com.ebay.jetstream.event.processor.esper.raw.EsperTest.java

@Test
public void aggregationTest() {
    Configuration configuration = new Configuration();
    configuration.configure(/* w w w  .j ava2 s. c o  m*/
            new File("src/test/java/com/ebay/jetstream/event/processor/esper/raw/EsperTestConfig.xml"));
    EPServiceProvider epService = EPServiceProviderManager.getProvider("EsperTest", configuration);
    EsperTestAggregationStatement esperStmt = new EsperTestAggregationStatement(epService.getEPAdministrator());
    EsperTestAggregationListener listener = new EsperTestAggregationListener();
    esperStmt.addListener(listener);

    ExecutorService threadPool = Executors.newCachedThreadPool(new EsperTestThreadFactory());
    EsperTestAggregationRunnable runnables[] = new EsperTestAggregationRunnable[THREADS_NUM_AGGRTEST];
    try {
        for (int i = 0; i < THREADS_NUM_AGGRTEST; i++) {
            runnables[i] = new EsperTestAggregationRunnable(epService, i);
            threadPool.submit(runnables[i]);
        }
        threadPool.shutdown();
        threadPool.awaitTermination(200, TimeUnit.SECONDS);
    } catch (InterruptedException e) {
        fail("InterruptedException: " + e.getMessage());
    }
    assertTrue("ExecutorService failed to shut down properly", threadPool.isShutdown());
    assertEquals(THREADS_NUM_AGGRTEST * 2, listener.getCount());
    assertEquals(THREADS_NUM_AGGRTEST, m_aggregationResults.size()); // only one result per oroginal event
    for (int i = 0; i < THREADS_NUM_AGGRTEST; i++) {
        assertEquals(11.0 + 4. * i, m_aggregationResults.get(i), 1.e-06);
    }
    assertEquals(THREADS_NUM_AGGRTEST, m_aggregationAvgResults.size()); // only one result per oroginal event
    for (int i = 0; i < THREADS_NUM_AGGRTEST; i++) {
        assertEquals((11.0 + 4. * i) / 4., m_aggregationAvgResults.get(i), 1.e-06);
    }
}

From source file:com.hp.mqm.clt.TestResultCollectionTool.java

private boolean validatePublishResult(long testResultId, String fileName) {
    String publishResult = null;/*w  ww .j a va  2  s. co m*/
    try {
        publishResult = getPublishResult(testResultId);
    } catch (InterruptedException e) {
        System.out.println("Thread was interrupted: " + e.getMessage());
        System.exit(ReturnCode.FAILURE.getReturnCode());
    }
    if (StringUtils.isEmpty(publishResult)) {
        System.out.println("Unable to verify publish result of the last push from file '" + fileName
                + "' with ID: " + testResultId);
        return false;
    }

    Set<String> allowedPublishResults = new HashSet<String>();
    allowedPublishResults.add("success");
    if (settings.isSkipErrors()) {
        allowedPublishResults.add("warning");
    }
    if (!allowedPublishResults.contains(publishResult)) {
        System.out.println("Test result from file '" + fileName + "' with ID " + testResultId
                + " was not pushed - "
                + "please check if all references (e.g. release id) are correct or try to set skip-errors option");
        return false;
    } else {
        System.out.println("Test result from file '" + fileName + "' with ID " + testResultId
                + " was successfully pushed");
        return true;
    }
}