com.ibm.tspaces.examples.services
Class TstServer

java.lang.Object
  |
  +--com.ibm.tspaces.examples.services.TService
        |
        +--com.ibm.tspaces.examples.services.TstServer

public class TstServer
extends TService
implements Callback, java.lang.Runnable

TstServer accepts "TstServer"" requests from TupleSpace and simulates the processing of the request The TstServer service is started by issuing the java invocation and specifying the TupleSpace host name as parameters

     java com.ibm.tspaces.examples.services.TstServer  localhost 
       
 
  A client that wants to use the services needs to only do the following

      TupleSpace servers = new TupleSpace("Services",servicehost);	    
	    
	    servers.write(TService.OTHER, "TstServer");

Author:
John Thomas
See Also:
TupleSpace, Serialized Form

Fields inherited from class com.ibm.tspaces.examples.services.TService
APPLICATION, OTHER, PRINT_FILE, PRINT_TEXT, READMAIL, SENDMAIL
 
Constructor Summary
TstServer(java.lang.String name)
          TstServer Constructor
 
Method Summary
 boolean call(java.lang.String eventName, java.lang.String tsName, int seqNum, SuperTuple tuple, boolean isException)
          Implementation for the Callback interface.
static void main(java.lang.String[] argv)
          Startup the TstServer Service Client.
 void run()
          The run() method will wait for a request Tuple to be Queued It will then take the request from TSpaces and then invoke the test() method .
 void test(java.lang.String text, java.lang.Long ack)
          The test(msg,ack) method will simulate a processing rtn then issue an ack.
 
Methods inherited from class com.ibm.tspaces.examples.services.TService
enable, equals, getName, getQ, printQ, putQ, toString
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

TstServer

public TstServer(java.lang.String name)
TstServer Constructor
Method Detail

call

public boolean call(java.lang.String eventName,
                    java.lang.String tsName,
                    int seqNum,
                    SuperTuple tuple,
                    boolean isException)
Implementation for the Callback interface.
Specified by:
call in interface Callback
Parameters:
eventName_ - the name of the event command that caused this call, that is the name of the client side command of the thread that registered this call, e.g., in the case of a read, this would be TupleSpace.READ, **not** TupleSpace.WRITE which is the corresponding command that caused the actaul event.
tsName_ - the name of the tuple space this command was executed on.
sequenceNumber_ - the sequenceNumber for this event/command
tuple_ - the returned tuple or a Tuple with an exception inside
isException_ - was the command processed normaly or was there an exception
Returns:
true if this is the last call this sequence # should be getting otherwise false

run

public void run()
The run() method will wait for a request Tuple to be Queued It will then take the request from TSpaces and then invoke the test() method .
Specified by:
run in interface java.lang.Runnable

test

public void test(java.lang.String text,
                 java.lang.Long ack)
The test(msg,ack) method will simulate a processing rtn then issue an ack.

main

public static void main(java.lang.String[] argv)
Startup the TstServer Service Client. Syntax: java ...TstServer name name = Name to be used to contact server