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:fr.aliasource.webmail.common.cache.DatabaseCache.java

public W getData() {
    if (!exists()) {
        try {/*from   w ww.  ja v a  2  s.c o m*/
            update();
        } catch (InterruptedException e) {
            logger.error(e.getMessage(), e);
            return null;
        }
    }

    if (memoryCacheEnabled && memoryCache != null) {
        return memoryCache;
    } else {
        return loadFromCache();
    }
}

From source file:ch.cyberduck.core.bonjour.LimitedRendezvousListener.java

private boolean acquire() {
    if (limit.getAvailablePermits() > 0) {
        try {/*from   w w w . j  a  v  a2 s  .  co m*/
            // Blocking if limit is exceeded
            limit.acquire();
            if (log.isDebugEnabled()) {
                log.debug(String.format("Acquired lock for %s", limit));
            }
            return true;
        } catch (InterruptedException e) {
            log.warn(String.format("Failure acquiring lock %s", e.getMessage()));
        }
    }
    return false;
}

From source file:gsn.wrappers.GPSGenerator.java

public void run() {
    while (isActive()) {
        double latitude = 37.4419 + .01 * (step++);
        double longitude = -122.1419;
        try {/* w  w  w  . ja  va2 s .  c  o m*/
            Thread.sleep(samplingRate);
        } catch (InterruptedException e) {
            logger.error(e.getMessage(), e);
        }
        StreamElement streamElement = new StreamElement(FIELD_NAMES, FIELD_TYPES,
                new Serializable[] { latitude, longitude, 25.5, 650, picture });
        postStreamElement(streamElement);
    }
}

From source file:gridool.GridServer.java

private <A extends Serializable, R extends Serializable> R execute(
        @Nonnull Class<? extends GridJob<A, R>> jobClass, @Nullable A arg, @Nonnull String deploymentGroup)
        throws RemoteException {
    final GridJobFuture<R> future = kernel.execute(jobClass, arg, deploymentGroup);
    try {/*from   w w w  .ja  v  a 2  s  .  c  o  m*/
        return future.get();
    } catch (InterruptedException e) {
        LOG.error(e.getMessage(), e);
        throw new RemoteException(e.getMessage(), e);
    } catch (ExecutionException e) {
        LOG.error(e.getMessage(), e);
        throw new RemoteException(e.getMessage(), e);
    }
}

From source file:edu.cornell.med.icb.R.RConfigurationServer.java

/**
 * Get a configuration for an Rserve instance. If no items are available at the moment, this
 * method will wait up to the specified wait time for a configuration to become available.
 *
 * @param timeout how long to wait before giving up, in units of <tt>unit</tt>
 * @param unit a <tt>TimeUnit</tt> determining how to interpret the <tt>timeout</tt> parameter
 * @return A valid object or null if no connection was available within the timeout period
 */// w w w .  j a  v  a2 s .c om
public RConfigurationItem borrowConfigurationItem(final long timeout, final TimeUnit unit)
        throws RemoteException {
    RConfigurationItem item = null;
    try {
        item = configurations.pollFirst(timeout, unit);
    } catch (InterruptedException e) {
        LOG.warn("Interrupted", e);
        Thread.currentThread().interrupt();
        throw new RemoteException(e.getMessage());
    }
    return item;
}

From source file:com.qwazr.crawler.web.manager.CurrentSessionImpl.java

@Override
public void sleep(int millis) {
    try {//from www. j  a v a 2 s.c o m
        if (millis == 0)
            return;
        Thread.sleep(millis);
    } catch (InterruptedException e) {
        abort(e.getMessage());
    }
}

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

/**
 * Idle this transfer until a free slot is avilable 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   w  ww  .ja  va2  s  . com
public void add(final Transfer t) {
    if (log.isDebugEnabled()) {
        log.debug("add:" + t);
    }
    if (running.size() >= Preferences.instance().getInteger("queue.maxtransfers")) {
        t.fireTransferQueued();
        if (log.isInfoEnabled()) {
            log.info("Queuing:" + t);
        }
        while (running.size() >= Preferences.instance().getInteger("queue.maxtransfers")) {
            // The maximum number of transfers is already reached
            if (t.isCanceled()) {
                break;
            }
            // Wait for transfer slot.
            try {
                overflow.put(t);
            } catch (InterruptedException e) {
                log.error(e.getMessage());
            }
        }
        if (log.isInfoEnabled()) {
            log.info("Released from queue:" + t);
        }
        t.fireTransferResumed();
    }
    running.add(t);
    ApplicationBadgeLabelerFactory.get().badge(String.valueOf(running.size()));
}

From source file:by.zuyeu.deyestracker.core.video.capture.CameraFrameCapture.java

@Override
public boolean open() throws DEyesTrackerException {
    if (!capture.isOpened()) {
        try {/*from  www. j  a  v  a  2 s .c  o  m*/
            capture.open(DEFAULT_DEVICE);
            Thread.sleep(1000);
        } catch (InterruptedException ex) {
            LOG.error(ex.getMessage());
            stop();
            throw new DEyesTrackerException(DEyesTrackerExceptionCode.OPEN_CAMERA_FAIL, "capture init failure");
        }
    }
    return capture.isOpened();
}

From source file:com.bt.aloha.batchtest.v2.scenarios.InboundCallScenario.java

private void connectCallLegAndWaitForCallLegConnectionFailedEvent(String callLegId) {
    ScenarioRunResult scenarioRunResult = new ScenarioRunResult(callLegIdScenarioIds.get(callLegId),
            this.getName());
    try {/*from w  w w .  java 2s.  co m*/
        this.outboundCallLegBean.connectCallLeg(callLegId);
        if (callLegIdSemaphores.get(callLegId).tryAcquire(20, TimeUnit.SECONDS)) {
            callLegIdSemaphores.remove(callLegId);
            scenarioRunResult.setResult(true, "OK");
        } else {
            scenarioRunResult.setMessage("timed out waiting for CallLegConnectionFailedEvent");
        }
    } catch (InterruptedException e) {
        scenarioRunResult.setResult(false, e.getMessage());
    } finally {
        publishResultOnScenarioComplete(scenarioRunResult);
    }
}

From source file:org.chimi.s4s.imageprocessor.IM4JavaImageProcessor.java

@Override
public File resize(InputStream in, File destFile, Size newSize) throws ImageProcessingException {
    try {//from  w  w  w .  j ava 2 s.  c  o  m
        IMOperation op = new IMOperation();
        op.format("jpeg");
        op.addImage("-"); // read from stdin
        if (newSize.getHeight() == 0 || newSize.getWidth() == 0) {
            op.resize(newSize.getWidth(), newSize.getHeight());
        } else {
            op.resize(newSize.getWidth(), newSize.getHeight(), "!");
        }
        op.addImage(destFile.getAbsolutePath());
        Pipe pipeIn = new Pipe(in, null);

        // set up command
        ConvertCmd convert = new ConvertCmd(true);
        convert.setInputProvider(pipeIn);
        try {
            convert.run(op);
            if (logger.isDebugEnabled()) {
                logger.debug("Thumbnail Image {} created", destFile.getAbsolutePath());
            }
            return destFile;
        } catch (InterruptedException e) {
            throw new ImageProcessingException("Fail to resize:" + e.getMessage(), e);
        } catch (IM4JavaException e) {
            throw new ImageProcessingException("Fail to resize:" + e.getMessage(), e);
        } catch (IOException e) {
            throw new ImageProcessingException("Fail to resize:" + e.getMessage(), e);
        }
    } finally {
        Util.close(in);
    }
}