Examples of DelayedTask


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

      AzureusCoreImpl.this.stop();
       }
     })
        

     DelayedTask delayed_task =
         UtilitiesImpl.addDelayedTask(
           "Core",
           new Runnable()
           {
             public void
             run()
             {
               new AEThread2( "core:delayTask", true )
               {
                 public void
                 run()
                 {       
                   AEDiagnostics.checkDumpsAndNatives();
   
                   COConfigurationManager.setParameter( "diags.enable.pending.writes", true );
                  
                   AEDiagnostics.flushPendingLogs();
                  
                   NetworkAdmin na = NetworkAdmin.getSingleton();
   
                   na.runInitialChecks(AzureusCoreImpl.this);
   
                   na.addPropertyChangeListener(
                       new NetworkAdminPropertyChangeListener()
                       {
                         private String  last_as;
   
                         public void
                         propertyChanged(
                             String    property )
                         {
                           NetworkAdmin na = NetworkAdmin.getSingleton();
   
                           if ( property.equals( NetworkAdmin.PR_NETWORK_INTERFACES )){
   
                             boolean  found_usable = false;
   
                             NetworkAdminNetworkInterface[] intf = na.getInterfaces();
   
                             for (int i=0;i<intf.length;i++){
   
                               NetworkAdminNetworkInterfaceAddress[] addresses = intf[i].getAddresses();
   
                               for (int j=0;j<addresses.length;j++){
   
                                 if ( !addresses[j].isLoopback()){
   
                                   found_usable = true;
                                 }
                               }
                             }
   
                             // ignore event if nothing usable
   
                             if ( !found_usable ){
   
                               return;
                             }
   
                             Logger.lognew LogEvent(LOGID, "Network interfaces have changed (new=" + na.getNetworkInterfacesAsString() + ")"));
   
                             announceAll( false );
   
                           }else if ( property.equals( NetworkAdmin.PR_AS )){
   
                             String  as = na.getCurrentASN().getAS();
   
                             if ( last_as == null ){
   
                               last_as = as;
   
                             }else if ( !as.equals( last_as )){
   
                               Logger.lognew LogEvent(LOGID, "AS has changed (new=" + as + ")" ));
   
                               last_as = as;
   
                               announceAll( false );
                             }
                           }
                         }
                       });
                  
                   setupCloseActions();
                 }
               }.start();
             }
           });

     delayed_task.queue();

      if (stopped) {
        System.err.println("Core stopped while starting");
        return;
      }
View Full Code Here

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

          paused        = COConfigurationManager.getBooleanParameter( "xcode.queue.paused", false );
          max_bytes_per_sec  = COConfigurationManager.getIntParameter( "xcode.queue.maxbps", 0 );
        }
      });
   
    DelayedTask delayed_task =
      UtilitiesImpl.addDelayedTask(
        "TranscodeQueue:schedule",
        new Runnable()
        {
          public void
          run()
          {
            schedule();
          }
        });
   
    delayed_task.queue();
  }
View Full Code Here

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

    }
   
    try{
      PluginInterface default_pi = PluginInitializer.getDefaultInterface();

      DelayedTask dt = default_pi.getUtilities().createDelayedTask(
        new Runnable()
        {
          public void
          run()
          {
            new DelayedEvent(
              "PM:delayinit",
              10*1000,
              new AERunnable()
              {
                public void
                runSupport()
                {
                  enableUpdates();
                }
              });
          }
        });
     
      dt.queue();
     
    }finally{
     
      init_sem.releaseForever();
    }
View Full Code Here

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

  }
 
  public void
  initializationComplete()
  {
    final DelayedTask dt = plugin_interface.getUtilities().createDelayedTask(new Runnable()
      {
        public void
        run()
        {
          initialise();
        }
      });
   
    dt.queue();
  }
