javax.realtime
Class MonitorControl

java.lang.Object
  extended byjavax.realtime.MonitorControl
Direct Known Subclasses:
PriorityCeilingEmulation, PriorityInheritance

public abstract class MonitorControl
extends java.lang.Object

Abstract superclass for all monitor control policy objects.


Constructor Summary
protected MonitorControl()
          Invoked from subclass constructors.
 
Method Summary
static MonitorControl getMonitorControl()
          Gets the current default monitor control policy.
static MonitorControl getMonitorControl(java.lang.Object obj)
          Gets the monitor control policy of the given instance of Object.
static MonitorControl setMonitorControl(MonitorControl policy)
          Sets the default monitor control policy.
static MonitorControl setMonitorControl(java.lang.Object obj, MonitorControl policy)
          Immediately sets policy as the monitor control policy for obj.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

MonitorControl

protected MonitorControl()
Invoked from subclass constructors.

Method Detail

getMonitorControl

public static MonitorControl getMonitorControl(java.lang.Object obj)
Gets the monitor control policy of the given instance of Object.

Parameters:
obj - The object being queried.
Returns:
The monitor control policy of the obj parameter.
Throws:
java.lang.IllegalArgumentException - Thrown if obj is null.

getMonitorControl

public static MonitorControl getMonitorControl()
Gets the current default monitor control policy.

Returns:
The default monitor control policy object.

setMonitorControl

public static MonitorControl setMonitorControl(MonitorControl policy)
Sets the default monitor control policy. This policy does not affect the monitor control policy of any already created object, it will, however, govern any object subsequently constructed, until either:
  1. a new "per-object" policy is set for that object. This will alter the monitor control policy for a single object without changing the default policy.
  2. a new default policy is set.
Like the per-object method (see setMonitorControl(Object, MonitorControl), the setting of the default monitor control policy occurs immediately.

Parameters:
policy - The new monitor control policy. If null nothing happens.
Returns:
The default MonitorControl policy that was replaced.
Throws:
java.lang.SecurityException - Thrown if the caller is not permitted to alter the default monitor control policy.
java.lang.IllegalArgumentException - Thrown if policy is not in immortal memory.
java.lang.UnsupportedOperationException - Thrown if policy is not a supported monitor control policy.
Since:
1.0.1 The return type is changed from void to MonitorControl.

setMonitorControl

public static MonitorControl setMonitorControl(java.lang.Object obj,
                                               MonitorControl policy)
Immediately sets policy as the monitor control policy for obj.

A thread or schedulable object that is queued for the lock associated with obj, or is in obj's wait set, is not rechecked (e.g., for a CeilingViolationException) under policy, either as part of the execution of setMonitorControl or when it is awakened to (re)acquire the lock.

The thread or schedulable object invoking setMonitorControl must already hold the lock on obj.

Parameters:
obj - The object that will be governed by the new policy.
policy - The new policy for the object. If null nothing will happen.
Returns:
The current MonitorControl policy for obj, which will be replaced.
Throws:
java.lang.IllegalArgumentException - Thrown when obj is null or policy is not in immortal memory.
java.lang.UnsupportedOperationException - Thrown if policy is not a supported monitor control policy.
java.lang.IllegalMonitorStateException - Thrown if the caller does not hold a lock on obj.
Since:
1.0.1 The return type is changed from void to MonitorControl.