Message10978

Author zyasoft
Recipients andrewparks, zyasoft
Date 2016-10-27.14:37:08
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1477579029.02.0.171917585932.issue2530@psf.upfronthosting.co.za>
In-reply-to
Content
Presumably we can implement PythonInterpreter#abort using a similar approach to org.python.util.jython#shutdownInterpreter, but to set the restart flag for a specific PySystemState, not the current state as defined by a thread local.

    public static void shutdownInterpreter() {
        // Stop all the active threads and signal the SystemRestart
        thread.interruptAllThreads();
        Py.getSystemState()._systemRestart = true;
        // Close all sockets -- not all of their operations are stopped by
        // Thread.interrupt (in particular pre-nio sockets)
        try {
            imp.load("socket").__findattr__("_closeActiveSockets").__call__();
        } catch (PyException pye) {
            // continue
        }
    }

Note that we should be able to do a better cleanup in  as of Jython 2.7 and recent Java - assuming well behaved resources.
History
Date User Action Args
2016-10-27 14:37:09zyasoftsetmessageid: <1477579029.02.0.171917585932.issue2530@psf.upfronthosting.co.za>
2016-10-27 14:37:09zyasoftsetrecipients: + zyasoft, andrewparks
2016-10-27 14:37:08zyasoftlinkissue2530 messages
2016-10-27 14:37:08zyasoftcreate