Package java.util.concurrent.atomic

Examples of java.util.concurrent.atomic.AtomicInteger.incrementAndGet()


                // with the class name in the map.
                newThreadId = 1;
                threadIds.put(cls, new AtomicInteger(newThreadId));
            } else {
                // Just increment the lat ID, and get it.
                newThreadId = threadId.incrementAndGet();
            }
        }

        // Now we can compute the name for this thread
        return cls.getSimpleName() + '-' + newThreadId;
View Full Code Here


        class TestExecutor implements Executor {
           
            private AtomicInteger count = new AtomicInteger();
           
            public void execute(Runnable command) {
                int c = count.incrementAndGet();
                LOG.info("asyn call time " + c);
                command.run();
            }
           
            public int getCount() {
View Full Code Here

        //System.err.println("e=" + e.toString());

        AtomicInteger counter = _keyCounts.get(e.key());
        assert null != counter : "No counter for key: " + e.key();
        counter.incrementAndGet();

        AtomicInteger srcidCount = _srcidCounts.get((short)e.getSourceId());
        assert null != srcidCount : "No counter for source:" + e.getSourceId();
        srcidCount.incrementAndGet();
        _metadataSchema = ((DbusEventAvroDecoder)eventDecoder).getLatestMetadataSchema();
View Full Code Here

        assert null != counter : "No counter for key: " + e.key();
        counter.incrementAndGet();

        AtomicInteger srcidCount = _srcidCounts.get((short)e.getSourceId());
        assert null != srcidCount : "No counter for source:" + e.getSourceId();
        srcidCount.incrementAndGet();
        _metadataSchema = ((DbusEventAvroDecoder)eventDecoder).getLatestMetadataSchema();
        return super.onDataEvent(e, eventDecoder);
    }

    public VersionedSchema getMetadataSchema()
View Full Code Here

        final ServiceRegistration ehReg = this.registerJobConsumer(TOPIC, new JobConsumer() {

            @Override
            public JobResult process(final Job job) {
                if ( job.getTopic().equals(TOPIC) ) {
                    counter.incrementAndGet();
                }
                return JobResult.OK;
            }

        });
View Full Code Here

        final AtomicInteger count = new AtomicInteger(0);
        final ServiceRegistration reg2 = this.registerEventHandler(NotificationConstants.TOPIC_JOB_FINISHED,
                new EventHandler() {
                    @Override
                    public void handleEvent(Event event) {
                        count.incrementAndGet();
                    }
                 });

        try {
            // we start "some" jobs
View Full Code Here

        final ServiceRegistration eh1 = this.registerJobConsumer(TOPIC,
                new JobConsumer() {

            @Override
            public JobResult process(final Job job) {
                count.incrementAndGet();

                return JobResult.OK;
            }
         });
View Full Code Here

        final String id = UUID.randomUUID().toString();
        final AtomicInteger counter = new AtomicInteger(Integer.MIN_VALUE);
        final HealthCheck hc = new HealthCheck() {
            @Override
            public Result execute() {
                final int v = counter.incrementAndGet();
                return new Result(Result.Status.OK, "counter is now " + v);
            }
           
        };
       
View Full Code Here

              Result result = region.get(g);
              assertEquals(result.getValue(fam1, qual1).length, result.getValue(fam1, qual2).length);
              assertEquals(result.getValue(fam1, qual1).length, result.getValue(fam2, qual3).length);
            } catch (IOException e) {
              e.printStackTrace();
              failures.incrementAndGet();
              fail();
            }
          }
        }
      };
View Full Code Here

              // check: should always see exactly one column
              Get g = new Get(row);
              Result r = region.get(g);
              if (r.size() != 1) {
                LOG.debug(r);
                failures.incrementAndGet();
                fail();
              }
            } catch (IOException e) {
              e.printStackTrace();
              failures.incrementAndGet();
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.