Examples of AtomicLong


Examples of edu.emory.mathcs.backport.java.util.concurrent.atomic.AtomicLong

        }
    }

    private void processAlive(String brokerName,String service){
        if(selfService == null || !service.equals(selfService)){
            AtomicLong lastKeepAlive=(AtomicLong) services.get(service);
            if(lastKeepAlive==null){
                brokers.put(service, brokerName);
                if(discoveryListener!=null){
                    final DiscoveryEvent event=new DiscoveryEvent(service);
                    event.setBrokerName(brokerName);
                   
                    // Have the listener process the event async so that
                    // he does not block this thread since we are doing time sensitive
                    // processing of events.
                    executor.execute(new Runnable() {
                        public void run() {
                            DiscoveryListener discoveryListener = MulticastDiscoveryAgent.this.discoveryListener;
                            if(discoveryListener!=null){
                                discoveryListener.onServiceAdd(event);
                            }
                        }
                    });
                }
                lastKeepAlive=new AtomicLong(System.currentTimeMillis());
                services.put(service,lastKeepAlive);
                doAdvertizeSelf();
               
            }
            lastKeepAlive.set(System.currentTimeMillis());
        }
    }
View Full Code Here

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

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, 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

Examples of java.util.concurrent.atomic.AtomicLong

    }

    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

Examples of java.util.concurrent.atomic.AtomicLong

         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

Examples of java.util.concurrent.atomic.AtomicLong

     
      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

Examples of java.util.concurrent.atomic.AtomicLong


    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

Examples of java.util.concurrent.atomic.AtomicLong

   {
      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

Examples of java.util.concurrent.atomic.AtomicLong

        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

Examples of java.util.concurrent.atomic.AtomicLong

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

  public BNodeFactoryImpl() {
    bnodePrefix = "node" + Integer.toString(seq.incrementAndGet(), 32) + "x";
    nextBNodeID = new AtomicLong(0);
  }
View Full Code Here
TOP
Copyright © 2015 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.