org.ow2.carol.cmi.rpc
Class POJOInvocationHandler

java.lang.Object
  extended by org.ow2.carol.cmi.rpc.CMIInvocationHandler<T>
      extended by org.ow2.carol.cmi.rpc.CMIInvocationHandlerByPool<java.lang.Object>
          extended by org.ow2.carol.cmi.rpc.POJOInvocationHandler
All Implemented Interfaces:
java.io.Serializable, java.lang.reflect.InvocationHandler

@ThreadSafe
public class POJOInvocationHandler
extends org.ow2.carol.cmi.rpc.CMIInvocationHandlerByPool<java.lang.Object>

This is the InvocationHandler for stateless POJOs. It is created by CMIProxyFactory.newCMIProxy(ClusterViewManager, String, String). The CMIProxy intercepts the invocation of method of the clustered objects.

Author:
The new CMI team
See Also:
CMIProxyFactory, Serialized Form

Field Summary
 
Fields inherited from class org.ow2.carol.cmi.rpc.CMIInvocationHandler
clusterViewManager, cmiProxyHandle, itf, objectName, protocolName
 
Constructor Summary
POJOInvocationHandler(java.lang.ClassLoader classLoader, org.ow2.carol.cmi.controller.common.ClusterViewManager clusterViewManager, java.lang.String objectName, java.lang.String protocolName, java.lang.Class<?> itf)
          Build a new CMI Invocation Handler.
 
Method Summary
protected  void checkInitialized()
           
protected  org.ow2.carol.cmi.reference.CMIProxyHandle getHandle(org.ow2.carol.cmi.rpc.CMIProxy cmiProxy)
           
protected  java.lang.Object invokeRemoteMethod(java.lang.Object proxy, java.lang.reflect.Method method, java.lang.Object... args)
          Handles remote methods.
protected  java.lang.String proxyToString(java.lang.Object proxy)
          Returns a string representation for a proxy that uses this invocation handler.
 
Methods inherited from class org.ow2.carol.cmi.rpc.CMIInvocationHandlerByPool
getCMIReferenceable, onExceptionHook, onFinallyHook
 
Methods inherited from class org.ow2.carol.cmi.rpc.CMIInvocationHandler
getCurrentRef, getHandleMethodName, invoke, postInvokeHook, preInvokeHook, setClassLoader, setCmiProxyHandle, setCurrentRef
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

POJOInvocationHandler

public POJOInvocationHandler(java.lang.ClassLoader classLoader,
                             org.ow2.carol.cmi.controller.common.ClusterViewManager clusterViewManager,
                             java.lang.String objectName,
                             java.lang.String protocolName,
                             java.lang.Class<?> itf)
Build a new CMI Invocation Handler.

Parameters:
classLoader - the classloader to use (when the smart factory is used, it is the smart classloader)
clusterViewManager - A manager of the cluster view
objectName - a name of the object
protocolName - a protocol to perform the invocation
itf - interface of the object
Method Detail

invokeRemoteMethod

protected java.lang.Object invokeRemoteMethod(java.lang.Object proxy,
                                              java.lang.reflect.Method method,
                                              java.lang.Object... args)
                                       throws POJOInvocationHandlerException,
                                              java.lang.Throwable
Handles remote methods.

Overrides:
invokeRemoteMethod in class org.ow2.carol.cmi.rpc.CMIInvocationHandler<java.lang.Object>
Throws:
CMIInvocationHandlerException - if a server cannot be chosen
java.lang.Throwable - if the invoked method throws an exception
POJOInvocationHandlerException

proxyToString

protected java.lang.String proxyToString(java.lang.Object proxy)
Returns a string representation for a proxy that uses this invocation handler.

Overrides:
proxyToString in class org.ow2.carol.cmi.rpc.CMIInvocationHandler<java.lang.Object>

checkInitialized

protected void checkInitialized()
                         throws POJOInvocationHandlerException
Specified by:
checkInitialized in class org.ow2.carol.cmi.rpc.CMIInvocationHandler<java.lang.Object>
Throws:
POJOInvocationHandlerException

getHandle

protected org.ow2.carol.cmi.reference.CMIProxyHandle getHandle(org.ow2.carol.cmi.rpc.CMIProxy cmiProxy)
Specified by:
getHandle in class org.ow2.carol.cmi.rpc.CMIInvocationHandler<java.lang.Object>


Copyright © 2008 OW2 Consortium. All Rights Reserved.