List of usage examples for java.lang InterruptedException printStackTrace
public void printStackTrace()
From source file:com.waku.common.http.MyHttpClient.java
private static String getResponse(HttpClient httpclient, HttpRequestBase http) { try {//from w ww.j a v a2 s.co m logger.info("Executing ---> " + http.getRequestLine()); return httpclient.execute(http, new BasicResponseHandler()); } catch (Throwable e) { logger.info("Exception got ->", e); if (e.getMessage().equalsIgnoreCase("Internal Server Error")) { logger.info("Internal Server Error, seems not recovery-able!"); return null; } logger.info("======== Retry will start after 10 sec ----->"); try { Thread.sleep(10000); } catch (InterruptedException ie) { ie.printStackTrace(); } return getResponse(httpclient, http); } }
From source file:Main.java
private static void smoothToOrigin(final View view) { Date firstDate = new Date(); final long firstTime = firstDate.getTime(); executeAsyncTask(new AsyncTask<Void, Integer, Void>() { int n = 1, t = 4000; boolean increaseN; @Override// w ww.j ava 2s .co m protected Void doInBackground(Void... params) { while (!isCancelled()) { Date currentDate = new Date(); long diffTime = currentDate.getTime() - firstTime; double y = getCosY(diffTime); int alpha = (int) (y * 255); int resultColor = setAlphaComponent(mColor, alpha); if (alpha < 0.038 * 255) { publishProgress(0); this.cancel(true); return null; } publishProgress(resultColor, alpha); try { Thread.sleep(38); } catch (InterruptedException e) { e.printStackTrace(); } } return null; } @Override protected void onProgressUpdate(Integer... values) { super.onProgressUpdate(values); view.setBackgroundColor(values[0]); } }); }
From source file:geo.cic.ipn.mx.accelerometer_sensor.RestApi.java
public static String obtenerClase(Float x, Float y, Float z, Integer k) { String clase = ""; try {/*from w w w .j a va 2 s. co m*/ // TODO code application logic here OkHttpClient client = new OkHttpClient(); MediaType mediaType = MediaType.parse("application/octet-stream"); Request request = new Request.Builder() .url(URL + "ObtenerClase.php?x=" + Math.abs(x * 1000) + "&y=" + Math.abs(y * 1000) + "&z=" + Math.abs(z * 1000) + "&k=" + k) .get().addHeader("cache-control", "no-cache") .addHeader("postman-token", "b983b2f6-8cd7-5956-32f5-bc7cf4e53b9f").build(); JSONObject jsonObject = new RequestApi().execute(request).get(); Integer estatus = jsonObject.getInt("estado"); if (estatus == 1) { // exito clase = jsonObject.getString("clase"); } } catch (JSONException ex) { ex.printStackTrace(); } catch (InterruptedException e) { e.printStackTrace(); } catch (ExecutionException e) { e.printStackTrace(); } catch (Exception ex) { clase = "-1"; } return clase; }
From source file:net.sf.jsignpdf.utils.PKCS11Utils.java
/** * Unregisters security provider with given name. * <p>//from w w w . j a v a2 s .c o m * Some tokens/card-readers hangs during second usage of the program, they * have to be unplugged and plugged again following code should prevent this * issue. * </p> * * @param providerName */ public static void unregisterProvider(final String providerName) { if (providerName != null) { LOGGER.debug("Removing security provider with name " + providerName); Security.removeProvider(providerName); //we should wait a little bit to de-register provider correctly (is it a driver issue?) try { Thread.sleep(1000); } catch (InterruptedException e) { e.printStackTrace(); } } }
From source file:de.laures.cewolf.util.ImageHelper.java
public static boolean hasAlpha(Image image) { if (image instanceof BufferedImage) { return ((BufferedImage) image).getColorModel().hasAlpha(); }/*ww w .j a va 2s. c o m*/ PixelGrabber pg = new PixelGrabber(image, 0, 0, 1, 1, false); try { pg.grabPixels(); } catch (InterruptedException e) { e.printStackTrace(); } ColorModel cm = pg.getColorModel(); if (cm == null) { return false; } return cm.hasAlpha(); }
From source file:com.serli.open.data.poitiers.jobs.importer.ImportAllDataJobTest.java
private static void sleep(int seconds) { try {/*www. j ava 2 s.co m*/ TimeUnit.SECONDS.sleep(seconds); } catch (InterruptedException e) { e.printStackTrace(); } }
From source file:functionaltests2.SchedulerCommandLine.java
public static void killSchedulerCmdLine() { HashMap<String, String> env = new HashMap<String, String>(); env.put("SchedulerTStarter", "SchedulerTStarter"); // and eventually we kill remaining nodes try {// ww w . j a v a 2 s.com ProcessTree.get().killAll(p, env); Thread.sleep(3000); } catch (InterruptedException e) { e.printStackTrace(); } //p.destroy(); }
From source file:com.apps.android.viish.encyclolpedia.tools.ImageManager.java
public static void downloadAndSaveChampionImage(Context context, String fileName) throws IOException { try {/*from w w w .j av a2 s. com*/ downloadAndSaveImageWithPrefix(context, "", fileName); } catch (IOException ioe) { try { Thread.sleep(1000); } catch (InterruptedException e1) { e1.printStackTrace(); } downloadAndSaveImageWithPrefix(context, "", fileName); } }
From source file:com.apps.android.viish.encyclolpedia.tools.ImageManager.java
public static void downloadAndSaveSkillImage(Context context, String fileName) throws IOException { try {/*from w ww . j a va 2 s .c o m*/ downloadAndSaveImageWithPrefix(context, "skills/", fileName); } catch (IOException ioe) { try { Thread.sleep(1000); } catch (InterruptedException e1) { e1.printStackTrace(); } downloadAndSaveImageWithPrefix(context, "skills/", fileName); } }
From source file:Main.java
public static void shutdown() { try {// w ww .java 2 s . c om pool.awaitTermination(30, TimeUnit.SECONDS); } catch (InterruptedException e) { System.err.println("Shutdown was interrupted, forcing shutdown..."); pool.shutdownNow(); e.printStackTrace(); } }