|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectde.uniba.wiai.lspi.chord.com.Endpoint
de.uniba.wiai.lspi.chord.com.local.ThreadEndpoint
public final class ThreadEndpoint
This represents the Endpoint for the protocol that can be used to
build a (local) chord network within one JVM.
| Field Summary | |
|---|---|
protected List<InvocationListener> |
invocationListeners
Listof listenersthat want to be
notified if a method is invoked on this endpoint. |
protected Registry |
registry
The registryof local endpoints. |
| Fields inherited from class de.uniba.wiai.lspi.chord.com.Endpoint |
|---|
ACCEPT_ENTRIES, DISCONNECTED, endpoints, LISTENING, METHODS_ALLOWED_IN_ACCEPT_ENTRIES, node, STARTED, url |
| Constructor Summary | |
|---|---|
ThreadEndpoint(Node node1,
URL url1)
Creates a new Endpoint for communication via Java Threads. |
|
| Method Summary | |
|---|---|
protected void |
closeConnections()
This method has to be overwritten by sub classes and is invoked by Endpoint.disconnect()to close all connections from the chord network. |
void |
crash()
Method to emulate a crash of the node that this is the endpoint for. |
protected void |
entriesAcceptable()
This method has to be overwritten by subclasses. |
boolean |
equals(Object obj)
Overwritten from Object. |
Node |
findSuccessor(ID key)
|
ID |
getNodeID()
|
int |
hashCode()
Overwritten from Object. |
void |
insertEntry(Entry entry)
|
void |
insertReplicas(Set<Entry> entries)
|
void |
leavesNetwork(Node predecessor)
|
List<Node> |
notify(Node potentialPredecessor)
|
RefsAndEntries |
notifyAndCopyEntries(Node potentialPredecessor)
|
protected void |
openConnections()
To implemented by sub classes. |
void |
ping()
|
void |
register(InvocationListener listener)
|
void |
removeEntry(Entry entry)
|
void |
removeReplicas(ID sendingNodeID,
Set<Entry> entriesToRemove)
|
Set<Entry> |
retrieveEntries(ID id)
|
String |
toString()
Overwritten from Object. |
| Methods inherited from class de.uniba.wiai.lspi.chord.com.Endpoint |
|---|
acceptEntries, createEndpoint, deregister, disconnect, getEndpoint, getNode, getState, getURL, listen, notify, register, setState |
| Methods inherited from class java.lang.Object |
|---|
clone, finalize, getClass, notify, notifyAll, wait, wait, wait |
| Field Detail |
|---|
protected final Registry registry
registryof local endpoints.
protected List<InvocationListener> invocationListeners
Listof listenersthat want to be
notified if a method is invoked on this endpoint.
| Constructor Detail |
|---|
public ThreadEndpoint(Node node1,
URL url1)
node1 - The Nodethis endpoint invocates methods on.url1 - The URLof this endpoint. The hostname of url is the
name of the node.| Method Detail |
|---|
public ID getNodeID()
Node.notify(Node). See documentation
of Node.public void register(InvocationListener listener)
listener -
public Node findSuccessor(ID key)
throws CommunicationException
key -
key.
CommunicationException
public void insertEntry(Entry entry)
throws CommunicationException
entry -
CommunicationException
public void removeEntry(Entry entry)
throws CommunicationException
entry -
CommunicationException
public List<Node> notify(Node potentialPredecessor)
throws CommunicationException
potentialPredecessor -
Node.notify(Node). See documentation
of Node.
CommunicationException
public void ping()
throws CommunicationException
CommunicationException
public Set<Entry> retrieveEntries(ID id)
throws CommunicationException
id -
CommunicationException
public void leavesNetwork(Node predecessor)
throws CommunicationException
predecessor -
CommunicationException
public void removeReplicas(ID sendingNodeID,
Set<Entry> entriesToRemove)
throws CommunicationException
sendingNodeID - entriesToRemove -
CommunicationException
public void insertReplicas(Set<Entry> entries)
throws CommunicationException
entries -
CommunicationException
public RefsAndEntries notifyAndCopyEntries(Node potentialPredecessor)
throws CommunicationException
potentialPredecessor -
Node.notify(Node). See documentation
of Node.
CommunicationExceptionprotected void openConnections()
EndpointEndpoint.listen()to
make it possible for other chord nodes to connect to the node on that
this endpoint invocates methods.
TODO: This method may throw an exception when starting to listen for
incoming connections.
openConnections in class Endpointprotected void closeConnections()
EndpointEndpoint.disconnect()to close all connections from the chord network.
closeConnections in class Endpointprotected void entriesAcceptable()
EndpointEndpoint.acceptEntries()to indicate that entries can now be accepted. So
maybe if an endpoint queues incoming requests for storage or removal of
entries this requests can be answered when endpoint changes it state to
ACCEPT_ENTRIES.
entriesAcceptable in class Endpointpublic void crash()
public boolean equals(Object obj)
Object. Two ThreadEndpoints A and B
are equal if they are endpoints for the node with the same name. (A.name ==
B.name).
equals in class Objectobj -
true if this equals the provided obj.public int hashCode()
Object.
hashCode in class ObjectObject.public String toString()
Object.
toString in class Endpoint
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||