public static TRTrackerAnnouncer | create(TOTorrent torrent, java.lang.String[] networks, boolean manual)
TRTrackerAnnouncer client;
if ( TorrentUtils.isDecentralised( torrent )){
client = new TRTrackerDHTAnnouncerImpl( torrent, networks, manual );
}else{
client = new TRTrackerBTAnnouncerImpl( torrent, networks, manual );
}
if ( !manual ){
List listeners_copy = new ArrayList();
try{
class_mon.enter();
clients.add( client );
listeners_copy = new ArrayList( listeners );
}finally{
class_mon.exit();
}
for (int i=0;i<listeners_copy.size();i++){
try{
((TRTrackerAnnouncerFactoryListener)listeners_copy.get(i)).clientCreated( client );
}catch( Throwable e ){
Debug.printStackTrace(e);
}
}
}
return( client );
|