Methods Summary |
---|
private void | cleanupPending(int id, java.lang.String midlet)Cleanup the matching entry in the startPending list.
Once removed; the MIDlet will be eligible to be started
again.
synchronized (startPending) {
// If the notification is for this monitor
if (id == suiteId &&
(midlet == null || midlet.equals(midlet))) {
// Remove from the startPending list
startPending.removeElement(this);
// Remove the instance as a listener of the MIDletProxyList
midletProxyList.removeListener(this);
}
}
|
private static com.sun.midp.main.StartMIDletMonitor | findMonitor(int id, java.lang.String midlet)Scan the startPending list for a matching id and MIDlet.
The caller must synchronize using {@link #startPending}.
If midlet is null then it only checks to see
if the suite is started and returns any monitor for the suite.
To prevent using stale Isolate state; check that the Isolate (if any)
has not terminated.
for (int i = 0; i < startPending.size(); i++) {
StartMIDletMonitor pending =
(StartMIDletMonitor)startPending.elementAt(i);
// If there is a terminated Isolate in the list, clean it up
if (pending.isolate != null &&
pending.isolate.isTerminated()) {
// Isolate is not alive, clean the pending entry
startPending.removeElementAt(i);
midletProxyList.removeListener(pending);
// Recheck the element at the same index
i--;
continue; // keep looking
}
if (id == pending.suiteId &&
(midlet == null || midlet.equals(pending.midlet))) {
return pending;
}
}
return null;
|
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;
|
public void | midletAdded(MIDletProxy midlet)Called when a MIDlet is added to the list.
If there's a match in the startPending list clean it up.
IsolateMonitor.addIsolate(midlet, isolate);
cleanupPending(midlet.getSuiteId(), midlet.getClassName());
|
public void | midletRemoved(MIDletProxy midlet)Called when a MIDlet is removed from the list.
If there's a match in the startPending list clean it up.
cleanupPending(midlet.getSuiteId(), midlet.getClassName());
|
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.
If there's a match in the startPending list clean it up.
cleanupPending(suiteId, className);
|
public void | midletUpdated(MIDletProxy midlet, int fieldId)Called when the state of a MIDlet in the list is updated.
If there's a match in the startPending list clean it up.
|
static com.sun.midp.main.StartMIDletMonitor | okToStart(int id, java.lang.String midlet)Check if the MIDlet is already in the ProxyList or is
already being started. If so, return.
If not, start it. Register with the proxy list and
cleanup when the start of the MIDlet
succeeds (and is now in the ProxyList) or
fails (and is eligible to be started again).
synchronized (startPending) {
// Verify that the requested MIDlet is not already running
// (is not in the MIDletProxyList)
if (midletProxyList.isMidletInList(id, midlet)) {
if (Logging.REPORT_LEVEL <= Logging.WARNING) {
Logging.report(Logging.WARNING, LogChannels.LC_CORE,
"MIDlet already running; execute ignored");
}
return null;
}
/*
* Find the StartMIDletMonitor instance
* to track the startup, (if any)
*/
StartMIDletMonitor start = findMonitor(id, midlet);
if (start == null) {
// Not already starting; register new start
start = new StartMIDletMonitor(id, midlet);
} else {
// MIDlet is already started; return null
start = null;
if (Logging.REPORT_LEVEL <= Logging.WARNING) {
Logging.report(Logging.WARNING, LogChannels.LC_CORE,
"MIDlet already started; execute ignored");
}
}
return start;
}
|
void | setIsolate(com.sun.cldc.isolate.Isolate newIsolate)Sets the Isolate associated with this starting MIDlet.
It is used to cleanup the Isolate if the start does not
start correctly.
isolate = newIsolate;
|