|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectsds.DistributedObject
sds.DistributedServerObject
public abstract class DistributedServerObject
Provides server-oriented distributed objects functionalities. A server-oriented distributed object waits for incoming messages on its allocated port number
Constructor Summary | |
---|---|
DistributedServerObject(boolean requiresSignature)
Creates a server-oriented distributed object. |
Method Summary | |
---|---|
abstract void |
execute()
Defines this server's default behaviour (i.e. while not receiving messages from other distributed objects) |
boolean |
isSignatureRequired()
|
abstract void |
processError(SdsException error)
Automatically called when receive(Message) returns
false or when an SdsException while
processing an incoming request
|
abstract boolean |
receive(Message msg)
Defines the server behavior when a message is received |
void |
run(int port,
boolean daemon)
Executes this distributed object as a server. |
boolean |
runsAsServer()
Checks if this distributed object can receive message |
void |
terminate()
Called by the hosting daemon when asked (by a manager) to kill its running distributed objects. |
abstract void |
terminateServer()
Automatically called by terminate()
|
Methods inherited from class sds.DistributedObject |
---|
createReference, deliver, deliver, getExpectedResponseInfo, getManager, getReference, run, setDefaultReference, setManager, setReference |
Methods inherited from class java.lang.Object |
---|
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public DistributedServerObject(boolean requiresSignature)
Creates a server-oriented distributed object. A default reference is automatically created. This distributed object is not associated with a manager
requiresSignature
- true if all incoming non digitally
signed (and authenticated) messages must be rejectedMethod Detail |
---|
public final boolean isSignatureRequired()
public final boolean runsAsServer()
Checks if this distributed object can receive message
runsAsServer
in class DistributedObject
public final void run(int port, boolean daemon) throws SdsException
DistributedObject
Executes this distributed object as a server. This operation must be
non-blocking. A default reference is created if not initialized before (DistributedObject.getReference()
returns null)
run
in class DistributedObject
port
- the port to be used by this distributed object when running
as a serverdaemon
- tells this server to run as a daemon or a normal server
SdsException
- raised if the port is already reserved or when this
distributed object has no server abilitypublic abstract void execute()
Defines this server's default behaviour (i.e. while not receiving messages from other distributed objects)
public final void terminate()
Called by the hosting daemon when asked (by a manager) to kill its
running distributed objects. Allows to perform tasks before an effective
closing (along with freeing this distributed object). This operation must
not be called within a thread (mainly from receive(Message)
) as
it would lead to wait indefinitely (until the current thread stops, which
never occurs!)
terminate
in class DistributedObject
public abstract void terminateServer()
Automatically called by terminate()
public abstract boolean receive(Message msg) throws SdsException
Defines the server behavior when a message is received
msg
- received message. Must not be null (no checking is
necessary when implementing this operation)
SdsException
- an error occurred when retrieving information from
the message (or cast)public abstract void processError(SdsException error)
Automatically called when receive(Message)
returns
false or when an SdsException
while
processing an incoming request
error
-
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |