List of usage examples for java.lang InterruptedException printStackTrace
public void printStackTrace()
From source file:cn.buk.qms.listener.QuartzContextListener.java
@Override public void contextDestroyed(ServletContextEvent arg0) { WebApplicationContext webApplicationContext = (WebApplicationContext) arg0.getServletContext() .getAttribute(WebApplicationContext.ROOT_WEB_APPLICATION_CONTEXT_ATTRIBUTE); Object obj = webApplicationContext.getBean("ctripHotelService"); //System.out.println(obj); cn.buk.api.service.CtripHotelServiceImpl ctripHotelService = (cn.buk.api.service.CtripHotelServiceImpl) obj; if (ctripHotelService != null) { ctripHotelService.stopService(); System.out.println("ctripHotelService.stopService();"); try {/*from ww w . j a va2s . c o m*/ Thread.sleep(5000); } catch (InterruptedException e) { e.printStackTrace(); } } obj = null; System.out.println("Obj: " + obj); obj = webApplicationContext.getBean("hotelService"); System.out.println("Obj: " + obj); //if(obj != null) { //cn.buk.hotel.service.HotelServiceImpl hotelService = ; //System.out.println("hotelService: " + hotelService); System.out.println("hotelService.stopService();"); ((cn.buk.hotel.service.HotelServiceImpl) obj).stopService(); try { Thread.sleep(5000); } catch (InterruptedException e) { e.printStackTrace(); } //} obj = webApplicationContext.getBean("startQuartz"); //System.out.println(obj.getClass().getName()); org.quartz.impl.StdScheduler startQuartz = (org.quartz.impl.StdScheduler) obj; if (startQuartz != null) { //System.out.println("startQuertz.shutdown();"); startQuartz.shutdown(); } try { Thread.sleep(2000); } catch (InterruptedException e) { e.printStackTrace(); } }
From source file:MainClass.java
public void imageComplete(int status) { if ((status == IMAGEERROR) || (status == IMAGEABORTED)) { consumer.imageComplete(status);//from ww w .ja v a 2 s . co m return; } else { int xWidth = imageWidth / iterations; if (xWidth <= 0) xWidth = 1; int newPixels[] = new int[xWidth * imageHeight]; int iColor = overlapColor.getRGB(); for (int x = 0; x < (xWidth * imageHeight); x++) newPixels[x] = iColor; int t = 0; for (; t < (imageWidth - xWidth); t += xWidth) { consumer.setPixels(t, 0, xWidth, imageHeight, ColorModel.getRGBdefault(), newPixels, 0, xWidth); consumer.imageComplete(ImageConsumer.SINGLEFRAMEDONE); try { Thread.sleep(delay); } catch (InterruptedException e) { e.printStackTrace(); } } int left = imageWidth - t; if (left > 0) { consumer.setPixels(imageWidth - left, 0, left, imageHeight, ColorModel.getRGBdefault(), newPixels, 0, xWidth); consumer.imageComplete(ImageConsumer.SINGLEFRAMEDONE); } consumer.imageComplete(STATICIMAGEDONE); } }
From source file:org.duracloud.mill.workman.NoopProcessorLocalRoundTripTest.java
private void sleep(long ms) { try {//from w ww . jav a 2s .c o m Thread.sleep(ms); } catch (InterruptedException e) { e.printStackTrace(); } }
From source file:com.github.nethad.clustermeister.provisioning.torque.TorqueJPPFTestSetup.java
private void startNodes() { // torqueNodeManager.deployResources(); TorqueNodeConfiguration nodeConfiguration = TorqueNodeConfiguration.configurationForNode(driverIpAddress, 1, new LinkedList<File>()); for (int i = 0; i < NUMBER_OF_NODES; i++) { ListenableFuture<Void> node = torqueNodeManager.addNode(nodeConfiguration); try {//from w w w . j a v a 2 s. c om node.get(); } catch (InterruptedException ex) { ex.printStackTrace(); } catch (ExecutionException ex) { ex.printStackTrace(); } } // nodes = new ArrayList<ListenableFuture<? extends Node>>(); // nodes.add(torqueNodeManager.addNode(nodeConfiguration)); }
From source file:net.daporkchop.porkbot.command.music.CommandPlayAll.java
public void execute(MessageReceivedEvent evt, String[] split, String rawContent) { if (split.length < 2) { sendErrorMessage(evt.getTextChannel(), "Not enough arguments!"); return;//from w ww . j a v a 2 s . c om } if (validator.isValid(split[1])) { try { String[] data = HTTPUtils.performGetRequest(HTTPUtils.constantURL(split[1]), 32000).trim() .split("\n"); int i = 0; Message message = evt.getChannel() .sendMessage("Loading " + data.length + " tracks... (this might take a while)").complete(); for (String s : data) { s = s.trim(); if (!s.contains("~") && validator.isValid(s)) { AudioUtils.loadAndPlay(evt.getTextChannel(), s, evt.getMember(), false); try { synchronized (s) { s.wait(); } } catch (InterruptedException e) { e.printStackTrace(); } i++; } } message.editMessage("Loaded " + i + " tracks! (Out of " + data.length + ")").queue(); } catch (Exception e) { MessageUtils.sendException(e, evt); } } else { MessageUtils.sendMessage("Invalid URL: " + split[1], evt.getTextChannel()); } }
From source file:middleware.LogTailerListener.java
public void handle(String line, long offset) { // if it is resumed then no need to send dstat headers. if (resumed) { if (line.contains("Dstat") || line.contains("Author") || line.contains("Host") || line.contains("Cmdline") || line.contains("epoch") || line.isEmpty()) { return; }/* w w w .j ava 2 s. c o m*/ } IncrementalLog log = new IncrementalLog(type, (line + System.lineSeparator()).getBytes(), offset); while (!queue.offer(log)) { try { Thread.sleep(100); } catch (InterruptedException e) { if (this.run) { e.printStackTrace(); } } if (!this.run) break; } this.offset = offset; }
From source file:ca.cmput301w14t09.PopUpEdit.java
/** * Creates a popup edit window with the given input parameters. * @param comment - edited comment.// w w w .j av a 2s. co m */ public void popUpEdit(final Comment comment) { //Creates a dialog box final Dialog dialog = new Dialog(caller); dialog.setContentView(R.layout.pop_up_edit); dialog.setTitle("Comment Text"); Button Submit = (Button) dialog.findViewById(R.id.Submit); final EditText commentText = (EditText) dialog.findViewById(R.id.editComment); commentText.setHint(comment.getCommentText()); dialog.show(); Submit.setOnClickListener(new View.OnClickListener() { //when submit is pressed everything is pused to the server @Override public void onClick(View v) { String str = "commentText = \\\"" + commentText.getText() + "\\\"\""; if (Server.getInstance().isServerReachable(caller)) { try { ElasticSearchOperations.updateComment(comment, str); } catch (InterruptedException e) { e.printStackTrace(); } catch (ClientProtocolException e) { e.printStackTrace(); } catch (IOException e) { e.printStackTrace(); } } dialog.dismiss(); } }); }
From source file:com.nts.alphamale.monitor.HierarchyMonitor.java
public void run() { try {//w w w . ja v a 2 s. c o m while (DataQueue.IS_CONTROLED) { log.info("IS_CONTROLED is true"); if (DataQueue.IS_AUTO_MODE) { synchronized (this) { while (suspended) { log.info("dump monitoring suspend"); wait(); } } getHierarchyDump(); Thread.sleep(200); } else { } } } catch (InterruptedException e) { e.printStackTrace(); } }
From source file:ESDemo.java
@SuppressWarnings("unchecked") private JSONObject intialiseJSONObject() { if (!(hcAPI.getEnvironmentData().getProcessId() > 0)) { System.out.print("initialising data ."); while (!(hcAPI.getEnvironmentData().getProcessId() > 0)) { try { System.out.print("."); Thread.sleep(1000); } catch (InterruptedException e) { e.printStackTrace(); }//from ww w . j a v a 2 s .c o m } System.out.println(" initialisation complete"); } JSONObject obj = new JSONObject(); obj.put("hostName", hcAPI.getEnvironmentData().getHostName()); obj.put("pid", hcAPI.getEnvironmentData().getProcessId()); obj.put("commandLine", hcAPI.getEnvironmentData().getJavaCommandLine().toString()); obj.put("agentPort", agentPortNum); return obj; }
From source file:com.almende.eve.test.TestBoot.java
/** * Test boot: requires a testWakeService state, with a list of agents. *//*from ww w . j a v a2s . c om*/ @Test public void testBoot() { //This configuration normally comes from eve.yaml: final ObjectNode config = JOM.createObjectNode(); final InstantiationServiceConfig instantiationConfig = new InstantiationServiceConfig(); final FileStateConfig state = new FileStateConfig(); state.setPath(".wakeservices"); state.setId("testWakeService"); instantiationConfig.setState(state); final ArrayNode services = JOM.createArrayNode(); services.add(instantiationConfig); config.set("instantiationServices", services); //Basic boot action: Boot.boot(config); LOG.warning("Sleep for 20 seconds, allowing external XMPP call."); try { Thread.sleep(20000); } catch (final InterruptedException e) { // TODO Auto-generated catch block e.printStackTrace(); } }