jgroup.relacs.rmi
Class IntGroupHandler

java.lang.Object
  extended by jgroup.relacs.rmi.IntGroupHandler
All Implemented Interfaces:
java.lang.reflect.InvocationHandler, InternalGMIService, Layer, MulticastListener

public class IntGroupHandler
extends java.lang.Object
implements InternalGMIService, java.lang.reflect.InvocationHandler, MulticastListener

Handler for group internal invocations. It is used to dynamically generate a proxy for internal GMI. Note that the InternalGMIService interface is not implemented by the IntGroupHandler layer, but rather by the dynamically generated proxy object. The interface is included here, only to follow the rules of the layer configuration structure which does not deal with proxy based layers as is. That is a layer must implement its service interface (InternalGMIService in this case), and since the dynamically generated proxy is the object actually implementing the service interface, we must do this trick. The method from the InternalGMIService interface simply throws an UnsupportedOperationException and thus should never be called.

Since:
Jgroup 0.9
Author:
Alberto Montresor, Hein Meling

Nested Class Summary
 
Nested classes/interfaces inherited from interface jgroup.core.Layer
Layer.FinalizeLayer
 
Method Summary
 void addListener(java.lang.Object listener)
          Add a server/layer that is listening for internal group method invocations.
 java.lang.Object deliverObject(java.lang.Object obj, MemberId sender, int seqNo)
          Upcall that is invoked by Jgroup to deliver a message obj related to the group identified by group.
 java.lang.Object deliverStream(java.io.InputStream inmsg, MemberId sender, int seqNo)
          Upcall that is invoked by Jgroup to deliver a message msg related to the IGMI protocol.
static IntGroupHandler getLayer(MulticastService mcastService)
           
 java.lang.String getProtocolName()
          Returns a string naming the protocol implemented by this multicast listener.
 java.lang.Object invoke(java.lang.reflect.Method m, java.lang.Object[] args, Callback callback)
          Dummy method.
 java.lang.Object invoke(java.lang.Object proxy, java.lang.reflect.Method m, java.lang.Object[] args)
          Processes a method invocation on a proxy instance and returns the result.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

getLayer

public static IntGroupHandler getLayer(MulticastService mcastService)

addListener

public void addListener(java.lang.Object listener)
Add a server/layer that is listening for internal group method invocations.

Specified by:
addListener in interface Layer
Parameters:
listener - An Object representation of the listener interface. This will typically be cast to the appropriate listener interface type after checking the type with the instanceof operator.
Throws:
java.lang.IllegalStateException - Thrown if this method has already been invoked with another listener for group method invocations. It is not allowed to have multiple local listeners for group method invocations.
java.lang.IllegalArgumentException - Raised if the specified listener is not an InternalGMIListener.

invoke

public java.lang.Object invoke(java.lang.reflect.Method m,
                               java.lang.Object[] args,
                               Callback callback)
                        throws java.lang.Exception
Dummy method. The method of the InternalGMIService interface is not implemented IntGroupHandler layer, but the interface is implemented by the dynamically generated proxy object. This method is included here, only to follow the rules of the layer configuration structure which does not deal with proxy based layers as is. That is a layer must implement its service interface (InternalGMIService in this case), and since the dynamically generated proxy is the object actually implementing the service interface, we must do this trick.

Specified by:
invoke in interface InternalGMIService
Throws:
java.lang.Exception

invoke

public java.lang.Object invoke(java.lang.Object proxy,
                               java.lang.reflect.Method m,
                               java.lang.Object[] args)
                        throws java.lang.Throwable
Processes a method invocation on a proxy instance and returns the result. This method will be invoked on an invocation handler when a method is invoked on a proxy instance that it is associated with.

Specified by:
invoke in interface java.lang.reflect.InvocationHandler
Throws:
java.lang.Throwable

getProtocolName

public java.lang.String getProtocolName()
Returns a string naming the protocol implemented by this multicast listener.

Specified by:
getProtocolName in interface MulticastListener

deliverStream

public java.lang.Object deliverStream(java.io.InputStream inmsg,
                                      MemberId sender,
                                      int seqNo)
Upcall that is invoked by Jgroup to deliver a message msg related to the IGMI protocol.

Specified by:
deliverStream in interface MulticastListener
Parameters:
inmsg - the stream from which the message may be read.
sender - the sender of the multicast message
seqNo - the sequence number of this multicast message
Returns:
an object that will be delivered to the invoker through the AckListener object specified when multicasting the message.

deliverObject

public java.lang.Object deliverObject(java.lang.Object obj,
                                      MemberId sender,
                                      int seqNo)
Upcall that is invoked by Jgroup to deliver a message obj related to the group identified by group. In this case, the message is an object marshalled and unmarshalled through java serialization.

Specified by:
deliverObject in interface MulticastListener
Parameters:
obj - the object containing the message.
sender - the sender of the multicast message
seqNo - the sequence number of this multicast message
Returns:
an object that will be delivered to the invoker through the AckListener object specified when multicasting the message.


Copyright © 1998-2006 The Jgroup/ARM development team. All Rights Reserved.