Package java.util.concurrent

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


            migrationService.setStructureProvider(structureprovider);
            consumerRegistry.setMigrationService(migrationService);

            // wait 'delay' seconds before starting the consumers to give JBoss WS a chance to publish the WSDL and not deadlock
            ScheduledExecutorService scheduledExecutorService = Executors.newScheduledThreadPool(1);
            scheduledExecutorService.schedule(new Runnable() {
                public void run() {
                    try {
                        consumerRegistry.start();
                    } catch (Exception e) {
                        throw new RuntimeException(e);
View Full Code Here


        ScheduledExecutorService scheduler = this.scheduler;
        if (scheduler != null)
        {
            try
            {
                scheduler.schedule(action, interval + backoff, TimeUnit.MILLISECONDS);
                return true;
            }
            catch (RejectedExecutionException x)
            {
                // It has been shut down
View Full Code Here

    @Test
    public void testExecutorRetriesTask_whenOneNodeTerminates() throws InterruptedException, ExecutionException {
        final int taskCount = 20;
        ScheduledExecutorService ex = Executors.newSingleThreadScheduledExecutor();
        try {
            ex.schedule(new Runnable() {
                @Override
                public void run() {
                    instances.get(1).getLifecycleService().terminate();
                }
            }, 1000, TimeUnit.MILLISECONDS);
View Full Code Here

    @Test
    public void testExecutorRetriesTask_whenOneNodeShutdowns() throws InterruptedException, ExecutionException {
        final int taskCount = 20;
        ScheduledExecutorService ex = Executors.newSingleThreadScheduledExecutor();
        try {
            ex.schedule(new Runnable() {
                @Override
                public void run() {
                    instances.get(1).shutdown();
                }
            }, 1000, TimeUnit.MILLISECONDS);
View Full Code Here

            migrationService.setStructureProvider(structureprovider);
            consumerRegistry.setMigrationService(migrationService);

            // wait 'delay' seconds before starting the consumers to give JBoss WS a chance to publish the WSDL and not deadlock
            ScheduledExecutorService scheduledExecutorService = Executors.newScheduledThreadPool(1);
            scheduledExecutorService.schedule(new Runnable() {
                public void run() {
                    try {
                        consumerRegistry.start();
                    } catch (Exception e) {
                        throw new RuntimeException(e);
View Full Code Here

  }

  public static void closeActiveShell(long delay) {
    final ScheduledExecutorService scheduler = Executors
        .newScheduledThreadPool(1);
    scheduler.schedule(new Runnable() {
      @Override
      public void run() {
        UITestTools.closeActiveShell();
      }
    }, delay, TimeUnit.MILLISECONDS);
View Full Code Here

    public void testWaiting() throws NoSuchMethodException, InterruptedException {
        final ReceptionSynchronizer cut = new ReceptionSynchronizer();
        ScheduledExecutorService pool = Executors.newScheduledThreadPool(1);
        final Method method = ReceptionSynchronizerTest.class.getDeclaredMethod("testWaiting");
        long startTime = System.currentTimeMillis();
        pool.schedule(new Runnable() {

            @Override
            public void run() {
                cut.registerInvocation(method);
            }
View Full Code Here

            LOG.debug("***  send message 2 to broker");
            m.setText("2");

            // need to reset the flag in a seperate thread during the send
            ScheduledExecutorService executor = Executors.newSingleThreadScheduledExecutor();
            executor.schedule(new Runnable() {
                @Override
                public void run() {
                    testTransactionContext.throwSQLException = false;
                    jdbc.throwSQLException = false;
                }
View Full Code Here

        System.out.printf("PeriodictskExecution: Starting at: %s\n", new Date());

        // Send the tasks to the executor with the specified delay
        for (int i = 0; i < 5; i++) {
            Task task = new Task("Task " + i);
            executor.schedule(task, i + 1, TimeUnit.SECONDS);
        }

        // Finish the executor
        executor.shutdown();
View Full Code Here

            base = path.substring(0, lastDot);
        }
        for(int n = 0; n <= sampleCount; n ++) {
            final String samplePath = base + "-" + n + (suffix != null ? suffix : "");
            int delay = 5*n;
            ScheduledFuture future = ses.schedule(new Runnable() {
                @Override
                public void run() {
                    try {
                        doWriteAllEvents(samplePath);
                    } catch (IOException e) {
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.