View Full Code Here

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

    }
  }

  public void run() {
   
    DelayedTask delayed_task = UtilitiesImpl.addDelayedTask( "SWT Initialisation", new Runnable()
        {
          public void
          run()
          {
            init_task.reserve();
          }
        });

    delayed_task.queueFirst();
   
    // initialise the SWT locale util
    long startTime = SystemTime.getCurrentTime();

    new LocaleUtilSWT(core);
View Full Code Here

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

           
            if ( enabled ){
             
              status_area.setText( "Initialising" );
             
              final DelayedTask dt = plugin_interface.getUtilities().createDelayedTask(new Runnable()
              {
                public void
                run()
                {
                    // go async again as don't want to block other tasks
                 
                  new AEThread2"DHTPlugin.init2", true )
                  {
                    public void
                    run()
                    {
                      try{
                        List  plugins = new ArrayList();
                       
                          // adapter only added to first DHTPluginImpl we create
                       
                        DHTPluginImplAdapter adapter =
                                new DHTPluginImplAdapter()
                                {
                                  public void
                                  localContactChanged(
                                    DHTPluginContact  local_contact )
                                  {
                                    for (int i=0;i<listeners.size();i++){
                                     
                                      ((DHTPluginListener)listeners.get(i)).localAddressChanged( local_contact );
                                    }
                                  }
                                };
                               
                        if ( MAIN_DHT_ENABLE ){
                         
                          main_dht =
                            new DHTPluginImpl(
                                  plugin_interface,
                                  AzureusCoreFactory.getSingleton().getNATTraverser(),
                                  adapter,
                                  DHTTransportUDP.PROTOCOL_VERSION_MAIN,
                                  DHT.NW_MAIN,
                                  false,
                                  override_ip,
                                  dht_data_port,
                                  reseed,
                                  warn_user,
                                  logging,
                                  log, dht_log );
                                         
                          plugins.add( main_dht );
                         
                          adapter = null;
                        }
                       
                        if ( MAIN_DHT_V6_ENABLE ){
                         
                          if ( NetworkAdmin.getSingleton().hasDHTIPV6()){
                             
                            main_v6_dht =
                              new DHTPluginImpl(
                                plugin_interface,
                                AzureusCoreFactory.getSingleton().getNATTraverser(),
                                adapter,
                                DHTTransportUDP.PROTOCOL_VERSION_MAIN,
                                DHT.NW_MAIN_V6,
                                true,
                                null,
                                dht_data_port,
                                reseed,
                                warn_user,
                                logging,
                                log, dht_log );
                                         
                            plugins.add( main_v6_dht );
                           
                            adapter = null;
                          }
                        }
                       
                        if ( Constants.isCVSVersion() && CVS_DHT_ENABLE ){
                         
                          cvs_dht =
                            new DHTPluginImpl(
                              plugin_interface,
                              AzureusCoreFactory.getSingleton().getNATTraverser(),
                              adapter,
                              DHTTransportUDP.PROTOCOL_VERSION_CVS,
                              DHT.NW_CVS,
                              false,
                              override_ip,
                              dht_data_port,
                              reseed,
                              warn_user,
                              logging,
                              log, dht_log );
                       
                          plugins.add( cvs_dht );
                         
                          adapter = null;
                        }
                       
                        DHTPluginImpl[]  _dhts = new DHTPluginImpl[plugins.size()];
                       
                        plugins.toArray( _dhts );
                                 
                        dhts = _dhts;
                       
                        status = dhts[0].getStatus();
                       
                        status_area.setText( dhts[0].getStatusText());
                       
                      }catch( Throwable e ){
                       
                        enabled  = false;
                       
                        status  = STATUS_DISABLED;
   
                        status_area.setText( "Disabled due to error during initialisation" );
   
                        log.log( e );
                       
                        Debug.printStackTrace(e);
                       
                      }finally{
                       
                        init_sem.releaseForever();
                      }
                     
                        // pick up any port changes that occurred during init
                     
                      if ( status == STATUS_RUNNING ){
                     
                        changePort( dht_data_port );
                      }
                    }
                  }.start();
                }
              });
             
              dt.queue();
               
              went_async = true;
             
            }else{
             
View Full Code Here

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

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

  }

  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

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

  {
    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

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

              }
            }
          }
        });
       
      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
TOP
Copyright © 2018 www.massapi.com. 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.