org.objectweb.dream.protocol.utobcast
Class ProcessMembershipImpl

java.lang.Object
  extended byorg.objectweb.dream.AbstractComponent
      extended byorg.objectweb.dream.protocol.utobcast.ProcessMembershipImpl
All Implemented Interfaces:
AttributeController, BindingController, LifeCycleController, Loggable, ProcessMembership, ProcessMembershipAttributeController

public class ProcessMembershipImpl
extends AbstractComponent
implements ProcessMembership, ProcessMembershipAttributeController

Implementation of the ProcessMembershipinterface.


Field Summary
 
Fields inherited from class org.objectweb.dream.AbstractComponent
bindingLogger, componentDesc, fcState, firstStart, lifeCycleLogger, logger, weaveableC
 
Fields inherited from interface org.objectweb.dream.protocol.utobcast.ProcessMembership
ITF_NAME
 
Fields inherited from interface org.objectweb.fractal.api.control.LifeCycleController
STARTED, STOPPED
 
Constructor Summary
ProcessMembershipImpl()
          Constructor.
 
Method Summary
 void addProcess(Process process)
          Adds a process to the group of processes.
 void bindFc(String clientItfName, Object serverItf)
           
 Process electBackup()
          Elects a new backup process.
 Process electBackupAsLeader(Process oldLeader)
          Elects the backup as new leader provided the curerntly registered leader is the one given in parameter.
 Process getBackup()
          Returns the backup process.
 boolean getBlocking()
          Returns true if the ProcessMembership component is in blocking mode.
 Process getLeader()
          Returns the leader process.
 Process getMyself()
          Returns the process to which this process membership component belongs.
 Process[] getOtherProcesses()
          Returns an array containing all the processes except backup and leader processes.
 String[] listFc()
           
 void removeProcess(Process process)
          Removes a process from the group of processes.
 void setBackup(Process backup)
          Sets the backup process.
 void setBlocking(boolean blocking)
          Sets the blocking attribute.
 void setLeader(Process leader)
          Sets the leader process.
 void setMyself(Process myself)
          Sets the process to which this process membership component belongs.
 void setOtherProcesses(Process[] processes)
          Sets the processes to be considered for broadcast (except backup and leader).
 void unbindFc(String clientItfName)
           
 
Methods inherited from class org.objectweb.dream.AbstractComponent
beforeFirstStart, getFcState, initComponent, lookupFc, setLogger, startFc, stopFc
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ProcessMembershipImpl

public ProcessMembershipImpl()
Constructor.

Method Detail

getLeader

public Process getLeader()
                  throws InterruptedException
Description copied from interface: ProcessMembership
Returns the leader process.

Specified by:
getLeader in interface ProcessMembership
Returns:
the leader process.
Throws:
InterruptedException
See Also:
ProcessMembership.getLeader()

setLeader

public void setLeader(Process leader)
Description copied from interface: ProcessMembership
Sets the leader process.

Specified by:
setLeader in interface ProcessMembership
Parameters:
leader - the leader to set.
See Also:
ProcessMembership.setLeader(Process)

getBackup

public Process getBackup()
                  throws InterruptedException
Description copied from interface: ProcessMembership
Returns the backup process.

Specified by:
getBackup in interface ProcessMembership
Returns:
the backup process.
Throws:
InterruptedException - if the component is interrupted while waiting for a backup to be elected.
See Also:
ProcessMembership.getBackup()

setBackup

public void setBackup(Process backup)
Description copied from interface: ProcessMembership
Sets the backup process.

Specified by:
setBackup in interface ProcessMembership
Parameters:
backup - the backup to set.
See Also:
ProcessMembership.setBackup(Process)

getMyself

public Process getMyself()
                  throws InterruptedException
Description copied from interface: ProcessMembership
Returns the process to which this process membership component belongs.

Specified by:
getMyself in interface ProcessMembership
Returns:
the process to which this process membership component belongs.
Throws:
InterruptedException
See Also:
ProcessMembership.getMyself()

setMyself

public void setMyself(Process myself)
Description copied from interface: ProcessMembership
Sets the process to which this process membership component belongs.

