Package com.sshtools.j2ssh.transport
Class AsyncService
java.lang.Object
com.sshtools.j2ssh.transport.Service
com.sshtools.j2ssh.transport.AsyncService
- All Implemented Interfaces:
Runnable
- Direct Known Subclasses:
AuthenticationProtocolServer
,ConnectionProtocol
Extends the simple Service
class to provide an asyncronous
messaging service for the transport protocol.
- Since:
- 0.2.0
- Version:
- $Revision: 1.28 $
- Author:
- Lee David Painter
-
Field Summary
FieldsFields inherited from class com.sshtools.j2ssh.transport.Service
ACCEPTING_SERVICE, messageStore, REQUESTING_SERVICE, startMode, state, transport
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected abstract int[]
Implement this method by returning the message ids of the asyncrounous messages your implementation wants to receive.protected abstract void
Called by the service thread when an asyncronous message is received.protected void
onStart()
Implements the abstractService
method and starts the service thread.protected abstract void
onStop()
The service thread calls this method when the thread is exiting.final void
run()
Implements the asyncronous services message loop.Methods inherited from class com.sshtools.j2ssh.transport.Service
getServiceName, getState, init, onServiceAccept, onServiceInit, onServiceRequest, sendServiceAccept, start, stop
-
Field Details
-
thread
-
-
Constructor Details
-
AsyncService
Constructs an asyncronous service.
- Parameters:
serviceName
- the name of the service- Since:
- 0.2.0
-
-
Method Details
-
onStart
Implements the abstract
Service
method and starts the service thread.- Specified by:
onStart
in classService
- Throws:
IOException
- if an IO error occurs- Since:
- 0.2.0
-
run
public final void run()Implements the asyncronous services message loop.
-
onStop
protected abstract void onStop()The service thread calls this method when the thread is exiting.
- Since:
- 0.2.0
-
getAsyncMessageFilter
protected abstract int[] getAsyncMessageFilter()Implement this method by returning the message ids of the asyncrounous messages your implementation wants to receive.
- Returns:
- an int array of message ids
- Since:
- 0.2.0
-
onMessageReceived
Called by the service thread when an asyncronous message is received.
- Parameters:
msg
- the message received- Throws:
IOException
- if an IO error occurs- Since:
- 0.2.0
-