com.aelitis.azureus.core.instancemanager.impl
Class AZInstanceManagerImpl

java.lang.Object
  extended by com.aelitis.azureus.core.instancemanager.impl.AZInstanceManagerImpl
All Implemented Interfaces:
AZInstanceManager, MCGroupAdapter

public class AZInstanceManagerImpl
extends Object
implements AZInstanceManager, MCGroupAdapter


Nested Class Summary
protected  class AZInstanceManagerImpl.request
           
protected static class AZInstanceManagerImpl.trackedInstance
           
 
Field Summary
 
Fields inherited from interface com.aelitis.azureus.core.instancemanager.AZInstanceManager
AT_TCP, AT_UDP, AT_UDP_NON_DATA
 
Constructor Summary
protected AZInstanceManagerImpl(AZInstanceManagerAdapter _adapter)
           
 
Method Summary
protected  void addAddresses(AZInstance inst)
           
 boolean addInstance(InetAddress explicit_address)
           
protected  boolean addInstanceSupport(InetAddress explicit_address, boolean force_send_alive)
           
 boolean addLANSubnet(String subnet)
           
 void addListener(AZInstanceManagerListener l)
           
protected  AZOtherInstanceImpl checkAdd(AZOtherInstanceImpl inst)
           
protected  void checkRemove(AZOtherInstanceImpl inst)
           
protected  void checkTimeouts()
           
 long getClockSkew()
           
 InetSocketAddress getExternalAddress(InetSocketAddress lan_address, int address_type)
           
 boolean getIncludeWellKnownLANs()
           
 InetSocketAddress getLANAddress(InetSocketAddress external_address, int address_type)
           
 AZInstance getMyInstance()
           
 int getOtherInstanceCount(boolean block_if_needed)
           
 AZInstance[] getOtherInstances()
           
static AZInstanceManager getSingleton(AZInstanceManagerAdapter core)
           
protected  void informAdded(AZInstance inst)
           
protected  void informChanged(AZInstance inst)
           
protected  void informRemoved(AZOtherInstanceImpl inst)
           
protected  void informTracked(AZInstanceTracked inst)
           
 void initialize()
           
 void interfaceChanged(NetworkInterface network_interface)
           
protected  boolean isClosing()
           
 boolean isExternalAddress(InetAddress address)
           
 boolean isInitialized()
           
 boolean isLANAddress(InetAddress address)
           
 void log(Throwable e)
           
protected  Map modifyAddress(Map map, InetSocketAddress key, InetSocketAddress value, boolean add)
           
protected  void modifyAddresses(InetAddress internal_address, InetAddress external_address, int tcp, int udp, int udp2, boolean add)
           
 void received(NetworkInterface network_interface, InetAddress local_address, InetSocketAddress originator, byte[] data, int length)
           
protected  void removeAddresses(AZOtherInstanceImpl inst)
           
 void removeListener(AZInstanceManagerListener l)
           
protected  Map requestReceived(AZInstance instance, Map body)
           
protected  void search()
           
protected  void sendAlive()
           
protected  void sendAlive(InetSocketAddress target)
           
protected  void sendByeBye()
           
protected  void sendByeBye(InetSocketAddress target)
           
protected  void sendMessage(int type)
           
protected  void sendMessage(int type, InetSocketAddress target)
           
protected  void sendMessage(int type, Map body)
           
protected  void sendMessage(int type, Map body, InetSocketAddress member)
           
protected  Map sendRequest(int type)
           
protected  Map sendRequest(int type, Map body)
           
 void setIncludeWellKnownLANs(boolean include)
           
 void trace(String str)
           
 AZInstanceTracked[] track(byte[] hash, AZInstanceTracked.TrackTarget target)
           
 void updateNow()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

AZInstanceManagerImpl

protected AZInstanceManagerImpl(AZInstanceManagerAdapter _adapter)
Method Detail

getSingleton

public static AZInstanceManager getSingleton(AZInstanceManagerAdapter core)

initialize

public void initialize()
Specified by:
initialize in interface AZInstanceManager

getClockSkew

public long getClockSkew()
Specified by:
getClockSkew in interface AZInstanceManager

trace

public void trace(String str)
Specified by:
trace in interface MCGroupAdapter

log

public void log(Throwable e)
Specified by:
log in interface MCGroupAdapter

isInitialized

public boolean isInitialized()
Specified by:
isInitialized in interface AZInstanceManager

