Example usage for java.lang InterruptedException printStackTrace

List of usage examples for java.lang InterruptedException printStackTrace

Introduction

In this page you can find the example usage for java.lang InterruptedException printStackTrace.

Prototype

public void printStackTrace() 

Source Link

Document

Prints this throwable and its backtrace to the standard error stream.

Usage

From source file:mystructure.ClonerTest.java

@Test
public void testClonerWithMyMonomerAndConvertionToV3000() throws ParsingConfigFileException, IOException,
        ReadingStructurefileException, ExceptionInMyStructurePackage {

    AlgoParameters algoParameters = Tools.generateModifiedAlgoParametersForTestWithTestFoldersWithUltiJmol();

    String fourLetterCode = "1di9";
    Pair<String, MyStructureIfc> pathAndMyStructure = IOTools.getMyStructureIfc(algoParameters,
            fourLetterCode.toCharArray());

    int initialCount = algoParameters.ultiJMolBuffer.getSize();

    MyMonomerIfc msqLigand = pathAndMyStructure.getValue().getHeteroChain("A".toCharArray())
            .getMyMonomerFromResidueId(500);
    Cloner cloner = new Cloner(msqLigand, algoParameters);
    MyStructureIfc myStructureFromAMyMonomer = cloner.getClone();
    String myStructureV3000 = myStructureFromAMyMonomer.toV3000();

    // write to a temp text file
    String pathToTempFolder = folder.getRoot().getAbsolutePath();
    String pathTOWriteV3000Molfile = pathToTempFolder + "//v3000test.mol";
    WriteTextFile.writeTextFile(myStructureV3000, pathTOWriteV3000Molfile);

    // read it with cdk and check atom and bond count

    IAtomContainer mol = CdkTools.readV3000molFile(pathTOWriteV3000Molfile);
    int atomCount = MyStructureTools.getAtomCount(myStructureFromAMyMonomer);
    int bondCount = TestTools.getBondCount(myStructureFromAMyMonomer);
    assertTrue(mol.getAtomCount() == atomCount);
    assertTrue(mol.getBondCount() * 2 == bondCount);

    int finalCount = algoParameters.ultiJMolBuffer.getSize();
    assertTrue(finalCount == initialCount);
    try {/*from  w ww . j av  a 2  s. c o  m*/
        for (int i = 0; i < initialCount; i++) {
            algoParameters.ultiJMolBuffer.get().frame.dispose();
        }
    } catch (InterruptedException e) {
        e.printStackTrace();
    }
    assertTrue(algoParameters.ultiJMolBuffer.getSize() == 0);

}

From source file:client.ServiceRequester.java

public void shutdown() {
    Log.info("ServiceRequester shutting down.");
    this.running = false;
    try {/*w w  w  . j a v a2s.c  o  m*/
        runningThread.join();
    } catch (InterruptedException e) {
        e.printStackTrace();
    }
}

From source file:edu.umich.robot.Application.java

/**
 * <p> Loops, running each config file in a batch mode.
 * /*from   ww w .  j  a  v a2s . com*/
 * <p> Each run continues until a specified timeout or a number of cycles
 * is exceeded. Both or neither may be specified.  The run also will stop
 * if Soar stops for whatever reason.
 *
 * <p> After a run, the garbage collector is called and the system sleeps
 * for a few seconds. This helps Java manage its memory and threads.
 */
private void multipleRuns(Config config) {
    String[] configs = config.requireStrings("configs");
    int cycles = config.requireInt("cycles");
    int seconds = config.requireInt("seconds");

    for (int i = 0; i < configs.length; ++i) {
        logger.info("Running " + configs[i] + " for " + cycles + " cycles, timeout " + seconds + " seconds.");
        HeadlessApplication h = new HeadlessApplication(toArgs(configs[i]), cycles, seconds);
        if (h.go())
            break;
        logger.info("Done, garbage collect and 5 second sleep.");
        System.gc();
        try {
            Thread.sleep(5000);
        } catch (InterruptedException e) {
            e.printStackTrace();
        }
    }
    logger.info("Done.");
}

From source file:com.galenframework.ide.tests.integration.controllers.ApiTestBase.java

@BeforeSuite
public void startupMockedWebApp() throws IOException {
    MockedWebApp.create();//ww w .j av  a2 s. com
    try {
        Thread.sleep(2000);
    } catch (InterruptedException e) {
        e.printStackTrace();
    }
}

From source file:com.roquahacks.semafor4j.FrameNetService.java

public void runFNSemanticParsing() {
    try {/*from   w  w w . j  av  a  2  s .com*/
        Process proc = Runtime.getRuntime().exec(FrameNetOptions.ABS_PATH_DRIVER_SCRIPT + " "
                + FrameNetOptions.ABS_PATH_FNDATA + FrameNetOptions.FN_FILE_NAME);
        proc.waitFor();
    } catch (InterruptedException e) {
        e.printStackTrace();
    } catch (IOException e) {
        e.printStackTrace();
    }
}

From source file:mx.com.gaby.controller.HomeController.java

private void sleepALittle(int time) {
    try {/*from   w ww.  ja  v a2  s  .  c o  m*/
        Thread.sleep(time);
    } catch (InterruptedException e) {
        e.printStackTrace();
    }
}

From source file:eu.prestoprime.plugin.ltfsarchiver.client.LTFSClient.java

public LTFSResponse execute(LTFSRequest request) throws LTFSException {
    LTFSResponse response;/*from ww  w .j a va2  s .com*/
    do {
        response = this.executeRequest(request);
        LTFSRequest nextRequest = request.nextRequest(response);

        if (nextRequest != null && nextRequest == request) {
            try {
                Thread.sleep(5000);
            } catch (InterruptedException e) {
                e.printStackTrace();
            }
        }
        request = nextRequest;
    } while (request != null);
    return response;
}

From source file:org.fcrepo.it.BasicIT.java

@Test
public void testAddContainer() throws IOException {

    // Create a container with title
    putDummyDatastream(pid101, "text/turtle");
    try {/*from   w  ww  . j a  v a  2  s.  c om*/
        Thread.sleep(5000);
    } catch (final InterruptedException e) {
        e.printStackTrace();
    }

}

From source file:conexionSiabra.PeticionGet.java

public String Ejecutar() {
    AsyncTask<String, String, String> variable = new PeticionHttp().execute(url, "nada", result);
    try {//  ww  w  .ja v a  2  s.com
        result = variable.get();
    } catch (InterruptedException e) {
        // TODO Auto-generated catch block
        e.printStackTrace();
    } catch (ExecutionException e) {
        // TODO Auto-generated catch block
        e.printStackTrace();
    }

    return result;
}

From source file:com.googlecode.android_scripting.facade.EventServer.java

@Override
protected void handleConnection(Socket socket) throws IOException {
    Listener l = new Listener(socket);
    Log.v("Adding EventServer listener " + socket.getPort());
    mListeners.add(l);//from   w ww .j  a va 2s  .co  m
    // we are running in the socket accept thread
    // wait until the event dispatcher gets us the events
    // or we die, what ever happens first
    try {
        l.lock.await();
    } catch (InterruptedException e) {
        e.printStackTrace();
    }
    try {
        l.sock.close();
    } catch (IOException e) {
        e.printStackTrace();
    }
    Log.v("Ending EventServer listener " + socket.getPort());
}