List of usage examples for java.lang InterruptedException toString
public String toString()
From source file:com.android.profilerapp.memory.MemoryFragment.java
@Override public void onPause() { super.onPause(); try {//from w ww . j ava2s. co m mChurnAllocatorThread.interrupt(); mChurnAllocatorThread.join(); mChurnAllocatorThread = null; mProfilerThread.interrupt(); mProfilerThread.join(); mProfilerThread = null; } catch (InterruptedException e) { System.out.println(e.toString()); } }
From source file:org.apache.synapse.samples.framework.clients.EventSampleClient.java
public SampleClientResult getStatus(String addUrl, String identifier) { /**// w w w. j a va2 s . c o m * (01) <s12:Envelope (02) xmlns:s12="http://www.w3.org/2003/05/soap-envelope" (03) xmlns:wsa="http://schemas.xmlsoap.org/ws/2004/08/addressing" (04) xmlns:wse="http://schemas.xmlsoap.org/ws/2004/08/eventing" (05) xmlns:ow="http://www.example.org/oceanwatch" > (06) <s12:Header> (07) <wsa:Action> (08) http://schemas.xmlsoap.org/ws/2004/08/eventing/GetStatus (09) </wsa:Action> (10) <wsa:MessageID> (11) uuid:bd88b3df-5db4-4392-9621-aee9160721f6 (12) </wsa:MessageID> (13) <wsa:ReplyTo> (14) <wsa:Address>http://www.example.com/MyEventSink</wsa:Address> (15) </wsa:ReplyTo> (16) <wsa:To> (17) http://www.example.org/oceanwatch/SubscriptionManager (18) </wsa:To> (19) <wse:Identifier> (20) uuid:22e8a584-0d18-4228-b2a8-3716fa2097fa (21) </wse:Identifier> (22) </s12:Header> (23) <s12:Body> (24) <wse:GetStatus /> (25) </s12:Body> (26) </s12:Envelope> */ OMElement subscribeOm = factory.createOMElement("GetStatus", eventingNamespace); log.info("GetStatus using: " + subscribeOm.toString()); SampleClientResult clientResult = new SampleClientResult(); try { initializeClient(addUrl); options.setAction("http://schemas.xmlsoap.org/ws/2004/08/eventing/GetStatus"); OMElement identifierOm = factory.createOMElement("Identifier", eventingNamespace); factory.createOMText(identifierOm, identifier); serviceClient.addHeader(identifierOm); OMElement response = serviceClient.sendReceive(subscribeOm); log.info("GetStatus to ID " + identifier); try { Thread.sleep(1000); } catch (InterruptedException e) { } log.info("GetStatus Response Received: " + response.toString()); clientResult.incrementResponseCount(); } catch (Exception e) { log.error("Fault Received : " + e.toString(), e); clientResult.setException(e); } deInitializeClient(); return clientResult; }
From source file:org.apache.synapse.samples.framework.clients.EventSampleClient.java
public SampleClientResult renew(String addUrl, String expires, String identifier) { /**/*w w w.j a v a 2s .c o m*/ * (01) <s12:Envelope (02) xmlns:s12="http://www.w3.org/2003/05/soap-envelope" (03) xmlns:wsa="http://schemas.xmlsoap.org/ws/2004/08/addressing" (04) xmlns:wse="http://schemas.xmlsoap.org/ws/2004/08/eventing" (05) xmlns:ow="http://www.example.org/oceanwatch" > (06) <s12:Header> (07) <wsa:Action> (08) http://schemas.xmlsoap.org/ws/2004/08/eventing/Renew (09) </wsa:Action> (10) <wsa:MessageID> (11) uuid:bd88b3df-5db4-4392-9621-aee9160721f6 (12) </wsa:MessageID> (13) <wsa:ReplyTo> (14) <wsa:Address>http://www.example.com/MyEventSink</wsa:Address> (15) </wsa:ReplyTo> (16) <wsa:To> (17) http://www.example.org/oceanwatch/SubscriptionManager (18) </wsa:To> (19) <wse:Identifier> (20) uuid:22e8a584-0d18-4228-b2a8-3716fa2097fa (21) </wse:Identifier> (22) </s12:Header> (23) <s12:Body> (24) <wse:Renew> (25) <wse:Expires>2004-06-26T21:07:00.000-08:00</wse:Expires> (26) </wse:Renew> (27) </s12:Body> (28) </s12:Envelope> */ OMElement subscribeOm = factory.createOMElement("Renew", eventingNamespace); OMElement expiresOm = factory.createOMElement("Expires", eventingNamespace); factory.createOMText(expiresOm, expires); subscribeOm.addChild(expiresOm); log.info("SynapseSubscription Renew \n" + subscribeOm.toString()); SampleClientResult clientResult = new SampleClientResult(); try { initializeClient(addUrl); OMElement identifierOm = factory.createOMElement("Identifier", eventingNamespace); factory.createOMText(identifierOm, identifier); serviceClient.addHeader(identifierOm); options.setAction("http://schemas.xmlsoap.org/ws/2004/08/eventing/Renew"); OMElement response = serviceClient.sendReceive(subscribeOm); log.info("SynapseSubscription Renew to ID " + identifier); try { Thread.sleep(1000); } catch (InterruptedException e) { } log.info("SynapseSubscription Renew Response Received: " + response.toString()); clientResult.incrementResponseCount(); } catch (Exception e) { log.error("Fault Received : " + e.toString(), e); clientResult.setException(e); } deInitializeClient(); return clientResult; }
From source file:org.kuali.test.proxyserver.TestProxyServer.java
/** * * @param webTestPanel/*from w w w . j av a 2 s . com*/ */ public TestProxyServer(WebTestPanel webTestPanel) { this.webTestPanel = webTestPanel; try { Thread.sleep(1000); initializeProxyServer(); } catch (InterruptedException ex) { LOG.error(ex.toString(), ex); } }
From source file:org.powertac.server.CompetitionSetupService.java
private void waitForSession() { if (session != null) try {// ww w .jav a2 s . c o m session.join(); } catch (InterruptedException e) { System.out.println("Error waiting for session completion: " + e.toString()); } }
From source file:org.mozilla.gecko.tests.testDistribution.java
/** * This is a hack.// w w w. j av a 2 s . c om * * Startup results in us writing prefs -- we fetch the Distribution, which * caches its state. Our tests try to wipe those prefs, but apparently * sometimes race with startup, which leads to us not getting one of our * expected messages. The test fails. * * This hack waits for any existing background tasks -- such as the one that * writes prefs -- to finish before we begin the test. */ private void waitForBackgroundHappiness() { final Object signal = new Object(); final Runnable done = new Runnable() { @Override public void run() { synchronized (signal) { signal.notify(); } } }; synchronized (signal) { ThreadUtils.postToBackgroundThread(done); try { signal.wait(); } catch (InterruptedException e) { mAsserter.ok(false, "InterruptedException waiting on background thread.", e.toString()); } } mAsserter.dumpLog("Background task completed. Proceeding."); }
From source file:org.cloudata.core.common.ShellCommand.java
/** Run a command */ private void runCommand() throws IOException { if (onlyUnix() && WINDOWS) { return;// w w w . j av a 2s. c o m } ProcessBuilder builder = new ProcessBuilder(getExecString()); boolean completed = false; if (environment != null) { builder.environment().putAll(this.environment); } if (dir != null) { builder.directory(this.dir); } process = builder.start(); final BufferedReader errReader = new BufferedReader(new InputStreamReader(process.getErrorStream())); BufferedReader inReader = new BufferedReader(new InputStreamReader(process.getInputStream())); final StringBuffer errMsg = new StringBuffer(); // read error and input streams as this would free up the buffers // free the error stream buffer Thread errThread = new Thread() { @Override public void run() { try { String line = errReader.readLine(); while ((line != null) && !isInterrupted()) { errMsg.append(line); errMsg.append(System.getProperty("line.separator")); line = errReader.readLine(); } } catch (IOException ioe) { LOG.warn("Error reading the error stream", ioe); } } }; try { errThread.start(); } catch (IllegalStateException ise) { } try { parseExecResult(inReader); // parse the output // clear the input stream buffer String line = inReader.readLine(); while (line != null) { line = inReader.readLine(); } // wait for the process to finish and check the exit code exitCode = process.waitFor(); try { // make sure that the error thread exits errThread.join(); } catch (InterruptedException ie) { LOG.warn("Interrupted while reading the error stream", ie); } completed = true; if (exitCode != 0) { throw new ExitCodeException(exitCode, errMsg.toString()); } } catch (InterruptedException ie) { throw new IOException(ie.toString()); } finally { // close the input stream try { inReader.close(); } catch (IOException ioe) { LOG.warn("Error while closing the input stream", ioe); } if (!completed) { errThread.interrupt(); } try { errReader.close(); } catch (IOException ioe) { LOG.warn("Error while closing the error stream", ioe); } process.destroy(); lastTime = System.currentTimeMillis(); } }
From source file:qhindex.controller.SearchAuthorWorksController.java
private synchronized Document requestWebDocFromScholar(String url, int attempts, boolean wait) { int attemptsToRetrieveResource = attempts; Document doc = null;/*from w ww . ja v a2s .c o m*/ for (int i = 0; i < attemptsToRetrieveResource; i++) { Debug.info("(" + i + ")Attempting to retrieve: " + url); try { Response response = Jsoup.connect(url).ignoreHttpErrors(true).method(Connection.Method.GET) .execute(); int statusCode = response.statusCode(); if (statusCode == 503) { Debug.info("Waiting one day to continue search after a 503 response from schoolar"); // Wait one day before continue search if (wait == true) { try { wait(1000 * 60 * 60 * 24); } catch (InterruptedException iex) { Debug.print("Exception while waiting to continue search after a 503 response: " + iex.toString()); resultsMsg += "Exception while waiting to continue search after a 503 response.\n"; } } } else if (statusCode == 200) { doc = response.parse(); break; } } catch (IOException ioex) { try { wait(1000);//*60*60*24); } catch (InterruptedException iex) { Debug.print( "Exception while waiting to continue search after a 503 response: " + iex.toString()); resultsMsg += "Exception while waiting to continue search after a 503 response.\n"; } Debug.print("Exception while retrieving scholar web page: " + ioex.toString()); resultsMsg += "Exception while retrieving scholar web page.\n"; } } return doc; }
From source file:com.nubits.nubot.tasks.strategy.PriceMonitorTriggerTask.java
private void unableToUpdatePrice(ArrayList<LastPrice> priceList) { count++;/* w ww . j a v a2 s. co m*/ try { Thread.sleep(count * 60 * 1000); } catch (InterruptedException ex) { LOG.severe(ex.toString()); } executeUpdatePrice(count); }
From source file:org.apache.jxtadoop.util.Shell.java
/** Run a command */ private void runCommand() throws IOException { ProcessBuilder builder = new ProcessBuilder(getExecString()); boolean completed = false; if (environment != null) { builder.environment().putAll(this.environment); }/*from w ww.j av a 2s . c o m*/ if (dir != null) { builder.directory(this.dir); } process = builder.start(); final BufferedReader errReader = new BufferedReader(new InputStreamReader(process.getErrorStream())); BufferedReader inReader = new BufferedReader(new InputStreamReader(process.getInputStream())); final StringBuffer errMsg = new StringBuffer(); // read error and input streams as this would free up the buffers // free the error stream buffer Thread errThread = new Thread() { @Override public void run() { try { String line = errReader.readLine(); while ((line != null) && !isInterrupted()) { errMsg.append(line); errMsg.append(System.getProperty("line.separator")); line = errReader.readLine(); } } catch (IOException ioe) { LOG.warn("Error reading the error stream", ioe); } } }; try { errThread.start(); } catch (IllegalStateException ise) { } try { parseExecResult(inReader); // parse the output // clear the input stream buffer String line = inReader.readLine(); while (line != null) { line = inReader.readLine(); } // wait for the process to finish and check the exit code exitCode = process.waitFor(); try { // make sure that the error thread exits errThread.join(); } catch (InterruptedException ie) { LOG.warn("Interrupted while reading the error stream", ie); } completed = true; if (exitCode != 0) { throw new ExitCodeException(exitCode, errMsg.toString()); } } catch (InterruptedException ie) { throw new IOException(ie.toString()); } finally { // close the input stream try { inReader.close(); } catch (IOException ioe) { LOG.warn("Error while closing the input stream", ioe); } if (!completed) { errThread.interrupt(); } try { errReader.close(); } catch (IOException ioe) { LOG.warn("Error while closing the error stream", ioe); } process.destroy(); lastTime = System.currentTimeMillis(); } }