Package java.util.concurrent

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


            instrumenter.open(instrumenterFile, true);
            List<Future<File>> futures = new ArrayList<Future<File>>();
            for (File file: srcPaths) {
                String path = file.getPath();
                if (path.matches(".*/ofbiz[^/]*\\.(jar|zip)")) {
                    futures.add(executor.submit(new FileInstrumenter(instrumenter, file)));
                } else {
                    futures.add(new ConstantFutureFile(file));
                }
            }
            List<File> result = new ArrayList<File>(futures.size());
View Full Code Here


        for (int i = 0; i < NUM_ROWS; i++)
        {
            final ByteBuffer key = ByteBufferUtil.bytes(String.format("%3d", i));
            final int index = i;

            futures.add(executor.submit(new Runnable()
            {
                public void run()
                {
                    ColumnFamily result = store.getColumnFamily(sstable.partitioner.decorateKey(key), Composites.EMPTY, Composites.EMPTY, false, 100, 100);
                    assertFalse(result.isEmpty());
View Full Code Here

                    assertFalse(result.isEmpty());
                    assertEquals(0, ByteBufferUtil.compare(String.format("%3d", index).getBytes(), result.getColumn(Util.cellname("0")).value()));
                }
            }));

            futures.add(executor.submit(new Runnable()
            {
                public void run()
                {
                    Iterable<DecoratedKey> results = store.keySamples(
                            new Range<>(sstable.partitioner.getMinimumToken(), sstable.partitioner.getToken(key)));
View Full Code Here

        for (int i = 0; i < NUM_ROWS; i++)
        {
            final ByteBuffer key = ByteBufferUtil.bytes(String.format("%3d", i));
            final int index = i;

            futures.add(executor.submit(new Runnable()
            {
                public void run()
                {
                    ColumnFamily result = store.getColumnFamily(sstable.partitioner.decorateKey(key), Composites.EMPTY, Composites.EMPTY, false, 100, 100);
                    assertFalse(result.isEmpty());
View Full Code Here

                    assertFalse(result.isEmpty());
                    assertEquals(0, ByteBufferUtil.compare(String.format("%3d", index).getBytes(), result.getColumn(Util.cellname("0")).value()));
                }
            }));

            futures.add(executor.submit(new Runnable()
            {
                public void run()
                {
                    Iterable<DecoratedKey> results = store.keySamples(
                            new Range<>(sstable.partitioner.getMinimumToken(), sstable.partitioner.getToken(key)));
View Full Code Here

        for (int i = 0; i < NUM_ROWS; i++)
        {
            final ByteBuffer key = ByteBufferUtil.bytes(String.format("%3d", i));
            final int index = i;

            futures.add(executor.submit(new Runnable()
            {
                public void run()
                {
                    ColumnFamily result = store.getColumnFamily(sstable.partitioner.decorateKey(key), Composites.EMPTY, Composites.EMPTY, false, 100, 100);
                    assertFalse(result.isEmpty());
View Full Code Here

                    assertFalse(result.isEmpty());
                    assertEquals(0, ByteBufferUtil.compare(String.format("%3d", index).getBytes(), result.getColumn(Util.cellname("0")).value()));
                }
            }));

            futures.add(executor.submit(new Runnable()
            {
                public void run()
                {
                    Iterable<DecoratedKey> results = store.keySamples(
                            new Range<>(sstable.partitioner.getMinimumToken(), sstable.partitioner.getToken(key)));
View Full Code Here

            fudgeMsgWriter.flush();
           
            try (FudgeMsgReader fudgeMsgReader = new FudgeMsgReader(
                new FudgeDataInputStreamReader(context, proc.getInputStream()))) {
              ScheduledThreadPoolExecutor scheduledThreadPoolExecutor = new ScheduledThreadPoolExecutor(3);
              Future<FudgeMsg> retMsgFuture = scheduledThreadPoolExecutor.submit(new Callable<FudgeMsg>() {
                @Override
                public FudgeMsg call() throws Exception {
                  return fudgeMsgReader.nextMessage();
                }
              });
View Full Code Here

                public FudgeMsg call() throws Exception {
                  return fudgeMsgReader.nextMessage();
                }
              });
             
              Future<List<String>> errFuture = scheduledThreadPoolExecutor.submit(new Callable<List<String>>() {
                @Override
                public List<String> call() throws Exception {
                  InputStream errorStream = proc.getErrorStream();
                  try {
                    return IOUtils.readLines(errorStream);
View Full Code Here

      int numThreads = 1;
      int numSubscriptions = 100;
      topicArn = cns1.createTopic(new CreateTopicRequest(topicName)).getTopicArn();
    ScheduledThreadPoolExecutor ep = new ScheduledThreadPoolExecutor(numThreads + 2);
    for (int i=0; i<numThreads; i++) {
      ep.submit(new SubscriptionGenerator(numSubscriptions/numThreads));
    }
    logger.info("event=started");
    try {
      ep.shutdown();
      ep.awaitTermination(60, TimeUnit.MINUTES);
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.