|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object p2p.simulator.protocol.Peer
public abstract class Peer
The class Peer should be implemented by all user defined protocols. This class defines the basic peer-to-peer operations and the basic management methods.
Constructor Summary | |
---|---|
Peer()
|
Method Summary | |
---|---|
java.lang.Object |
clone()
Creates and returns an instance of class peer. |
abstract void |
delete(long key)
This method is called by the simulator in order the peer to perform a key deletion. |
abstract int |
getNumOfKeys()
Returns the number of keys stored in the peer. |
abstract long |
getPeerId()
Returns the peer's identifier. |
abstract int |
getPendingQueries()
Returns the number of pending queries. |
abstract int |
getRTSize()
Returns the size of the peer's routing table. |
abstract java.lang.Thread.State |
getState()
Returns the peer's state regarding its thread state. |
abstract void |
init(long id,
long N,
long K,
Network Net)
Initializes a peer. |
abstract void |
insert(long key)
This method is called by the simulator in order the peer to perform a key insertion. |
abstract boolean |
isOnline()
Returns true if the peer is ready to service any request, false otherwise. |
abstract void |
joinPeer()
This method is called by the simulator in order to connect the peer to the overlay. |
abstract void |
leavePeer()
This method is called by the simulator in order to remove the peer from the overlay. |
abstract void |
lookup(long key)
This method is called by the simulator in order the peer to perform a key lookup. |
abstract void |
registerLogger(java.util.logging.Logger logger)
Attaches the simulator's logger. |
abstract void |
run()
Overides the method run of the Runnable interface. |
abstract void |
setState(java.lang.Thread.State state)
Sets the peer's state regarding its thread state. |
Methods inherited from class java.lang.Object |
---|
equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public Peer()
Method Detail |
---|
public abstract void init(long id, long N, long K, Network Net)
id
- The id of the peer.N
- The total number of overlay peers.K
- The key space of the overlay.Net
- A Network instance.public abstract void run()
run
in interface java.lang.Runnable
public abstract long getPeerId()
public abstract int getNumOfKeys()
public abstract boolean isOnline()
public abstract void setState(java.lang.Thread.State state)
run
method should set its state to TERMINATED before exit.
state
- The peer's state.public abstract java.lang.Thread.State getState()
public abstract void joinPeer()
public abstract void leavePeer()
public abstract void lookup(long key)
key
- The key is being searched.public abstract void insert(long key)
key
- The key is being inserted.public abstract void delete(long key)
key
- The key is being deleted.public abstract void registerLogger(java.util.logging.Logger logger)
logger
- The simulator's logger.public abstract int getRTSize()
public abstract int getPendingQueries()
public java.lang.Object clone() throws java.lang.CloneNotSupportedException
clone
in class java.lang.Object
java.lang.CloneNotSupportedException
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |