FileDocCategorySizeDatePackage
SuspendSystem.javaAPI DocphoneME MR2 API (J2ME)9277Wed May 02 18:00:10 BST 2007com.sun.midp.suspend

SuspendSystem

public class SuspendSystem extends AbstractSubsystem
Main system of the current isolate that contains all suspendable subsystems in current isolate. There is a singleton instance in each isolate. The instance kept in the AMS isolate is a special one and belongs to MIDPSystem subtype.

Fields Summary
private final Vector
listeners
Listeners interested in suspend/resume operations.
private static SuspendSystem
instance
The singleton instance.
Constructors Summary
private SuspendSystem()
Constructs an instance.

Methods Summary
public voidaddListener(SuspendSystemListener listener)
Registers a listener interested in system suspend/resume operations. IMPL_NOTE: method for removing listeners is not needed currently.

param
listener the listener to be added

        synchronized (listeners) {
            listeners.addElement(listener);
        }
    
public static com.sun.midp.suspend.SuspendSystemgetInstance(com.sun.midp.security.SecurityToken token)
Retrieves the singleton instance.

param
token security token that identifies caller permissions for accessing this API
return
the singleton instance


                                    
         
        token.checkIfPermissionAllowed(Permissions.MIDP);
        return instance;
    
static com.sun.midp.suspend.SuspendSystemgetInstance()
Retrieves the singleton instance. The method is only available from this restricted package.

return
the singleton instance

        return instance;
    
protected voidresumed()
Notifies listeners of system resume.

        synchronized (listeners) {
            for (int i = listeners.size() - 1; i >= 0; i-- ) {
                SuspendSystemListener listener =
                        (SuspendSystemListener)listeners.elementAt(i);
                listener.midpResumed();
            }
        }
    
protected voidsuspended()
Notifies listeners of system suspend.

        synchronized (listeners) {
            for (int i = listeners.size() - 1; i >= 0; i-- ) {
                SuspendSystemListener listener =
                        (SuspendSystemListener)listeners.elementAt(i);
                listener.midpSuspended();
            }
        }