org.jboss.cache.rpc
Class RpcTreeCache

java.lang.Object
  extended by org.jboss.mx.util.JBossNotificationBroadcasterSupport
      extended by org.jboss.system.ServiceMBeanSupport
          extended by org.jboss.cache.TreeCache
              extended by org.jboss.cache.rpc.RpcTreeCache
All Implemented Interfaces:
java.lang.Cloneable, javax.management.MBeanRegistration, javax.management.NotificationBroadcaster, javax.management.NotificationEmitter, RpcTreeCacheMBean, TreeCacheMBean, org.jboss.system.Service, org.jboss.system.ServiceMBean, org.jgroups.MembershipListener

Deprecated. This class will be removed when JGroups adds a multiplexing capability.

public class RpcTreeCache
extends TreeCache
implements RpcTreeCacheMBean

TreeCache extension that adds a general purpose RPC functionality to allow clients to make/receive RPC calls over the same JGroups Channel used by the cache.

Services wishing to receive remote calls should register a unique service name and an object on which the remote calls for that service can be invoked.

Clients wishing to make RPC calls need to know the unique service name, which they can pass to one of the flavors of callRemoteMethods.

NOTE: The purpose of this class is to allow services that want to use a TreeCache to avoid also having to use a HAPartition (and thus potentially requiring a duplicate JGroups Channel).

Version:
$Revision$
Author:
Brian Stansberry

Field Summary
static java.lang.reflect.Method dispatchRpcCallMethod
          Deprecated. The _dispatchRpcCall(String, MethodCall) method
protected  java.util.Map rpcHandlers
          Deprecated. Map of registered RPC handlers
 
Fields inherited from class org.jboss.cache.TreeCache
activationChangeNodes, buddyManager, buddyReplicationConfig, cache_mode, cacheLoaderConfig, cacheLoaderManager, channel, cloaderConfig, cluster_name, cluster_props, coordinator, DEFAULT_REPLICATION_VERSION, disp, evictConfig_, eviction_policy_class, eviction_policy_provider, evictionInterceptorClass, evictionRegionManager_, fetchInMemoryState, hasListeners, inactiveOnStartup, interceptor_chain, internalFqns, INVALIDATION_ASYNC, INVALIDATION_SYNC, isolationLevel, isStandalone, isStateSet, LOCAL, lock_acquisition_timeout, log, marshaller_, members, ml, mux_serviceName, mux_stackName, nodeLockingOptimistic, regionManager_, REPL_ASYNC, repl_queue, repl_queue_interval, repl_queue_max_elements, REPL_SYNC, root, SEPARATOR, setStateException, state_fetch_timeout, sync_commit_phase, sync_repl_timeout, sync_rollback_phase, tm, tm_lookup, tm_lookup_class, UNINITIALIZED, use_interceptor_mbeans, use_repl_queue, useCreateService, useRegionBasedMarshalling, usingEviction
 
Fields inherited from class org.jboss.system.ServiceMBeanSupport
server, SERVICE_CONTROLLER_SIG, serviceName
 
Fields inherited from interface org.jboss.system.ServiceMBean
CREATE_EVENT, CREATED, DESTROY_EVENT, DESTROYED, FAILED, REGISTERED, START_EVENT, STARTED, STARTING, states, STOP_EVENT, STOPPED, STOPPING, UNREGISTERED
 
Constructor Summary
RpcTreeCache()
          Deprecated. Default constructor.
RpcTreeCache(org.jgroups.JChannel channel)
          Deprecated. Expects an already connected channel.
RpcTreeCache(java.lang.String cluster_name, java.lang.String props, long state_fetch_timeout)
          Deprecated. Creates a channel with the given properties.
 
