Package java.util.concurrent

Examples of java.util.concurrent.ExecutorService.execute()


        final AtomicInteger gets = new AtomicInteger(0);
        final AtomicInteger puts = new AtomicInteger(0);
        final AtomicInteger removes = new AtomicInteger(0);
        load(load, es, map);
        for (int i = 0; i < threadCount; i++) {
            es.execute(new Runnable() {
                public void run() {
                    while (true) {
                        int key = (int) (RANDOM.nextFloat() * entryCount);
                        int operation = ((int) (RANDOM.nextFloat() * 100));
                        if (operation < getPercentage) {
View Full Code Here


      startStoreCoordinator();
   }

   private void startStoreCoordinator() {
      ExecutorService storeCoordinator = Executors.newFixedThreadPool(1);
      storeCoordinator.execute( new AsyncStoreCoordinator() );
      storeCoordinator.shutdown();
   }

   @Override
   public void stop() throws CacheLoaderException {
View Full Code Here

      ExecutorService exec = Executors.newFixedThreadPool(NUM_THREADS);
      log.warn("Starting warmup");
      // creates all the Fqns since this can be expensive and we don't really want to measure this (for now)
      for (final String key : keys)
      {
         exec.execute(new Runnable()
         {
            public void run()
            {
               // this will create the necessary nodes.
//               cache.put(f, Collections.emptyMap());
View Full Code Here

      }

      // loop through WARMUP_LOOPS gets and puts for JVM optimisation
      for (int i = 0; i < WARMUP_LOOPS; i++)
      {
         exec.execute(new Runnable()
         {
            public void run()
            {
//               Fqn f = fqns.get(r.nextInt(MAX_ENTRIES));
               String key = keys.get(r.nextInt(MAX_ENTRIES));
View Full Code Here

               break;
            case 2:
               r = new Remover(i++);
               break;
         }
         exec.execute(r);
//         if (USE_SLEEP) TestingUtil.sleepRandom(MAX_RANDOM_SLEEP_MILLIS);
         if (USE_SLEEP) TestingUtil.sleepThread(MAX_RANDOM_SLEEP_MILLIS);
      }
      log.warn("Finished generating runnables; awaiting executor completion");
      // wait for executors to complete!
View Full Code Here

      ExecutorService exec = Executors.newFixedThreadPool(NUM_THREADS);
      log.warn("Starting warmup");
      // creates all the Fqns since this can be expensive and we don't really want to measure this (for now)
      for (final Fqn f : fqns)
      {
         exec.execute(new Runnable()
         {
            public void run()
            {
               // this will create the necessary nodes.
               cache.put(f, Collections.emptyMap());
View Full Code Here

      }

      // loop through WARMUP_LOOPS gets and puts for JVM optimisation
      for (int i = 0; i < WARMUP_LOOPS; i++)
      {
         exec.execute(new Runnable()
         {
            public void run()
            {
               Fqn f = fqns.get(r.nextInt(MAX_OVERALL_NODES));
               cache.get(f, "");
View Full Code Here

               r = new Remover(i, durationRemoves);
               break;
         }
         if (i % print == 0)
            log.warn("processing iteration " + i);
         exec.execute(r);
//         if (USE_SLEEP) TestingUtil.sleepRandom(MAX_RANDOM_SLEEP_MILLIS);
         if (USE_SLEEP) TestingUtil.sleepThread(MAX_RANDOM_SLEEP_MILLIS);
      }
      log.warn("Finished generating runnables; awaiting executor completion");
      // wait for executors to complete!
View Full Code Here

      for (int i = 0; i < 100; i++)
      {
         if (i % 3 == 0)
         {
            // task 1 above
            e.execute(new Runnable()
            {
               public void run()
               {
                  try
                  {
View Full Code Here

            });
         }
         else if (i % 3 == 1)
         {
            // task 2 above
            e.execute(new Runnable()
            {
               public void run()
               {
                  try
                  {
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.