Package java.util.concurrent.atomic

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


            public void matchCreated( MatchCreatedEvent event ) {
                i.incrementAndGet();
            }

            public void matchCancelled( MatchCancelledEvent event ) {
                i.decrementAndGet();
            }
        } );

        ksession.insert(new SimpleEvent());
        ksession.fireAllRules();
View Full Code Here


                for (T t : iter) {
                  if (!Thread.currentThread().isInterrupted()) {
                    queue.add(Option.some(t));
                  }
                }
                if (wip.decrementAndGet() == 0) {
                  if (!Thread.currentThread().isInterrupted()) {
                    queue.add(Option.<T>none());
                  }
                }
              } catch (Throwable t) {
View Full Code Here

            }
          };
          wip.incrementAndGet();
          handlers.add(scheduler.schedule(r));
        }
        if (wip.decrementAndGet() == 0) {
          queue.add(Option.<T>none());
        }
        return new Iterator<T>() {
          final SingleContainer<Option<T>> peek = new SingleContainer<Option<T>>();
          /** Are we broken? */
 
View Full Code Here

                        responseHandler.response(null);
                }
                finally
                {
                    totalHintsInProgress.decrementAndGet();
                    targetHints.decrementAndGet();
                }
            }
        };

        return (Future<Void>) StageManager.getStage(Stage.MUTATION).submit(runnable);
View Full Code Here

    public static void releaseCacheManger(CacheManager cacheManager) {
        AtomicInteger a = COUNTS.get(cacheManager.getName());
        if (a == null) {
            return;
        }
        if (a.decrementAndGet() == 0) {
            //System.out.println("Shutdown!! " + cacheManager.getName());
            cacheManager.shutdown();
        }
    }
   
View Full Code Here

        if (refCounter == null)
        {
            return 0;
        }

        int layer = refCounter.decrementAndGet();

        if (layer == 0)
        {
            refCounterMap.remove(qualifierKey);
        }
View Full Code Here

                public CloseFuture close(boolean immediately) {
                    final CloseFuture future = new DefaultCloseFuture(lock);
                    final AtomicInteger count = new AtomicInteger(closeables.length);
                    SshFutureListener<CloseFuture> listener = new SshFutureListener<CloseFuture>() {
                        public void operationComplete(CloseFuture f) {
                            if (count.decrementAndGet() == 0) {
                                future.setClosed();
                            }
                        }
                    };
                    for (Closeable c : closeables) {
View Full Code Here

        } else {
            final CloseFuture future = new DefaultCloseFuture(null);
            final AtomicInteger count = new AtomicInteger(futures.length);
            SshFutureListener<?> listener = new SshFutureListener<SshFuture>() {
                public void operationComplete(SshFuture f) {
                    if (count.decrementAndGet() == 0) {
                        future.setClosed();
                    }
                }
            };
            for (SshFuture f : futures) {
View Full Code Here

    }

    public void remove(Exchange exchange, String routeId) {
        AtomicInteger existing = routeCount.get(routeId);
        if (existing != null) {
            existing.decrementAndGet();
        }
    }

    public int size() {
        return totalCount.get();
View Full Code Here

            InetSocketAddress remoteAddress = (InetSocketAddress) ctx.getChannel().getRemoteAddress();
            String remoteIp = remoteAddress.getAddress().getHostAddress();
           
            AtomicInteger atomicCount = connections.get(remoteIp);
            if (atomicCount != null) {
                atomicCount.decrementAndGet();
            }             
           
        }
        super.channelClosed(ctx, e);
    }
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.