public final class TcpEventReceiver extends Object implements EventReceiver, TcpEventReceiverMBean
| Modifier and Type | Field and Description |
|---|---|
static int |
UNLIMITED_EVENTS
The value that defines unlimited events per connection.
|
RUNNING, START_PENDING, STARTING, STATUS_NAMES, STOP_PENDING, STOPPED| Constructor and Description |
|---|
TcpEventReceiver()
Constructs a new TCP/IP event receiver on the default TCP/IP port.
|
TcpEventReceiver(int port,
String ipAddress)
Constructs a new TCP/IP event receiver on the passed port.
|
| Modifier and Type | Method and Description |
|---|---|
void |
addEventHandler(EventHandler handler)
Adds a new event handler to receiver.
|
void |
addEventHandler(String name)
Adds a new event handler by its managed name.
|
void |
destroy()
Called when the fiber is destroyed
|
List<EventHandler> |
getEventHandlers()
getEventHandlers
|
String |
getIpAddress()
getIpAddress
|
String |
getName()
Returns the name of this Fiber.
|
Integer |
getPort()
getPort
|
int |
getStatus()
Returns the status of this Fiber.
|
String |
getStatusText()
getStatusText
|
void |
init()
Called when the fiber is initialized
|
void |
removeEventHandler(EventHandler handler)
Removes an event handler from the list of handler called when an event is
received.
|
void |
removeEventHandler(String name)
Removes an event handler.
|
void |
setEventHandlers(List<EventHandler> eventHandlers)
setEventHandlers
|
void |
setEventsPerConnection(Integer number)
The number of event records a new connection is allowed to send before
the connection is terminated by the server.
|
void |
setIpAddress(String ipAddress)
setIpAddress
|
void |
setLogPrefix(String prefix)
The logging prefix to use
|
void |
setPort(Integer port)
Sets the port where new requests will be handled.
|
void |
start()
Allocates the server socket and starts up the server socket processor
thread.
|
String |
status()
status
|
void |
stop()
Stops the TCP/IP event receiver.
|
public static final int UNLIMITED_EVENTS
public TcpEventReceiver()
throws UnknownHostException
UnknownHostException - if any.public TcpEventReceiver(int port,
String ipAddress)
throws UnknownHostException
port - The binding port for the TCP/IP server socket.ipAddress - TODOUnknownHostException - if any.public void start()
runtime exceptionis thrown.start in interface Fiberstart in interface BaseOnmsMBeanUndeclaredThrowableException - Thrown if an error occurs allocating the server socket.RuntimeException - Thrown if the fiber is in an erronous state or the underlying
thread cannot be started.public void stop()
joined.stop in interface Fiberstop in interface BaseOnmsMBeanpublic String getName()
public int getStatus()
getStatus in interface FibergetStatus in interface BaseOnmsMBeanpublic String getStatusText()
getStatusText
getStatusText in interface BaseOnmsMBeanString object.public String status()
status
status in interface BaseOnmsMBeanString object.public void init()
init in interface InitializableFiberinit in interface BaseOnmsMBeanpublic void destroy()
destroy in interface InitializableFiberdestroy in interface TcpEventReceiverMBeanpublic void addEventHandler(EventHandler handler)
addEventHandler in interface EventReceiverhandler - A reference to an event handlerpublic void removeEventHandler(EventHandler handler)
equals() inherieted from the Object class.
Removes an event handler from the list of handler called when an event is
received. The handler is removed based upon the method
equals() inherieted from the Object class.removeEventHandler in interface EventReceiverhandler - A reference to the event handler.public List<EventHandler> getEventHandlers()
getEventHandlers
List object.public void setEventHandlers(List<EventHandler> eventHandlers)
setEventHandlers
eventHandlers - a List object.public void setIpAddress(String ipAddress)
setIpAddress
ipAddress - a String object.public Integer getPort()
getPort
getPort in interface TcpEventReceiverMBeanInteger object.public void setPort(Integer port)
setPort in interface TcpEventReceiverMBeanport - The port to listen on.public void addEventHandler(String name) throws MalformedObjectNameException, InstanceNotFoundException
addEventHandler in interface TcpEventReceiverMBeanname - The name of the handler to add.MalformedObjectNameException - Thrown if the passed name is not a valid ObjectName.InstanceNotFoundException - Thrown if no managed bean can be found that matches the name.public void removeEventHandler(String name) throws MalformedObjectNameException, InstanceNotFoundException
removeEventHandler in interface TcpEventReceiverMBeanname - The name of the handler to remove.MalformedObjectNameException - Thrown if the passed name is not a valid ObjectName.InstanceNotFoundException - Thrown if no managed bean can be found that matches the name.public void setLogPrefix(String prefix)
setLogPrefix in interface TcpEventReceiverMBeanprefix - a String object.public void setEventsPerConnection(Integer number)
setEventsPerConnection in interface TcpEventReceiverMBeannumber - The number of event records.Copyright © 2020. All rights reserved.