/** * Creates a <tt>FutureTask</tt> that will, upon running, execute the * given <tt>Runnable</tt>, and arrange that <tt>get</tt> will return the * given result on successful completion. * * @param runnable the runnable task * @param result the result to return on successful completion. If * you don't need a particular result, consider using * constructions of the form: * <tt>Future<?> f = new FutureTask<Object>(runnable, null)</tt> * @throws NullPointerException if runnable is null */ public FutureTask(Runnable runnable, Object result) { this(Executors.callable(runnable, result)); }
RejectedExecutionHandler handler) { this(corePoolSize, maximumPoolSize, keepAliveTime, unit, workQueue, Executors.defaultThreadFactory(), handler);
public void start() throws StartingException { log.info( "Starting task executor, thread name '" + name + "'." ); this.executorService = Executors.newSingleThreadExecutor(); executorRunnable = new ExecutorRunnable(); executorRunnable.setDaemon( true ); executorRunnable.start(); }
/** * Constructs a new <code>RedeployManager</code> with the supplied thread * factory. * * @param tf Thread factory to use for the scheduled service used. */ public RedeployManager(ThreadFactory tf) { if (tf == null) tf = new MonitorThreadFactory(); enabled = false; touches = new ArrayList(); watchInterval = 20; watches = new ArrayList(); redeployService = Executors.newSingleThreadScheduledExecutor(tf); }
public void start() throws StartingException { log.info( "Starting task executor, thread name '" + name + "'." ); this.executorService = Executors.newCachedThreadPool(); executorRunnable = new ExecutorRunnable(); executorRunnable.setDaemon( true ); executorRunnable.start(); }
/** * Implements MessageReceiver.startReceive. */ public void startReceive() { if (!isScheduled) { if (Log.isDebug()) Log.getLogger(JMSAdapter.LOG_CATEGORY).debug(Thread.currentThread() + " JMS consumer sync receive thread for JMS destination '" + jmsConsumer.destinationJndiName + "' is starting to poll the JMS server for new messages."); ThreadFactory mrtf = new MessageReceiveThreadFactory(); messageReceiverService = Executors.newScheduledThreadPool(syncMaxReceiveThreads, mrtf); messageReceiverService.scheduleAtFixedRate(new MessageReceiveThread(), syncReceiveIntervalMillis, syncReceiveIntervalMillis, TimeUnit.MILLISECONDS); isScheduled = true; } }
ExecutorService clientIdSetter = Executors.newSingleThreadExecutor(); ClientIdSetterCallable cisc = new ClientIdSetterCallable(topicFactory, durableSubscriptionName); Future future = clientIdSetter.submit(cisc);
/** * Creates a <tt>FutureTask</tt> that will, upon running, execute the * given <tt>Runnable</tt>, and arrange that <tt>get</tt> will return the * given result on successful completion. * * @param runnable the runnable task * @param result the result to return on successful completion. If * you don't need a particular result, consider using * constructions of the form: * <tt>Future<?> f = new FutureTask<Object>(runnable, null)</tt> * @throws NullPointerException if runnable is null */ public FutureTask(Runnable runnable, Object result) { this(Executors.callable(runnable, result)); }
BlockingQueue workQueue) { this(corePoolSize, maximumPoolSize, keepAliveTime, unit, workQueue, Executors.defaultThreadFactory(), defaultHandler);
/** * Creates a <tt>FutureTask</tt> that will, upon running, execute the * given <tt>Runnable</tt>, and arrange that <tt>get</tt> will return the * given result on successful completion. * * @param runnable the runnable task * @param result the result to return on successful completion. If * you don't need a particular result, consider using * constructions of the form: * <tt>Future<?> f = new FutureTask<Object>(runnable, null)</tt> * @throws NullPointerException if runnable is null */ public FutureTask(Runnable runnable, Object result) { this(Executors.callable(runnable, result)); }
RejectedExecutionHandler handler) { this(corePoolSize, maximumPoolSize, keepAliveTime, unit, workQueue, Executors.defaultThreadFactory(), handler);
/** * @throws RejectedExecutionException {@inheritDoc} * @throws NullPointerException {@inheritDoc} */ public Future submit(Runnable task, Object result) { return schedule(Executors.callable(task, result), 0, TimeUnit.NANOSECONDS); }
BlockingQueue workQueue) { this(corePoolSize, maximumPoolSize, keepAliveTime, unit, workQueue, Executors.defaultThreadFactory(), defaultHandler);
/** * @throws RejectedExecutionException {@inheritDoc} * @throws NullPointerException {@inheritDoc} */ public Future submit(Runnable task, Object result) { return schedule(Executors.callable(task, result), 0, TimeUnit.NANOSECONDS); }
BlockingQueue workQueue) { this(corePoolSize, maximumPoolSize, keepAliveTime, unit, workQueue, Executors.defaultThreadFactory(), defaultHandler);
/** * @throws RejectedExecutionException {@inheritDoc} * @throws NullPointerException {@inheritDoc} */ public Future submit(Runnable task, Object result) { return schedule(Executors.callable(task, result), 0, TimeUnit.NANOSECONDS); }
RejectedExecutionHandler handler) { this(corePoolSize, maximumPoolSize, keepAliveTime, unit, workQueue, Executors.defaultThreadFactory(), handler);