mChaRM.mChaRMCollection
Class RMPChannel

java.lang.Object
  |
  +--uka.karmi.rmi.server.RemoteObject
        |
        +--uka.karmi.rmi.server.UnicastRemoteObject
              |
              +--mChaRM.multichannel.channelCore
                    |
                    +--mChaRM.mChaRMCollection.RMPChannel
All Implemented Interfaces:
channelInterface, java.lang.Cloneable, uka.karmi.rmi.Remote, RMPChannelInterface

public class RMPChannel
extends channelCore
implements RMPChannelInterface

Realizes a multi-channel of kind RMP. Its meta-behavior, together with the ReceiverStub's one, implements the Reliable Multicast Protolcol by Brian Whetten, Todd Montgomery and Simon Kaplan, which provides a totally ordered, reliable, atomic multicast service on top of an unreliable service.
It applies a message number to the message and sends it to the receiverStubs.
When results are returned from the receiverStubs it uses a voting algorithm to choose which result will be returned to the senderStub. It also allows the receiverStubs to request the retransmission of the message with the nACK method.
It uses instances of senderStub class as senderStubs, and instances of RMPReceiverStub as receiverStubs

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
RMPChannel(java.lang.String[] RsName)
          Constructor of RMP-multi-channels.
 
Method Summary
 java.lang.Object coreMetaBehavior(mChaRMMethodCall msg)
          This method embodies the reflective behaviour realized by the RMP-multi-channel.
 java.lang.String nACK(int n, java.lang.String name)
          Sends the message n to the receiver that has requested it
 
Methods inherited from class mChaRM.multichannel.channelCore
howManyReceivers, howManySenders, kind, receiverName, receiverStub, receiverStubByPosition, receiverStubClassName, retrieveReceiverFieldValue, retrieveSenderFieldValue, senderName, senderStub, senderStubByPosition, senderStubClassName, senderStubHasBeenCreated, setKind, setReceiverName, setReceiverStub, setReceiverStubClassName, setRsName, setSenderName, setSenderStub, setSenderStubClassName, supplyASenderStub
 
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.channelInterface
senderStubHasBeenCreated, supplyASenderStub
 

Constructor Detail

RMPChannel

public RMPChannel(java.lang.String[] RsName)
           throws uka.karmi.rmi.RemoteException,
                  ReceiverStubNotFoundException
Constructor of RMP-multi-channels.
This constructor calls the superclass' one fixing the kind "RMP" and specifing classes for senders and receivers that must be "senderStub" and "RMPReceiverStub" It initializes data structures for messages, results and, in the end, initializes the counter for ordering messages.
Parameters:
RsName - an Array of Strings representing the name of the receivers, which it is connected to.
Throws:
ReceiverStubNotFoundException - thrown when one of the specified receiver wasn't started before the core.
Method Detail

nACK

public java.lang.String nACK(int n,
                             java.lang.String name)
                      throws MethodDoesNotExistException,
                             uka.karmi.rmi.RemoteException
Sends the message n to the receiver that has requested it
If the message is correctly sent return the string "Ok"
Specified by:
nACK in interface RMPChannelInterface
Parameters:
n - number of the message required.
name - the name of the receiver.
Returns:
"Ok" if all is right.

coreMetaBehavior

public java.lang.Object coreMetaBehavior(mChaRMMethodCall msg)
                                  throws MethodDoesNotExistException,
                                         uka.karmi.rmi.RemoteException
This method embodies the reflective behaviour realized by the RMP-multi-channel.
It performs meta-computations on the reified method call:
multiRMI(RsName, methodName, args)
the computations performed can't make assumption about where their are performed.
It adds to the message a progressive number then multicasts it to the receivers, collects the results and returns the most probable result (obtained with the voting method) of the computation to the sender.
Note that receivers can be a subset of the multi-channel's receivers
Specified by:
coreMetaBehavior in interface channelInterface
Overrides:
coreMetaBehavior in class channelCore
Parameters:
msg - the hijacked method call.
Returns:
the result of the method call.
Throws:
MethodDoesNotExistException - thrown when the method reified doesn't exist in the referent class.