List of usage examples for java.lang InterruptedException printStackTrace
public void printStackTrace()
From source file:com.splunk.shuttl.testutil.TUtilsFunctional.java
public static void waitForAsyncArchiving() { try {/*from www.j a v a2s. c o m*/ Thread.sleep(500); } catch (InterruptedException e) { e.printStackTrace(); TUtilsTestNG.failForException("Got interrupted when waiting for async archiving.", e); } }
From source file:javarestart.JavaRestartLauncher.java
public static void fork(String... args) { String javaHome = System.getProperty("java.home"); System.out.println(javaHome); if (splashLocation == null) { File codeSource = new File(JavaRestartLauncher.class.getProtectionDomain().getCodeSource().getLocation() .toExternalForm().substring(6)); System.out.println(codeSource); if (codeSource.isDirectory()) { splashLocation = new File(codeSource, "defaultSplash.gif"); } else {/*from w w w . ja v a 2s.co m*/ splashLocation = Utils.fetchResourceToTempFile("defaultSplash", ".gif", JavaRestartLauncher.class.getClassLoader().getResource("defaultSplash.gif")); } } String classpath = System.getProperty("java.class.path"); String javaLauncher = "\"" + javaHome + "\\bin\\javaw.exe\"" + " -splash:" + splashLocation.getAbsolutePath() + " -Dbinary.css=false -cp \"" + classpath + "\" " + JavaRestartLauncher.class.getName(); for (String arg : args) { javaLauncher = javaLauncher + " " + arg; } System.out.println(javaLauncher); final String finalJavaLauncher = javaLauncher; (new Thread() { @Override public void run() { try { Runtime.getRuntime().exec(finalJavaLauncher).waitFor(); } catch (InterruptedException e) { e.printStackTrace(); } catch (IOException e) { e.printStackTrace(); } } }).start(); }
From source file:com.qpark.eip.core.spring.lockedoperation.EipTest.java
/** Sleep ... */ static void sleep() { try {/* ww w. j a va2 s . c o m*/ Thread.sleep(SLEEP_MILLISECONDS); } catch (InterruptedException e) { e.printStackTrace(); } }
From source file:de.uzk.hki.da.utils.FolderUtils.java
public static void waitToCompleteNFSAwareFileOperation() { try {//from ww w . j a v a 2 s .c o m Thread.sleep(TIME_TO_END_FILE_OPERATION); } catch (InterruptedException e) { e.printStackTrace(); } }
From source file:edu.umass.cs.gigapaxos.paxosutil.PaxosPacketDemultiplexer.java
/** * //from w w w. java 2 s .co m */ public static void throttleExcessiveLoad() { try { Thread.sleep(THROTTLE_SLEEP >= 1 ? (long) THROTTLE_SLEEP : (Math.random() < THROTTLE_SLEEP ? 1 : 0)); } catch (InterruptedException e) { e.printStackTrace(); } }
From source file:ch.elexis.importer.div.Helpers.java
public static void removeAllLaboWerte() { Query<LabResult> qr = new Query<LabResult>(LabResult.class); List<LabResult> qrr = qr.execute(); for (int j = 0; j < qrr.size(); j++) { qrr.get(j).removeFromDatabase(); }/* w w w . ja va 2 s .c o m*/ Query<LabOrder> qro = new Query<LabOrder>(LabOrder.class); List<LabOrder> qrro = qro.execute(); for (int j = 0; j < qrro.size(); j++) { qrro.get(j).removeFromDatabase(); } Query<LabItem> qrli = new Query<LabItem>(LabItem.class); List<LabItem> qLi = qrli.execute(); for (int j = 0; j < qLi.size(); j++) { qLi.get(j).removeFromDatabase(); } PersistentObject.clearCache(); try { Thread.sleep(10); } catch (InterruptedException e) { e.printStackTrace(); } }
From source file:Main.java
public static void setBreathingBackgroundColor(final View view, final int color) { Date firstDate = new Date(); final long firstTime = firstDate.getTime(); mAsyncTask = new AsyncTask<Void, Integer, Void>() { int n = 1, t = 3000; boolean increaseN; @Override//from w w w . j a va 2 s.com protected Void doInBackground(Void... params) { while (!isCancelled() || !mCancelled) { Date currentDate = new Date(); long diffTime = currentDate.getTime() - firstTime; if (diffTime > n * t) { increaseN = true; } if (increaseN) { n++; increaseN = false; } double y = getBreathingY(diffTime, n, t); int alpha = (int) ((y * 0.618f + 0.382f) * 255); int resultColor = setAlphaComponent(color, alpha); mColor = resultColor; publishProgress(resultColor); try { Thread.sleep(38); } catch (InterruptedException e) { e.printStackTrace(); } } return null; } @Override protected void onProgressUpdate(Integer... values) { super.onProgressUpdate(values); view.setBackgroundColor(values[0]); } }; executeAsyncTask(mAsyncTask); }
From source file:Main.java
private static List<Integer> getAllRelatedPids(final int pid) { List<Integer> result = new ArrayList<Integer>(Arrays.asList(pid)); // use 'ps' to get this pid and all pids that are related to it (e.g. // spawned by it) try {//from w w w . j a va 2 s . c om final Process suProcess = Runtime.getRuntime().exec("su"); new Thread(new Runnable() { @Override public void run() { PrintStream outputStream = null; try { outputStream = new PrintStream(new BufferedOutputStream(suProcess.getOutputStream(), 8192)); outputStream.println("ps"); outputStream.println("exit"); outputStream.flush(); } finally { if (outputStream != null) { outputStream.close(); } } } }).run(); if (suProcess != null) { try { suProcess.waitFor(); } catch (InterruptedException e) { e.printStackTrace(); } } BufferedReader bufferedReader = null; try { bufferedReader = new BufferedReader(new InputStreamReader(suProcess.getInputStream()), 8192); while (bufferedReader.ready()) { String[] line = SPACES_PATTERN.split(bufferedReader.readLine()); if (line.length >= 3) { try { if (pid == Integer.parseInt(line[2])) { result.add(Integer.parseInt(line[1])); } } catch (NumberFormatException ignore) { } } } } finally { if (bufferedReader != null) { bufferedReader.close(); } } } catch (IOException e1) { e1.printStackTrace(); } return result; }
From source file:com.qmetry.qaf.automation.integration.ResultUpdator.java
public static void awaitTermination() { if (hasActivePool) { ThreadPoolExecutor pool = getPool(); while (pool.getActiveCount() > 0) { logger.info("Result updator : Remaining " + pool.getActiveCount() + " result to be update."); try { pool.awaitTermination(5, TimeUnit.SECONDS); } catch (InterruptedException e) { e.printStackTrace(); }// w ww. j a va 2 s.c o m } System.out.println("Result updator : Remaining " + pool.getActiveCount() + " result to be update."); try { pool.shutdownNow(); } catch (Exception e) { e.printStackTrace(); } hasActivePool = false; } }
From source file:com.taobao.itest.spring.context.SpringContextManager.java
private static Object getBean(String name, ApplicationContext applicationContext) { // return applicationContext.getBean(name); // modified by yufan hsf bean no need to wait config server load Object bean = applicationContext.getBean(name); if (Proxy.isProxyClass(bean.getClass())) { ServiceUtil.waitServiceReady(name); try {//hsf??sleep2s Thread.sleep(2000);//from www . jav a2 s . c om } catch (InterruptedException e) { e.printStackTrace(); } } return bean; }