org.mpisws.p2p.transport.simpleidentity
Class MutableInetSocketAddressStrategy

java.lang.Object
  extended by org.mpisws.p2p.transport.simpleidentity.MutableInetSocketAddressStrategy
Type Parameters:
InetSocketAddress -
All Implemented Interfaces:
LocalIdentifierStrategy<InetSocketAddress>

public class MutableInetSocketAddressStrategy
extends Object
implements LocalIdentifierStrategy<InetSocketAddress>

This is used if you are binding to 0.0.0.0 It will see if your local address changed before returning the serialized version.

Author:
Jeff Hoye

Constructor Summary
MutableInetSocketAddressStrategy(int port, Serializer<InetSocketAddress> serializer)
           
 
Method Summary
protected  InetAddress getLocalAddress()
          Can be overridden to do something special in the case of having multiple NICs
 byte[] getLocalIdentifierBytes()
           
protected  byte[] serializeAddress(InetSocketAddress addr)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

MutableInetSocketAddressStrategy

public MutableInetSocketAddressStrategy(int port,
                                        Serializer<InetSocketAddress> serializer)
Method Detail

getLocalIdentifierBytes

public byte[] getLocalIdentifierBytes()
                               throws IOException
Specified by:
getLocalIdentifierBytes in interface LocalIdentifierStrategy<InetSocketAddress>
Throws:
IOException

serializeAddress

protected byte[] serializeAddress(InetSocketAddress addr)
                           throws IOException
Throws:
IOException

getLocalAddress

protected InetAddress getLocalAddress()
                               throws IOException
Can be overridden to do something special in the case of having multiple NICs

Returns:
the current address to advertise
Throws:
IOException


Copyright © 2010. All Rights Reserved.