Specified by:
setMyself in interface ProcessMembership
Parameters:
myself - the process to set.
See Also:
ProcessMembership.setMyself(Process)

setOtherProcesses

public void setOtherProcesses(Process[] processes)
Description copied from interface: ProcessMembership
Sets the processes to be considered for broadcast (except backup and leader).

Specified by:
setOtherProcesses in interface ProcessMembership
Parameters:
processes - all the processes except backup and leader processes.
See Also:
ProcessMembership.setOtherProcesses(org.objectweb.dream.protocol.Process[])

getOtherProcesses

public Process[] getOtherProcesses()
Description copied from interface: ProcessMembership
Returns an array containing all the processes except backup and leader processes.

Specified by:
getOtherProcesses in interface ProcessMembership
Returns:
all the processes except backup and leader processes.
See Also:
ProcessMembership.getOtherProcesses()

addProcess

public void addProcess(Process process)
Description copied from interface: ProcessMembership
Adds a process to the group of processes.

Specified by:
addProcess in interface ProcessMembership
Parameters:
process - the process to be added.
See Also:
ProcessMembership.addProcess(Process)

removeProcess

public void removeProcess(Process process)
Description copied from interface: ProcessMembership
Removes a process from the group of processes.

Specified by:
removeProcess in interface ProcessMembership
Parameters:
process - the process to be removed.
See Also:
ProcessMembership.removeProcess(org.objectweb.dream.protocol.Process)

electBackup

public Process electBackup()
                    throws InterruptedException
Description copied from interface: ProcessMembership
Elects a new backup process. Returns null if no process is available for being elected.

Specified by:
electBackup in interface ProcessMembership
Returns:
the elected backup, null if no process is available.
Throws:
InterruptedException - if the component is interrupted while waiting for a process to be added in the group.
See Also:
ProcessMembership.electBackup()

electBackupAsLeader

public Process electBackupAsLeader(Process oldLeader)
Description copied from interface: ProcessMembership
Elects the backup as new leader provided the curerntly registered leader is the one given in parameter. Otherwise, don't do anything.

Specified by:
electBackupAsLeader in interface ProcessMembership
Parameters:
oldLeader - the process that were supposed to be the old leader.
Returns:
the new leader.
See Also:
ProcessMembership.electBackupAsLeader(org.objectweb.dream.protocol.Process)

setBlocking

public void setBlocking(boolean blocking)
Description copied from interface: ProcessMembershipAttributeController
Sets the blocking attribute. If this attribute is set to true, then the ProcessMembership component is in blocking mode, which means that its methods defined in the server interface it provides block until they can return a meaningful result. For instance calling the ProcessMembership.getLeader()method would block is no leader is currently elected.

Specified by:
setBlocking in interface ProcessMembershipAttributeController
Parameters:
blocking - the value to set.
See Also:
ProcessMembershipAttributeController.setBlocking(boolean)

getBlocking

public boolean getBlocking()
Description copied from interface: ProcessMembershipAttributeController
Returns true if the ProcessMembership component is in blocking mode.

Specified by:
getBlocking in interface ProcessMembershipAttributeController
Returns:
true if the ProcessMembership component is in blocking mode.
See Also:
ProcessMembershipAttributeController.getBlocking()

bindFc

public void bindFc(String clientItfName,
                   Object serverItf)
            throws NoSuchInterfaceException,
                   IllegalBindingException,
                   IllegalLifeCycleException
Specified by:
bindFc in interface BindingController
Throws:
NoSuchInterfaceException
IllegalBindingException
IllegalLifeCycleException
See Also:
BindingController.bindFc(java.lang.String, java.lang.Object)

unbindFc

public void unbindFc(String clientItfName)
              throws NoSuchInterfaceException,
                     IllegalBindingException,
                     IllegalLifeCycleException
Specified by:
unbindFc in interface BindingController
Throws:
NoSuchInterfaceException
IllegalBindingException
IllegalLifeCycleException
See Also:
BindingController.unbindFc(java.lang.String)

listFc

public String[] listFc()
Specified by:
listFc in interface BindingController
See Also:
BindingController.listFc()


Copyright © 2003, 2004 - INRIA Rhone-Alpes - All Rights Reserved.