Bug in Jython2.7b4?

David Charles <[email protected]>
Newsgroups gmane.comp.lang.jython.devel
Message-ID <CAJHoYy+X4QXveh_KbNjLKqhNd=3GukaYwusXwBOoM7hVYC8=ig@mail.gmail.com>
I tried to create an account at bugs.jython.org, but the registration
e-mail never arrived.  So, at Frank Wierzbicki's suggestion, I am reporting
my experience here.  I did not observe this behavior on previous releases
of Jython.  My demo program follows.

'''
This program demonstrates that Jython2.7b4 fails to start a JavaFX
Application if:

    1.  We are waiting for a threading.Event object, AND

    2.  This module is imported, rather than invoked as the entry
        point to the Python program.

I think this is an important use case, because it enables me to hide
JavaFX Application-start logic inside of a module and block until
JavaFX initialzation is complete.

I saw this behavior on Ubuntu Linux 11.04 and Windows7, Java 8u31.
'''

import sys
import threading
import javafx.application.Application as Application
import java.lang.Runnable as Runnable
import java.lang.Thread as Thread

javaFXIsReady = threading.Event()

class MyApplication(Application):

    @classmethod
    def main(cls, args):
        MyApplication.launch(cls, args)

    def start(self, primaryStage):
        print 'MyApplication.start() was called.'
        javaFXIsReady.set()

class MyRunnable(Runnable):

    def run(self):
        MyApplication.main(sys.argv)

thread = Thread(MyRunnable())
thread.start()

if __name__ == '__main__':
    print 'The module is the program entry point.'
    print 'So, MyApplication.start() will get called.'
else:
    print 'The module was imported.'
    print 'So, MyApplication.start() will NOT get called.'

javaFXIsReady.wait()

------------------------------------------------------------------------------
Dive into the World of Parallel Programming The Go Parallel Website, sponsored
by Intel and developed in partnership with Slashdot Media, is your hub for all
things parallel software development, from weekly thought leadership blogs to
news, videos, case studies, tutorials and more. Take a look and join the 
conversation now. http://goparallel.sourceforge.net/

_______________________________________________
Jython-dev mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/jython-dev
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.