com.javageeks.gjas.services
Class HeartbeatService
java.lang.Object
|
+--com.javageeks.gjas.services.ThreadedServer
|
+--com.javageeks.gjas.services.SocketServer
|
+--com.javageeks.gjas.services.HeartbeatService
- All Implemented Interfaces:
- java.io.Serializable, Service
- public class HeartbeatService
- extends SocketServer
HeartbeatService sends a message to any listening clients every
n milliseconds. Put basically, this is the same publish-
subscribe behavior found in a variety of other places, such as
AWT/Swing's Event-EventListener system.
This concept isn't necessarily limited solely to socket-based
communication--this could easily be adapted to other forms of
communicative technology, like RMI, CORBA, JMS, Mobile Objects,
and so on.
- See Also:
- Serialized Form
Methods inherited from class com.javageeks.gjas.services.ThreadedServer |
getInstanceID, getState, getThread, isPaused, kill, pause, resume, setRunnable, setState, setThread, shouldStop |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
HeartbeatService
public HeartbeatService(int port,
int interval,
java.lang.String pingMsg)
HeartbeatService
public HeartbeatService()
start
public void start()
throws java.lang.Exception
- Description copied from class:
SocketServer
- Start the SocketServer
- Overrides:
start
in class SocketServer
stop
public void stop()
throws java.lang.Exception
- Description copied from interface:
Service
- Stop the Service.
- Overrides:
stop
in class SocketServer
getConfigInfo
public ConfigProperties getConfigInfo()
- Description copied from interface:
Service
- Return the Properties configuration information
- Overrides:
getConfigInfo
in class SocketServer
setConfigInfo
public void setConfigInfo(ConfigProperties props)
- Description copied from interface:
Service
- Set the Properties configuration information
- Overrides:
setConfigInfo
in class SocketServer
serve
public void serve(java.net.Socket socket)
throws java.lang.Exception
- Derived services must override this method. Once a client has
connected to us, this method is called to "do the work" of
handling the connection.
- Overrides:
serve
in class SocketServer