FileDocCategorySizeDatePackage
EventWaiter.javaAPI DocAzureus 3.0.3.41697Thu Dec 07 12:10:14 GMT 2006com.aelitis.azureus.core.networkmanager

EventWaiter

public class EventWaiter extends Object

Fields Summary
private boolean
sleeping
private boolean
wakeup_outstanding
Constructors Summary
Methods Summary
public voideventOccurred()

		synchronized( this ){

			if ( !sleeping ){
				
				wakeup_outstanding	= true;
				
			}else{
				
				this.notify();
			}
		}
	
public booleanwaitForEvent(long timeout)

		synchronized( this ){
					
			if ( wakeup_outstanding ){
								
				wakeup_outstanding	= false;
				
				return( false );
			}
			
			try{
				sleeping	= true;

				this.wait( timeout );
				
			}catch( Throwable e ){
				
				Debug.printStackTrace( e );
				
			}finally{
				
				sleeping	= false;
			}
			
			return( true );
		}