Package org.gudy.azureus2.plugins.utils

Examples of org.gudy.azureus2.plugins.utils.DelayedTask


           
            if ( dht_pi != null ){
             
              dht = (DHTPlugin)dht_pi.getPlugin();
             
              final DelayedTask dt =
                plugin_interface.getUtilities().createDelayedTask(
                  new Runnable()
                  {
                 
                    public void
                    run()
                    {
                      AEThread2  t =
                        new AEThread2( "DHTTrackerPlugin:init", true )
                        {
                          public void
                          run()
                          {
                            try{
                           
                              if ( dht.isEnabled()){
                             
                                log.log( "DDB Available" );
                                 
                                model.getStatus().setText( MessageText.getString( "DHTView.activity.status.false" ));
                               
                                initialise();
                                 
                              }else{
                               
                                log.log( "DDB Disabled" );
                               
                                model.getStatus().setText( MessageText.getString( "dht.status.disabled" ));
                                 
                                notRunning();
                              }
                            }catch( Throwable e ){
                               
                              log.log( "DDB Failed", e );
                               
                              model.getStatus().setText( MessageText.getString( "DHTView.operations.failed" ));
                               
                              notRunning();
                             
                            }finally{
                             
                              initialised_sem.releaseForever();
                            }
                          }
                        };
                                     
                        t.start();
                    }
                  });
             
              dt.queue();
 
              release_now = false;
             
            }else{
             
View Full Code Here


  }

  public void
  initialise()
  {
    DelayedTask delayed_task =
      UtilitiesImpl.addDelayedTask(
          "VersionCheck",
          new Runnable()
          {
            public void
            run()
            {
              final AESemaphore sem = new AESemaphore( "VCC:init" );

              new AEThread2( "VCC:init", true )
              {
                public void
                run()
                {
                  try{
                    getVersionCheckInfo( REASON_UPDATE_CHECK_START );

                  }finally{

                    sem.release();
                  }
                }
              }.start();

              if ( !sem.reserve( 5000 )){

                Debug.out( "Timeout waiting for version check to complete" );
              }
            }
          });

    delayed_task.queue();
  }
View Full Code Here

  {
    manager  = _manager;
   
    manager.addListener( this );
   
    DelayedTask delayed_task = UtilitiesImpl.addDelayedTask( "Subscriptions Scheduler",
      new Runnable()
      {
        public void
        run()
        {
          synchronized( SubscriptionSchedulerImpl.this ){
           
            schedulng_permitted  = true;
          }
         
          calculateSchedule();
        }
      });
   
    delayed_task.queue();
  }
