Package java.util.concurrent

Examples of java.util.concurrent.Executor


        ra.setServerUrl(brokerAddress);
        ra.setBrokerXmlConfig(brokerXmlConfig);
        ra.setStartupTimeout(10000);

        // create a thead pool for ActiveMQ
        final Executor threadPool = Executors.newFixedThreadPool(30);

        // create a work manager which ActiveMQ uses to dispatch message delivery jobs
        final TransactionContextHandler txWorkContextHandler = new TransactionContextHandler(transactionManager);
        final GeronimoWorkManager workManager = new GeronimoWorkManager(threadPool, threadPool, threadPool, Collections.<WorkContextHandler>singletonList(txWorkContextHandler));
View Full Code Here


    public EjbTimerServiceImpl(DeploymentInfo deployment) {
        this(deployment, getDefaultTransactionManager(), getDefaultExecutor(), new MemoryTimerStore(getDefaultTransactionManager()), 1);
    }

    public static Executor getDefaultExecutor() {
        Executor executor = SystemInstance.get().getComponent(Executor.class);
        if (executor == null) {
            executor = Executors.newFixedThreadPool(10);
            SystemInstance.get().setComponent(Executor.class, executor);
        }
        return executor;
View Full Code Here

      FSDataInputStream is = fs.open(path);
      long fileSize = fs.getFileStatus(path).getLen();
      HFileBlock.FSReader hbr = new HFileBlock.FSReaderV2(is, compressAlgo,
          fileSize);

      Executor exec = Executors.newFixedThreadPool(NUM_READER_THREADS);
      ExecutorCompletionService<Boolean> ecs =
          new ExecutorCompletionService<Boolean>(exec);

      for (int i = 0; i < NUM_READER_THREADS; ++i) {
        ecs.submit(new BlockReaderThread("reader_" + (char) ('A' + i), hbr,
View Full Code Here

     * @param endpoint
     * @return
     */
    private static Executor getExecutor(final Message message) {
        Endpoint endpoint = message.getExchange().get(Endpoint.class);
        Executor executor = endpoint.getService().getExecutor();
       
        if (executor == null || SynchronousExecutor.isA(executor)) {
            // need true asynchrony
            Bus bus = message.getExchange().get(Bus.class);
            if (bus != null) {
                WorkQueueManager workQueueManager =
                    bus.getExtension(WorkQueueManager.class);
                Executor autoWorkQueue =
                    workQueueManager.getNamedWorkQueue("ws-addressing");
                executor = autoWorkQueue != null
                           ? autoWorkQueue
                           :  workQueueManager.getAutomaticWorkQueue();
            } else {
View Full Code Here

        _thread.interrupt();
    }

    public void run()
    {
        Executor exec = Executors.newFixedThreadPool(50);
        _logService.log(LogService.LOG_INFO, "Main.run");
        int loop = 0;
        while (_running)
        {
            _enabledLatch = new CountDownLatch(11); // for B,C,D,E,F,G,H,I,J,K and Main.bindA()
View Full Code Here

            .addDependency(ServerDeploymentRepository.SERVICE_NAME, ServerDeploymentRepository.class, service.injectedDeploymentRepository)
            .addDependency(ServerConfigurationPersister.SERVICE_NAME, ServerConfigurationPersister.class, service.injectedConfigurationPersister)
            .addDependency(ShutdownHandler.SERVICE_NAME, ShutdownHandler.class, service.injectedShutdownHandler);

        // FIXME inject Executor from an external service dependency
        final Executor hack = Executors.newCachedThreadPool();
        service.injectedDeploymentExecutor.inject(hack);
    }
View Full Code Here

                    channel.getSourceChannel().suspendReads();
                }
                if (exchange.isInIoThread()) {
                    channel.getIoThread().execute(this);
                } else {
                    Executor executor = exchange.getDispatchExecutor();
                    if (executor == null) {
                        executor = exchange.getConnection().getWorker();
                    }
                    executor.execute(this);
                }
            }
        } else if(exchange.isUpgrade() && exchange.getConnection().getExtraBytes() != null) {
            //if this is a HTTP upgrade request and there are extra bytes make the extra bytes available
            StreamSourceConduit conduit = connection.getChannel().getSourceChannel().getConduit();
View Full Code Here

      }
      else
      {
         throw new IllegalStateException("State transfer task for " + serviceName + " that will return an input stream is already pending");
      }
      Executor e = getThreadPool();
      if (e == null)
      {
         e = Executors.newSingleThreadExecutor();
      }
      e.execute(future);
      return future;
   }
View Full Code Here

      ConnectionState connectionState = (ConnectionState)sessionState.getParent();
      SessionDelegate sessionDelegate = (SessionDelegate)invocation.getTargetObject();
      ConsumerState consumerState = (ConsumerState)((DelegateSupport)consumerDelegate).getState();
      String consumerID = consumerState.getConsumerID();
      int prefetchSize = consumerState.getBufferSize();
      Executor executor = sessionState.getExecutor();
      int maxDeliveries = consumerState.getMaxDeliveries();
      long redeliveryDelay = consumerState.getRedeliveryDelay();
     
      //We need the queue name for recovering any deliveries after failover
      String queueName = null;
View Full Code Here

            future = new FutureTask<StreamStateTransferResult>((StreamStateTransferTask) task);
        } else {
            throw new IllegalStateException("State transfer task for " + serviceName
                    + " that will return an deserialized object is already pending");
        }
        Executor e = getThreadPool();
        if (e == null) {
            e = Executors.newSingleThreadExecutor();
        }
        e.execute(future);
        return future;
    }
View Full Code Here

TOP

Related Classes of java.util.concurrent.Executor

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.