Package org.gudy.azureus2.core3.util

Examples of org.gudy.azureus2.core3.util.AEThread2$JoinLock


  download(
    final Subscription           subs,
    final boolean            is_auto,
    final SubscriptionDownloadListener   listener )
  {
    new AEThread2( "SS:download", true )
    {
      public void
      run()
      {
        try{
View Full Code Here


                last_schedule = SystemTime.getCurrentTime();
               
                schedule_event = null;
              }
             
              new AEThread2( "SS:Sched", true )
              {
                public void
                run()
                {
                  try{
View Full Code Here

  public void
  search(
    final int          millis,
    final DeviceSearchListener  listener )
  {
    new AEThread2( "DM:search", true )
    {
      public void
      run()
      {
        synchronized( DeviceManagerImpl.this ){
View Full Code Here

      boolean                _con_fail_is_perm_fail )
    {
      listener        = _listener;
      con_fail_is_perm_fail  = _con_fail_is_perm_fail;
           
      new AEThread2( "ES:downloader", true )
      {
        public void
        run()
        {
          download();
View Full Code Here

  }
 
  protected void
  start()
  {
    new AEThread2( "PeerControlScheduler", true )
    {
      public void
      run()
      {
        schedule();
View Full Code Here

  public void
  launchRequest(
    final LaunchTarget  target,
    final LaunchAction  action )
  {
    new AEThread2( "LaunchManager:request" )
    {
      public void
      run()
      {
        for ( LaunchController c: controllers ){
View Full Code Here

      copy_outstanding_set = true;
     
      if ( copy_thread == null ){
       
        copy_thread =
          new AEThread2( "Device:copier", true )
          {
            public void
            run()
            {
              performCopy();
View Full Code Here

       
        Object[]  entry = (Object[])it.next();
       
        final DHTTransportUDPContact  contact = (DHTTransportUDPContact)entry[0];
       
        new AEThread2( "DHTNATPuncher:destroy", true )
        {
          public void
          run()
          {
            sendClose( contact );
View Full Code Here

         
    final DHTTransportContact  current_target = rendezvous_target;
 
    if ( current_target != null && Arrays.equals( current_target.getID(), originator.getID())){
     
      new AEThread2( "DHTNATPuncher:close", true )
      {
        public void
        run()
        {
          rendezvousFailed( current_target, true );
View Full Code Here

   
      observer.complete();
     
    }else{
   
      new AEThread2( "RCM:search", true )
      {
        public void
        run()
        {
          final Set<String>  hashes = new HashSet<String>();
         
          try{       
            List<RelatedContent>  matches = matchContent( term );
             
            for ( final RelatedContent c: matches ){
             
              final byte[] hash = c.getHash();
             
              if ( hash == null ){
               
                continue;
              }
             
              hashes.add( Base32.encode( hash ));
             
              SearchResult result =
                new SearchResult()
                {
                  public Object
                  getProperty(
                    int    property_name )
                  {
                    if ( property_name == SearchResult.PR_NAME ){
                     
                      return( c.getTitle());
                     
                    }else if ( property_name == SearchResult.PR_SIZE ){
                     
                      return( c.getSize());
                     
                    }else if ( property_name == SearchResult.PR_HASH ){
                     
                      return( hash );
                     
                    }else if ( property_name == SearchResult.PR_RANK ){
                     
                        // this rank isn't that accurate, scale down
                     
                      return( new Long( c.getRank() / 4 ));
                     
                    }else if ( property_name == SearchResult.PR_SEED_COUNT ){
                     
                      return( new Long( c.getSeeds()));
                     
                    }else if ( property_name == SearchResult.PR_LEECHER_COUNT ){
                     
                      return( new Long( c.getLeechers()));
                     
                    }else if ( property_name == SearchResult.PR_SUPER_SEED_COUNT ){
                     
                      if ( c.getContentNetwork() != ContentNetwork.CONTENT_NETWORK_UNKNOWN ){
                       
                        return( new Long( 1 ));
                       
                      }else{
                       
                        return( new Long( 0 ));
                      }
                    }else if ( property_name == SearchResult.PR_PUB_DATE ){
                       
                      long  date = c.getPublishDate();
                     
                      if ( date <= 0 ){
                       
                        return( null );
                      }
                     
                      return( new Date( date ));
                     
                    }else if (   property_name == SearchResult.PR_DOWNLOAD_LINK ||
                          property_name == SearchResult.PR_DOWNLOAD_BUTTON_LINK ){
                     
                      byte[] hash = c.getHash();
                     
                      if ( hash != null ){
                       
                        return( UrlUtils.getMagnetURI( hash ));
                      }
                    }
                   
                    return( null );
                  }
                };
               
              observer.resultReceived( si, result );
            }
          }finally{
           
            try{
              DHT[]  dhts = dht_plugin.getDHTs();
 
              Set<InetSocketAddress>  addresses = new HashSet<InetSocketAddress>();
             
              for ( DHT dht: dhts ){
             
                DHTTransportContact[] contacts = dht.getTransport().getReachableContacts();
               
                for ( DHTTransportContact c: contacts ){
                 
                  if ( c.getProtocolVersion() >= DHTTransportUDP.PROTOCOL_VERSION_REPLICATION_CONTROL ){
                   
                    addresses.add( c.getAddress());
                  }
                }
              }
             
              if ( addresses.size() < MAX_REMOTE_SEARCH_CONTACTS ){
               
                for ( DHT dht: dhts ){
                 
                  DHTTransportContact[] contacts = dht.getTransport().getRecentContacts();
 
                  for ( DHTTransportContact c: contacts ){
                   
                    if ( c.getProtocolVersion() >= DHTTransportUDP.PROTOCOL_VERSION_REPLICATION_CONTROL ){
                     
                      addresses.add( c.getAddress());
                     
                      if ( addresses.size() >= MAX_REMOTE_SEARCH_CONTACTS ){
                       
                        break;
                      }
                    }
                  }
                 
                  if ( addresses.size() >= MAX_REMOTE_SEARCH_CONTACTS ){
                   
                    break;
                  }
                }
              }
             
              List<InetSocketAddress>  list = new ArrayList<InetSocketAddress>( addresses );
             
              Collections.shuffle( list );
             
              List<DistributedDatabaseContact>  ddb_contacts = new ArrayList<DistributedDatabaseContact>();
             
              for (int i=0;i<Math.min( list.size(), MAX_REMOTE_SEARCH_CONTACTS );i++){
               
                try{       
                  ddb_contacts.add( ddb.importContact( list.get(i), DHTTransportUDP.PROTOCOL_VERSION_REPLICATION_CONTROL ));
                 
                }catch( Throwable e ){
                }
              }
             
              long  start    = SystemTime.getMonotonousTime();
              long  max      = MAX_REMOTE_SEARCH_MILLIS;
             
              final AESemaphore  sem = new AESemaphore( "RCM:rems" );
             
              int  sent = 0;
             
              final int[]      done = {0};
             
              for (int i=0;i<ddb_contacts.size();i++){
               
                final DistributedDatabaseContact c = ddb_contacts.get( i );
                               
                new AEThread2( "RCM:rems", true )
                {
                  public void
                  run()
                  {
                    try{
View Full Code Here

TOP

Related Classes of org.gudy.azureus2.core3.util.AEThread2$JoinLock

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.