Package org.gudy.azureus2.core3.util

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


        initializationComplete()
        {
            // make sure DDB is initialised as we need it to register its
            // transfer types
         
          AEThread2 t =
            new AEThread2( "MagnetPlugin:init", true )
            {
              public void
              run()
              {
                plugin_interface.getDistributedDatabase();
              }
            };
                   
          t.start();
        }
       
        public void
        closedownInitiated(){}
       
View Full Code Here


     
    SimplePluginInstallWindow window = new SimplePluginInstallWindow( this, _resource_prefix );
     
    window.open();
   
    AEThread2 installerThread = new AEThread2("plugin installer",true) {
      public void
      run()
      {
        install();
      }
    };
   
    installerThread.start()
  }
View Full Code Here

      pending = null;
    }
   
    if ( to_run != null ){
     
      new AEThread2( "UIFM:set" )
      {
        public void
        run()
        {
          for ( UIFRunnable r: to_run ){
View Full Code Here

    final DelayedTask dt = plugin_interface.getUtilities().createDelayedTask(new Runnable()
      {
        public void
        run()
        {
          AEThread2 t =
            new AEThread2( "ExternalSeedInitialise", true )
            {
              public void
              run()
              {
                setStatus( "Running" );
               
                plugin_interface.getDownloadManager().addListener( ExternalSeedPlugin.this);
              }
            };
         
          t.setPriority( Thread.MIN_PRIORITY );
         
          t.start();
         
        }
      });
   
    dt.queue();   
View Full Code Here

                      sem.releaseForever();
                    }
                  }
                });
             
              new AEThread2( "SM:anmon" )
                {
                  public void
                  run()
                  {
                    boolean  last_preview_mode = preview_mode;
                   
                    while( !sem.isReleasedForever() && !cancelled ){
                     
                      if ( !sem.reserve( 250 )){
                     
                        if ( cancelled ){
                         
                          return;
                        }
                         
                        try{
                          Boolean b = (Boolean)is_active_method.invoke( player, new Object[0] );
                         
                          if ( !b ){
                           
                            cancel();
                           
                            break;
                          }
                        }catch( Throwable e ){ 
                        }
                       
                        if ( last_preview_mode != preview_mode ){
                         
                          last_preview_mode = preview_mode;
                         
                          b_map.put( "msg", MessageText.getString( last_preview_mode?"stream.analysing.media.preview":"stream.analysing.media" ));

                        }
                        DownloadStats stats = download.getStats();
                       
                        b_map.put( "dl_rate", stats.getDownloadAverage());
                        b_map.put( "dl_size", stats.getDownloaded());
                        b_map.put( "dl_time", SystemTime.getMonotonousTime() - stream_start );
                       
                        try{
                          buffering_method.invoke(player, new Object[] { b_map });

                        }catch( Throwable e ){
                         
                        }
                      }
                    }
                  }
                }.start();
               
              sem.reserve();
             
              synchronized( StreamManager.this ){
               
                if ( cancelled ){
                   
                  throw( new Exception( "Cancelled" ));
                }
               
                active_job   = null;
                active_sem  = null;
              }
             
              if ( error[0] != null ){
               
                throw( error[0] );
              }
             
              duration     = properties[0];
              video_width    = properties[1];
              video_height  = properties[2];
             
              if ( duration > 0 ){
               
                if ( map == null ){
                 
                  map = new HashMap<String, Map<String,Object>>();
                 
                }else{
                 
                  map = new HashMap<String, Map<String,Object>>( map );
                }
               
                Map<String,Object> file_map = map.get( String.valueOf( file_index ));
               
                if ( file_map == null ){
               
                  file_map = new HashMap<String, Object>();
                 
                  map.put( String.valueOf( file_index ), file_map );
                }
               
                file_map.put( "duration", duration );
                file_map.put( "video_width", video_width );
                file_map.put( "video_height", video_height );
               
                download.setMapAttribute( mi_ta, map );
              }
             
            }catch( Throwable e ){
             
              tj.removeForce();
             
              throw( e );
            }
           
          }catch( Throwable e ){
           
            throw( new Exception( "Media analysis failed", e ));
           
          }finally{
           
          }
        }else{
           
          duration     = l_duration;
          video_width    = l_video_width==null?0:l_video_width;
          video_height  = l_video_height==null?0:l_video_height;
        }
         
        if ( video_width == 0 || video_height == 0){
         
          throw( new Exception( "Media analysis failed - video stream not found" ));
        }
       
        if ( duration == 0 ){
         
          throw( new Exception( "Media analysis failed - duration unknown" ));
        }
       
        listener.updateActivity( "MetaData read: duration=" + TimeFormatter.formatColon( duration/1000) + ", width=" + video_width + ", height=" + video_height );
       
        Method smd_method = player.getClass().getMethod( "setMetaData", new Class[] { Map.class });
       
        Map<String,Object>  md_map = new HashMap<String,Object>();
       
        md_map.put( "duration", duration );
        md_map.put( "width", video_width );
        md_map.put( "height", video_height );
       
        smd_method.invoke( player, new Object[] { md_map });

        final long  bytes_per_sec = file.getLength() / (duration/1000);
     
        long  dl_lim_max     = COConfigurationManager.getIntParameter( "Plugin.azemp.azemp.config.dl_lim_max" ) * 1024L;
        long  dl_lim_extra   = COConfigurationManager.getIntParameter( "Plugin.azemp.azemp.config.dl_lim_extra" ) * 1024L;

        existing_dl_limit = download.getDownloadRateLimitBytesPerSecond();
       
        long  required_limit = Math.max( dl_lim_max, bytes_per_sec + dl_lim_extra );

        if ( required_limit > 0 ){
       
          download.setDownloadRateLimitBytesPerSecond((int)required_limit );
        }
       
        listener.updateActivity( "Average rate=" + DisplayFormatters.formatByteCountToKiBEtcPerSec( bytes_per_sec ) + ", applied dl limit=" + DisplayFormatters.formatByteCountToKiBEtcPerSec( required_limit ));

        synchronized( StreamManager.this ){
         
          if ( cancelled ){
           
            throw( new Exception( "Cancelled" ));
          }
                                                   
          active_edm.setExplicitProgressive( BUFFER_SECS, bytes_per_sec, file_index );
         
          if ( !active_edm.setProgressiveMode( true )){
           
            throw( new Exception( "Failed to set download as progressive" ));
          }
         
          active_edm_activated = true;
        }
       
        new AEThread2( "streamMon" )
        {
         
          public void
          run()
          { 
View Full Code Here

    // un-necessary banning which then obviously affects the main DHTs. So we disable
    // banning for CVS

    final boolean ban_ip = control.getTransport().getNetwork() != DHT.NW_CVS;
   
    new AEThread2( "DHTDBImpl:delayed flood delete", true )
    {
      public void
      run()
      {
          // delete their data on a separate thread so as not to
View Full Code Here

    final Engine       engine,
    final SearchParameter[] searchParameters,
    final String       headers,
    final int        desired_max_matches )
  {
    new AEThread2( "MetaSearch: " + engine.getName() + " runner", true )
    {
      public void
      run()
      {
        try{
View Full Code Here

  getPopularity(
    final SubscriptionPopularityListener  listener )
 
    throws SubscriptionException
  {
    new AEThread2( "subs:popwait", true )
    {
      public void
      run()
      {   
        try{
View Full Code Here

            active_threads++;
           
            final int thread_index = i;
           
            threads[thread_index] =
              new AEThread2("DiskAccessController:dispatch(" + getName() + ")[" + index + "/" + thread_index + "]", true )
              {
                public void
                run()
                {
                  tls.set( this );
View Full Code Here

            }         

          }
        });
   
    new AEThread2( "ConnectDisconnectManager", true )
    {
      public void
      run()
      {
        while( true ){
View Full Code Here

TOP

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

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.