Package java.util.concurrent.atomic

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


        public void run() {
          try {
            IndexReader lastReader = null;
            IndexSearcher lastSearcher = null;

            while (operations.decrementAndGet() >= 0) {
              // bias toward a recently changed doc
              int id = rand.nextInt(100) < 25 ? lastId : rand.nextInt(ndocs);

              // when indexing, we update the index, then the model
              // so when querying, we should first check the model, and then the index
View Full Code Here


    Registry<Consumer<?>> registry = new CachingRegistry<Consumer<?>>();

    Consumer<?> countDown = new Consumer<Object>() {
      @Override
      public void accept(Object obj) {
        counter.decrementAndGet();
      }
    };

    Selector[] sels = new Selector[selectors];
    Object[] keys = new Object[selectors];
View Full Code Here

        Random rand = new Random(random.nextInt());

        @Override
        public void run() {
          try {
            while (operations.decrementAndGet() >= 0) {
              // bias toward a recently changed doc
              int id = rand.nextInt(100) < 25 ? lastId : rand.nextInt(ndocs);

              // when indexing, we update the index, then the model
              // so when querying, we should first check the model, and then the index
View Full Code Here

                new Thread(new Runnable() {

                    public void run() {
                        do {
                            s.onNext(i.incrementAndGet());
                        } while (capacity.decrementAndGet() > 0);
                    }
                }).start();
            }

            @Override
View Full Code Here

        Random rand = new Random(random.nextInt());

        @Override
        public void run() {
          try {
            while (operations.decrementAndGet() >= 0) {
              // bias toward a recently changed doc
              int id = rand.nextInt(100) < 25 ? lastId : rand.nextInt(ndocs);

              // when indexing, we update the index, then the model
              // so when querying, we should first check the model, and then the index
View Full Code Here

                return value.get() > 0;
            }

            @Override
            public Fun.Pair<Long, String> next() {
                Long v = value.decrementAndGet();
                return new Fun.Pair<Long, String>(v, v.toString());
            }

            @Override
            public void remove() {
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.