org.exoplatform.services.jcr.ext.replication.priority
Class AbstractPriorityChecker

java.lang.Object
  extended by org.exoplatform.services.jcr.ext.replication.priority.AbstractPriorityChecker
All Implemented Interfaces:
PacketListener
Direct Known Subclasses:
DynamicPriorityChecker, GenericPriorityChecker, StaticPriorityChecker

public abstract class AbstractPriorityChecker
extends java.lang.Object
implements PacketListener

Created by The eXo Platform SAS.

Version:
$Id: AbstractPriorityChecker.java 35186 2009-08-07 14:23:43Z pnedonosko $
Author:
Alex Reshetnyak

Field Summary
protected  ChannelManager channelManager
          The ChannalManager will be transmitted the Packets.
protected  java.util.HashMap<java.lang.String,java.lang.Integer> currentParticipants
          The HashMap of participants who are now online.
protected  java.lang.String identifier
          The identification string.
static int MAX_PRIORITY
          The definition max priority value.
protected  MemberListener memberListener
          The MemberListener.
protected  java.util.List<java.lang.String> otherParticipants
          The list of names to other participants cluster.
protected  java.lang.String ownName
          The own name in cluster.
protected  int ownPriority
          The own priority value.
 
Constructor Summary
AbstractPriorityChecker(ChannelManager channelManager, int ownPriority, java.lang.String ownName, java.util.List<java.lang.String> otherParticipants)
          AbstractPriorityChecker constructor.
 
Method Summary
 void informAll()
          informAll.
 boolean isAllOnline()
          isAllOnline.
 boolean isMaxOnline()
          isMaxOnline.
abstract  boolean isMaxPriority()
          isMaxPriority.
protected  void printOnlineMembers()
          printOnlineMembers.
abstract  void receive(Packet packet)
          receive.
 void setMemberListener(MemberListener memberListener)
          setMemberListener.
protected  void waitView()
          waitView.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

MAX_PRIORITY

public static final int MAX_PRIORITY
The definition max priority value.

See Also:
Constant Field Values

channelManager

protected final ChannelManager channelManager
The ChannalManager will be transmitted the Packets.


ownPriority

protected final int ownPriority
The own priority value.


ownName

protected final java.lang.String ownName
The own name in cluster.


otherParticipants

protected final java.util.List<java.lang.String> otherParticipants
The list of names to other participants cluster.


currentParticipants

protected java.util.HashMap<java.lang.String,java.lang.Integer> currentParticipants
The HashMap of participants who are now online.


identifier

protected java.lang.String identifier
The identification string.


memberListener

protected MemberListener memberListener
The MemberListener.

Constructor Detail

AbstractPriorityChecker

public AbstractPriorityChecker(ChannelManager channelManager,
                               int ownPriority,
                               java.lang.String ownName,
                               java.util.List<java.lang.String> otherParticipants)
AbstractPriorityChecker constructor.

Parameters:
channelManager - the ChannelManager
ownPriority - the own priority value
ownName - the own name
otherParticipants - the list of names to other participants.
Method Detail

receive

public abstract void receive(Packet packet)
receive. Will be called this method when receive the Packet.

Specified by:
receive in interface PacketListener
Parameters:
packet - the Packet object.

informAll

public void informAll()
informAll. If was changed members in cluster, then will be called this method.


printOnlineMembers

protected void printOnlineMembers()
printOnlineMembers. Write to console the current members.


setMemberListener

public void setMemberListener(MemberListener memberListener)
setMemberListener.

Parameters:
memberListener - the MemberListener

isMaxPriority

public abstract boolean isMaxPriority()
isMaxPriority.

Returns:
boolean if current time this is max priority then return 'true'

isMaxOnline

public boolean isMaxOnline()
isMaxOnline.

Returns:
boolean if max priority member is online then return 'true'

isAllOnline

public boolean isAllOnline()
isAllOnline.

Returns:
boolean if all member is online then return 'true'

waitView

protected final void waitView()
                       throws java.lang.InterruptedException
waitView.

Throws:
java.lang.InterruptedException - Will be generated the InterruptedException


Copyright © 2011 eXo Platform SAS. All Rights Reserved.