updateNow

public void updateNow()
Specified by:
updateNow in interface AZInstanceManager

isClosing

protected boolean isClosing()

sendAlive

protected void sendAlive()

sendAlive

protected void sendAlive(InetSocketAddress target)

sendByeBye

protected void sendByeBye()

sendByeBye

protected void sendByeBye(InetSocketAddress target)

sendMessage

protected void sendMessage(int type)

sendMessage

protected void sendMessage(int type,
                           InetSocketAddress target)

sendMessage

protected void sendMessage(int type,
                           Map body)

sendMessage

protected void sendMessage(int type,
                           Map body,
                           InetSocketAddress member)

received

public void received(NetworkInterface network_interface,
                     InetAddress local_address,
                     InetSocketAddress originator,
                     byte[] data,
                     int length)
Specified by:
received in interface MCGroupAdapter

requestReceived

protected Map requestReceived(AZInstance instance,
                              Map body)

interfaceChanged

public void interfaceChanged(NetworkInterface network_interface)
Specified by:
interfaceChanged in interface MCGroupAdapter

checkAdd

protected AZOtherInstanceImpl checkAdd(AZOtherInstanceImpl inst)

checkRemove

protected void checkRemove(AZOtherInstanceImpl inst)

getMyInstance

public AZInstance getMyInstance()
Specified by:
getMyInstance in interface AZInstanceManager

search

protected void search()

getOtherInstanceCount

public int getOtherInstanceCount(boolean block_if_needed)
Specified by:
getOtherInstanceCount in interface AZInstanceManager

getOtherInstances

public AZInstance[] getOtherInstances()
Specified by:
getOtherInstances in interface AZInstanceManager

addAddresses

protected void addAddresses(AZInstance inst)

removeAddresses

protected void removeAddresses(AZOtherInstanceImpl inst)

modifyAddresses

protected void modifyAddresses(InetAddress internal_address,
                               InetAddress external_address,
                               int tcp,
                               int udp,
                               int udp2,
                               boolean add)

modifyAddress

protected Map modifyAddress(Map map,
                            InetSocketAddress key,
                            InetSocketAddress value,
                            boolean add)

getLANAddress

public InetSocketAddress getLANAddress(InetSocketAddress external_address,
                                       int address_type)
Specified by:
getLANAddress in interface AZInstanceManager

getExternalAddress

public InetSocketAddress getExternalAddress(InetSocketAddress lan_address,
                                            int address_type)
Specified by:
getExternalAddress in interface AZInstanceManager

isLANAddress

public boolean isLANAddress(InetAddress address)
Specified by:
isLANAddress in interface AZInstanceManager

addLANSubnet

public boolean addLANSubnet(String subnet)
                     throws PatternSyntaxException
Specified by:
addLANSubnet in interface AZInstanceManager
Throws:
PatternSyntaxException

setIncludeWellKnownLANs

public void setIncludeWellKnownLANs(boolean include)
Specified by:
setIncludeWellKnownLANs in interface AZInstanceManager

getIncludeWellKnownLANs

public boolean getIncludeWellKnownLANs()
Specified by:
getIncludeWellKnownLANs in interface AZInstanceManager

addInstance

public boolean addInstance(InetAddress explicit_address)
Specified by:
addInstance in interface AZInstanceManager

addInstanceSupport

protected boolean addInstanceSupport(InetAddress explicit_address,
                                     boolean force_send_alive)

isExternalAddress

public boolean isExternalAddress(InetAddress address)
Specified by:
isExternalAddress in interface AZInstanceManager

track

public AZInstanceTracked[] track(byte[] hash,
                                 AZInstanceTracked.TrackTarget target)
Specified by:
track in interface AZInstanceManager

checkTimeouts

protected void checkTimeouts()

informRemoved

protected void informRemoved(AZOtherInstanceImpl inst)

informAdded

protected void informAdded(AZInstance inst)

informChanged

protected void informChanged(AZInstance inst)

informTracked

protected void informTracked(AZInstanceTracked inst)

sendRequest

protected Map sendRequest(int type)

sendRequest

protected Map sendRequest(int type,
                          Map body)

addListener

public void addListener(AZInstanceManagerListener l)
Specified by:
addListener in interface AZInstanceManager

removeListener

public void removeListener(AZInstanceManagerListener l)
Specified by:
removeListener in interface AZInstanceManager