Class TcpHandler
- java.lang.Object
-
- org.opendaylight.openflowjava.protocol.impl.core.TcpHandler
-
- All Implemented Interfaces:
Runnable
,OnlineProvider
,ServerFacade
,ShutdownProvider
public class TcpHandler extends Object implements ServerFacade
Class implementing server over TCP / TLS for handling incoming connections.- Author:
- michal.polkorab
-
-
Constructor Summary
Constructors Constructor Description TcpHandler(int port, Runnable readyRunnable)
Constructor of TCPHandler that listens on selected port.TcpHandler(InetAddress address, int port, Runnable readyRunnable)
Constructor of TCPHandler that listens on selected address and port.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description String
getAddress()
com.google.common.util.concurrent.ListenableFuture<Boolean>
getIsOnlineFuture()
int
getNumberOfConnections()
Returns the number of connected clients / channels.int
getPort()
io.netty.channel.EventLoopGroup
getWorkerGroup()
protected void
initiateEpollEventLoopGroups(ThreadConfiguration threadConfiguration)
Initiate Epoll event loop groups with Nio as fall back.void
initiateEventLoopGroups(ThreadConfiguration threadConfiguration, boolean isEpollEnabled)
Initiate event loop groups.void
initiateNioEventLoopGroups(ThreadConfiguration threadConfiguration)
Initiate Nio event loop groups.void
run()
Starts server on selected port.void
setChannelInitializer(TcpChannelInitializer channelInitializer)
void
setThreadConfig(ThreadConfiguration threadConfig)
Sets thread configuration.com.google.common.util.concurrent.ListenableFuture<Boolean>
shutdown()
Shuts downTcpHandler
}.
-
-
-
Constructor Detail
-
TcpHandler
public TcpHandler(int port, Runnable readyRunnable)
Constructor of TCPHandler that listens on selected port.- Parameters:
port
- listening port of TCPHandler server
-
TcpHandler
public TcpHandler(InetAddress address, int port, Runnable readyRunnable)
Constructor of TCPHandler that listens on selected address and port.- Parameters:
address
- listening address of TCPHandler serverport
- listening port of TCPHandler server
-
-
Method Detail
-
shutdown
public com.google.common.util.concurrent.ListenableFuture<Boolean> shutdown()
Shuts downTcpHandler
}.- Specified by:
shutdown
in interfaceShutdownProvider
-
getNumberOfConnections
public int getNumberOfConnections()
Returns the number of connected clients / channels.- Returns:
- number of connected clients / channels
-
getIsOnlineFuture
public com.google.common.util.concurrent.ListenableFuture<Boolean> getIsOnlineFuture()
- Specified by:
getIsOnlineFuture
in interfaceOnlineProvider
-
getPort
public int getPort()
-
getAddress
public String getAddress()
-
setChannelInitializer
public void setChannelInitializer(TcpChannelInitializer channelInitializer)
-
setThreadConfig
public void setThreadConfig(ThreadConfiguration threadConfig)
Description copied from interface:ServerFacade
Sets thread configuration.- Specified by:
setThreadConfig
in interfaceServerFacade
- Parameters:
threadConfig
- desired thread configuration
-
initiateEventLoopGroups
public void initiateEventLoopGroups(ThreadConfiguration threadConfiguration, boolean isEpollEnabled)
Initiate event loop groups.- Parameters:
threadConfiguration
- number of threads to be created, if not specified in threadConfig
-
initiateNioEventLoopGroups
public void initiateNioEventLoopGroups(ThreadConfiguration threadConfiguration)
Initiate Nio event loop groups.- Parameters:
threadConfiguration
- number of threads to be created, if not specified in threadConfig
-
initiateEpollEventLoopGroups
protected void initiateEpollEventLoopGroups(ThreadConfiguration threadConfiguration)
Initiate Epoll event loop groups with Nio as fall back.- Parameters:
threadConfiguration
- the ThreadConfiguration
-
getWorkerGroup
public io.netty.channel.EventLoopGroup getWorkerGroup()
-
-