mChaRM.mChaRMCollection
Class RMPReceiverStub

java.lang.Object
  |
  +--uka.karmi.rmi.server.RemoteObject
        |
        +--uka.karmi.rmi.server.UnicastRemoteObject
              |
              +--mChaRM.multichannel.stub
                    |
                    +--mChaRM.multichannel.receiverStub
                          |
                          +--mChaRM.mChaRMCollection.RMPReceiverStub
All Implemented Interfaces:
java.lang.Cloneable, receiverStubInterface, uka.karmi.rmi.Remote, RMPReceiverStubInterface, stubInterface

public class RMPReceiverStub
extends receiverStub
implements RMPReceiverStubInterface

Instances of this class are used as stubs of the multi-channel on the receiver site. Each receiver connected to a multi-channel will be extended by a stub of such a multi-channel.
This class defines the meta-computations that have to be performed on the receiver side.

Since:
Version 1.2
Version:
1.0
Author:
Michele Ferraro (1996s106@educ.disi.unige.it)
Luigi Tosetto (1996s028@educ.disi.unige.it)
Davide Zerbino (1996s027@educ.disi.unige.it)

Fields inherited from class uka.karmi.rmi.server.RemoteObject
serverRef
 
Constructor Summary
RMPReceiverStub(java.lang.Object myReferent, java.lang.String myKind, java.lang.String myReferentName)
          RMPReceiverStub constructor.
 
Method Summary
 void beforeReceiverSideMetaBehavior(mChaRMMethodCall msg)
          It is called before invoking the method and permits to perform the last meta-computation on the receiver
 java.lang.String pACK(int n)
          It adds an Ack for the message n.
 
Methods inherited from class mChaRM.multichannel.receiverStub
afterReceiverSideMetaBehavior, invoke, tInvoke
 
Methods inherited from class mChaRM.multichannel.stub
referent, retrieveField, setReferent, setWhoIsMyCore, WhoIsMyCore
 
Methods inherited from class uka.karmi.rmi.server.UnicastRemoteObject
buildStub, clone, exportObject, exportObject, unexportObject
 
Methods inherited from class uka.karmi.rmi.server.RemoteObject
equals, hashCode, toString, toStub
 
Methods inherited from class java.lang.Object
, finalize, getClass, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface mChaRM.multichannel.receiverStubInterface
invoke
 
Methods inherited from interface mChaRM.multichannel.stubInterface
retrieveField
 

Constructor Detail

RMPReceiverStub

public RMPReceiverStub(java.lang.Object myReferent,
                       java.lang.String myKind,
                       java.lang.String myReferentName)
                throws uka.karmi.rmi.RemoteException,
                       ReceiverStubCannotBeRegisteredAsAServerException,
                       CoreNotFoundException,
                       uka.karmi.rmi.NotBoundException
RMPReceiverStub constructor.
It calls the constructor of the superclass, stores the name of the receiver, the server and its core, initializes data structures for Acks.
Parameters:
myReferent - a representant of the stub referent.
myKind - the multi-channel's name.
myReferentName - the referent's name.
Throws:
ReceiverStubCannotBeRegisteredAsAServerException - thrown when the stub cannot be registered as a server.
CoreNotFoundException - thrown when the core of the multi-channel, which the stub is part of, doesn't exist or isn't correctly registered as a server.
uka.karmi.rmi.NotBoundException - thrown when there is a trouble allocating the space to store acknowledges.
Method Detail

pACK

public java.lang.String pACK(int n)
                      throws uka.karmi.rmi.RemoteException
It adds an Ack for the message n. If the receiver hasn't yet this message it sends to the channel a NAck
When a message arrives to a receiver, pACK is called on each other receiver to notify this event.
Specified by:
pACK in interface RMPReceiverStubInterface
Parameters:
n - the number of the message arrived.
Returns:
the string "OK" if it's all right.

beforeReceiverSideMetaBehavior

public void beforeReceiverSideMetaBehavior(mChaRMMethodCall msg)
It is called before invoking the method and permits to perform the last meta-computation on the receiver
If the message arrives for the first time it stores it and sends Acks to the others receivers, then waits until all previous messages and Acks are arrived. Otherwise nothing is done.
Overrides:
beforeReceiverSideMetaBehavior in class receiverStub
Parameters:
msg - the message arrived.