org.objectweb.perseus.distribution.jgroups

Class JGroupsUserService

Implemented Interfaces:
DistResUserService

public class JGroupsUserService
extends java.lang.Object
implements DistResUserService

Copyright (C) 2003-2004 - France Telecom R&D This library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with this library; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA Release: 1.0 Authors: Olivier Lobry (olivier.lobry@rd.francetelecom.com)

Constructor Summary

JGroupsUserService(JGroupsService drs)

Method Summary

Serializable
getNodeId()
Returns the id of the local node.
DistResUser
getUser(Object resId)
Gets the user interface associated with a given resource identifier.
boolean
joinUsers(Object rId, DistResUser dru)
Request the coordinator(s) to join the users of a resource.
void
sendToCoordinator(Object rId, Serializable message)
Asynchronously sends a message to the coordinator(s).
String
toString()

Constructor Details

JGroupsUserService

public JGroupsUserService(JGroupsService drs)

Method Details

getNodeId

public Serializable getNodeId()
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(Object resId)
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.


joinUsers

public boolean joinUsers(Object rId,
                         DistResUser dru)
            throws UseNotGrantedException,
                   InterruptedException
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:
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


sendToCoordinator

public void sendToCoordinator(Object rId,
                              Serializable message)
            throws NotUserException
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:
message - the message to send

Throws:
NotUserException - if the not is not registered has a user of this resource


toString

public String toString()


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