View Full Code Here

              }
            }
          }
        });
       
      DelayedTask delayed_task = UtilitiesImpl.addDelayedTask( "Subscriptions",
          new Runnable()
          {
            public void
            run()
            {
              new AEThread2( "Subscriptions:delayInit", true )
              {
                public void
                run()
                {
                  asyncInit();
                }
              }.start();
             
            }
           
            protected void
            asyncInit()
            {
              Download[] downloads = default_pi.getDownloadManager().getDownloads();
                 
              for (int i=0;i<downloads.length;i++){
               
                Download download = downloads[i];
               
                if ( download.getBooleanAttribute( ta_subs_download )){
                 
                  Map  rd = download.getMapAttribute( ta_subs_download_rd );
                 
                  boolean  delete_it;
                 
                  if ( rd == null ){
                   
                    delete_it = true;
                   
                  }else{
                   
                    delete_it = !recoverSubscriptionUpdate( download, rd );
                  }
                 
                  if ( delete_it ){
                   
                    removeDownload( download, true );
                  }
                }
              }
               
              default_pi.getDownloadManager().addListener(
                new DownloadManagerListener()
                {
                  public void
                  downloadAdded(
                    final Download  download )
                  {
                      // if ever changed to handle non-persistent then you need to fix init deadlock
                      // potential with share-hoster plugin
                   
                    if ( download.isPersistent()){
                     
                      if ( !dht_plugin.isInitialising()){
               
                          // if new download then we want to check out its subscription status
                       
                        lookupAssociations( download.getMapAttribute( ta_subscription_info ) == null );
                       
                      }else{
                       
                        new AEThread2( "Subscriptions:delayInit", true )
                        {
                          public void
                          run()
                          {
                            lookupAssociations( download.getMapAttribute( ta_subscription_info ) == null );
                          }
                        }.start();
                      }
                    }
                  }
                 
                  public void
                  downloadRemoved(
                    Download  download )
                  {
                  }
                },
                false );
             
              for (int i=0;i<PUB_ASSOC_CONC_MAX;i++){
             
                if ( publishAssociations()){
                 
                  break;
                }
              }
             
              publishSubscriptions();
             
              COConfigurationManager.addParameterListener(
                  CONFIG_MAX_RESULTS,
                  new ParameterListener()
                  {
                    public void
                    parameterChanged(
                      String   name )
                    {
                      final int  max_results = COConfigurationManager.getIntParameter( CONFIG_MAX_RESULTS );
                     
                      new AEThread2( "Subs:max results changer", true )
                      {
                        public void
                        run()
                        {
                          checkMaxResults( max_results );
                        }
                      }.start();
                    }
                  });
             
              SimpleTimer.addPeriodicEvent(
                  "SubscriptionChecker",
                  TIMER_PERIOD,
                  new TimerEventPerformer()
                  {
                    private int  ticks;
                   
                    public void
                    perform(
                      TimerEvent event )
                    {
                      ticks++;
                     
                      checkStuff( ticks );
                    }
                  });
            }
          });
   
      delayed_task.queue();
    }
   
    if ( isSearchEnabled()){
     
      try{
View Full Code Here

           
            uiQuickInit();

            Utilities utilities = default_pi.getUtilities();
           
            final DelayedTask dt = utilities.createDelayedTask(new Runnable()
              {
                public void
                run()
                {
                  Utils.execSWTThread(new AERunnable() {
                 
                    public void
                    runSupport()
                    {
                       delayedInit();
                    }
                  });
                }
              });
             
              dt.queue();   
          }

          public void UIDetached(UIInstance instance) {
          }
        });
View Full Code Here

      });

    // startup() used to be called on initializationComplete()
    // Moved to delayed task because rootDeviceFound can take
    // a lot of CPU cycle.  Let's hope nothing breaks
    DelayedTask dt = plugin_interface.getUtilities().createDelayedTask(new Runnable() {
      public void
      run()
      {
        if ( enabled ){
         
          updateIgnoreList();
         
          startUp();     
        }
      }
    });
    dt.queue();

    plugin_interface.addListener(
        new PluginListener()
        {
          public void
View Full Code Here

  {
    boolean  handled = false;
   
    for (int i=0;i<listeners.size();i++){
     
      PooledByteBuffer  buffer = new PooledByteBufferImpl(message.getPayload());
     
      try{
        ((GenericMessageConnectionListener)listeners.get(i)).receive( this, buffer );
       
        handled = true;
       
      }catch( Throwable f ){
       
        buffer.returnToPool();
       
        if ( !( f instanceof MessageException )){
       
          Debug.printStackTrace(f);
        }
View Full Code Here

  private void start() {
    for (int i = 0; i < updates.length; i++) {
      Update update = updates[i];
      ResourceDownloader[] rds = update.getDownloaders();
      for (int j = 0; j < rds.length; j++) {
        ResourceDownloader rd = rds[j];
        downloaders.add(rd);
      }
    }

    iterDownloaders = downloaders.iterator();
View Full Code Here

   *
   * @since 3.0.0.7
   */
  private boolean nextUpdate() {
    if (iterDownloaders.hasNext()) {
      ResourceDownloader downloader = (ResourceDownloader) iterDownloaders.next();
      downloader.addListener(this);
      downloader.asyncDownload();
      return true;
    }
    return false;
  }
View Full Code Here

              }
             
              setProgress( 0 );
             
              downloader.addListener(
                new ResourceDownloaderAdapter()
                {
                  public void
                  reportPercentComplete(
                    ResourceDownloader  downloader,
                    int          percentage )
View Full Code Here

TOP

Related Classes of org.gudy.azureus2.plugins.utils.DelayedTask

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.