ibis.gmi
Class Forwarder

java.lang.Object
  extended byibis.gmi.Forwarder
All Implemented Interfaces:
GroupProtocol

public class Forwarder
extends java.lang.Object
implements GroupProtocol

The Forwarder class serves as a base class for user-defined forwarders. A forwarder is to be defined for the ForwardReply reply scheme. When this reply scheme is used, all replies of a group method invocation are passed to this forwarder object, through calls to a "forward" method. This class is not abstract, because the user-defined forwarder does not have to supply all "forward" methods (for all different result types). Therefore, default ones are supplied that just throw an exception.


Field Summary
 
Fields inherited from interface ibis.gmi.GroupProtocol
BARRIER, BARRIER_FAILED, BARRIER_OK, COMBINE, COMBINE_RESULT, COMBINED_FAILED, COMBINED_OK, CREATE_FAILED, CREATE_GROUP, CREATE_OK, DEFINE_COMBINED, FIND_GROUP, GROUP_NOT_READY, GROUP_OK, GROUP_UNKNOWN, INVOCATION, INVOCATION_BINCOMBINE, INVOCATION_FLATCOMBINE, INVOCATION_REPLY, JOIN_FULL, JOIN_GROUP, JOIN_ILLEGAL_RANK, JOIN_OK, JOIN_RANK_TAKEN, JOIN_TIMEOUT, JOIN_UNKNOWN, JOIN_WRONG_TYPE, REGISTRY, REGISTRY_REPLY, RESULT_BOOLEAN, RESULT_BYTE, RESULT_CHAR, RESULT_DOUBLE, RESULT_EXCEPTION, RESULT_FLOAT, RESULT_INT, RESULT_LONG, RESULT_OBJECT, RESULT_SHORT, RESULT_VOID
 
Constructor Summary
Forwarder()
           
 
Method Summary
 void forward(int rank, int size)
          Invoked when a "void" result is received.
 void forward(int rank, int size, boolean result)
          Invoked when a boolean result is received.
 void forward(int rank, int size, byte result)
          Invoked when a byte result is received.
 void forward(int rank, int size, char result)
          Invoked when a char result is received.
 void forward(int rank, int size, double result)
          Invoked when a double result is received.
 void forward(int rank, int size, java.lang.Exception result)
          Invoked when the group method invoked caused an exception.
 void forward(int rank, int size, float result)
          Invoked when a float result is received.
 void forward(int rank, int size, int result)
          Invoked when a int result is received.
 void forward(int rank, int size, long result)
          Invoked when a long result is received.
 void forward(int rank, int size, java.lang.Object result)
          Invoked when an Object result is received.
 void forward(int rank, int size, short result)
          Invoked when a short result is received.
 void startReceiving(GroupStub stb, int nr, int tckt)
          Initiate receiving and forwarding a reply for a group method invoked by the GroupStub "stub".
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Forwarder

public Forwarder()
Method Detail

forward

public void forward(int rank,
                    int size)
Invoked when a "void" result is received.

Parameters:
rank - the rank number of the group member from which this reply was received
size - the total number of replies to be expected

forward

public void forward(int rank,
                    int size,
                    boolean result)
Invoked when a boolean result is received.

Parameters:
rank - the rank number of the group member from which this reply was received
size - the total number of replies to be expected
result - the replied value

forward

public void forward(int rank,
                    int size,
                    byte result)
Invoked when a byte result is received.

Parameters:
rank - the rank number of the group member from which this reply was received
size - the total number of replies to be expected
result - the replied value

forward

public void forward(int rank,
                    int size,
                    char result)
Invoked when a char result is received.

Parameters:
rank - the rank number of the group member from which this reply was received
size - the total number of replies to be expected
result - the replied value

forward

public void forward(int rank,
                    int size,
                    short result)
Invoked when a short result is received.

Parameters:
rank - the rank number of the group member from which this reply was received
size - the total number of replies to be expected
result - the replied value

forward

public void forward(int rank,
                    int size,
                    int result)
Invoked when a int result is received.

Parameters:
rank - the rank number of the group member from which this reply was received
size - the total number of replies to be expected
result - the replied value

forward

public void forward(int rank,
                    int size,
                    long result)
Invoked when a long result is received.

Parameters:
rank - the rank number of the group member from which this reply was received
size - the total number of replies to be expected
result - the replied value

forward

public void forward(int rank,
                    int size,
                    float result)
Invoked when a float result is received.

Parameters:
rank - the rank number of the group member from which this reply was received
size - the total number of replies to be expected
result - the replied value

forward

public void forward(int rank,
                    int size,
                    double result)
Invoked when a double result is received.

Parameters:
rank - the rank number of the group member from which this reply was received
size - the total number of replies to be expected
result - the replied value

forward

public void forward(int rank,
                    int size,
                    java.lang.Object result)
Invoked when an Object result is received.

Parameters:
rank - the rank number of the group member from which this reply was received
size - the total number of replies to be expected
result - the replied value

forward

public void forward(int rank,
                    int size,
                    java.lang.Exception result)
Invoked when the group method invoked caused an exception.

Parameters:
rank - the rank number of the group member from which this reply was received
size - the total number of replies to be expected
result - the exception

startReceiving

public void startReceiving(GroupStub stb,
                           int nr,
                           int tckt)
Initiate receiving and forwarding a reply for a group method invoked by the GroupStub "stub". This is done by placing this forwarder on the reply stack of the stub, so that a reply handler can invoke the forwarder, once it receives a reply.

Parameters:
stb - the stub expecting a reply
nr - the total number of replies to be expected
tckt - the ticket number for the stub's reply stack


The Ibis project