パッケージ org.piax.gtrans.ov.ddll
クラス Node
java.lang.Object
org.piax.gtrans.ov.ddll.Node
public class Node extends Object
a DDLL node.
this class contains an implementation of DDLL protocol.
-
ネストされたクラスの概要
ネストされたクラス 修飾子とタイプ クラス 説明 static classNode.InsertionResulta class representing a result of insertion.static classNode.InsertPointa class representing an insertion point in a linked-list.static classNode.ModeDDLL node state -
フィールドの概要
フィールド 修飾子とタイプ フィールド 説明 static intDEFAULT_CHECK_PERIODfix処理を定期実行するための基準となる周期 (msec)static intDEFAULT_TIMEOUTstatic intDELETE_OP_TIMEOUTstatic intGETSTAT_OP_TIMEOUTtimeout for a response of GetStat message in msec. if the left node does not respond within this period, the left node is considered failed.static intINS_DEL_RETRY_INTERVAL_BASEstatic intMIN_FIX_INTERVALminimum interval of fixing To avoid rush of fixing, make minimum interval between fixing.static intSEARCH_OP_TIMEOUTstatic intSETR_TIMEOUT -
メソッドの概要
修飾子とタイプ メソッド 説明 booleandelete(int maxRetry)delete this node from the linked-list.protected booleandelete0()delete this node from the linked-list.voidfin()voidfindNearest(Link sender, int reqNo, DdllKey searchKey, Link prevKey)DdllKeygetKey()LinkgetLeft()Node.ModegetMode()LinkgetMyLink()List<Link>getNeighborSet()LinkgetRight()voidgetStat(Link sender, int reqNo)static voidinitializeConnectedNodes(List<Node> list)Node.InsertionResultinsert(Node.InsertPoint pos)insert this node to a linked-list by specifying the immediate left and right nodes.Node.InsertionResultinsert(Link introducer, int maxRetry)insert this node to a linked-list by specifying an introducer node, which is an arbitrary node that has been inserted to the linked-list.protected Node.InsertionResultinsert0(Node.InsertPoint p)insert a node between two nodes specified by anNode.InsertPointinstance.voidinsertAsInitialNode()Insert this node as the initial node.booleanisBetween(DdllKey a, DdllKey c)booleanisOnline()static booleanisOrdered(Comparable<?> from, boolean fromInclusive, Comparable<?> val, Comparable<?> to, boolean toInclusive)推奨されていません。static booleanisOrdered(Comparable<?> a, Comparable<?> b, Comparable<?> c)推奨されていません。voidlock()voidoffline()inactivate the protocol.voidonline()activate the protocol.voidreset()forcibly delete this node without notifying other nodesvoidsetCheckPeriod(int period)voidsetFindNext(int reqNo, Link next, Link prevKey)voidsetFindResult(int reqNo, Link left, Link right)voidsetL(Link lNew, LinkSeq lNewNum, Link prevL, Set<Link> nbrs)protected voidsetLeft(Link left)protected voidsetLeftNum(LinkSeq lNum)protected voidsetMode(Node.Mode mode)voidsetR(Link sender, int reqNo, Link rNew, Link rCur, LinkSeq rNewNum, int type, Object payload)SetR message handler.voidsetRAck(Link sender, int reqNo, LinkSeq zNum, Set<Link> nbrs)SetRAck message handler.protected voidsetRef(int r)protected voidsetRight(Link right)protected voidsetRightNum(LinkSeq rNum)voidsetRNak(Link sender, int reqNo, Link curR)SetRNak message handler.voidstartfix(Collection<Link> failedLinks, Object payload)voidstartfix(Collection<Link> failedLinks, Object payload, boolean force)start fixing `failedLinks'.voidstartFix(Collection<Link> failedLinks)start fixing set of failed links.voidstartFix(Link failed)voidstartFix(Link failed, boolean force)start fixing a single failed link.StringtoString()voidunlock()voidunrefL(Link sender)
-
フィールド詳細
-
DEFAULT_TIMEOUT
public static int DEFAULT_TIMEOUT -
SETR_TIMEOUT
public static int SETR_TIMEOUT -
DELETE_OP_TIMEOUT
public static int DELETE_OP_TIMEOUT -
SEARCH_OP_TIMEOUT
public static int SEARCH_OP_TIMEOUT -
GETSTAT_OP_TIMEOUT
public static int GETSTAT_OP_TIMEOUTtimeout for a response of GetStat message in msec. if the left node does not respond within this period, the left node is considered failed. TODO: change timeout adaptively -
INS_DEL_RETRY_INTERVAL_BASE
public static final int INS_DEL_RETRY_INTERVAL_BASE- 関連項目:
- 定数フィールド値
-
MIN_FIX_INTERVAL
public static int MIN_FIX_INTERVALminimum interval of fixing To avoid rush of fixing, make minimum interval between fixing. -
DEFAULT_CHECK_PERIOD
public static int DEFAULT_CHECK_PERIODfix処理を定期実行するための基準となる周期 (msec)
-
-
メソッドの詳細
-
online
public void online()activate the protocol. -
offline
public void offline()inactivate the protocol. -
isOnline
public boolean isOnline() -
fin
public void fin() -
getMyLink
-
getKey
-
getMode
-
setMode
-
setCheckPeriod
public void setCheckPeriod(int period) -
setLeft
-
setLeftNum
-
getLeft
-
getRight
-
setRight
-
setRightNum
-
setRef
protected void setRef(int r) -
getNeighborSet
-
toString
-
reset
public void reset()forcibly delete this node without notifying other nodes -
lock
public void lock() -
unlock
public void unlock() -
isOrdered
推奨されていません。 -
isOrdered
@Deprecated public static boolean isOrdered(Comparable<?> from, boolean fromInclusive, Comparable<?> val, Comparable<?> to, boolean toInclusive)推奨されていません。 -
isBetween
-
insertAsInitialNode
public void insertAsInitialNode()Insert this node as the initial node. This node becomes the first node in the network. -
initializeConnectedNodes
-
insert
insert this node to a linked-list by specifying an introducer node, which is an arbitrary node that has been inserted to the linked-list.note that this method may take O(N) steps for finding proper insertion point and thus, should not be used for large linked-list.
- パラメータ:
introducer- some node that has been inserted to a linked-listmaxRetry- max retry count- 戻り値:
- insertion result
- 例外:
IllegalStateException- thrown if the node is already inserted
-
insert
insert this node to a linked-list by specifying the immediate left and right nodes.note that this method does not retry insertion when failed.
- パラメータ:
pos- the insert point, which contains the immediate left and right node of this node.- 戻り値:
- insertion result
- 例外:
IllegalStateException- thrown if the node is already inserted
-
insert0
insert a node between two nodes specified by anNode.InsertPointinstance.- パラメータ:
p- insertion point- 戻り値:
- true if successfully inserted, false otherwise
-
delete
delete this node from the linked-list. if the DDLL protocol fails to delete this node after maxRetry retries, the node is forcibly deleted and returns false.- パラメータ:
maxRetry- max retry- 戻り値:
- true if successfully deleted
- 例外:
IllegalStateException- thrown if node is not inserted
-
delete0
delete this node from the linked-list.- 戻り値:
- true if successfully deleted
- 例外:
OfflineSendException- thrown if this node is offline
-
setR
public void setR(Link sender, int reqNo, Link rNew, Link rCur, LinkSeq rNewNum, int type, Object payload)SetR message handler.pseudo code: (A2) receive SetR(rnew , rcur , rnewnum , incr) from q → if ((s ̸= in ∧ s ̸= lwait) ∨ r ̸= rcur) then send SetRNak() to q else send SetRAck(rnum) to q; r, rnum, ref := rnew, rnewnum, ref + incr fi
- パラメータ:
sender- the sender of this SetR messagereqNo- request numberrNew- the new right link numberrCur- the current right link that this node should haverNewNum- the new right linktype- the type of SetRpayload- the optional data transferred along with the SetR message
-
setRAck
SetRAck message handler.pseudo code: (A3) receive SetRAck(znum) from q → if (s = jng) then s, rnum, ref := in, znum.next(), 1; send SetL(u, rnum, l) to r elseif (s = lvg) then s := grace; send SetL(l, rnum.next(), u) to r elseif (s = fix) then s := in fi- パラメータ:
sender- the sender of this SetRAck messagereqNo- request numberzNum- the previous right link number of the sender nodenbrs- neighbor node set
-
setRNak
SetRNak message handler.pseudo code: (A4) receive SetRNak() from q → if (s = jng) then s := jwait elseif (s = lvg) then s := lwait elseif (fixing) then fixing := false fi
- パラメータ:
sender- the sender of this SetRNak messagereqNo- request numbercurR- current right link of the sender node
-
setL
-
unrefL
-
setFindResult
-
setFindNext
-
findNearest
-
getStat
-
startFix
start fixing a single failed link.- パラメータ:
failed- the failed link.force- true if you want to check the left node even if it is not equals to `failed'.
-
startFix
-
startFix
start fixing set of failed links.- パラメータ:
failedLinks- the failed links.
-
startfix
-
startfix
start fixing `failedLinks'. `payload' is piggy-backed by SetR message if it is non-null.- パラメータ:
failedLinks- the failed links.payload- the payload object.force- true if you want to check the left node even if it is not contained in `failedLinks'.
-