Method Summary
 java.lang.Object _dispatchRpcCall(java.lang.String serviceName, org.jgroups.blocks.MethodCall call)
          Deprecated. Looks up the RPC handler for serviceName and invokes the method call on it.
 java.util.List callRemoteMethods(java.lang.String serviceName, java.util.Vector mbrs, org.jgroups.blocks.MethodCall method_call, boolean synchronous, boolean exclude_self, long timeout)
          Deprecated. Calls a remote method on nodes in the cluster, targeted at objects registered under a given serviceName.
 java.util.List callRemoteMethods(java.lang.String serviceName, java.util.Vector members, java.lang.reflect.Method method, java.lang.Object[] args, boolean synchronous, boolean exclude_self, long timeout)
          Deprecated. Calls a remote method on nodes in the cluster, targeted at objects registered under a given serviceName.
 java.util.List callRemoteMethods(java.lang.String serviceName, java.util.Vector members, java.lang.String method_name, java.lang.Class[] types, java.lang.Object[] args, boolean synchronous, boolean exclude_self, long timeout)
          Deprecated. Calls a remote method on nodes in the cluster, targeted at objects registered under a given serviceName.
 void registerRPCHandler(java.lang.String serviceName, java.lang.Object handler)
          Deprecated. Registers the given object as the on which any MethodCall associated with the given service should be invoked.
 void unregisterRPCHandler(java.lang.String serviceName, java.lang.Object handler)
          Deprecated. Removes the given object as a handler for RPC calls for the given service.
 
Methods inherited from class org.jboss.cache.TreeCache
_addChild, _clusteredGet, _createService, _dataGravitationCleanup, _enqueueMethodCall, _evict, _evict, _evictSubtree, _get, _get, _getAssociatedState, _getChildrenNames, _getData, _getKeys, _getState, _getState, _gravitateData, _loadState, _loadState, _lock, _print, _put, _put, _put, _put, _put, _put, _releaseAllLocks, _remoteAnnounceBuddyPoolName, _remoteAssignToBuddyGroup, _remoteRemoveFromBuddyGroup, _remove, _remove, _remove, _remove, _remove, _remove, _remove, _removeData, _removeData, _removeData, _removeData, _removeData, _replicate, _replicate, _setState, acquireLocksForStateTransfer, activateRegion, addTreeCacheListener, addUndoOperation, block, callRemoteMethods, callRemoteMethods, callRemoteMethods, callRemoteMethods, callRemoteMethods, commit, createEvictionPolicy, createService, createSubtreeRootNode, destroyService, determineCoordinator, dumpTransactionTable, evict, exists, exists, exists, exists, fetchState, fetchStateOnStartup, forceAcquireLock, get, get, get, get, get, get, get, get, getBuddyManager, getBuddyReplicationConfig, getCacheLoader, getCacheLoaderAsynchronous, getCacheLoaderClass, getCacheLoaderConfig, getCacheLoaderConfiguration, getCacheLoaderFetchPersistentState, getCacheLoaderFetchTransientState, getCacheLoaderManager, getCacheLoaderPassivation, getCacheLoaderPreload, getCacheLoaderShared, getCacheMode, getCacheModeInternal, getChildrenNames, getChildrenNames, getChildrenNames, getClusterName, getClusterProperties, getCoordinator, getCurrentTransaction, getCurrentTransaction, getCurrentTransaction, getCurrentTransaction, getDeadlockDetection, getDefaultProperties, getEvictionInterceptorClass, getEvictionPolicyClass, getEvictionPolicyConfig, getEvictionRegionManager, getEvictionThreadWakeupIntervalSeconds, getFetchInMemoryState, getFetchPersistentState, getFetchStateOnStartup, getInitialStateRetrievalTimeout, getInstance, getInterceptorChain, getInterceptors, getInternalFqns, getInvocationContext, getIsolationLevel, getIsolationLevelClass, getKeys, getKeys, getLocalAddress, getLocalTransaction, getLockAcquisitionTimeout, getLockTable, getMarshaller, getMembers, getMessageListener, getMultiplexerService, getMultiplexerStack, getNodeLockingScheme, getNumberOfAttributes, getNumberOfAttributes, getNumberOfLocksHeld, getNumberOfNodes, getOwnerForLock, getPojoCacheConfig, getRegionManager, getReplicationVersion, getReplicationVersionShort, getReplQueue, getReplQueueInterval, getReplQueueMaxElements, getRoot, getStateBytes, getStateTransferVersion, getSyncCommitPhase, getSyncReplTimeout, getSyncRollbackPhase, getTransactionManager, getTransactionManagerLookupClass, getTransactionTable, getTreeCacheListeners, getUseInterceptorMbeans, getUseMarshalling, getUseRegionBasedMarshalling, getUseReplQueue, getVersion, hasChild, inactivateRegion, invokeMethod, isCoordinator, isInactiveOnStartup, isNodeLockingOptimistic, isUsingEviction, load, loadClass, notifyAllNodesCreated, notifyCacheStarted, notifyCacheStopped, notifyCallForInactiveSubtree, notifyNodeActivate, notifyNodeCreated, notifyNodeEvict, notifyNodeEvicted, notifyNodeLoaded, notifyNodeModified, notifyNodeModify, notifyNodePassivate, notifyNodeRemove, notifyNodeRemoved, notifyNodeVisited, notifyViewChange, optimisticPrepare, peek, peek, prepare, print, print, printDetails, printLockInfo, purgeCacheLoaders, put, put, put, put, put, put, putFailFast, putFailFast, registerClassLoader, releaseAllLocks, releaseAllLocks, releaseStateTransferLocks, remove, remove, remove, remove, remove, remove, removeData, removeData, removeTreeCacheListener, rollback, setBuddyReplicationConfig, setCacheLoader, setCacheLoaderAsynchronous, setCacheLoaderClass, setCacheLoaderConfig, setCacheLoaderConfiguration, setCacheLoaderFetchPersistentState, setCacheLoaderFetchTransientState, setCacheLoaderManager, setCacheLoaderPassivation, setCacheLoaderPreload, setCacheLoaderShared, setCacheMode, setCacheMode, setClusterConfig, setClusterName, setClusterProperties, setDeadlockDetection, setEvictionListener, setEvictionPolicyClass, setEvictionPolicyConfig, setEvictionPolicyProvider, setFetchInMemoryState, setFetchStateOnStartup, setInactiveOnStartup, setInitialStateRetrievalTimeout, setInterceptorChain, setInvocationContext, setIsolationLevel, setIsolationLevel, setIsUsingEviction, setLockAcquisitionTimeout, setMultiplexerService, setMultiplexerStack, setNodeLockingOptimistic, setNodeLockingScheme, setPojoCacheConfig, setReplicationVersion, setReplQueueInterval, setReplQueueMaxElements, setStateBytes, setStateTransferVersion, setSyncCommitPhase, setSyncReplTimeout, setSyncRollbackPhase, setTransactionManagerLookup, setTransactionManagerLookupClass, setUseInterceptorMbeans, setUseMarshalling, setUseRegionBasedMarshalling, setUseReplQueue, startService, stopService, string2Mode, suspect, toString, toString, unregisterClassLoader, viewAccepted
 
