Package java.util.concurrent.atomic

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


        final AtomicInteger lv1Computed = new AtomicInteger(0);
        LazyValue<String, Long> lv1 = new LazyValue<String, Long>("42", new Callable<Long>()
        {
            public Long call() throws Exception
            {
                lv1Computed.incrementAndGet();
                return 24L;
            }
        });

        final AtomicInteger lv2Computed = new AtomicInteger(0);
View Full Code Here


        final AtomicInteger lv2Computed = new AtomicInteger(0);
        LazyValue<String, Long> lv2 = new LazyValue<String, Long>("zero", new Callable<Long>()
        {
            public Long call() throws Exception
            {
                lv2Computed.incrementAndGet();
                return 0L;
            }
        });

        Collection<LazyValue<String, Long>> lazyValues = new ArrayList<LazyHashMap.LazyValue<String,Long>>();
View Full Code Here

      AtomicInteger ai = map.get(st);
      if(ai==null) {
        ai = new AtomicInteger(0);
        map.put(st, ai);
      }
      ai.incrementAndGet();
    }
    return map;
  }

  /**
 
View Full Code Here

        final ServiceRegistration ehReg = this.registerEventHandler(TOPIC, new EventHandler() {

            @Override
            public void handleEvent(final Event event) {
                if ( TOPIC.equals(event.getTopic()) ) {
                    counter.incrementAndGet();
                }
            }
        });
        try {
            final Date d = new Date();
View Full Code Here

        final ServiceRegistration ehReg = this.registerEventHandler(TOPIC, new EventHandler() {

            @Override
            public void handleEvent(final Event event) {
                if ( TOPIC.equals(event.getTopic()) ) {
                    counter.incrementAndGet();
                }
            }
        });
        try {
            // send timed event
View Full Code Here

        final List<Event> finishedEvents = Collections.synchronizedList(new ArrayList<Event>());
        final ServiceRegistration jcReg = this.registerJobConsumer(TOPIC,
                new JobConsumer() {
                    @Override
                    public JobResult process(Job job) {
                        processedJobsCount.incrementAndGet();
                        return JobResult.OK;
                    }
                });
        final ServiceRegistration ehReg = this.registerEventHandler(NotificationConstants.TOPIC_JOB_FINISHED,
                new EventHandler() {
View Full Code Here

        final ServiceRegistration jcReg = this.registerJobConsumer(TOPIC + "/failed",
                new JobConsumer() {

                    @Override
                    public JobResult process(Job job) {
                        failedJobsCount.incrementAndGet();
                        return JobResult.OK;
                    }
                });
        final ServiceRegistration ehReg = this.registerEventHandler(NotificationConstants.TOPIC_JOB_FINISHED,
                new EventHandler() {
View Full Code Here

                        lastCounter = counter;
                        if ("sling/orderedtest/start".equals(job.getTopic()) ) {
                            cb.block();
                            return JobResult.OK;
                        }
                        if ( parallelCount.incrementAndGet() > 1 ) {
                            parallelCount.decrementAndGet();
                            return JobResult.FAILED;
                        }
                        final String topic = job.getTopic();
                        if ( topic.endsWith("sub1") ) {
View Full Code Here

        final ServiceRegistration jcReg = this.registerJobConsumer(TOPIC + "/*",
                new JobConsumer() {

                    @Override
                    public JobResult process(final Job job) {
                        if ( parallelCount.incrementAndGet() > MAX_PAR ) {
                            parallelCount.decrementAndGet();
                            return JobResult.FAILED;
                        }
                        sleep(30);
                        parallelCount.decrementAndGet();
View Full Code Here

    this.provider = new ExtensionAwareEvaluationContextProvider(Arrays.asList( //
        new DummyExtension("_first", "first") {

          @Override
          public CustomExtensionRootObject1 getRootObject() {
            counter.incrementAndGet();
            return new CustomExtensionRootObject1();
          }
        }) //
    );
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.