Code example for AtomicReference

Methods: get

0
        } 
 
        WireMsg msg = null;
        try { 
            if (log.isTraceEnabled()) { 
                log.trace(format("Delivering bytes [%s]: \n%s",
                                 messageConnection,
                                 toHex(fullRxBuffer.array(),
                                       fullRxBuffer.limit())));
            } 
            msg = wireSecurity.fromWireForm(fullRxBuffer);
 
        } catch (WireSecurityException ex) {
            log.error(format("%s non blocking connection transport encountered security violation unmarshalling message - ignoring the message ",
                             me), ex);
            return; 
 
        } catch (Exception ex) {
            log.error(format("%s connection transport unable to unmarshall message ",
                             me), ex);
            shutdown(); 
            return; 
        } 
 
        if (!(msg instanceof TimedMsg)) {
            log.error(format("%s connection transport received non timed message ",
                             me));
            shutdown(); 
            return; 
        } 
 
        final TimedMsg tm = (TimedMsg) msg;
 
        if (order != receiveCount.get()) {
            log.error(format("%s connection transport has delivered a message out of order - shutting down.  Expected: %s, received: %s",
                             me, receiveCount, order));
            shutdown(); 
            return; 
        } 
 
        /** 
         * handle the message. We do not increment the order for the initial 
         * heartbeat message opening a new connection. 
         */ 
        if (messageConnection.get() == null) {
            try { 
                initialMsg(tm);
            } catch (Throwable e) {
                if (log.isInfoEnabled()) { 
                    log.info("Error delivering initial message", e);
 
                } 
                error(); 
            } 
        } else { 
            receiveCount.incrementAndGet();
            if (!(tm instanceof Heartbeat)) {
                if (log.isTraceEnabled()) { 
                    log.trace(format("delivering %s [%s]", tm,
                                     messageConnection));
                } 
            } 
            try { 
                messageConnection.get().deliver(tm);
            } catch (Throwable e) {
                if (log.isInfoEnabled()) { 
                    log.info("Error delivering message", e);
 
                }