Methods inherited from class org.jboss.system.ServiceMBeanSupport
create, destroy, getDeploymentInfo, getLog, getName, getNextNotificationSequenceNumber, getObjectName, getServer, getServiceName, getState, getStateString, jbossInternalCreate, jbossInternalDescription, jbossInternalDestroy, jbossInternalLifecycle, jbossInternalStart, jbossInternalStop, postDeregister, postRegister, preDeregister, preRegister, start, stop
 
Methods inherited from class org.jboss.mx.util.JBossNotificationBroadcasterSupport
addNotificationListener, getNotificationInfo, handleNotification, nextNotificationSequenceNumber, removeNotificationListener, removeNotificationListener, sendNotification
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface org.jboss.cache.TreeCacheMBean
_put, _put, _put, _put, _put, _remove, _remove, _remove, _remove, activateRegion, addTreeCacheListener, callRemoteMethods, callRemoteMethods, createService, destroyService, dumpTransactionTable, evict, exists, exists, exists, exists, fetchState, get, get, get, get, get, get, get, getBuddyReplicationConfig, getCacheLoader, getCacheLoaderAsynchronous, getCacheLoaderClass, getCacheLoaderConfig, getCacheLoaderConfiguration, getCacheLoaderFetchPersistentState, getCacheLoaderFetchTransientState, getCacheLoaderPassivation, getCacheLoaderPreload, getCacheLoaderShared, getCacheMode, getChildrenNames, getChildrenNames, getChildrenNames, getClusterName, getClusterProperties, getDeadlockDetection, getEvictionPolicyClass, getEvictionThreadWakeupIntervalSeconds, getFetchInMemoryState, getFetchStateOnStartup, getInitialStateRetrievalTimeout, getInstance, getInterceptorChain, getInterceptors, getIsolationLevel, getKeys, getKeys, getLocalAddress, getLockAcquisitionTimeout, getMembers, getMultiplexerService, getMultiplexerStack, getNodeLockingScheme, getNumberOfAttributes, getNumberOfLocksHeld, getNumberOfNodes, getPojoCacheConfig, getReplicationVersion, getReplQueueInterval, getReplQueueMaxElements, getStateTransferVersion, getSyncCommitPhase, getSyncReplTimeout, getSyncRollbackPhase, getTransactionManager, getTransactionManagerLookupClass, getUseInterceptorMbeans, getUseMarshalling, getUseRegionBasedMarshalling, getUseReplQueue, getVersion, inactivateRegion, isCoordinator, isInactiveOnStartup, isUsingEviction, load, print, print, printDetails, printLockInfo, purgeCacheLoaders, put, put, put, put, put, put, registerClassLoader, releaseAllLocks, releaseAllLocks, remove, remove, remove, remove, remove, remove, removeData, removeData, removeTreeCacheListener, setBuddyReplicationConfig, setCacheLoader, setCacheLoaderAsynchronous, setCacheLoaderClass, setCacheLoaderConfig, setCacheLoaderConfiguration, setCacheLoaderFetchPersistentState, setCacheLoaderFetchTransientState, setCacheLoaderPassivation, setCacheLoaderPreload, setCacheLoaderShared, setCacheMode, setClusterConfig, setClusterName, setClusterProperties, setDeadlockDetection, setEvictionPolicyClass, setEvictionPolicyConfig, setFetchInMemoryState, setFetchStateOnStartup, setInactiveOnStartup, setInitialStateRetrievalTimeout, setIsolationLevel, setLockAcquisitionTimeout, setMultiplexerService, setMultiplexerStack, setNodeLockingScheme, setPojoCacheConfig, setReplicationVersion, setReplQueueInterval, setReplQueueMaxElements, setStateTransferVersion, setSyncCommitPhase, setSyncReplTimeout, setSyncRollbackPhase, setTransactionManagerLookup, setTransactionManagerLookupClass, setUseMarshalling, setUseRegionBasedMarshalling, setUseReplQueue, startService, stopService, toString, unregisterClassLoader
 
