FileDocCategorySizeDatePackage
NetworkAdminSpeedTestSchedulerImpl.javaAPI DocAzureus 3.0.3.43996Fri May 04 18:49:58 BST 2007com.aelitis.azureus.core.networkmanager.admin.impl

NetworkAdminSpeedTestSchedulerImpl

public class NetworkAdminSpeedTestSchedulerImpl extends Object implements com.aelitis.azureus.core.networkmanager.admin.NetworkAdminSpeedTestScheduler
Created on Apr 17, 2007 Created by Alan Snyder Copyright (C) 2007 Aelitis, All Rights Reserved. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. AELITIS, SAS au capital de 63.529,40 euros 8 Allee Lenotre, La Grille Royale, 78600 Le Mesnil le Roi, France.

Fields Summary
private static NetworkAdminSpeedTestSchedulerImpl
instance
private NetworkAdminSpeedTestScheduledTestImpl
currentTest
private org.gudy.azureus2.plugins.PluginInterface
plugin
Constructors Summary
private NetworkAdminSpeedTestSchedulerImpl()

        AzureusCore ac = AzureusCoreFactory.getSingleton();
        PluginManager pm = ac.getPluginManager();

        plugin = pm.getDefaultPluginInterface();
     
Methods Summary
public synchronized com.aelitis.azureus.core.networkmanager.admin.NetworkAdminSpeedTestScheduledTestgetCurrentTest()

    	return( currentTest );
    
public static synchronized com.aelitis.azureus.core.networkmanager.admin.NetworkAdminSpeedTestSchedulergetInstance()


         
        if(instance==null){
            instance = new NetworkAdminSpeedTestSchedulerImpl();
        }
        return instance;
    
public com.aelitis.azureus.core.networkmanager.admin.NetworkAdminSpeedTesterResultgetLastResult(int type)
Get the most recent result for the test.

return
- Result

    	
        if ( type == TEST_TYPE_BT ){
        	
        	return( NetworkAdminSpeedTesterBTImpl.getLastResult());
        	
        }else{
        	
        	Debug.out( "Unknown test type" );
        	
        	return( null );
        }
    
public voidinitialise()

    	NetworkAdminSpeedTesterBTImpl.startUp( plugin );
    
public synchronized com.aelitis.azureus.core.networkmanager.admin.NetworkAdminSpeedTestScheduledTestscheduleTest(int type)

    	if ( currentTest != null ){

    		throw( new NetworkAdminException( "Test already scheduled" ));
    	}

    	if ( type == TEST_TYPE_BT ){

    		currentTest = new NetworkAdminSpeedTestScheduledTestImpl(plugin, new NetworkAdminSpeedTesterBTImpl(plugin) );
            currentTest.getTester().setMode(type);

            currentTest.addListener(
    			new NetworkAdminSpeedTestScheduledTestListener()
    			{
    				public void stage(NetworkAdminSpeedTestScheduledTest test, String step){}

    				public void 
    				complete(NetworkAdminSpeedTestScheduledTest test )
    				{
    					synchronized( NetworkAdminSpeedTestSchedulerImpl.this ){
    						
    						currentTest = null;
    					}
    				}
  				
    			});
    	}else{

    		throw( new NetworkAdminException( "Unknown test type" ));
    	}

    	return( currentTest );