org.objectweb.perseus.distribution.jgroups
Class JGroupsUserService

java.lang.Object
  extended byorg.objectweb.perseus.distribution.jgroups.JGroupsUserService
All Implemented Interfaces:
DistResUserService

public class JGroupsUserService
extends java.lang.Object
implements DistResUserService


Constructor Summary
JGroupsUserService(JGroupsService drs)
           
 
Method Summary
 java.io.Serializable getNodeId()
          Returns the id of the local node.
 DistResUser getUser(java.lang.Object resId)
          Gets the user interface associated with a given resource identifier.
 boolean joinUsers(java.lang.Object rId, DistResUser dru)
          Request the coordinator(s) to join the users of a resource.
 void sendToCoordinator(java.lang.Object rId, java.io.Serializable message)
          Asynchronously sends a message to the coordinator(s).
 java.lang.String toString()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

JGroupsUserService

public JGroupsUserService(JGroupsService drs)
Method Detail

joinUsers

public boolean joinUsers(java.lang.Object rId,
                         DistResUser dru)
                  throws UseNotGrantedException,
                         java.lang.InterruptedException
Description copied from interface: DistResUserService
Request the coordinator(s) to join the users of a resource. This is a synchronous operation which is accepted only if all coordinators have accepted the node as a new user member.

Specified by:
joinUsers in interface DistResUserService
Parameters:
rId - the id of the related resource
dru - the user to which messages must be delivered
Returns:
true if the user is the first (and only one) user of the resource
Throws:
UseNotGrantedException - if the joining has not been accepted
java.lang.InterruptedException - if the thread has been interrupted during the operation

sendToCoordinator

public void sendToCoordinator(java.lang.Object rId,
                              java.io.Serializable message)
                       throws NotUserException
Description copied from interface: DistResUserService
Asynchronously sends a message to the coordinator(s). A FIFO delivery is guaranteed for each resource, that is, the receive method of the coordinator will be called in the same order that the call to this method with the same resource id. Also, either the coordinator will receive the message once and only once, or the user will be excluded from the users

Specified by:
sendToCoordinator in interface DistResUserService
Parameters:
rId - the id of the resource
message - the message to send
Throws:
NotUserException - if the not is not registered has a user of this resource

getNodeId

public java.io.Serializable getNodeId()
Description copied from interface: DistResUserService
Returns the id of the local node. The identifier can be sent in messages as it is serializable.

Specified by:
getNodeId in interface DistResUserService
Returns:
the id of the local node

getUser

public DistResUser getUser(java.lang.Object resId)
Description copied from interface: DistResUserService
Gets the user interface associated with a given resource identifier.

Specified by:
getUser in interface DistResUserService
Parameters:
resId - the id of the coresponding resource
Returns:
the user interface associated with the resource identifier, null if there is no correspondance.

toString

public java.lang.String toString()


Copyright © 2000-2002 France Telecom S.A., INRIA, IMAG-LSR All Rights Reserved.