List of usage examples for java.lang InterruptedException getMessage
public String getMessage()
From source file:com.orange.clara.cloud.servicedbdumper.acceptance.AcceptanceExternalTest.java
@Override protected InputStream getSourceStream(DatabaseType databaseType) throws DatabaseExtractionException, ServiceKeyException, IOException { String command = String.format("cf download-dump %s --recent --original --stdout", this.getDbParamsForDump(databaseType)); try {//from w ww .j ava2 s . c om Process process = this.runCommandLine(command.split(" ")); return process.getInputStream(); } catch (InterruptedException e) { throw new IOException(e.getMessage(), e); } }
From source file:com.orange.clara.cloud.servicedbdumper.acceptance.AcceptanceExternalTest.java
@Override protected InputStream getTargetStream(DatabaseType databaseType) throws DatabaseExtractionException, ServiceKeyException, IOException { String command = String.format("cf download-dump %s --recent --original --stdout", this.getDbParamsForRestore(databaseType)); try {/* w ww .ja v a2 s .c om*/ Process process = this.runCommandLine(command.split(" ")); return process.getInputStream(); } catch (InterruptedException e) { throw new IOException(e.getMessage(), e); } }
From source file:com.clustercontrol.monitor.util.StatusSearchRunUtil.java
@SuppressWarnings("unchecked") public Map<String, ArrayList<ArrayList<Object>>> searchInfo(List<String> managerList, String facilityId, StatusFilterInfo filter) {//from www .ja v a2 s . co m Map<String, ArrayList<ArrayList<Object>>> dispDataMap = new ConcurrentHashMap<>(); Map<String, String> errMsgs = new ConcurrentHashMap<>(); long start = System.currentTimeMillis(); try { String threadName = Thread.currentThread().getName() + "-StatusSearch"; List<StatusSearchTask> searchList = new ArrayList<StatusSearchTask>(); for (String managerName : managerList) { StatusSearchTask task = null; task = new StatusSearchTask(threadName, managerName, facilityId, filter, ContextProvider.getContext()); searchList.add(task); } List<Future<Map<String, List<?>>>> list = getExecutorService().invokeAll(searchList); for (Future<Map<String, List<?>>> future : list) { if (future == null || future.get() == null) { continue; } Map<String, List<?>> map = future.get(); for (Map.Entry<String, List<?>> entry : map.entrySet()) { //?1?? String managerName = entry.getKey(); List<?> ret = entry.getValue(); if (ret.get(POS_INFO) != null && ret.get(POS_INFO) instanceof ArrayList) { ArrayList<ArrayList<Object>> infoList = (ArrayList<ArrayList<Object>>) ret.get(POS_INFO); dispDataMap.put(managerName, infoList); } if (ret.get(POS_ERROR) != null && ret.get(POS_ERROR) instanceof String) { String errList = (String) ret.get(POS_ERROR); errMsgs.put(managerName, errList); } } } } catch (InterruptedException e) { m_log.error(e.getMessage() + e.getClass().getName()); } catch (ExecutionException e) { m_log.error(e.getMessage() + e.getClass().getName()); } // if (0 < errMsgs.size()) { UIManager.showMessageBox(errMsgs, true); } long end = System.currentTimeMillis(); m_log.debug("time=" + (end - start)); return dispDataMap; }
From source file:it.pronetics.madstore.repository.index.impl.IndexManagerMultiThreadTest.java
public void testIndexManagerSharedByMultipleThreads() throws Exception { final CountDownLatch firstStepLatch = new CountDownLatch(1); final CountDownLatch secondStepLatch = new CountDownLatch(1); final CountDownLatch thirdStepLatch = new CountDownLatch(1); final CountDownLatch stopLatch = new CountDownLatch(4); final List<String> terms = new ArrayList<String>(); final Element entry1 = Utils.getDoc("luceneentry1.xml").getDocumentElement(); final Element entry2 = Utils.getDoc("luceneentry2.xml").getDocumentElement(); terms.add("bla"); Thread t1 = threadFactory.newThread(new Runnable() { public void run() { try { indexManager.index(COLLECTION_KEY, "entry1", entry1); firstStepLatch.countDown(); } finally { stopLatch.countDown();// w ww.jav a 2 s . c o m } } }); t1.start(); Thread t2 = threadFactory.newThread(new Runnable() { public void run() { try { firstStepLatch.await(5, TimeUnit.SECONDS); List<SearchResult> entryKeyPair = indexManager.searchCollectionByFullText(COLLECTION_KEY, terms, 0, 0); assertEquals(1, entryKeyPair.size()); secondStepLatch.countDown(); } catch (InterruptedException ex) { fail(ex.getMessage()); } finally { stopLatch.countDown(); } } }); t2.start(); Thread t3 = threadFactory.newThread(new Runnable() { public void run() { try { secondStepLatch.await(5, TimeUnit.SECONDS); indexManager.index(COLLECTION_KEY, "entry2", entry2); thirdStepLatch.countDown(); } catch (InterruptedException ex) { fail(ex.getMessage()); } finally { stopLatch.countDown(); } } }); t3.start(); Thread t4 = threadFactory.newThread(new Runnable() { public void run() { try { thirdStepLatch.await(5, TimeUnit.SECONDS); List<SearchResult> entryKeyPair = indexManager.searchCollectionByFullText(COLLECTION_KEY, terms, 0, 0); assertEquals(2, entryKeyPair.size()); } catch (InterruptedException ex) { fail(ex.getMessage()); } finally { stopLatch.countDown(); } } }); t4.start(); stopLatch.await(); threadFactory.verifyThreads(); threadFactory.resetThreads(); }
From source file:com.turbospaces.network.ServerCommunicationDispatcher.java
/** * get the remove server nodes(block if 0 nodes discovered) * //from w w w .java 2 s.co m * @return the remote server side jspace nodes * @throws RemoteLookupFailureException * if no remote server nodes are discovered */ public final Address[] getServerNodes() throws RemoteLookupFailureException { Address[] nodes = serverNodes; long communicationTimeout = configuration.getCommunicationTimeoutInMillis(); if (nodes.length == 0) synchronized (monitor) { try { monitor.wait(communicationTimeout); } catch (InterruptedException e) { logger.error(e.getMessage(), e); Thread.currentThread().interrupt(); throw new SpaceException(e.getMessage(), e); } } if (nodes.length == 0) throw new RemoteLookupFailureException(String.format(LOOKUP_TIMEOUT, communicationTimeout)); return nodes; }
From source file:com.oakesville.mythling.util.ServiceFrontendPlayer.java
public boolean checkIsPlaying() throws IOException, JSONException { int timeout = 5000; // TODO: pref state = null;//from w w w .j a v a 2s . c o m new StatusTask().execute(); while (state == null && timeout > 0) { try { Thread.sleep(100); timeout -= 100; } catch (InterruptedException ex) { Log.e(TAG, ex.getMessage(), ex); if (appSettings.isErrorReportingEnabled()) new Reporter(ex).send(); } } if (state == null) throw new IOException(Localizer.getStringRes(R.string.error_frontend_status_) + appSettings.getFrontendServiceBaseUrl()); return !state.equals("idle"); }
From source file:fr.aliasource.webmail.proxy.impl.ProxyImpl.java
public String allocateAttachmentId() { try {// w w w .j ava 2 s. c o m return getAccount().getAttachementManager().allocateAttachementId(); } catch (InterruptedException e) { logger.error(e.getMessage(), e); return null; } }
From source file:ch.sourcepond.io.checksum.impl.BaseUpdateStrategy.java
/** * @param pInterval//from ww w. j a v a 2 s . c o m * @param pUnit * @throws IOException * @throws InterruptedException */ @GuardedBy("this") protected final void wait(final long pInterval, final TimeUnit pUnit) throws IOException { if (isCancelled()) { LOG.debug("Checksum calculation cancelled by user."); } else if (pInterval > 0) { try { wait(pUnit.toMillis(pInterval)); } catch (final InterruptedException e) { currentThread().interrupt(); throw new IOException(e.getMessage(), e); } } }
From source file:com.discogs.api.QueryTest.java
@BeforeMethod public void wait1Second() { // because we are only allowed to query the web service once in a second try {/*from w ww.j a v a2 s. co m*/ logger.debug("waiting 1 second to avoid too much server load"); Thread.sleep(1000); } catch (InterruptedException e) { logger.warn(e.getMessage(), e); } }
From source file:com.clustercontrol.monitor.util.EventSearchRunUtil.java
public Map<String, ViewListInfo> searchInfo(List<String> managerList, String facilityId, EventFilterInfo filter, int messages) { Map<String, ViewListInfo> dispDataMap = new ConcurrentHashMap<>(); Map<String, String> errMsgs = new ConcurrentHashMap<>(); long start = System.currentTimeMillis(); try {//from w w w .java 2s . c o m String threadName = Thread.currentThread().getName() + "-EventSearch"; List<EventSearchTask> searchList = new ArrayList<EventSearchTask>(); for (String managerName : managerList) { EventSearchTask task = null; task = new EventSearchTask(threadName, managerName, facilityId, filter, messages, ContextProvider.getContext()); searchList.add(task); } List<Future<Map<String, List<?>>>> list = getExecutorService().invokeAll(searchList); for (Future<Map<String, List<?>>> future : list) { if (future == null || future.get() == null) { continue; } Map<String, List<?>> map = future.get(); for (Map.Entry<String, List<?>> entry : map.entrySet()) { //?1?? String managerName = entry.getKey(); List<?> ret = entry.getValue(); if (ret.get(POS_INFO) != null && ret.get(POS_INFO) instanceof ViewListInfo) { ViewListInfo infoList = (ViewListInfo) ret.get(POS_INFO); dispDataMap.put(managerName, infoList); } if (ret.get(POS_ERROR) != null && ret.get(POS_ERROR) instanceof String) { String err = (String) ret.get(POS_ERROR); errMsgs.put(managerName, (String) err); } } } } catch (InterruptedException e) { m_log.error(e.getMessage() + e.getClass().getName()); } catch (ExecutionException e) { m_log.error(e.getMessage() + e.getClass().getName()); } // if (0 < errMsgs.size()) { UIManager.showMessageBox(errMsgs, true); } long end = System.currentTimeMillis(); m_log.debug("time=" + (end - start)); return dispDataMap; }