Package org.serviceconnector.net.res
Class EndpointAdapter
java.lang.Object
org.serviceconnector.net.res.EndpointAdapter
- Direct Known Subclasses:
NettyHttpEndpoint,NettyTcpEndpoint,NettyTcpProxyEndpoint,NettyWebEndpoint
The Class EndpointAdapter. Provides basic functionality for endpoints.
- Author:
- JTraber
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected final BasicConfigurationThe base conf.protected io.netty.bootstrap.ServerBootstrapThe bootstrap.protected io.netty.channel.EventLoopGroupprotected io.netty.channel.ChannelThe channel.protected StringThe host.protected intThe port.protected IResponderThe responder.protected io.netty.channel.EventLoopGroup -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidcreate()Creates an endpoint.voiddestroy()Destroys endpoint.voiddump(XMLDumpWriter writer) Dump the endpoint into the xml writer.getHost()Gets the host.intgetPort()Gets the port.Gets the responder.voidrun()voidSets the host.voidsetPort(int port) Sets the port.voidsetResponder(IResponder resp) Sets the responder.voidStart listen synchronous.voidStarts listen asynchronous.voidStop listening.
-
Field Details
-
baseConf
The base conf. -
host
The host. -
port
protected int portThe port. -
bootstrap
protected io.netty.bootstrap.ServerBootstrap bootstrapThe bootstrap. -
channel
protected io.netty.channel.Channel channelThe channel. -
resp
The responder. -
bossGroup
protected io.netty.channel.EventLoopGroup bossGroup -
workerGroup
protected io.netty.channel.EventLoopGroup workerGroup
-
-
Constructor Details
-
EndpointAdapter
public EndpointAdapter()Instantiates a new EndpointAdapter.
-
-
Method Details
-
create
public void create()Creates an endpoint. -
run
public void run() -
startListenSync
Start listen synchronous. Starts listener in current thread. Does not give back control.- Specified by:
startListenSyncin interfaceIEndpoint- Throws:
Exception- the exception
-
startsListenAsync
Starts listen asynchronous. Starts listener in a separate thread.- Specified by:
startsListenAsyncin interfaceIEndpoint- Throws:
Exception- the exception
-
stopListening
public void stopListening()Stop listening.- Specified by:
stopListeningin interfaceIEndpoint
-
destroy
public void destroy()Destroys endpoint. -
getResponder
Gets the responder.- Specified by:
getResponderin interfaceIEndpoint- Returns:
- the responder
-
setResponder
Sets the responder.- Specified by:
setResponderin interfaceIEndpoint- Parameters:
resp- the new responder
-
getHost
Gets the host.- Returns:
- the host
-
setHost
Sets the host. -
getPort
public int getPort()Gets the port.- Returns:
- the port
-
setPort
public void setPort(int port) Sets the port. -
dump
Dump the endpoint into the xml writer.
-