|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectorg.opennms.netmgt.eventd.adaptors.tcp.TcpEventReceiver
public final class TcpEventReceiver
This class is the access point for the agents to hook into the event queue. This fiber sets up an server socket that accepts incomming connections on the configured port (port 5817 by default). When a connection is established a new thread is started to process the socket connection. The event document is decoded and each of the events are passed to the handlers. Based upon the action of the handlers an event recipt is generated and sent to the remote client.
| Field Summary | |
|---|---|
static int |
UNLIMITED_EVENTS
The value that defines unlimited events per connection. |
| Fields inherited from interface org.opennms.core.fiber.Fiber |
|---|
RUNNING, START_PENDING, STARTING, STATUS_NAMES, STOP_PENDING, STOPPED |
| Constructor Summary | |
|---|---|
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. |
|
| Method Summary | |
|---|---|
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()
|
String |
getIpAddress()
|
String |
getName()
Returns the name of this Fiber. |
Integer |
getPort()
Returns the where a listener is waiting to process new request. |
int |
getStatus()
Returns the status of this Fiber. |
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)
|
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)
|
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. |
void |
stop()
Stops the TCP/IP event receiver. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
public static final int UNLIMITED_EVENTS
| Constructor Detail |
|---|
public TcpEventReceiver()
throws UnknownHostException
UnknownHostException
public TcpEventReceiver(int port,
String ipAddress)
throws UnknownHostException
port - The binding port for the TCP/IP server socket.ipAddress - TODO
UnknownHostException| Method Detail |
|---|
public void start()
runtime exceptionis thrown.
start in interface Fiberstart in interface TcpEventReceiverMBeanUndeclaredThrowableException - 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 TcpEventReceiverMBeanpublic String getName()
getName in interface Fiberpublic int getStatus()
getStatus in interface FibergetStatus in interface TcpEventReceiverMBeanpublic void init()
init in interface InitializableFiberinit in interface TcpEventReceiverMBeanpublic 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.
removeEventHandler in interface EventReceiverhandler - A reference to the event handler.public List<EventHandler> getEventHandlers()
public void setEventHandlers(List<EventHandler> eventHandlers)
public String getIpAddress()
public void setIpAddress(String ipAddress)
public Integer getPort()
TcpEventReceiverMBean
getPort in interface TcpEventReceiverMBeanpublic void setPort(Integer port)
TcpEventReceiverMBean
setPort in interface TcpEventReceiverMBeanport - The port to listen on.
public void addEventHandler(String name)
throws MalformedObjectNameException,
InstanceNotFoundException
TcpEventReceiverMBean
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
TcpEventReceiverMBean
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)
TcpEventReceiverMBean
setLogPrefix in interface TcpEventReceiverMBeanpublic void setEventsPerConnection(Integer number)
setEventsPerConnection in interface TcpEventReceiverMBeannumber - The number of event records.
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||