Examples of decrementAndGet()


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

                        }
                        final String topic = job.getTopic();
                        if ( topic.endsWith("sub1") ) {
                            final int i = (Integer)job.getProperty(Job.PROPERTY_JOB_RETRY_COUNT);
                            if ( i == 0 ) {
                                parallelCount.decrementAndGet();
                                return JobResult.FAILED;
                            }
                        }
                        try {
                            Thread.sleep(30);
View Full Code Here

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

                        try {
                            Thread.sleep(30);
                        } catch (InterruptedException ie) {
                            // ignore
                        }
                        parallelCount.decrementAndGet();
                        return JobResult.OK;
                    }
                });
        final ServiceRegistration ehReg = this.registerEventHandler(NotificationConstants.TOPIC_JOB_FINISHED,
                new EventHandler() {
View Full Code Here

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

                new JobConsumer() {

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

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

                        if ( parallelCount.incrementAndGet() > MAX_PAR ) {
                            parallelCount.decrementAndGet();
                            return JobResult.FAILED;
                        }
                        sleep(30);
                        parallelCount.decrementAndGet();
                        return JobResult.OK;
                    }
                });
        final ServiceRegistration ehReg = this.registerEventHandler(NotificationConstants.TOPIC_JOB_FINISHED,
                new EventHandler() {
View Full Code Here

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

        }

        synchronized (timers) {
            // decrease reference counter
            AtomicInteger counter = refCounts.get(key);
            if (counter != null && counter.decrementAndGet() <= 0) {
                refCounts.remove(key);
                // remove timer as its no longer in use
                Timer timer = timers.remove(key);
                if (timer != null) {
                    timer.cancel();
View Full Code Here

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

        }

        // Decrement camel job count for this endpoint
        AtomicInteger number = (AtomicInteger) scheduler.getContext().get(QuartzConstants.QUARTZ_CAMEL_JOBS_COUNT);
        if (number != null) {
            number.decrementAndGet();
        }
    }

    private void addJobInScheduler() throws Exception {
        // Add or use existing trigger to/from scheduler
View Full Code Here

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

                    }

                    @Override
                    public void onStateChange(AtmosphereResourceEvent r) throws IOException {
                        response.get().append(r.getMessage());
                        if (count.decrementAndGet() == 0 && (!r.isResuming() || !r.isCancelled())) {
                            r.getResource().getResponse().write(response.toString());
                            r.getResource().resume();
                        }
                    }
View Full Code Here

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

                    }

                    @Override
                    public void onStateChange(AtmosphereResourceEvent r) throws IOException {
                        response.get().append(r.getMessage());
                        if (count.decrementAndGet() == 0 && (!r.isResuming() || !r.isCancelled())) {
                            r.getResource().getResponse().write(response.toString());
                            r.getResource().resume();
                        }
                    }
View Full Code Here

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

                    @Override
                    public void onStateChange(AtmosphereResourceEvent r) throws IOException {
                        if (r.getMessage() != null) {
                            response.get().append(r.getMessage());
                            if (count.decrementAndGet() == 0) {
                                r.getResource().getResponse().write(response.toString());
                                r.getResource().resume();
                            }
                        }
                    }
View Full Code Here

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

                }
                sync.countDown();
            }

            public void messageSendFailed(ApnsNotification message, Throwable e) {
                numSent.decrementAndGet();
            }

            public void connectionClosed(DeliveryError e, int messageIdentifier) {
            }
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.