List of usage examples for java.lang InterruptedException fillInStackTrace
public synchronized Throwable fillInStackTrace()
From source file:org.eclipse.smila.search.index.IndexCleaner.java
/** * {@inheritDoc}// w ww . j a va2 s .c o m * * @see java.lang.Runnable#run() */ @Override public void run() { final Log log = LogFactory.getLog(getClass()); while (true) { try { sleep(SLEEP_TIME); IndexManager.doGarbageCollection(); } catch (final InterruptedException e) { log.error("unable to set cleaner into wait state", e.fillInStackTrace()); } } }
From source file:org.openspaces.test.client.executor.Executor.java
/** * Allows the caller to wait for the completion of the process, but no longer than a given * timeout value.//from ww w . j a va 2s . com * * @param timeout - The given timeout value (ms). * @return <code>true</code> if process finished(destroyed), otherwise <code>false</code>. */ static boolean waitFor(Process process, long timeout) throws InterruptedException { /* interval constant */ final int interval = 1000 * 1; // 1 sec long timeWaiting = 0; while (timeWaiting < timeout) { if (!isProcessAlive(process)) return true; if (_logger.isDebugEnabled()) _logger.debug("Process is still alive [" + process + "] time to wait [" + (timeout - timeWaiting) + "ms], timeout [" + timeout + "]ms"); try { Thread.sleep(interval); } catch (InterruptedException e) { e.fillInStackTrace(); throw e; } timeWaiting += interval; } /* process hasn't been destroyed */ return false; }
From source file:uk.nhs.cfh.dsp.srth.desktop.uiframework.utils.ActionComponentManager.java
/** * Inits the components./*from w ww . j a v a 2 s . com*/ */ public synchronized void initComponents() { if (applicationService != null && applicationService.getFrameView() != null) { menuBar = applicationService.getFrameView().getMMenuBar(); toolBar = applicationService.getFrameView().getMToolBar(); } while (menuBar == null || toolBar == null) { // idle this thread for a little while try { this.wait(waitTime); } catch (InterruptedException e) { logger.warn(e.fillInStackTrace()); } if (applicationService != null && applicationService.getFrameView() != null) { menuBar = applicationService.getFrameView().getMMenuBar(); toolBar = applicationService.getFrameView().getMToolBar(); } } logger.info("Number of actions registered with actionComponentService = " + actionComponentService.getComponents().size()); // loop through registered action components and add them to menu bar for (ActionComponent actionComponent : actionComponentService.getComponents()) { logger.info("Adding action component : " + actionComponent.getClass().getName()); addActionComponent(actionComponent); } // register this listener with service actionComponentService.addListener(this); }
From source file:uk.nhs.cfh.dsp.srth.distribution.FileDownloader.java
private void checkAndOpenFTPConnection() { if (!ftpClient.isConnected() || !FTPReply.isPositiveCompletion(ftpClient.getReplyCode())) { logger.info("Opening login dialog"); final TRUDLoginService trudLoginService = new TRUDLoginService(ftpClient); final JXLoginPane.JXLoginFrame frame = JXLoginPane.showLoginFrame(trudLoginService); logger.info("Showed login dialog"); frame.addWindowStateListener(new WindowAdapter() { @Override/*from ww w .j ava2 s. c o m*/ public void windowClosed(WindowEvent windowEvent) { logger.info("Login frame no longer visible"); // get result from login if (JXLoginPane.Status.SUCCEEDED == frame.getStatus()) { logger.info("frame.getStatus() = " + frame.getStatus()); // get ftpclient in trudLoginService ftpClient = trudLoginService.getFtpClient(); } } }); frame.setAlwaysOnTop(true); frame.setVisible(true); while (JXLoginPane.Status.SUCCEEDED != frame.getStatus() && frame.isVisible()) { // idle thread try { Thread.sleep(1000); } catch (InterruptedException e) { logger.warning(ERR_MESSAGE + e.fillInStackTrace()); } } logger.info("frame.getStatus() = " + frame.getStatus()); } }