Keepalive message can be shared between instances 35/5135/1
authorRobert Varga <rovarga@cisco.com>
Wed, 5 Feb 2014 15:20:21 +0000 (16:20 +0100)
committerRobert Varga <rovarga@cisco.com>
Wed, 5 Feb 2014 17:46:56 +0000 (18:46 +0100)
Change-Id: I1d3ae97a295a348d1a0610d6f94cc1574c6638a7
Signed-off-by: Robert Varga <rovarga@cisco.com>
pcep/impl/src/main/java/org/opendaylight/protocol/pcep/impl/AbstractPCEPSessionNegotiator.java

index 8f43dc37f5f590ef07e792cd8925854b7ee695ae..e1fabedcfef2538d2185deb5bf0a55a5e8f5c105 100644 (file)
@@ -75,6 +75,7 @@ public abstract class AbstractPCEPSessionNegotiator extends AbstractSessionNegot
        }
 
        private static final Logger LOG = LoggerFactory.getLogger(AbstractPCEPSessionNegotiator.class);
+       private static final Keepalive KEEPALIVE = new KeepaliveBuilder().setKeepaliveMessage(new KeepaliveMessageBuilder().build()).build();
 
        private final Timer timer;
 
@@ -92,8 +93,6 @@ public abstract class AbstractPCEPSessionNegotiator extends AbstractSessionNegot
 
        private volatile boolean localOK, openRetry, remoteOK;
 
-       private final Keepalive keepalive = new KeepaliveBuilder().setKeepaliveMessage(new KeepaliveMessageBuilder().build()).build();
-
        protected AbstractPCEPSessionNegotiator(final Timer timer, final Promise<PCEPSessionImpl> promise, final Channel channel) {
                super(promise, channel);
                this.timer = Preconditions.checkNotNull(timer);
@@ -251,7 +250,7 @@ public abstract class AbstractPCEPSessionNegotiator extends AbstractSessionNegot
                                final org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev131005.open.message.OpenMessage o = ((org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.message.rev131007.Open) msg).getOpenMessage();
                                final Open open = o.getOpen();
                                if (isProposalAcceptable(open)) {
-                                       this.channel.writeAndFlush(this.keepalive);
+                                       this.channel.writeAndFlush(KEEPALIVE);
                                        this.remotePrefs = open;
                                        this.remoteOK = true;
                                        if (this.localOK) {