/**
 * Reports a fatal error that cannot be handled in Java.
 * Must be called from a KNI method
 *
 */
void handleFatalError(void) {
    KNI_StartHandles(1);
    KNI_DeclareHandle(throwableObj);
    KNI_GetParameterAsObject(1, throwableObj);

    /* IMPL NOTE: Figure out what throwable class this is and log the error? */
    REPORT_CRIT1(LC_CORE, "handleFatalError: uncaught exception in "
        "isolate %d event processing thread", getCurrentIsolateId());
    
    KNI_EndHandles();

    if (getCurrentIsolateId() == midpGetAmsIsolateId()) {
        /* AMS isolate or SVM mode, terminate VM */
        midp_exitVM(-1);
    } else {
        MidpEvent event;

        /* Application isolate, notify the AMS isolate. */
        MIDP_EVENT_INITIALIZE(event);
        event.type = FATAL_ERROR_NOTIFICATION;
        event.intParam1 = getCurrentIsolateId();

        /* Send the shutdown event. */
        StoreMIDPEventInVmThread(event, midpGetAmsIsolateId());
    }

    KNI_ReturnVoid();
}
示例#2
0
/**
 * Stops the VM and exit immediately.
 * <p>
 * Java declaration:
 * <pre>
 *     exitInternal(I)V
 * </pre>
 *
 * @param value The return code of the VM.
 */
KNIEXPORT KNI_RETURNTYPE_VOID
Java_com_sun_midp_main_CommandState_exitInternal(void) {
    int value = (int)KNI_GetParameterAsInt(1);

    midp_exitVM(value);
    KNI_ReturnVoid();
}
KNIEXPORT KNI_RETURNTYPE_VOID
KNIDECL(com_sun_midp_main_MIDletProxyUtils_requestVMStop) {
    midp_exitVM(ABEND);
    KNI_ReturnVoid();
}