Package groovyx.gpars.group

Examples of groovyx.gpars.group.DefaultPGroup.task()


        // variable can be assigned once only, read allowed multiple times
        final DataflowVariable<Integer> a = new DataflowVariable<Integer>();

        // group.task will use thread from pool and uses it to execute value bind
        group.task(new Runnable() {
            public void run() {
                // first thread binding value succeeds, other attempts would fail with IllegalStateException
                logMessages.add("Value bound");
                a.bind(10);
            }
View Full Code Here


                a.bind(10);
            }
        });

        // group.task will use thread from pool and uses it to execute call method
        final Promise<?> result = group.task(new Callable() {
            public Object call() throws Exception {
                // getVal will wait for the value to be assigned
                final int result = a.getVal() + 10;
                logMessages.add("Value calculated");
                return result;
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.