com.solab.alarms
Class ProtobufAlarmServer
java.lang.Object
java.lang.Thread
com.solab.alarms.ProtobufAlarmServer
- All Implemented Interfaces:
- Runnable
public class ProtobufAlarmServer
- extends Thread
A TCP server for the Protocol Buffers AlarmSender client.
Once configured, the start() method must be invoked on the component
so that it starts listening on the TCP port and starts sending the alarms.
This components requires a configured AlarmSender to forward the alarms to.
Internally, this component uses a cached thread pool to handle the incoming
connections. Each connection can send any number of alarms, no more than 5
seconds apart. After 5 seconds of inactivity, the connection is closed.
|
Method Summary |
void |
close()
Shuts down the thread pool. |
void |
run()
Opens a ServerSocket on the specified port, and accepts incoming connections,
processing them in a thread pool. |
void |
setAlarmSender(AlarmSender value)
Specified the AlarmSender to forward the alarms to. |
void |
setMaxThreads(int value)
Specifies the maximum number of threads that the internal thread pool
should allow. |
| Methods inherited from class java.lang.Thread |
activeCount, checkAccess, clone, countStackFrames, currentThread, destroy, dumpStack, enumerate, getAllStackTraces, getContextClassLoader, getDefaultUncaughtExceptionHandler, getId, getName, getPriority, getStackTrace, getState, getThreadGroup, getUncaughtExceptionHandler, holdsLock, interrupt, interrupted, isAlive, isDaemon, isInterrupted, join, join, join, resume, setContextClassLoader, setDaemon, setDefaultUncaughtExceptionHandler, setName, setPriority, setUncaughtExceptionHandler, sleep, sleep, start, stop, stop, suspend, toString, yield |
ProtobufAlarmServer
public ProtobufAlarmServer(int tcpPort)
- Creates a new instance which listens on the specified TCP port.
ProtobufAlarmServer
public ProtobufAlarmServer(int tcpPort,
boolean local)
setAlarmSender
public void setAlarmSender(AlarmSender value)
- Specified the AlarmSender to forward the alarms to.
setMaxThreads
public void setMaxThreads(int value)
- Specifies the maximum number of threads that the internal thread pool
should allow. By default it is unbound.
run
public void run()
- Opens a ServerSocket on the specified port, and accepts incoming connections,
processing them in a thread pool.
- Specified by:
run in interface Runnable- Overrides:
run in class Thread
close
@PreDestroy
public void close()
- Shuts down the thread pool.