Class RPCServiceImpl
- java.lang.Object
-
- org.exoplatform.services.rpc.impl.AbstractRPCService
-
- org.exoplatform.services.rpc.jgv3.RPCServiceImpl
-
- All Implemented Interfaces:
RPCService,org.jgroups.blocks.RequestHandler,org.jgroups.MembershipListener,org.picocontainer.Startable
public class RPCServiceImpl extends AbstractRPCService
This class is the implementation of theAbstractRPCServicefor JGroups 3.- Version:
- $Id$
- Author:
- Nicolas Filotto
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from class org.exoplatform.services.rpc.impl.AbstractRPCService
AbstractRPCService.MemberHasLeftException, AbstractRPCService.MessageBody, AbstractRPCService.State
-
-
Field Summary
-
Fields inherited from class org.exoplatform.services.rpc.impl.AbstractRPCService
channel, CLUSTER_NAME, configurator, coordinator, DEFAULT_RETRY_TIMEOUT, DEFAULT_TIMEOUT, dispatcher, isCoordinator, LOG, members, PARAM_ALLOW_FAILOVER, PARAM_CLUSTER_NAME, PARAM_DEFAULT_TIMEOUT, PARAM_JGROUPS_CONFIG, PARAM_RETRY_TIMEOUT
-
Fields inherited from interface org.exoplatform.services.rpc.RPCService
ACCESS_RPC_SERVICE_PERMISSION
-
-
Constructor Summary
Constructors Constructor Description RPCServiceImpl(org.exoplatform.container.ExoContainerContext ctx, org.exoplatform.container.xml.InitParams params, org.exoplatform.container.configuration.ConfigurationManager configManager)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected org.jgroups.util.RspList<Object>castMessage(List<org.jgroups.Address> dests, org.jgroups.Message msg, boolean synchronous, long timeout)Cast a message to all the given membersprotected org.jgroups.ChannelcreateChannel()Create a channelStringgetHostAddress()Returns the IP address of current channel.protected org.jgroups.AddressgetLocalAddress()Returns the channel's own address.protected List<org.jgroups.Address>getMembers(org.jgroups.View view)Returns a reference to the List of members (ordered) Do NOT change this list, hence your will invalidate the view Make a copy if you have to modify it.protected voidsetObject(org.jgroups.Message m, Object o)Takes an object and uses Java serialization to generate the byte[] buffer which is set in the message.voidunblock()-
Methods inherited from class org.exoplatform.services.rpc.impl.AbstractRPCService
block, excecuteCommand, executeCommandOnAllNodes, executeCommandOnAllNodes, executeCommandOnAllNodesMain, executeCommandOnCoordinator, executeCommandOnCoordinator, executeCommandOnCoordinatorMain, getClusterName, getCommand, getDefaultTimeout, getRetryTimeout, handle, isAllowFailover, isCoordinator, registerCommand, registerTopologyChangeListener, start, stop, suspect, unregisterCommand, unregisterTopologyChangeListener, viewAccepted
-
-
-
-
Method Detail
-
getLocalAddress
protected org.jgroups.Address getLocalAddress()
Returns the channel's own address. The result of calling this method on an unconnected channel is implementation defined (may return null). Calling this method on a closed channel returns null. Successor to #getAddress(). Addresses can be used as destination in thesend()operation.- Specified by:
getLocalAddressin classAbstractRPCService- Returns:
- The channel's address (opaque) or null if it cannot be found
-
getHostAddress
public String getHostAddress()
Returns the IP address of current channel.- Specified by:
getHostAddressin classAbstractRPCService- Returns:
- The Host's address or null if it cannot be found
-
castMessage
protected org.jgroups.util.RspList<Object> castMessage(List<org.jgroups.Address> dests, org.jgroups.Message msg, boolean synchronous, long timeout) throws Exception
Cast a message to all the given members- Specified by:
castMessagein classAbstractRPCService- Parameters:
dests- The members to which the message is to be sent.msg- The message to be sent to the members.synchronous- Indicates whether the message must be sent in synchronous or asynchronous mode.timeout- If 0: wait forever. Otherwise, wait for responses or timeout time.- Returns:
- A list of responses. Each response is an
Objectand associated to its sender. - Throws:
Exception- if any error occur while casting the message
-
createChannel
protected org.jgroups.Channel createChannel() throws ExceptionCreate a channel- Specified by:
createChannelin classAbstractRPCService- Returns:
- An initialized channel
- Throws:
Exception- if any error occur while creating the channel
-
unblock
public void unblock()
-
getMembers
protected List<org.jgroups.Address> getMembers(org.jgroups.View view)
Returns a reference to the List of members (ordered) Do NOT change this list, hence your will invalidate the view Make a copy if you have to modify it.- Specified by:
getMembersin classAbstractRPCService- Returns:
- a reference to the ordered list of members in this view
-
setObject
protected void setObject(org.jgroups.Message m, Object o)Takes an object and uses Java serialization to generate the byte[] buffer which is set in the message.- Specified by:
setObjectin classAbstractRPCService
-
-