Public Member Functions | Private Attributes

T3 Class Reference

The class T3 extends T1 class. More...

Inheritance diagram for T3:
Inheritance graph
[legend]
Collaboration diagram for T3:
Collaboration graph
[legend]

List of all members.

Public Member Functions

 T3 (JPWorld component, float sleepIntervalSec, float initialDelaySec)
 Creates a new instance of T3.
void run ()
 Test procedure for T1 and T2 classes running in separate thread.

Private Attributes

String signature = "T3: Thread 3"
float initialDelaySec = 0f

Detailed Description

The class T3 extends T1 class.

It is a test wrapper for T1 and T2 classes according to the following specification:

   1. Create and start thread from class T1
   2. Wait 5 seconds
   3. Create and start thread from class T2
   4. Wait 5 seconds
   5. Pause thread from class T2
   6. Wait 5 seconds
   7. Activate thread from class T2
   8. Wait 5 seconds
   9. Kill thread from class T1
  10. Wait 5 seconds
  11. Kill thread from class T2
  
Author:
Mikica B Kocic

Definition at line 22 of file T3.java.


Constructor & Destructor Documentation

T3.T3 ( JPWorld  component,
float  sleepIntervalSec,
float  initialDelaySec 
)

Creates a new instance of T3.

Definition at line 31 of file T3.java.

References initialDelaySec.

    {
        super( component, sleepIntervalSec );
        this.initialDelaySec = initialDelaySec;
    }

Member Function Documentation

void T3.run (  )

Test procedure for T1 and T2 classes running in separate thread.

Reimplemented from T1.

Definition at line 41 of file T3.java.

References JPWorld.afterTestsCompleted(), JPWorld.clearLogArea(), T2.disableThread(), T2.enableThread(), initialDelaySec, T1.interruptibleSleep(), T1.parent, JPWorld.println(), signature, T1.start(), T2.startThread(), T2.stopThread(), T1.stopThread(), and T1.T1().

    {
        interruptibleSleep( (int)( initialDelaySec * 1000f ) );
        
        parent.clearLogArea (); // clear log area first

        parent.println( signature + ": Running..." );

        interruptibleSleep( 1000 );
        
        parent.println( "------ Creating T1" );
        T1 t1 = new T1( parent, 1.0f );

        parent.println( "------ Starting T1" );
        t1.start ();

        interruptibleSleep( 5000 );
        
        parent.println( "------ Creating T2" );
        T2 t2 = new T2( parent, 1.0f );

        parent.println( "------ Starting T2" );
        t2.startThread ();
        
        interruptibleSleep( 5000 );
        
        parent.println( "------ Disabling T2" );
        t2.disableThread ();
        
        interruptibleSleep( 5000 );
        
        parent.println( "------ Enabling T2" );
        t2.enableThread ();
        
        interruptibleSleep( 5000 );
        
        parent.println( "------ Killing T1" );
        t1.stopThread ();
        
        interruptibleSleep( 5000 );
        
        parent.println( "------ Killing T2" );
        t2.stopThread ();
        
        parent.println( signature + ": Done." );
        parent.afterTestsCompleted ();
    }

Member Data Documentation

float T3.initialDelaySec = 0f [private]

Definition at line 26 of file T3.java.

Referenced by run(), and T3().

String T3.signature = "T3: Thread 3" [private]

Reimplemented from T1.

Definition at line 24 of file T3.java.

Referenced by run().


The documentation for this class was generated from the following file: