org.objectweb.perseus.distribution.api
Interface DistResUserService
- JGroupsUserService
public interface DistResUserService
This is the user side interface of a distributed resource service.
It permit resource users to communicate with their respective resource
coordinators. Tipically, the user side of a sharing protocol will use this
interface to communicate with the corresponding coordinator side, while the
coordinator will use the DistResCoordinatorService
interface.
The newLocalNode
of the DistResServiceManager
interface should be used to retrieve this interface.
DistResServiceManager
, DistResUser
, DistResCoordinator
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 resId, DistResUser dru) - Request the coordinator(s) to join the users of a resource.
|
void | sendToCoordinator(Object resId, Serializable message) - Asynchronously sends a message to the coordinator(s).
|
getNodeId
public Serializable getNodeId()
Returns the id of the local node. The identifier can be sent in messages
as it is serializable.
- the id of the local node
getUser
public DistResUser getUser(Object resId)
Gets the user interface associated with a given resource identifier.
resId
- the id of the coresponding resource
- the user interface associated with the resource identifier, null
if there is no correspondance.
joinUsers
public boolean joinUsers(Object resId,
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.
resId
- the id of the related resourcedru
- the user to which messages must be delivered
- true if the user is the first (and only one) user of the resource
UseNotGrantedException
- if the joining has not been accepted
sendToCoordinator
public void sendToCoordinator(Object resId,
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
resId
- the id of the resourcemessage
- the message to send
NotUserException
- if the not is not registered has a user of
this resource
Copyright © 2000-2002 France Telecom S.A., INRIA, IMAG-LSR All Rights Reserved.