private PluginInterface waitForPluginToBeAvailable( Class<? extends PluginTypeInterface> pluginType, String pluginId, int waitLimit ) { int timeToSleep = 50; try { Thread.sleep( timeToSleep ); waitLimit -= timeToSleep; } catch ( InterruptedException e ) { log.logError( e.getLocalizedMessage(), e ); Thread.currentThread().interrupt(); return null; } PluginInterface pluginInterface = findPluginWithId( pluginType, pluginId ); return waitLimit <= 0 && pluginInterface == null ? null : pluginInterface != null ? pluginInterface : waitForPluginToBeAvailable( pluginType, pluginId, waitLimit ); } }
@Override public void close() throws EtcdClientException { publishers.values().forEach(SubmissionPublisher::close); if (!channel.isShutdown() && !channel.isTerminated()) { try { channel.awaitTermination(1, TimeUnit.SECONDS); } catch (InterruptedException e) { LOGGER.log(Level.CONFIG, "Error closing gRPC channel, reason: " + e.getLocalizedMessage(), e); } finally { channel.shutdown(); } } } }
key = watchService.take(); } catch (InterruptedException exc) { logger.info("Caught InterruptedException: {}", exc.getLocalizedMessage()); return;
pool.awaitTermination(3600, TimeUnit.SECONDS); // wait for one hour } catch (InterruptedException e) { throw new RuntimeException(e.getLocalizedMessage());
pool.awaitTermination(3600, TimeUnit.SECONDS); // wait for one hour } catch (InterruptedException e) { throw new RuntimeException(e.getLocalizedMessage());
private static void dWait ( final long damperWaitOnMultiFails ) { try{ Thread.sleep(damperWaitOnMultiFails); } catch ( InterruptedException e){ logger.log(Level.FINEST, e.getLocalizedMessage(), e); } }
@Override public void run() { try { Thread.sleep(2000); // how long this should be? } catch (InterruptedException ex) { logger.debug(ex.getLocalizedMessage()); } }
private static void dWait ( final long damperWaitOnMultiFails ) { try{ Thread.sleep(damperWaitOnMultiFails); } catch ( InterruptedException e){ logger.log(Level.FINEST, e.getLocalizedMessage(), e); } }
/** * Waits for a maximum of waitTime, but returns if another thread calls release().<p> * * @param waitTime the maximum wait time */ public synchronized void enter(long waitTime) { try { wait(waitTime); } catch (InterruptedException e) { // should never happen, but log it just in case... LOG.error(e.getLocalizedMessage(), e); } }
@Override public void rejectedExecution(Runnable kafkaStreamProducer, ThreadPoolExecutor executor) { try { Thread.sleep(1000); } catch (InterruptedException e) { log.error(e.getLocalizedMessage(), e); } executor.execute(kafkaStreamProducer); } });
@Override public void rejectedExecution(Runnable kafkaStreamProducer, ThreadPoolExecutor executor) { try { Thread.sleep(1000); } catch (InterruptedException e) { log.error(e.getLocalizedMessage(), e); } executor.execute(kafkaStreamProducer); } });
void stopTrashExecutor() { entityTrashExecutor.shutdown(); try { entityTrashExecutor.awaitTermination(Long.MAX_VALUE, TimeUnit.MILLISECONDS); entityTrashExecutor = null; } catch (InterruptedException e) { logger.log(Level.SEVERE, e.getLocalizedMessage(), e); } }
void requestFile(final Path file) { try { channel.writeAndFlush(encrypt(FILE_REQUEST + file) + EOL_DELIMITER).sync(); } catch (final InterruptedException e) { logger.log(Level.SEVERE, e.getLocalizedMessage(), e); Thread.currentThread().interrupt(); } }
void deleteFile(final String attachment) { try { channel.writeAndFlush(encrypt(DELETE + Paths.get(attachment).getFileName()) + EOL_DELIMITER).sync(); } catch (final InterruptedException e) { logger.log(Level.SEVERE, e.getLocalizedMessage(), e); Thread.currentThread().interrupt(); } }
private void terminateListener() { executorService.shutdown(); try { executorService.awaitTermination(300, TimeUnit.MILLISECONDS); LOG.debug("Handler Thread terminated, Port: " + ipParameters.getPort()); } catch (InterruptedException e) { LOG.debug("Error terminating executorService - " + e.getLocalizedMessage()); getExceptionHandler().receivedException(e); } handler = null; }
public void stopServer() { try { channelGroup.close().sync(); executorService.shutdown(); eventLoopGroup.shutdownGracefully(); eventLoopGroup = null; logger.info("Distributed Lock Server Stopped"); } catch (final InterruptedException e) { logger.log(Level.SEVERE, e.getLocalizedMessage(), e); } }
DialogActionException errorCreateDialogInterrupted( AbstractDialogAction<?, ?> action, InterruptedException e) { return logException( new DialogActionException(create_dialog_interrupted).add( action, action), create_dialog_interrupted_message, e.getLocalizedMessage()); }
public String getTargetDir(String targetDir, String relativeDir) throws IOException { try { String downloadFileRelativePath = this.flatDownload && relativeDir.contains("/") ? StringUtils.substringAfterLast(relativeDir, "/") : relativeDir; FilePath targetDirFile = new FilePath(workspace, targetDir).child(downloadFileRelativePath); return targetDirFile.absolutize().getRemote(); } catch (InterruptedException e) { log.warn("Caught interrupted exception: " + e.getLocalizedMessage()); } return null; }
public Map<String, String> saveDownloadedFile(InputStream is, String filePath) throws IOException { try { FilePath child = workspace.child(filePath); child.copyFrom(is); return child.act(new DownloadFileCallable(log)); } catch (InterruptedException e) { log.warn("Caught interrupted exception: " + e.getLocalizedMessage()); } finally { IOUtils.closeQuietly(is); } return null; }
@After public void afterEach() { try { this.executor.shutdown(); this.executor.awaitTermination(5, TimeUnit.SECONDS); } catch (InterruptedException e) { Thread.interrupted(); fail(e.getLocalizedMessage()); } }