Package java.util.concurrent

Examples of java.util.concurrent.ScheduledExecutorService.submit()


          }
        }
      }
    });
   
    sender.submit(new Callable<Object>() {
      @Override
      public Object call() throws Exception {
        while (true) {
          try {
          endpoint.doDispatch();
View Full Code Here


        }
        return true;
      }
    };
    ScheduledExecutorService executor = Executors.newSingleThreadScheduledExecutor();
    Future<Boolean> submit = executor.submit(runnable);
    int count = 0;
    while (count < 10)
    {
      try
      {
View Full Code Here

    }

    @Test
    public void scheduledExecutorServiceBuildsDaemonThreads() throws ExecutionException, InterruptedException {
        final ScheduledExecutorService executorService = environment.scheduledExecutorService("daemon-%d", true).build();
        final Future<Boolean> isDaemon = executorService.submit(new Callable<Boolean>() {
            @Override
            public Boolean call() throws Exception {
                return Thread.currentThread().isDaemon();
            }
        });
View Full Code Here

    }

    @Test
    public void scheduledExecutorServiceBuildsUserThreadsByDefault() throws ExecutionException, InterruptedException {
        final ScheduledExecutorService executorService = environment.scheduledExecutorService("user-%d").build();
        final Future<Boolean> isDaemon = executorService.submit(new Callable<Boolean>() {
            @Override
            public Boolean call() throws Exception {
                return Thread.currentThread().isDaemon();
            }
        });
View Full Code Here

            }
        });

        requestReceived.await();

        Future<Void> serverStopped = executor.submit(new Callable<Void>() {
            @Override
            public Void call() throws Exception {
                server.stop();
                return null;
            }
View Full Code Here

        try {
            final WebTarget target = target();
            for (int i = 1; i <= PARALLEL_CLIENTS; i++) {
                final int id = i;
                executor.submit(new Runnable() {
                    @Override
                    public void run() {
                        try {
                            startBarrier.await();
                            Response response;
View Full Code Here

   public static void assertProcessExits(final boolean sameValue, final int value, final Process p) throws InterruptedException,
                                                                                                   ExecutionException,
                                                                                                   TimeoutException
   {
      ScheduledExecutorService executor = Executors.newSingleThreadScheduledExecutor();
      Future<Integer> future = executor.submit(new Callable<Integer>()
      {

         public Integer call() throws Exception
         {
            p.waitFor();
View Full Code Here

    final Pool pool = Resources.getPoolHandle();
    final ScheduledExecutorService exec = pool.aquireBlockableExec();
    try {
      final ImmutableMap.Builder<F, Future<T>> submits = ImmutableMap.builder();
      for (final F i : items) {
        submits.put(i, exec.submit(new Callable<T>() {
          @Override
          public T call() throws Exception {
            return f.apply(i);
          }
        }));
View Full Code Here

        }
        return true;
      }
    };
    ScheduledExecutorService executor = Executors.newSingleThreadScheduledExecutor();
    Future<Boolean> submit = executor.submit(runnable);
    int count = 0;
    while (count < 10)
    {
      try
      {
View Full Code Here

                final AtomicReference<ModelNode> deploymentResults = new AtomicReference<ModelNode>();
                final CountDownLatch scanDoneLatch = new CountDownLatch(1);
                final CountDownLatch deploymentDoneLatch = new CountDownLatch(1);
                final DeploymentOperations deploymentOps = new BootTimeScannerDeployment(deploymentOperation, deploymentDoneLatch, deploymentResults, scanDoneLatch);

                scheduledExecutorService.submit(new Runnable() {
                    @Override
                    public void run() {
                        try {
                            bootTimeScanner.oneOffScan(deploymentOps);
                        } finally {
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.