Examples of FutureTask


Examples of java.util.concurrent.FutureTask

            _oneInstance),

            _timeout);

         _futureResult = new FutureTask(_callable);
         return _futureResult;
        
      }
      catch (Exception e)
      {
View Full Code Here

Examples of java.util.concurrent.FutureTask

   }

   public Object call() throws Exception
   {

      FutureTask result = new FutureTask(function);


      Thread thread = Executors.defaultThreadFactory().newThread(result);

      thread.start();

      try
      {

         startingTime = System.currentTimeMillis();

         Object obj = result.get(millis, TimeUnit.MILLISECONDS);

         endingTime = System.currentTimeMillis();

         return obj;
View Full Code Here

Examples of java.util.concurrent.FutureTask

  /**
   * This method also exist in PlatformUtil in commons, but we can't use that here
   */
  static public void runAndWait(final Runnable runnable) {
    try {
      FutureTask future = new FutureTask(runnable, null);
      Platform.runLater(future);
      future.get();
    }
    catch (InterruptedException | ExecutionException e) {
      throw new RuntimeException(e);
    }
  }
View Full Code Here

Examples of java.util.concurrent.FutureTask

            }
            for (int i = 0; i < chunks; i++)
            {
                final int start = i * chunkSize;
                final int end = Math.min((i + 1) * chunkSize, currentArray.length());
                futures[i] = new FutureTask(new Runnable()
                {
                    public void run()
                    {
                        ConcurrentHashMap.this.sequentialPutAll(currentArray, start, end);
                    }
View Full Code Here

Examples of java.util.concurrent.FutureTask

            for (int i = 0; i < chunks; i++)
            {
                final int start = i * chunkSize;
                final int end = Math.min((i + 1) * chunkSize, currentArray.length());
                final Procedure2<K, V> block = blocks.get(i);
                futures[i] = new FutureTask(new Runnable()
                {
                    public void run()
                    {
                        ConcurrentHashMap.this.sequentialForEachKeyValue(block, currentArray, start, end);
                    }
View Full Code Here

Examples of java.util.concurrent.FutureTask

            for (int i = 0; i < chunks; i++)
            {
                final int start = i * chunkSize;
                final int end = Math.min((i + 1) * chunkSize, currentArray.length() - 1);
                final Procedure<V> block = blocks.get(i);
                futures[i] = new FutureTask(new Runnable()
                {
                    public void run()
                    {
                        ConcurrentHashMap.this.sequentialForEachValue(block, currentArray, start, end);
                    }
View Full Code Here

Examples of java.util.concurrent.FutureTask

    });

    myIdeMock.expects(once()).method("runOnPooledThread").will(new CustomStub("foo"){
      @Override
      public Object invoke(Invocation invocation) throws Throwable {
        final FutureTask task = new FutureTask((Runnable) invocation.parameterValues.get(0), null);
        task.run();
        return task;  //To change body of implemented methods use File | Settings | File Templates.
      }
    });
    myDispatcherMock.expects(once()).method("clearHistory");
View Full Code Here

Examples of java.util.concurrent.FutureTask

                public Message createMessage(Session session) throws JMSException {
                    Message message = endpoint.getBinding().makeJmsMessage(exchange, in, session);
                    message.setJMSReplyTo(replyTo);
                    requestor.setReplyToSelectorHeader(in, message);

                    FutureTask future = null;
                    future = (!msgIdAsCorrId)
                        ? requestor.getReceiveFuture(message.getJMSCorrelationID(), endpoint
                            .getRequestTimeout()) : requestor.getReceiveFuture(callback);

                    futureHolder.set(future);
View Full Code Here

Examples of java.util.concurrent.FutureTask

    return new DefaultExecutionStrategy(
        new Function<Callable, Future>() {
          @SuppressWarnings({"unchecked"})
          @Override
          public Future apply(Callable from) {
            FutureTask futureTask = new FutureTask(from);
            Thread singleThread = new Thread(futureTask);
            singleThread.setName(threadName);
            singleThread.start();
            return futureTask;
          }
View Full Code Here

Examples of java.util.concurrent.FutureTask

public class FutureInvoker implements RunnableFuture {

    private final RunnableFuture delegate;

    public FutureInvoker(final Invoker invoker) {
        delegate = new FutureTask(new CallableFutureInvoker(new FutureInvokerSupport(invoker)));
    }
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.