com.sshtools.j2ssh.transport

Class AsyncService

Implemented Interfaces:
Runnable
Known Direct Subclasses:
AuthenticationProtocolServer, ConnectionProtocol

public abstract class AsyncService
extends Service
implements Runnable

Extends the simple Service class to provide an asyncronous messaging service for the transport protocol.
Version:
$Revision: 1.28 $
Author:
Lee David Painter
Since:
0.2.0

Field Summary

protected SshThread
thread

Fields inherited from class com.sshtools.j2ssh.transport.Service

ACCEPTING_SERVICE, REQUESTING_SERVICE, messageStore, startMode, state, transport

Constructor Summary

AsyncService(String serviceName)
Constructs an asyncronous service.

Method Summary

protected abstract int[]
getAsyncMessageFilter()
Implement this method by returning the message ids of the asyncrounous messages your implementation wants to receive.
protected abstract void
onMessageReceived(SshMessage msg)
Called by the service thread when an asyncronous message is received.
protected void
onStart()
Implements the abstract Service method and starts the service thread.
protected abstract void
onStop()
The service thread calls this method when the thread is exiting.
void
run()
Implements the asyncronous services message loop.

Methods inherited from class com.sshtools.j2ssh.transport.Service

getServiceName, getState, init, onServiceAccept, onServiceInit, onServiceRequest, onStart, sendServiceAccept, start, stop

Field Details

thread

protected SshThread thread

Constructor Details

AsyncService

public AsyncService(String serviceName)
Constructs an asyncronous service.
Parameters:
serviceName - the name of the service
Since:
0.2.0

Method Details

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

protected abstract void onMessageReceived(SshMessage msg)
            throws IOException
Called by the service thread when an asyncronous message is received.
Parameters:
msg - the message received
Since:
0.2.0

onStart

protected void onStart()
            throws IOException
Implements the abstract Service method and starts the service thread.
Overrides:
onStart in interface Service
Since:
0.2.0

onStop

protected abstract void onStop()
The service thread calls this method when the thread is exiting.
Since:
0.2.0

run

public final void run()
Implements the asyncronous services message loop.
Since:
0.2.0

Copyright © 2002-2003 Lee David Painter & Contributors. All Rights Reserved.