List of usage examples for java.lang InterruptedException printStackTrace
public void printStackTrace()
From source file:com.acme.TopTagsTupleTest.java
private void simulateLatency() { try {/*from w w w . j ava 2 s. c om*/ Thread.sleep(500); } catch (InterruptedException e) { e.printStackTrace(); } }
From source file:org.apigw.authserver.svc.impl.ExpiringAuthorizationCodeServicesTest.java
@Test(expected = InvalidGrantException.class) public void testExpirationTime() { ExpiringAuthorizationCodeServices codeService = new ExpiringAuthorizationCodeServices(1); String code = codeService.createAuthorizationCode(createAuth()); try {/* w w w . j a v a 2s. c o m*/ Thread.sleep(1500L); } catch (InterruptedException e) { e.printStackTrace(); } codeService.consumeAuthorizationCode(code); }
From source file:com.apress.prospringintegration.channels.queuechannel.EmergencyTicketReceiver.java
@Override public void handleTicketMessage() { Message<?> ticketMessage = null; while (true) { List<Message<?>> emergencyTicketMessages = channel.purge(emergencyTicketSelector); handleEmergencyTickets(emergencyTicketMessages); ticketMessage = channel.receive(RECEIVE_TIMEOUT); if (ticketMessage != null) { handleTicket((Ticket) ticketMessage.getPayload()); } else {/* w w w. java 2 s. c o m*/ try { /** Handle some other tasks **/ Thread.sleep(1000); } catch (InterruptedException ex) { ex.printStackTrace(); } } } }
From source file:Main.java
public Main() { super(BoxLayout.Y_AXIS); glassPane.setOpaque(false);//from w w w. j a v a2 s . co m DefaultMutableTreeNode root = new DefaultMutableTreeNode("Root"); for (int i = 0; i < 14000; i++) { DefaultMutableTreeNode node = new DefaultMutableTreeNode("Root" + i); node.add(new DefaultMutableTreeNode("Child" + i)); root.add(node); } final JTree tree = new JTree(root); tree.setRootVisible(false); final JScrollPane pane = new JScrollPane(tree); add(pane); JButton button = new JButton("Expand"); button.addActionListener(e -> { Thread t = new Thread(new Runnable() { @Override public void run() { try { Thread.sleep(2000); } catch (InterruptedException e) { e.printStackTrace(); } TreePath[] paths = tree.getSelectionPaths(); if (paths == null || paths.length == 0) { glassPane.setVisible(false); return; } tree.setSelectionPath(paths[0]); for (int i = 0; i < paths.length; i++) { tree.expandPath(paths[i]); } glassPane.setVisible(false); } }); getRootPane().setGlassPane(glassPane); glassPane.setVisible(true); t.start(); }); add(button); glassPane.addMouseWheelListener(e -> { for (MouseWheelListener mwl : pane.getMouseWheelListeners()) { mwl.mouseWheelMoved(e); } }); }
From source file:koper.event.InsertOrderListener.java
private void sleep(int s) { try {// w w w.j a v a 2s . com Thread.sleep(s); } catch (InterruptedException e) { e.printStackTrace(); } }
From source file:com.rr.autobot1.bot.RobotIml.java
public void turnLeft() { stop();// w ww. j a va2 s. c om gpioService.turnPinOn(config.getLeftReversePin()); gpioService.turnPinOn(config.getRightForwardPin()); try { Thread.sleep(config.getStepDelay()); } catch (InterruptedException e) { e.printStackTrace(); } stop(); }
From source file:com.rr.autobot1.bot.RobotIml.java
public void turnRight() { stop();//from w ww . j a va2 s . c om gpioService.turnPinOn(config.getLeftForwardPin()); gpioService.turnPinOn(config.getRightReversePin()); try { Thread.sleep(config.getStepDelay()); } catch (InterruptedException e) { e.printStackTrace(); } stop(); }
From source file:io.awacs.demo.TestController.java
public void bis2() { try {/*ww w.j a v a2s . c om*/ Thread.sleep(100); } catch (InterruptedException e) { e.printStackTrace(); } }
From source file:de.ipbhalle.metfusion.main.SubstructureSearch.java
public static void test() { String token = "eeca1d0f-4c03-4d81-aa96-328cdccf171a"; MassSpecAPISoapProxy chemSpiderProxy = new MassSpecAPISoapProxy(); try {/*from ww w .ja va2s. c om*/ ExtendedCompoundInfo cpdInfo = chemSpiderProxy.getExtendedCompoundInfo(905, token); System.out.println(cpdInfo.getCommonName()); chemSpiderProxy.searchByMass2(272.04d, 0.001d); } catch (RemoteException e1) { // TODO Auto-generated catch block e1.printStackTrace(); } SearchSoapProxy ssp = new SearchSoapProxy(); SubstructureSearchOptions sso = new SubstructureSearchOptions(); sso.setMatchTautomers(false); //sso.setMolecule("CC(=O)Oc1ccccc1C(=O)O"); //sso.setMolecule("O=C(\\C1=C(/O)\\C(=C(\\O)C(C1=O)(C\\C=C(/C)C)C\\C=C(/C)C)C\\C=C(/C)C)C(C)C"); sso.setMolecule("Cc1cccc2nnnc12"); CommonSearchOptions cso = new CommonSearchOptions(); cso.setComplexity(EComplexity.Any); cso.setIsotopic(EIsotopic.Any); // NotLabeled when using Formula search cso.setHasSpectra(false); cso.setHasPatents(false); String transactionID = ""; ERequestStatus ers = null; try { transactionID = ssp.substructureSearch(sso, cso, token); System.out.println("transaction id -> " + transactionID); ers = ssp.getAsyncSearchStatus(transactionID, token); while (ers.equals(ERequestStatus.Processing)) { Thread.sleep(2000); ers = ssp.getAsyncSearchStatus(transactionID, token); } } catch (RemoteException e1) { // TODO Auto-generated catch block e1.printStackTrace(); } catch (InterruptedException e) { // TODO Auto-generated catch block e.printStackTrace(); } if (ers.equals(ERequestStatus.Failed)) { System.out.println("failed"); System.exit(-1); } //String strucAbsent = "CC=C(C)C"; String strucAbsent = "O=CO"; // O=CO[H] SmilesParser sp = new SmilesParser(DefaultChemObjectBuilder.getInstance()); IAtomContainer out = null; try { out = sp.parseSmiles(strucAbsent); } catch (InvalidSmilesException e1) { // TODO Auto-generated catch block e1.printStackTrace(); } if (ers.equals(ERequestStatus.ResultReady)) { System.out.println("woohoo"); try { int[] CSIDs = ssp.getAsyncSearchResult(transactionID, token); ExtendedCompoundInfo[] info = chemSpiderProxy.getExtendedCompoundInfoArray(CSIDs, token); System.out.println("# matches -> " + info.length); List<IAtomContainer> containersList = new ArrayList<IAtomContainer>(); for (int i = 0; i < info.length; i++) { System.out.println( info[i].getCSID() + "\t" + info[i].getCommonName() + "\t" + info[i].getSMILES()); IAtomContainer ac = null; try { ac = sp.parseSmiles(info[i].getSMILES()); } catch (InvalidSmilesException ise) { continue; } containersList.add(ac); } // String sdf = chemSpiderProxy.getRecordsSdf(transactionID, token); // InputStream in = IOUtils.toInputStream(sdf); // MDLReader reader = new MDLReader(in); // ChemFile chemFile = (ChemFile) reader.read((ChemObject) new ChemFile()); // List<IAtomContainer> containersList = ChemFileManipulator.getAllAtomContainers(chemFile); System.out.println("# mols -> " + containersList.size()); SMARTSQueryTool sqt = new SMARTSQueryTool(strucAbsent); // filter out container that contain strucAbsent for (IAtomContainer container : containersList) { // MCSS search List<IAtomContainer> mcsslist = UniversalIsomorphismTester.getOverlaps(container, out); int maxmcss = -9999999; IAtomContainer maxac = null; for (int j = 0; j < mcsslist.size(); j++) { IAtomContainer a = (IAtomContainer) mcsslist.get(j); if (a.getAtomCount() > maxmcss) { // TODO: leave out candidates that match the substructure !!! maxmcss = a.getAtomCount(); maxac = a; } if (a.getAtomCount() == out.getAtomCount()) { // matching number of atoms between MCSS and structure to leave out System.out.println("#atoms in MCSS matches substrucAbsent -> filter out"); break; } } System.out.println("maxac -> " + maxac.getAtomCount()); // SMARTS matching boolean matches = sqt.matches(container); // , true if (matches) { // leave out container System.out.println("matches"); int nmatch = sqt.countMatches(); List<List<Integer>> mappings = sqt.getMatchingAtoms(); for (int i = 0; i < nmatch; i++) { List<Integer> atomIndices = mappings.get(i); System.out.println("#atom indices -> " + atomIndices.size()); } } else { // keep container System.out.println("no match"); } } } catch (RemoteException e) { // TODO Auto-generated catch block e.printStackTrace(); } catch (CDKException e) { // TODO Auto-generated catch block e.printStackTrace(); } } else System.out.println("oh no"); }
From source file:com.rr.autobot1.bot.RobotIml.java
public void init() { while (true) { moveForward();//from ww w .j a v a2s . com try { Thread.sleep(400); } catch (InterruptedException e) { e.printStackTrace(); } } }