Crossfire JXClient, Trunk
Public Member Functions | Package Functions | Package Attributes | Private Member Functions | List of all members
com.sun.jmx.examples.scandir.ScanManager.SessionTask Class Reference
Inheritance diagram for com.sun.jmx.examples.scandir.ScanManager.SessionTask:
Inheritance graph
Collaboration diagram for com.sun.jmx.examples.scandir.ScanManager.SessionTask:
Collaboration graph

Public Member Functions

boolean cancel ()
 
void run ()
 

Package Functions

 SessionTask (long scheduleNext)
 

Package Attributes

volatile boolean cancelled =false
 
final long delayBeforeNext
 
final long taskid
 

Private Member Functions

boolean execute ()
 
boolean notifyStateChange (ScanState newState, String condition)
 
boolean scheduleNext ()
 

Detailed Description

A session task will be scheduled to run in background in a timer thread. There can be at most one session task running at a given time (this is ensured by using a timer - which is a single threaded object).

If the session needs to be repeated, it will reschedule an identical session when it finishes to run. This ensure that two session runs are separated by the given interval time.

Definition at line 762 of file ScanManager.java.

Constructor & Destructor Documentation

◆ SessionTask()

com.sun.jmx.examples.scandir.ScanManager.SessionTask.SessionTask ( long  scheduleNext)
package

Member Function Documentation

◆ cancel()

boolean com.sun.jmx.examples.scandir.ScanManager.SessionTask.cancel ( )

◆ execute()

boolean com.sun.jmx.examples.scandir.ScanManager.SessionTask.execute ( )
private

Invoke all directories scanners in sequence. At each step, checks to see whether the task should stop.

Definition at line 822 of file ScanManager.java.

References com.sun.jmx.examples.scandir.ScanManager.SessionTask.cancelled, com.sun.jmx.examples.scandir.ScanManager.LOG, com.sun.jmx.examples.scandir.ScanManager.SessionTask.notifyStateChange(), com.sun.jmx.examples.scandir.ScanManager.scanAllDirectories(), and com.sun.jmx.examples.scandir.ScanManager.SessionTask.taskid.

Referenced by com.sun.jmx.examples.scandir.ScanManager.SessionTask.run().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ notifyStateChange()

boolean com.sun.jmx.examples.scandir.ScanManager.SessionTask.notifyStateChange ( ScanState  newState,
String  condition 
)
private

When run() begins, the state is switched to RUNNING. When run() ends then: If the task is repeated, the state will be switched to SCHEDULED (because a new task was scheduled). Otherwise the state will be switched to either STOPPED (if it was stopped before it could complete) or COMPLETED (if it completed gracefully) This method is used to switch to the desired state and send the appropriate notifications. When entering the method, we check whether the state is STOPPED. If so, we return false - and the SessionTask will stop. Otherwise, we switch the state to the desired value.

Definition at line 803 of file ScanManager.java.

References com.sun.jmx.examples.scandir.ScanManager.sendQueuedNotifications(), com.sun.jmx.examples.scandir.ScanManager.state, and com.sun.jmx.examples.scandir.ScanManager.switchState().

Referenced by com.sun.jmx.examples.scandir.ScanManager.SessionTask.execute(), com.sun.jmx.examples.scandir.ScanManager.SessionTask.run(), and com.sun.jmx.examples.scandir.ScanManager.SessionTask.scheduleNext().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ run()

void com.sun.jmx.examples.scandir.ScanManager.SessionTask.run ( )

◆ scheduleNext()

boolean com.sun.jmx.examples.scandir.ScanManager.SessionTask.scheduleNext ( )
private

Member Data Documentation

◆ cancelled

volatile boolean com.sun.jmx.examples.scandir.ScanManager.SessionTask.cancelled =false
package

◆ delayBeforeNext

final long com.sun.jmx.examples.scandir.ScanManager.SessionTask.delayBeforeNext
package

Delay after which the next iteration of this task will start. This delay is measured starting at the end of the previous iteration.

Definition at line 769 of file ScanManager.java.

Referenced by com.sun.jmx.examples.scandir.ScanManager.SessionTask.run(), com.sun.jmx.examples.scandir.ScanManager.SessionTask.scheduleNext(), and com.sun.jmx.examples.scandir.ScanManager.SessionTask.SessionTask().

◆ taskid

final long com.sun.jmx.examples.scandir.ScanManager.SessionTask.taskid
package

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