Make sure PCEPMessageHeader is threadsafe
[bgpcep.git] / bgp / rib-impl / src / main / java / org / opendaylight / protocol / bgp / rib / impl / BGPSessionFactory.java
1 /*
2  * Copyright (c) 2013 Cisco Systems, Inc. and others.  All rights reserved.
3  *
4  * This program and the accompanying materials are made available under the
5  * terms of the Eclipse Public License v1.0 which accompanies this distribution,
6  * and is available at http://www.eclipse.org/legal/epl-v10.html
7  */
8 package org.opendaylight.protocol.bgp.rib.impl;
9
10 import io.netty.channel.Channel;
11
12 import java.util.Timer;
13
14 import org.opendaylight.protocol.bgp.rib.impl.spi.BGPConnection;
15 import org.opendaylight.protocol.framework.ProtocolConnection;
16 import org.opendaylight.protocol.framework.ProtocolMessageFactory;
17 import org.opendaylight.protocol.framework.ProtocolSessionFactory;
18 import org.opendaylight.protocol.framework.SessionParent;
19
20 /**
21  *
22  */
23 public final class BGPSessionFactory implements ProtocolSessionFactory<BGPSessionImpl> {
24
25         private final ProtocolMessageFactory parser;
26
27         public BGPSessionFactory(final ProtocolMessageFactory parser) {
28                 this.parser = parser;
29         }
30
31         @Override
32         public BGPSessionImpl getProtocolSession(final SessionParent parent, final Timer timer, final ProtocolConnection connection,
33                         final int sessionId, final Channel channel) {
34                 return new BGPSessionImpl(parent, timer, (BGPConnection) connection, sessionId, this.parser, channel);
35         }
36 }