Package org.apache.geronimo.concurrent

Examples of org.apache.geronimo.concurrent.ManagedContext


        if (ntasks == 0) {
            throw new IllegalArgumentException();
        }
        List<Future<T>> futures= new ArrayList<Future<T>>(ntasks);
        ManagedTaskListenerSupport listenerSupport = getManagedTaskListenerSupport(listener);
        ManagedContext managedContext = getManagedContext();
        ManagedExecutorCompletionService<T> ecs =
            new ManagedExecutorCompletionService<T>(this, managedContext, listenerSupport);
       
        // For efficiency, especially in executors with limited
        // parallelism, check to see if previously submitted tasks are
View Full Code Here


        throws InterruptedException {
        if (tasks == null) {
            throw new NullPointerException();
        }
        ManagedTaskListenerSupport listenerSupport = getManagedTaskListenerSupport(listener);
        ManagedContext managedContext = getManagedContext();
        List<Future<T>> futures = new ArrayList<Future<T>>(tasks.size());
        boolean done = false;
        try {
            for (Callable<T> task : tasks) {
                ManagedFutureTask<T> future = createManagedTask(task, managedContext, listenerSupport);
View Full Code Here

        throws InterruptedException {
        if (tasks == null || unit == null) {
            throw new NullPointerException();
        }
        ManagedTaskListenerSupport listenerSupport = getManagedTaskListenerSupport(listener);
        ManagedContext managedContext = getManagedContext();
        long nanos = unit.toNanos(timeout);
        List<Future<T>> futures = new ArrayList<Future<T>>(tasks.size());
        boolean done = false;
        try {
            for (Callable<T> task : tasks)  {
View Full Code Here

        if (task == null) {
            throw new NullPointerException();
        }
       
        ManagedTaskListenerSupport listenerSupport = getManagedTaskListenerSupport(listener);
        ManagedContext managedContext = getManagedContext();
        ManagedFutureTask<T> managedFuture = new ManagedFutureTask<T>(task,
                                                                      result,
                                                                      managedContext,
                                                                      listenerSupport);      
        executeTask(managedFuture);
View Full Code Here

        if (task == null) {
            throw new NullPointerException();
        }
       
        ManagedTaskListenerSupport listenerSupport = getManagedTaskListenerSupport(listener);
        ManagedContext managedContext = getManagedContext();
        ManagedFutureTask<T> managedFuture = new ManagedFutureTask<T>(task,
                                                                      managedContext,
                                                                      listenerSupport);            
        executeTask(managedFuture);
       
View Full Code Here

        if (command == null || unit == null) {
            throw new NullPointerException();
        }
        Date triggerTime = new Date(System.currentTimeMillis() + unit.toMillis(delay));
        ManagedTaskListenerSupport listenerSupport = getManagedTaskListenerSupport(listener);
        ManagedContext managedContext = getManagedContext();
        ScheduledFutureTask<T> t = new ScheduledFutureTask<T>(command,
                                                              result,
                                                              managedContext,
                                                              listenerSupport,
                                                              triggerTime);
View Full Code Here

                                       ManagedTaskListener listener) {
        if (command == null || trigger == null) {
            throw new NullPointerException();
        }
        ManagedTaskListenerSupport listenerSupport = getManagedTaskListenerSupport(listener);
        ManagedContext managedContext = getManagedContext();
        ScheduledFutureTask<?> t = new ScheduledFutureTask<Boolean>(command,
                                                                    null,
                                                                    managedContext,
                                                                    listenerSupport,
                                                                    trigger);
View Full Code Here

            throw new NullPointerException();
        }
        if (delay < 0) delay = 0;
        Date triggerTime = new Date(System.currentTimeMillis() + unit.toMillis(delay));
        ManagedTaskListenerSupport listenerSupport = getManagedTaskListenerSupport(listener);
        ManagedContext managedContext = getManagedContext();
        ScheduledFutureTask<V> t = new ScheduledFutureTask<V>(callable,
                                                              managedContext,
                                                              listenerSupport,
                                                              triggerTime);
        delayedExecute(t);
View Full Code Here

                                           ManagedTaskListener listener) {
        if (callable == null || trigger == null) {
            throw new NullPointerException();
        }
        ManagedTaskListenerSupport listenerSupport = getManagedTaskListenerSupport(listener);
        ManagedContext managedContext = getManagedContext();
        ScheduledFutureTask<V> t = new ScheduledFutureTask<V>(callable,
                                                              managedContext,
                                                              listenerSupport,
                                                              trigger);
        delayedExecute(t);
View Full Code Here

        return new GenericThreadFactory(factory, managedContext, false);
    }
           
    public static ManagedThreadFactory createStandaloneThreadFactory(ManagedThreadFactory factory,
                                                                     ManagedContextHandler contextHandler) {
        ManagedContext managedContext = ManagedContext.captureContext(contextHandler);
        // apply context to the thread AND set the right task info on the thread
        return new GenericThreadFactory(factory, managedContext, true);
    }
View Full Code Here

TOP

Related Classes of org.apache.geronimo.concurrent.ManagedContext

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.