Methods inherited from interface org.jboss.system.ServiceMBean
getName, getState, getStateString, jbossInternalLifecycle
 
Methods inherited from interface org.jboss.system.Service
create, destroy, start, stop
 

Field Detail

dispatchRpcCallMethod

public static final java.lang.reflect.Method dispatchRpcCallMethod
Deprecated. 
The _dispatchRpcCall(String, MethodCall) method


rpcHandlers

protected java.util.Map rpcHandlers
Deprecated. 
Map of registered RPC handlers

Constructor Detail

RpcTreeCache

public RpcTreeCache(java.lang.String cluster_name,
                    java.lang.String props,
                    long state_fetch_timeout)
             throws java.lang.Exception
Deprecated. 
Creates a channel with the given properties. Connects to the channel, then creates a PullPushAdapter and starts it

Throws:
java.lang.Exception

RpcTreeCache

public RpcTreeCache()
             throws java.lang.Exception
Deprecated. 
Default constructor.

Throws:
java.lang.Exception

RpcTreeCache

public RpcTreeCache(org.jgroups.JChannel channel)
             throws java.lang.Exception
Deprecated. 
Expects an already connected channel. Creates a PullPushAdapter and starts it

Throws:
java.lang.Exception
Method Detail

callRemoteMethods

public java.util.List callRemoteMethods(java.lang.String serviceName,
                                        java.util.Vector members,
                                        java.lang.reflect.Method method,
                                        java.lang.Object[] args,
                                        boolean synchronous,
                                        boolean exclude_self,
                                        long timeout)
                                 throws java.lang.Exception
Deprecated. 
Calls a remote method on nodes in the cluster, targeted at objects registered under a given serviceName.

Specified by:
callRemoteMethods in interface RpcTreeCacheMBean
Parameters:
serviceName - name of a callback handler that will have been registered on the remote end via registerRPCHandler(String, Object).
members - Vector, each of whose members is the Address of one the nodes in the cache's member list. If null, the method will be invoked on all members.
method - method to execute
args - method arguments
synchronous - true if the call should block until all members respond (or timeout); false if the call should return immediately without waiting for responses
exclude_self - should the call be invoked on the callee?
timeout - how long to wait for synchronous responses
Returns:
List containing the responses that were received, or null if the call is asynchronous. Elements of the list will either be a returned value or an exception if one was returned. Any NoHandlerForRPCException returned will be removed.
Throws:
java.lang.Exception

