FileDocCategorySizeDatePackage
PeerConnectionFactory.javaAPI DocAzureus 3.0.3.42859Thu Feb 09 19:43:22 GMT 2006com.aelitis.azureus.core.peermanager.connection

PeerConnectionFactory

public class PeerConnectionFactory extends Object

Fields Summary
private static final PeerConnectionFactory
instance
private volatile ArrayList
creation_listeners_cow
private org.gudy.azureus2.core3.util.AEMonitor
creation_listeners_mon
Constructors Summary
Methods Summary
public AZPeerConnectioncreateAZPeerConnection(com.aelitis.azureus.core.peermanager.peerdb.PeerItem peer_identity, com.aelitis.azureus.core.networkmanager.NetworkConnection connection)

    AZPeerConnection conn = new AZPeerConnection( peer_identity, connection );
    
    ArrayList listeners = creation_listeners_cow;
    for( int i=0; i < listeners.size(); i++ ) {
      CreationListener listener = (CreationListener)listeners.get( i );
      listener.connectionCreated( conn );
    }
    
    return conn;
  
public voidderegisterCreationListener(com.aelitis.azureus.core.peermanager.connection.PeerConnectionFactory$CreationListener listener)

    try{  creation_listeners_mon.enter();
      ArrayList newlist = new ArrayList( creation_listeners_cow );
      newlist.remove( listener );
      creation_listeners_cow = newlist;
    }
    finally{  creation_listeners_mon.exit();  }
  
public static com.aelitis.azureus.core.peermanager.connection.PeerConnectionFactorygetSingleton()

  
  
  
        return instance;  
public voidregisterCreationListener(com.aelitis.azureus.core.peermanager.connection.PeerConnectionFactory$CreationListener listener)

    try{  creation_listeners_mon.enter();
      ArrayList newlist = new ArrayList( creation_listeners_cow.size() + 1 );
      newlist.addAll( creation_listeners_cow );
      newlist.add( listener );
      creation_listeners_cow = newlist;
    }
    finally{  creation_listeners_mon.exit();  }