Package java.util.concurrent.atomic

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


    final AtomicLong tx = new AtomicLong(0);
    UploadProgress progress = new UploadProgress() {
      public void onUpload(long transferred, long total) {
        assertEquals(-1, total);
        assertEquals(tx.incrementAndGet(), transferred);
      }
    };
    File file = File.createTempFile("post", ".txt");
    new FileWriter(file).append("hello").close();
    post(url).progress(progress).bufferSize(1).send(new FileReader(file)).code();
View Full Code Here


            @Override
            protected void service(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException
            {
                resp.setStatus(SC_OK);
                resp.getWriter().printf("1.%d", m_count.incrementAndGet());
                resp.flushBuffer();
            }
        };

        TestServlet servlet2 = new TestServlet(initLatch, destroyLatch)
View Full Code Here

            @Override
            protected void service(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException
            {
                resp.setStatus(SC_OK);
                resp.getWriter().printf("2.%d", m_count.incrementAndGet());
                resp.flushBuffer();
            }
        };

        TestFilter filter = new TestFilter(initLatch, destroyLatch)
View Full Code Here

                    LOG.debug("Run now allowed for timer: {}", endpoint);
                    return;
                }

                try {
                    long count = counter.incrementAndGet();

                    boolean fire = endpoint.getRepeatCount() <= 0 || count <= endpoint.getRepeatCount();
                    if (fire) {
                        sendTimerExchange(count);
                    } else {
View Full Code Here

        AtomicLong counter = values.get(nodeId);
        if(counter == null) {
            counter = new AtomicLong(0L);
            values.putIfAbsent(nodeId, counter);
        }
        counter.incrementAndGet();
    }

    public void clearCount() {
        for(AtomicLong counter: values.values())
            counter.set(0L);
View Full Code Here

                if (c == null)
                {
                    c = new AtomicLong();
                    timeoutsPerHost.put(ip, c);
                }
                c.incrementAndGet();
                // we only create AtomicLong instances here, so that the write
                // access to the hashmap happens single-threadedly.
                if (recentTimeoutsPerHost.get(ip) == null)
                    recentTimeoutsPerHost.put(ip, new AtomicLong());
View Full Code Here

            try
            {
               while (running.get())
               {
                  final long[] values = new long[100];
                  long tx = seqGenerator.incrementAndGet();

                  OperationContextImpl ctx = new OperationContextImpl(executor);
                  storage.setContext(ctx);

                  for (int i = 0; i < 100; i++)
View Full Code Here

                  OperationContextImpl ctx = new OperationContextImpl(executor);
                  storage.setContext(ctx);

                  for (int i = 0; i < 100; i++)
                  {
                     long id = seqGenerator.incrementAndGet();
                     values[i] = id;

                     ServerMessageImpl message = new ServerMessageImpl(id, 100);

                     message.getBodyBuffer().writeBytes(new byte[1024]);
View Full Code Here

                     message.getBodyBuffer().writeBytes(new byte[1024]);

                     storage.storeMessageTransactional(tx, message);
                  }
                  ServerMessageImpl message = new ServerMessageImpl(seqGenerator.incrementAndGet(), 100);
                 
                  survivingMsgs.add(message.getMessageID());
                 
                  // This one will stay here forever
                  storage.storeMessage(message);
View Full Code Here

            try
            {
               boolean firstTime = true;
               while (true)
               {
                  long id = messageIdGenerator.incrementAndGet();

                  // Each thread will Keep paging until all the messages are depaged.
                  // This is possible because the depage thread is not actually reading the pages.
                  // Just using the internal API to remove it from the page file system
                  ServerMessage msg = createMessage(id, storeImpl, destination, createRandomBuffer(id, 5));
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.