Package edu.emory.mathcs.backport.java.util.concurrent.atomic

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


    private void doExpireOldServices(){
        long expireTime=System.currentTimeMillis()-(keepAliveInterval*HEARTBEAT_MISS_BEFORE_DEATH);
        for(Iterator i=services.entrySet().iterator();i.hasNext();){
            Map.Entry entry=(Map.Entry) i.next();
            AtomicLong lastHeartBeat=(AtomicLong) entry.getValue();
            if(lastHeartBeat.get()<expireTime){
                String brokerName = (String)brokers.get(entry.getKey());
                processDead(brokerName,entry.getKey().toString());
            }
        }
    }
View Full Code Here

        this.disableMessageTimestamp = session.connection.isDisableTimeStampsByDefault();
        this.defaultDeliveryMode = Message.DEFAULT_DELIVERY_MODE;
        this.defaultPriority = Message.DEFAULT_PRIORITY;
        this.defaultTimeToLive = Message.DEFAULT_TIME_TO_LIVE;
        this.startTime = System.currentTimeMillis();
        this.messageSequence = new AtomicLong(0);
        this.stats = new JMSProducerStatsImpl(session.getSessionStats(), destination);
        this.session.addProducer(this);       
        this.session.asyncSendPacket(info);
    }
View Full Code Here

        }
    }

    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

    private void doExpireOldServices(){
        long expireTime=System.currentTimeMillis()-(keepAliveInterval*HEARTBEAT_MISS_BEFORE_DEATH);
        for(Iterator i=services.entrySet().iterator();i.hasNext();){
            Map.Entry entry=(Map.Entry) i.next();
            AtomicLong lastHeartBeat=(AtomicLong) entry.getValue();
            if(lastHeartBeat.get()<expireTime){
                String brokerName = (String)brokers.get(entry.getKey());
                processDead(brokerName,entry.getKey().toString());
            }
        }
    }
View Full Code Here

TOP

Related Classes of edu.emory.mathcs.backport.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.