Package org.apache.geronimo.concurrent

Examples of org.apache.geronimo.concurrent.ManagedTaskListenerSupport


        int ntasks = tasks.size();
        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
View Full Code Here


                                         ManagedTaskListener listener)
        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) {
View Full Code Here

                                         ManagedTaskListener listener)
        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 {
View Full Code Here

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

    public <T> Future<T> submit(Callable<T> task, ManagedTaskListener listener) {
        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

            new ManagedFutureTask<T>(task, managedContext, listenerSupport);
        return managedFuture;
    }
   
    protected ManagedTaskListenerSupport getManagedTaskListenerSupport(ManagedTaskListener listener) {
        return (listener == null) ? null : new ManagedTaskListenerSupport(this, listener);
    }
View Full Code Here

       
    /*
     * This is called by invokeAll/invokeAny/submit functions.    
     */
    protected void executeTask(ManagedFutureTask<?> task) {       
        ManagedTaskListenerSupport listenerSupport = task.getManagedTaskListenerSupport();
        if (listenerSupport != null) {
            listenerSupport.taskSubmitted(task);
        }
        try {
            super.execute(task);
        } catch (RejectedExecutionException exception) {
            if (listenerSupport != null) {
                listenerSupport.taskDone(task, exception);
            }
            throw exception;
        }
    }
View Full Code Here

            new ScheduledFutureTask<Object>(task, null, null, null, triggerTime);   
        super.getQueue().add(t);
    }
   
    protected void preExecute(ManagedFutureTask<?> task) {
        ManagedTaskListenerSupport listenerSupport = task.getManagedTaskListenerSupport();
       
        if (listenerSupport != null) {
            listenerSupport.taskSubmitted(task);
        }
       
        if (isShutdown()) {
            try {
                reject(task);
            } catch (RejectedExecutionException exception) {
                if (listenerSupport != null) {
                    listenerSupport.taskDone(task, exception);
                }
                throw exception;
            }
            return;
        }
View Full Code Here

                                              ManagedTaskListener listener) {
        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,
View Full Code Here

                                       Trigger trigger,
                                       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,
View Full Code Here

TOP

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

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.