Package co.paralleluniverse.strands

Examples of co.paralleluniverse.strands.SuspendableRunnable


        }).start().join();
    }

    @Test
    public void testRollback() throws IOException, InterruptedException, Exception {
        new Fiber<Void>(new SuspendableRunnable() {
            @Override
            public void run() throws SuspendExecution, InterruptedException {
                try {
                    conn.setAutoCommit(false);
                    conn.createStatement().execute("drop table if exists testRollback");
View Full Code Here


        // snippet client creation
        final Client client = AsyncClientBuilder.newBuilder().build();
        // end of snippet
        final CountDownLatch cdl = new CountDownLatch(concurrencyLevel);
        for (int i = 0; i < concurrencyLevel; i++)
            new Fiber<Void>(new SuspendableRunnable() {
                @Override
                public void run() throws SuspendExecution, InterruptedException {
                    // snippet http call
                    String response = client.target("http://localhost:8080").request().get(String.class);
                    // end of snippet
View Full Code Here

        conn.close();
    }

    @Test
    public void testInsertSelect() throws IOException, InterruptedException, Exception {
        new Fiber<Void>(new SuspendableRunnable() {
            @Override
            public void run() throws SuspendExecution, InterruptedException {
                // snippet usage
                for (int i = 0; i < 100; i++)
                    ctx.insertInto(table("something"), field("id"), field("name")).values(i, "name" + i).execute();
View Full Code Here

                setMaxConnPerRoute(concurrencyLevel).
                setMaxConnTotal(concurrencyLevel).
                build());
        client.start();
        // end of snippet
        new Fiber<Void>(new SuspendableRunnable() {
            @Override
            public void run() throws SuspendExecution, InterruptedException {
                try {
                    // snippet future calls
                    ArrayList<Future<HttpResponse>> futures = new ArrayList<>();
View Full Code Here

                setMaxConnPerRoute(concurrencyLevel).
                setMaxConnTotal(concurrencyLevel).build();
        // end of snippet
        final CountDownLatch cdl = new CountDownLatch(concurrencyLevel);
        for (int i = 0; i < concurrencyLevel; i++)
            new Fiber<Void>(new SuspendableRunnable() {
                @Override
                public void run() throws SuspendExecution, InterruptedException {
                    try {
                        // snippet http call
                        String response = client.execute(new HttpGet("http://localhost:8080"), BASIC_RESPONSE_HANDLER);
View Full Code Here

            });
        }

        void onOpen() {
            try {
                FiberUtil.runInFiber(new SuspendableRunnable() {
                    @Override
                    public void run() throws SuspendExecution, InterruptedException {
                        webActor.send(new WebSocketOpened(WebSocketActor.this.ref()));
                    }
                });
View Full Code Here

        response = (HttpServletResponse) res;
        req.setAttribute("org.apache.catalina.ASYNC_SUPPORTED", true);
        final AsyncContext ac = req.startAsync();
        ac.setTimeout(120000);
        final FiberHttpServletRequest srad = new FiberHttpServletRequest(request);
        new Fiber(null, stackSize, new SuspendableRunnable() {
            @Override
            public void run() throws SuspendExecution, InterruptedException {
                try {
                    // TODO: check if ac has expired
                    currentAsyncContext.set(ac);
View Full Code Here

    public final void service(final ServletRequest req, final ServletResponse res) {
        req.setAttribute("org.apache.catalina.ASYNC_SUPPORTED", true);
        final AsyncContext ac = req.startAsync();
        ac.setTimeout(120000);
        final FiberServletRequest srad = wrapRequest(req);
        new Fiber(null, stackSize, new SuspendableRunnable() {
            @Override
            public void run() throws SuspendExecution, InterruptedException {
                try {
                    // TODO: check if ac has expired
                    currentAsyncContext.set(ac);
View Full Code Here

    @Test
    public void testGet() throws IOException, InterruptedException, Exception {
        // snippet registration
        final MyGitHub github = new FiberRestAdapterBuilder().setEndpoint("http://localhost:8080").build().create(MyGitHub.class);
        // end of snippet
        new Fiber<Void>(new SuspendableRunnable() {
            @Override
            public void run() throws SuspendExecution, InterruptedException {
                // snippet usage
                List<Contributor> contributors = github.contributors("puniverse", "comsat");
                String result = contributors.get(1).login;
View Full Code Here

        super.tearDownTestBase();
    }
   
    @Test
    public void testRunCommandDocument() throws ExecutionException, InterruptedException {
        new Fiber<Void>(new SuspendableRunnable() {
            @Override
            public void run() throws SuspendExecution, InterruptedException {
                Document res = mongoDb.runCommand (
                    BuilderFactory.start()
                        .add("ping", 1)
View Full Code Here

TOP

Related Classes of co.paralleluniverse.strands.SuspendableRunnable

Copyright © 2018 www.massapicom. 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.