Methods Summary |
---|
static void | addIsolate(MIDletProxy proxy, com.sun.cldc.isolate.Isolate isolate)Adds the Isolate associated with a started MIDlet.
synchronized (monitor.isolates) {
monitor.isolates.put(proxy, isolate);
}
|
public static void | addListener(IsolateMonitorListener listener)Add a listener for MIDlet suite terminations.
monitor.listeners.addElement(listener);
|
static void | initClass(MIDletProxyList theMIDletProxyList)Initializes StartMIDletMonitor class.
Shall only be called from AmsUtil.
No need in security checks since it is package private method.
midletProxyList = theMIDletProxyList;
monitor = new IsolateMonitor();
|
private boolean | lastInIsolate(MIDletProxy proxy)Determine if a MIDlet is the last MIDlet in an isolate.
Isolate isolate = (Isolate)isolates.get(proxy);
int midletCount = 0;
if (isolate != null) {
Enumeration enum = isolates.elements();
while (enum.hasMoreElements()) {
Isolate current = (Isolate)enum.nextElement();
if (current == isolate) {
midletCount++;
}
}
}
return midletCount == 1;
|
public void | midletAdded(MIDletProxy midlet)Called when a MIDlet is added to the list.
|
public void | midletRemoved(MIDletProxy proxy)Called when a MIDlet is removed from the list.
If this is the last MIDlet in its isolate then start a termination
notification thread to wait on its isolate.
synchronized (isolates) {
if (lastInIsolate(proxy)) {
startNotificationThread(proxy);
}
isolates.remove(proxy);
}
|
public void | midletStartError(int externalAppId, int suiteId, java.lang.String className, int errorCode, java.lang.String errorDetails)Called when error occurred while starting a MIDlet object.
|
public void | midletUpdated(MIDletProxy midlet, int fieldId)Called when the state of a MIDlet in the list is updated.
|
void | notifyListeners(int suiteId)Notifies the listeners that a suite has terminated.
synchronized (listeners) {
for (int i = 0; i < listeners.size(); i++) {
IsolateMonitorListener listener =
(IsolateMonitorListener)listeners.elementAt(i);
listener.suiteTerminated(suiteId);
}
}
|
private void | startNotificationThread(MIDletProxy proxy)Start a thread that will wait the MIDlet's isolate to terminate and
then notify the native application manager. This method will also
remove the MIDlet from the monitor's MIDlet list.
Isolate isolate = (Isolate)isolates.get(proxy);
TerminationNotifier notifier = new TerminationNotifier();
notifier.midlet = proxy;
notifier.isolate = isolate;
notifier.parent = this;
new Thread(notifier).start();
|