Package io.apigee.trireme.core

Examples of io.apigee.trireme.core.ScriptFuture.cancel()


        NodeScript script = env.createScript("server.js", new File("./target/test-classes/dogs/server.js"), null);
        ScriptFuture scriptFuture = script.execute();
        Utils.awaitPortOpen(PORT);
        long after = getMemoryUsed();
        System.out.println("Added " + (after - before) + " bytes after starting one script");
        scriptFuture.cancel(true);
    }

    @Test
    public void testAppMemoryManyTimes()
        throws NodeException, InterruptedException, IOException
View Full Code Here


        System.out.println("Waiting for the port to open. useNetty = " + useNetty);
        Utils.awaitPortOpen(port);

        System.out.println("Port " + port + " is open");
        Utils.getString(BASEURL + port + "/forecastrss?p=08904", 200);
        scriptFuture.cancel(true);

        try {
            scriptFuture.get();
        } catch (CancellationException ok) {
        }
View Full Code Here

            {
                assertTrue(status.isCancelled());
            }
        });
        Thread.sleep(50L);
        status.cancel(true);
        try {
            status.get();
            assertFalse("Script should return an cancellation exception", true);
        } catch (CancellationException ce) {
            // Expected result
View Full Code Here

        ScriptFuture future = script.executeModule();
        Scriptable module = future.getModuleResult();
        assertNotNull(module);
        assertTrue(module.has("modulename", module));
        assertEquals("testmodule", module.get("modulename", module));
        future.cancel(true);
    }

    @Test
    public void testBigFile()
        throws InterruptedException, ExecutionException, NodeException
View Full Code Here

            {
                assertTrue(status.isCancelled());
            }
        });
        Thread.sleep(50L);
        status.cancel(false);
        try {
            status.get();
            assertFalse("Script should return an cancellation exception", true);
        } catch (CancellationException ce) {
            // Expected result
View Full Code Here

        try {
            status.get(250L, TimeUnit.MILLISECONDS);
            assertTrue("Wait should have timed out", false);
        } catch (TimeoutException ok) {
        }
        status.cancel(true);
    }

    @Test
    public void testCancellationWithInterrupt()
        throws InterruptedException, ExecutionException, NodeException
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.