callRemoteMethods

public java.util.List callRemoteMethods(java.lang.String serviceName,
                                        java.util.Vector mbrs,
                                        org.jgroups.blocks.MethodCall method_call,
                                        boolean synchronous,
                                        boolean exclude_self,
                                        long timeout)
                                 throws java.lang.Exception
Deprecated. 
Calls a remote method on nodes in the cluster, targeted at objects registered under a given serviceName.

If the cache's cache mode is TreeCache.LOCAL and parameter exclude_self is false this request will be made directly to #_dispatchRpcCall().

Specified by:
callRemoteMethods in interface RpcTreeCacheMBean
Parameters:
serviceName - name of a callback handler that will have been registered on the remote end via registerRPCHandler(String, Object).
members - Vector, each of whose members is the Address of one the nodes in the cache's member list. If null, the method will be invoked on all members.
method_call - method call to execute
synchronous - true if the call should block until all members respond (or timeout); false if the call should return immediately without waiting for responses
exclude_self - should the call be invoked on the callee?
timeout - how long to wait for synchronous responses
Returns:
List containing the responses that were received, or null if the call is asynchronous. Elements of the list will either be a returned value or an exception if one was returned. Any NoHandlerForRPCException returned will be removed.
Throws:
java.lang.Exception

callRemoteMethods

public java.util.List callRemoteMethods(java.lang.String serviceName,
                                        java.util.Vector members,
                                        java.lang.String method_name,
                                        java.lang.Class[] types,
                                        java.lang.Object[] args,
                                        boolean synchronous,
                                        boolean exclude_self,
                                        long timeout)
                                 throws java.lang.Exception
Deprecated. 
Calls a remote method on nodes in the cluster, targeted at objects registered under a given serviceName.

Specified by:
callRemoteMethods in interface RpcTreeCacheMBean
Parameters:
serviceName - name of a callback handler that will have been registered on the remote end via registerRPCHandler(String, Object).
members - Vector, each of whose members is the Address of one the nodes in the cache's member list. If null, the method will be invoked on all members.
method_name - name of the method to execute
args - method arguments
synchronous - true if the call should block until all members respond (or timeout); false if the call should return immediately without waiting for responses
exclude_self - should the call be invoked on the callee?
timeout - how long to wait for synchronous responses
Returns:
List containing the responses that were received, or null if the call is asynchronous. Elements of the list will either be a returned value or an exception if one was returned. Any NoHandlerForRPCException returned will be removed.
Throws:
NoHandlerForRPCException - if no handler is registered on this node under serviceName.
java.lang.Exception

registerRPCHandler

public void registerRPCHandler(java.lang.String serviceName,
                               java.lang.Object handler)
Deprecated. 
Registers the given object as the on which any MethodCall associated with the given service should be invoked.

Specified by:
registerRPCHandler in interface RpcTreeCacheMBean
Parameters:
serviceName - name of a service that will be receiving RPC calls
handler - object on which RPC calls for serviceName can be invoked.
See Also:
_dispatchRpcCall(java.lang.String, org.jgroups.blocks.MethodCall)

unregisterRPCHandler

public void unregisterRPCHandler(java.lang.String serviceName,
                                 java.lang.Object handler)
Deprecated. 
Removes the given object as a handler for RPC calls for the given service.

Specified by:
unregisterRPCHandler in interface RpcTreeCacheMBean
Parameters:
serviceName - name of a service that will be receiving RPC calls
handler - object that was previously passed to registerRPCHandler(String, Object) for serviceName.
handler -

_dispatchRpcCall

public java.lang.Object _dispatchRpcCall(java.lang.String serviceName,
                                         org.jgroups.blocks.MethodCall call)
Deprecated. 
Looks up the RPC handler for serviceName and invokes the method call on it.

Parameters:
serviceName - the service
call - the call to invoke
Returns:
the result of the call, or NoHandlerForRPCException if no handler was registered for


Copyright 1998-2005 JBoss Inc . All Rights Reserved.