public class NodeSessionBean extends BaseNode implements NodeSessionBeanLocal
Modifier and Type | Field and Description |
---|---|
private javax.ejb.SessionContext |
context |
private DBConnectionSingletonSessionBeanLocal |
dBConnectionSingletonSessionBean
CONFIG VARS END
|
private FingerSessionBeanLocal |
fingerSessionBean |
private static int |
FIXFINGER_MULT |
private static int |
JOIN_MULT |
private NodeReference |
joinEntryPoint |
private static int |
PERIOD
CONFIGS for the timers of periodically called methods
|
private RingSessionBeanLocal |
ringSessionBean |
private static int |
STABILIZE_MULT |
private Storage |
storage |
Constructor and Description |
---|
NodeSessionBean() |
Modifier and Type | Method and Description |
---|---|
void |
bootstrap(NodeReference nodeRef)
TODO
|
private boolean |
checkPredecessor()
Ping/Healthcheck of the predecessor
|
private void |
create()
Create new Chord Ring with only "myself"
|
List<GenericValue> |
delete(Key key)
Remove from the storage of the node executing this method
|
private void |
fillFingertable()
Fill the fingerTable
|
NodeReference |
findSuccessor(Key key)
findSuccessor primitive of chord protocol
|
private void |
fixFingers()
Fix fingerTable (recreates and Swap with LockWrite).
|
List<GenericValue> |
get(Key key)
Get a List of Values stored in the storage of the node executing this method with the given Key
|
private Boolean |
getHasJoined() |
List<GenericValue> |
getLessThanAndRemove(Key key) |
private BaseNode |
getPredecessor() |
NodeReference |
getPredecessorNodeRef()
Get the NodeReference of the Predecessor if it is set
|
private BaseNode |
getReference(NodeReference nodeReference)
get a NodeReference (to himSelf or as a RemoteNodeProxy for another peer)
|
private BaseNode |
getSuccessor() |
private void |
init() |
private boolean |
isLocal(BaseNode obj)
if the BaseNode given is himself returns true
|
private boolean |
isLocal(NodeReference obj)
if the NodeReference given is himself returns true
|
private boolean |
isPredecessor(NodeReference obj)
returns true if the NodeReference given is the predecessor
|
private Boolean |
join(NodeReference entryPoint)
Join a ring using an entry point
|
List<GenericValue> |
lookup(Key key)
Get a NodeReference to the successor of the given Key and make a Get in the associated peer
|
private void |
moveKeys() |
NodeReference |
notify(NodeReference nodeRef)
Notify primitive of the Chord Protocol
|
Boolean |
put(GenericValue elem)
Store a value in the storage of the node executing this method
|
Boolean |
put(List<GenericValue> elems)
Sore a list of GenericValue in the storage of the node executing this method
|
List<GenericValue> |
remove(Key key)
Remove a Key-Value from the successor associated with the given Key
|
private void |
setHasJoined(Boolean hasJoined) |
private void |
setPredecessor(BaseNode predecessor) |
private void |
setSuccessor(BaseNode successor) |
private void |
stabilize()
Stabilize the ring.
|
void |
timeout(javax.ejb.Timer timer) |
Boolean |
update(Key key,
List<GenericValue> elems)
Update a Key-Value record from the successor associated with the given key
|
Boolean |
write(Key key,
GenericValue elem)
Get a NodeReference to the successor of the given Key and make a put in the associated peer
|
getNodeReference
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
getNodeReference
private static final int PERIOD
private static final int JOIN_MULT
private static final int STABILIZE_MULT
private static final int FIXFINGER_MULT
private DBConnectionSingletonSessionBeanLocal dBConnectionSingletonSessionBean
private FingerSessionBeanLocal fingerSessionBean
private RingSessionBeanLocal ringSessionBean
private Storage storage
private NodeReference joinEntryPoint
private javax.ejb.SessionContext context
@PostConstruct private void init()
public void timeout(javax.ejb.Timer timer)
private void create()
private Boolean join(NodeReference entryPoint)
entryPoint
- |public NodeReference notify(NodeReference nodeRef)
private void stabilize()
public void bootstrap(NodeReference nodeRef)
private void moveKeys()
public List<GenericValue> getLessThanAndRemove(Key key)
getLessThanAndRemove
in interface ChordNode
key
- |private void fillFingertable()
private void fixFingers()
public List<GenericValue> get(Key key)
public Boolean put(GenericValue elem)
public Boolean put(List<GenericValue> elems)
public List<GenericValue> delete(Key key)
public List<GenericValue> lookup(Key key)
lookup
in interface NodeSessionBeanLocal
key
- |public Boolean write(Key key, GenericValue elem)
write
in interface NodeSessionBeanLocal
key
- |elem
- |public List<GenericValue> remove(Key key)
remove
in interface NodeSessionBeanLocal
key
- |public Boolean update(Key key, List<GenericValue> elems)
update
in interface NodeSessionBeanLocal
key
- |elems
- |public NodeReference findSuccessor(Key key)
findSuccessor
in interface ChordNode
key
- |private BaseNode getReference(NodeReference nodeReference)
nodeReference
- |private boolean isLocal(BaseNode obj)
obj
- |private boolean isLocal(NodeReference obj)
obj
- |private boolean isPredecessor(NodeReference obj)
obj
- |private boolean checkPredecessor()
public NodeReference getPredecessorNodeRef()
getPredecessorNodeRef
in interface ChordNode
private BaseNode getSuccessor()
private void setSuccessor(BaseNode successor)
successor
- the successor to set |private BaseNode getPredecessor()
private void setPredecessor(BaseNode predecessor)
predecessor
- the predecessor to set |private Boolean getHasJoined()
private void setHasJoined(Boolean hasJoined)
hasJoined
- the hasJoined to set |Copyright © 2018. All rights reserved.