Package java.util.concurrent.atomic

Examples of java.util.concurrent.atomic.AtomicLong


    }

    private static void start(final int num_threads, final int num_msgs, boolean oob, int max_msg_batch_size) {
        final UNICAST unicast=new UNICAST();
        final AtomicInteger counter=new AtomicInteger(num_msgs);
        final AtomicLong seqno=new AtomicLong(1);
        final AtomicInteger delivered_msgs=new AtomicInteger(0);
        final Lock lock=new ReentrantLock();
        final Condition all_msgs_delivered=lock.newCondition();
        final ConcurrentLinkedQueue<Long> delivered_msg_list=new ConcurrentLinkedQueue<Long>();
        final Address local_addr=Util.createRandomAddress("A");
View Full Code Here


    }

    private static void start(final int num_threads, final int num_msgs, boolean oob, int max_msg_batch_size, TimeScheduler timer) {
        final UNICAST2 unicast=new UNICAST2();
        final AtomicInteger counter=new AtomicInteger(num_msgs);
        final AtomicLong seqno=new AtomicLong(1);
        final AtomicInteger delivered_msgs=new AtomicInteger(0);
        final Lock lock=new ReentrantLock();
        final Condition all_msgs_delivered=lock.newCondition();
        final ConcurrentLinkedQueue<Long> delivered_msg_list=new ConcurrentLinkedQueue<Long>();
        final Address local_addr=Util.createRandomAddress();
View Full Code Here

    }

    private static void start(final int num_threads, final int num_msgs, boolean oob, TimeScheduler timer) {
        final NAKACK nak=new NAKACK();
        final AtomicInteger counter=new AtomicInteger(num_msgs);
        final AtomicLong seqno=new AtomicLong(1);
        final AtomicInteger delivered_msgs=new AtomicInteger(0);
        final Lock lock=new ReentrantLock();
        final Condition all_msgs_delivered=lock.newCondition();
        final ConcurrentLinkedQueue<Long> delivered_msg_list=new ConcurrentLinkedQueue<Long>();
        final Address local_addr=Util.createRandomAddress("A");
View Full Code Here

         AtomicInteger version = (AtomicInteger) data.get(VERSION);
         if(version != null)
         {
            String realId = FqnUtil.getIdFromFqn(fqn, isBuddy);
            String owner = isBuddy ? FqnUtil.getBuddyOwner(fqn) : null;
            AtomicLong timestamp = (AtomicLong) data.get(TIMESTAMP);
            if (timestamp == null)
            {
               log.warn("No timestamp attribute found in " + fqn);
            }
            else
View Full Code Here

     
      if (data != null)
      {
         session = createEmptySession();
         AtomicInteger version = (AtomicInteger) data.get(VERSION);
         AtomicLong timestamp = (AtomicLong) data.get(TIMESTAMP);
         SessionMetadata metadata = (SessionMetadata) data.get(METADATA);
         Map<String, Object> attributes = loadSessionAttributes(id, data);
         session.update(version, timestamp, metadata, attributes);
      }
      return session;
View Full Code Here


    private static void start(int num_threads, int num_msgs, int segment_size) {
        final AckReceiverWindow win=new AckReceiverWindow(1, segment_size);
        final AtomicInteger counter=new AtomicInteger(num_msgs);
        final AtomicLong seqno=new AtomicLong(1);
        final AtomicInteger removed_msgs=new AtomicInteger(0);

        final CountDownLatch latch=new CountDownLatch(1);
        Adder[] adders=new Adder[num_threads];
        for(int i=0; i < adders.length; i++) {
View Full Code Here

   {
      Converter converter = new AtomicLongConverter();
      assertEquals("", converter.getAsString(null, null, null));
      assertEquals("", converter.getAsString(null, null, ""));
      assertEquals(" ", converter.getAsString(null, null, " "));
      assertEquals("-1", converter.getAsString(null, null, new AtomicLong(-1)));
      try
      {
         converter.getAsString(null, null, new Long(0));
         fail("should only take atomic ints");
      }
View Full Code Here

        int power2 = HashUtils.nextPowerOfTwo(nstripe);
        this._cnts = new AtomicLong[power2];
        this._size = power2;
        this._mask = power2 - 1;
        for(int i = 0; i < nstripe; i++) {
            _cnts[i] = new AtomicLong();
        }
    }
View Full Code Here

   * Constructors *
   *--------------*/

  public BNodeFactoryImpl() {
    bnodePrefix = "node" + Integer.toString(seq.incrementAndGet(), 32) + "x";
    nextBNodeID = new AtomicLong(0);
  }
View Full Code Here

    /*final List<FacetAccessible> list2 = new ArrayList<FacetAccessible>(numSegs);
    for (int i=0;i<numSegs;++i){
      list2.add(buildSubAccessible(fname2, i, fspec));
    }   
    */
    final AtomicLong timeCounter = new AtomicLong();
    Thread[] threads = new Thread[nThreads];
    for (int i =0;i<threads.length;++i){
      threads[i]=new Thread(new Runnable(){
       
        public void run() {
         
          for (int i=0;i<numIters;++i){
            long start = System.nanoTime();
            final CombinedFacetAccessible combined1 = new CombinedFacetAccessible(fspec, list1);
           // final CombinedFacetAccessible combined2 = new CombinedFacetAccessible(fspec, list2);
            List<BrowseFacet> facets1 = combined1.getFacets();
            //List<BrowseFacet> facets2 = combined2.getFacets();
            long end= System.nanoTime();
            timeCounter.getAndAdd(end-start);
          }
        }
       
      });
    }

//    System.out.println("press key to start load test... ");
//    {
//      BufferedReader br = new BufferedReader(new InputStreamReader(
//          System.in));
//      int ch = br.read();
//      char c = (char) ch;
//    }
    for (Thread t : threads){
      t.start();
    }
   
    for (Thread t : threads){
      t.join();
    }
   
    System.out.println("average time: "+timeCounter.get()/numIters/nThreads/1000000+" ms");
   
  }
View Full Code Here

TOP

Related Classes of java.util.concurrent.atomic.AtomicLong

Copyright © 2018 www.massapicom. 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.