Rice Pastry API

rice.pastry.socket
Class SocketNodeHandleFactory

java.lang.Object
  extended by rice.pastry.socket.SocketNodeHandleFactory
All Implemented Interfaces:
Serializer<SocketNodeHandle>, NodeHandleFactory<SocketNodeHandle>
Direct Known Subclasses:
RendezvousSNHFactory

public class SocketNodeHandleFactory
extends java.lang.Object
implements NodeHandleFactory<SocketNodeHandle>, Serializer<SocketNodeHandle>


Field Summary
protected  java.util.Map<SocketNodeHandle,SocketNodeHandle> handleSet
           
protected  java.util.Collection<NodeHandleFactoryListener<SocketNodeHandle>> listeners
           
protected  PastryNode pn
           
 
Constructor Summary
SocketNodeHandleFactory(PastryNode pn)
           
 
Method Summary
 void addNodeHandleFactoryListener(NodeHandleFactoryListener<SocketNodeHandle> listener)
           
 SocketNodeHandle coalesce(SocketNodeHandle h)
          Needed for legacy java deserialization of NodeHanlde because we aren't given any other way to do this properly such as a protected constructor.
 SocketNodeHandle deserialize(InputBuffer buf)
           
 SocketNodeHandle getNodeHandle(MultiInetSocketAddress i, long epoch, Id id)
          This is kind of weird, may need to rethink this.
protected  void notifyListeners(SocketNodeHandle nh)
          Notify the listeners that this new handle has come along.
 SocketNodeHandle readNodeHandle(InputBuffer buf)
           
 void removeNodeHandleFactoryListener(NodeHandleFactoryListener<SocketNodeHandle> listener)
           
 void serialize(SocketNodeHandle i, OutputBuffer buf)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

pn

protected PastryNode pn

handleSet

protected java.util.Map<SocketNodeHandle,SocketNodeHandle> handleSet

listeners

protected java.util.Collection<NodeHandleFactoryListener<SocketNodeHandle>> listeners
Constructor Detail

SocketNodeHandleFactory

public SocketNodeHandleFactory(PastryNode pn)
Method Detail

getNodeHandle

public SocketNodeHandle getNodeHandle(MultiInetSocketAddress i,
                                      long epoch,
                                      Id id)
This is kind of weird, may need to rethink this. This is called to build one w/o deserializing anything. (Either the local node, or one with a bogus id).

Parameters:
i -
id -
Returns:

readNodeHandle

public SocketNodeHandle readNodeHandle(InputBuffer buf)
                                throws java.io.IOException
Specified by:
readNodeHandle in interface NodeHandleFactory<SocketNodeHandle>
Throws:
java.io.IOException

coalesce

public SocketNodeHandle coalesce(SocketNodeHandle h)
Description copied from interface: NodeHandleFactory
Needed for legacy java deserialization of NodeHanlde because we aren't given any other way to do this properly such as a protected constructor.

Specified by:
coalesce in interface NodeHandleFactory<SocketNodeHandle>
Returns:

notifyListeners

protected void notifyListeners(SocketNodeHandle nh)
Notify the listeners that this new handle has come along.


addNodeHandleFactoryListener

public void addNodeHandleFactoryListener(NodeHandleFactoryListener<SocketNodeHandle> listener)
Specified by:
addNodeHandleFactoryListener in interface NodeHandleFactory<SocketNodeHandle>

removeNodeHandleFactoryListener

public void removeNodeHandleFactoryListener(NodeHandleFactoryListener<SocketNodeHandle> listener)
Specified by:
removeNodeHandleFactoryListener in interface NodeHandleFactory<SocketNodeHandle>

deserialize

public SocketNodeHandle deserialize(InputBuffer buf)
                             throws java.io.IOException
Specified by:
deserialize in interface Serializer<SocketNodeHandle>
Throws:
java.io.IOException

serialize

public void serialize(SocketNodeHandle i,
                      OutputBuffer buf)
               throws java.io.IOException
Specified by:
serialize in interface Serializer<SocketNodeHandle>
Throws:
java.io.IOException

Rice Pastry API

Copyright © 2001-2005 - Rice Pastry.


Imprint-Dataprotection