Examples of Future


Examples of net.sf.cindy.Future

*/
public class DaytimeHandler extends SessionHandlerAdapter {

    public void sessionStarted(Session session) throws Exception {
        ByteBuffer buffer = Charset.UTF8.encode(new Date().toString());
        Future future = session.flush(new DefaultPacket(buffer));
        future.addListener(new FutureListener() {

            public void futureCompleted(Future future) throws Exception {
                future.getSession().close();
            }
        });
    }
View Full Code Here

Examples of org.drools.concurrent.Future

        StatefulSession session = getSession();

        final Cheese stilton = new Cheese( "stilton",
                                           5 );

        Future futureAssert = session.asyncInsert( stilton );
        Future futureFireAllRules = session.asyncFireAllRules();
       
        int i = 0;
        while ( !futureFireAllRules.isDone() ) {
            Thread.sleep( 100 );
            if (i++ > 5) {
                fail( "Future should have finished by now" );
            }
        }
View Full Code Here

Examples of org.hornetq.utils.Future

      blockOnExecutorFuture();
   }

   public boolean blockOnExecutorFuture()
   {
      Future future = new Future();

      executor.execute(future);

      boolean ok = future.await(10000);

      if (!ok)
      {
         log.warn("Couldn't finish waiting executors. Try increasing the thread pool size");
      }
View Full Code Here

Examples of org.hornetq.utils.Future

   public synchronized void stop() throws Exception
   {
      active = false;

      Future future = new Future();

      executor.execute(future);

      boolean ok = future.await(10000);

      if (!ok)
      {
         Redistributor.log.warn("Timed out waiting for tasks to complete");
      }
View Full Code Here

Examples of org.hornetq.utils.Future

      // noop
   }
  
   public synchronized void close()
   {
      Future future = new Future();

      executor.execute(future);

      boolean ok = future.await(10000);

      if (!ok)
      {
         throw new IllegalStateException("Timed out waiting for executor to complete");
      }
View Full Code Here

Examples of org.hornetq.utils.Future

   public void flushExecutors()
   {
      cursorProvider.flushExecutors();

      Future future = new Future();

      executor.execute(future);

      if (!future.await(60000))
      {
         PagingStoreImpl.log.warn("Timed out on waiting PagingStore " + address + " to shutdown");
      }
   }
View Full Code Here

Examples of org.hornetq.utils.Future

      return ok;
   }

   private boolean internalFlushExecutor(long timeout)
   {
      Future future = new Future();

      getExecutor().execute(future);

      boolean result = future.await(timeout);

      if (!result)
      {
         log.warn("Queue " + this.getName() + " was busy for more than " + timeout + " miliseconds. There are possibly consumers hanging on a network operation");
      }
View Full Code Here

Examples of org.hornetq.utils.Future

   }

   public void flushExecutor()
   {
      // Wait for any create objects runnable to complete
      Future future = new Future();

      executor.execute(future);

      boolean ok = future.await(10000);

      if (!ok)
      {
         BridgeImpl.log.warn("Timed out waiting to stop");
      }
View Full Code Here

Examples of org.hornetq.utils.Future

      {
         // And we must wait for any force delivery to be executed - this is executed async so we add a future to the
         // executor and
         // wait for it to complete

         Future future = new Future();

         messageQueue.getExecutor().execute(future);

         future.await(10000);
      }

      if (!transferring)
      {
         promptDelivery();
View Full Code Here

Examples of org.jboss.aspects.asynch.Future

   public void test() throws Exception
   {
      AsynchProvider asynch = (AsynchProvider) this;
      testMethod(5);

      Future future = asynch.getFuture();
      int rtn = ((Integer) future.get()).intValue();
      if (rtn != 5) throw new RuntimeException("integer return value invalid");

      testMethod("hello");

      future = asynch.getFuture();
      String srtn = (String) future.get();
      if (!"hello".equals(srtn)) throw new RuntimeException("string return value failed");


   }
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.