From: Silvio A. <sar...@mo...> - 2001-08-23 10:12:39
|
Hello everybody, again on asynchronous callback. I am interacting with the Java API of a CORBA server. Some operations cannot return an immediate result, and so if I want to know the result of the operation I have to register a callback object (that must implement an interface provided with the API) to be called asynchronously from the API when the operation is completed. I corrected some bugs (I forgot the self attribute, argh!) and now my asynchronous callback object works, but I have a strange output message from Jython. My code is just like this: # implementation of ReportReceiver interface class getReport(ReportReceiver): def __init__(self,): self.received=threading.Event() # event to notify that report has been received def receiveReport(...): # callback method called by the API ... self.received.set() return #main program # register to get the report receiver=getReport() registerForReports(receiver) # call a CORBA operation ... # and then wait until the report is received receiver.received.wait() unregisterForReports() When i execute it it works fine, but Jython prints the following message on standard output: currentThread(): no current thread for 2006345 (ok, the number can be any:)) it writes this message just after the receiveReport method sets its received event. What is the reason for this message and what does it mean? ciao, Silvio. |
From: Robert W. B. <rb...@di...> - 2001-08-23 15:17:42
|
Hello Silvio, The "no current thread" message is unique to v2.0. It is a debug message in the threading.py module that has since been commented out (in versions 2.1+). If you're curious, looking at threading.py explains why it happes, but it is safe to comment it out. line ~520, in the following function. def currentThread(): try: return _active[_get_ident()] except KeyError: print "currentThread(): no current thread for", _get_ident() return _DummyThread() The offending line is the print statement obviously, so you can just change to: ##print "currentThread(): no current thread for:, _get_ident() On Thu, 23 Aug 2001, Silvio Arcangeli wrote: > Hello everybody, again on asynchronous callback. > I am interacting with the Java API of a CORBA server. Some operations > cannot return an immediate result, and so if I want to know the result of > the operation I have to register a callback object (that must implement an > interface provided with the API) to be called asynchronously from the API > when the operation is completed. > I corrected some bugs (I forgot the self attribute, argh!) and now my > asynchronous callback object works, but I have a strange output message > from Jython. > > My code is just like this: > > # implementation of ReportReceiver interface > class getReport(ReportReceiver): > def __init__(self,): > self.received=threading.Event() # event to notify that report has > been received > > def receiveReport(...): # callback method called by the API > ... > self.received.set() > return > > #main program > # register to get the report > receiver=getReport() > registerForReports(receiver) > > # call a CORBA operation > .. > > # and then wait until the report is received > receiver.received.wait() > unregisterForReports() > > > When i execute it it works fine, but Jython prints the following message on > standard output: > currentThread(): no current thread for 2006345 > > (ok, the number can be any:)) > it writes this message just after the receiveReport method sets its > received event. > What is the reason for this message and what does it mean? > > ciao, > Silvio. > > > _______________________________________________ > Jython-users mailing list > Jyt...@li... > http://lists.sourceforge.net/lists/listinfo/jython-users > |
From: <bc...@wo...> - 2001-08-23 16:26:48
|
[Silvio Arcangeli] >Hello everybody, again on asynchronous callback. >I am interacting with the Java API of a CORBA server. Some operations >cannot return an immediate result, and so if I want to know the result of >the operation I have to register a callback object (that must implement an >interface provided with the API) to be called asynchronously from the API >when the operation is completed. >I corrected some bugs (I forgot the self attribute, argh!) When debugging CORBA servers in jython you may find it usefull to set the registry option: python.options.showPythonProxyExceptions=true That makes certain exceptions thrown by jython code far more visible and easier to debug. regards, finn |
From: Brian Z. <bri...@ya...> - 2001-08-23 17:35:00
|
Hi all, About two months ago I experimented with jython on WinCE/iPaq and had some success, now VAME (IBM visual age micro edition) has released 1.4 (== 1.3.0 jvm), so I tried the new version. Good news is I don't have to copy Sun's rt.jar, and pystone shows an improvement from 48 to 52. But adding \vame1.4\lib\jclMax\classes.zip to the classpath option does not work, I have to work around by using a 9M extracted .class tree. Here's the updated instruction: 1. download from http://www.embedded.oti.com/ "runtime for ARM PocketPC" and "custom config" 2. install the runtime, extract the zip file and copy to pocketpc under \vame1.4 3. install the "custom config", copy lib\jclMax to pocketpc \vame1.4\lib 4. download jython2.1a3 from http://www.jython.org , copy \jython-2.1a3 to pocketpc \jython-2.1a3 5. extract lib\jclMax\classes.zip and copy all subdir/files to pocketpc \vame1.4\lib\classes 6. create a shortcut RunJython.lnk using the following 4 lines concated (on a single line seperated by " ") on your desktop PC and copy it to your pocketpc (-cp:classpath, -bp:bootstrap): 132#"\vame1.4\j9.exe" "-bp:\vame1.4\lib\jclMax\classes.zip" "-cp:\vame1.4\lib\classes;\jython-2.1a1\jython.jar" "org.python.util.jython" Here's the part I hope someone can give me some insight, I want to know why classes.zip cannot be in classpath: 1. If I leave the classpath as "-cp:\jython-2.1a1\jython.jar", I can launch jython fine, do all the python stuff, while "import java" shows "no module named java" 2. If I use "-cp:\vame1.4\lib\jclMax\classes.zip;\jython-2.1a1\jython.jar", I got error message: *sys-package-mgr*: processing new jar, '\vame1.4\lib\jclMax\classes.zip' java.lang.IndexOutOfBoundsException Stack trace: java/lang/Throwable.<init>()V java/lang/Throwable.<init>(Ljava/lang/String;)V java/lang/IndexOutOfBoundsException.<init>(Ljava/lang/String;)V java/util/zip/ZipInputStream.read([BII)I java/util/zip/ZipInputStream.skip(J)J java/io/DataInputStream.skipBytes(I)I org/python/core/PackageManager.checkAccess(Ljava/io/InputStream;)I org/python/core/CachedJarsPackageManager.addZipEntry(Ljava/util/Hashtable;Lj ava/util/zip/ZipEntry;Ljava/util/zip/ZipInputStream;)V org/python/core/CachedJarsPackageManager.getZipPackages(Ljava/io/InputStream ;)Ljava/util/Hashtable; org/python/core/CachedJarsPackageManager.addJarToPackages(Ljava/net/URL;Ljav a/io/File;Z)V org/python/core/CachedJarsPackageManager.addJarToPackages(Ljava/io/File;Z)V org/python/core/PathPackageManager.addClassPath(Ljava/lang/String;)V org/python/core/SysPackageManager.findAllPackages(Ljava/util/Properties;)V org/python/core/SysPackageManager.<init>(Ljava/io/File;Ljava/util/Properties ;)V org/python/core/PySystemState.initPackages(Ljava/util/Properties;)V org/python/core/PySystemState.initialize(Ljava/util/Properties;Ljava/util/Pr operties;[Ljava/lang/String;Ljava/lang/ClassLoader;)V org/python/core/PySystemState.initialize(Ljava/util/Properties;Ljava/util/Pr operties;[Ljava/lang/String;)V org/python/util/jython.main([Ljava/lang/String;)V 3. As mentioned, extract classes.zip to directory and add directory to -cp works fine. 4. I also tried to jar classes/ directory into a classes.jar but that caused jython to complain "skip bad jar" Anyone has any idea the cause, or what to do further? I mean it works ok right now, except I have to live with this 9M .class tree on a handheld. Thanks for any help or suggestions, -Brian |
From: <bc...@wo...> - 2001-08-24 19:58:29
|
[Brian Zhou] >Hi all, > >About two months ago I experimented with jython on WinCE/iPaq and had some >success, now VAME (IBM visual age micro edition) has released 1.4 (== 1.3.0 >jvm), so I tried the new version. > >Good news is I don't have to copy Sun's rt.jar, and pystone shows an >improvement from 48 to 52. But adding \vame1.4\lib\jclMax\classes.zip to the >classpath option does not work, I have to work around by using a 9M >extracted .class tree. > >Here's the updated instruction: >... Sounds like a good candidate for a faq entry: 2.7 How do I install jython on my iPAQ > >Here's the part I hope someone can give me some insight, I want to know why >classes.zip cannot be in classpath: > >1. If I leave the classpath as "-cp:\jython-2.1a1\jython.jar", I can launch >jython fine, do all the python stuff, while "import java" shows "no module >named java" >2. If I use "-cp:\vame1.4\lib\jclMax\classes.zip;\jython-2.1a1\jython.jar", >I got error message: >*sys-package-mgr*: processing new jar, '\vame1.4\lib\jclMax\classes.zip' >java.lang.IndexOutOfBoundsException > >Stack trace: > java/lang/Throwable.<init>()V > java/lang/Throwable.<init>(Ljava/lang/String;)V > java/lang/IndexOutOfBoundsException.<init>(Ljava/lang/String;)V > java/util/zip/ZipInputStream.read([BII)I > java/util/zip/ZipInputStream.skip(J)J > java/io/DataInputStream.skipBytes(I)I > org/python/core/PackageManager.checkAccess(Ljava/io/InputStream;)I > ... I find the stacktrace curious. Totally unrelated to the problem you are having, but when a skip() call can cause a IOOB (perhaps because a over/underflow of the temporary buffer allocated by skip) then ZipInputStream are having serious internal problems. Perhaps OTI can be convinced to take a closer look at the IOOB exception. >3. As mentioned, extract classes.zip to directory and add directory to -cp >works fine. >4. I also tried to jar classes/ directory into a classes.jar but that caused >jython to complain "skip bad jar" > >Anyone has any idea the cause, or what to do further? As the OTI guy said, putting classes.zip on -cp isn't the solution (even if it didn't throw a IOOB). I have made a very experimental feature that allow a tool (running under java2 on windows or unix) to pre-index a zip/jar file. The pre-index is then stored inside the zip file. If you want to try it out (and I really think you should because it fixes the problems you are having with this) you will have to apply a patch to SysPackageManager.java and install a new source file in org/python/util/jythonjar.java. > http://sourceforge.net/tracker/index.php?func=detail&aid=454329&group_id=12867&atid=312867 When you have compiled the changes to jython, you run the indexer tool like this: java org.python.util.jythonjar -usecp -cp classes.zip jython.jar After this the jython.jar file is updated with a lot of entries called META-INF/JYTHON-PACKAGES-java META-INF/JYTHON-PACKAGES-java.lang ... These entries will be used when the cache dir doesn't contain entries for the packages. As a result classes.zip doesn't need to be on the -cp. regards, finn |
From: Brian Z. <bri...@ya...> - 2001-08-24 21:17:29
|
I'll try it this weekend and report to the group, as always thanks Finn. -Brian ----- Original Message ----- From: "Finn Bock" <bc...@wo...> To: <jyt...@li...> Sent: Friday, August 24, 2001 1:00 PM Subject: Re: [Jython-users] jython on WinCE/iPaq update > [Brian Zhou] > > >Hi all, > > > >About two months ago I experimented with jython on WinCE/iPaq and had some > >success, now VAME (IBM visual age micro edition) has released 1.4 (== 1.3.0 > >jvm), so I tried the new version. > > > >Good news is I don't have to copy Sun's rt.jar, and pystone shows an > >improvement from 48 to 52. But adding \vame1.4\lib\jclMax\classes.zip to the > >classpath option does not work, I have to work around by using a 9M > >extracted .class tree. > > > >Here's the updated instruction: > >... > > Sounds like a good candidate for a faq entry: > > 2.7 How do I install jython on my iPAQ > > > > >Here's the part I hope someone can give me some insight, I want to know why > >classes.zip cannot be in classpath: > > > >1. If I leave the classpath as "-cp:\jython-2.1a1\jython.jar", I can launch > >jython fine, do all the python stuff, while "import java" shows "no module > >named java" > >2. If I use "-cp:\vame1.4\lib\jclMax\classes.zip;\jython-2.1a1\jython.jar", > >I got error message: > >*sys-package-mgr*: processing new jar, '\vame1.4\lib\jclMax\classes.zip' > >java.lang.IndexOutOfBoundsException > > > >Stack trace: > > java/lang/Throwable.<init>()V > > java/lang/Throwable.<init>(Ljava/lang/String;)V > > java/lang/IndexOutOfBoundsException.<init>(Ljava/lang/String;)V > > java/util/zip/ZipInputStream.read([BII)I > > java/util/zip/ZipInputStream.skip(J)J > > java/io/DataInputStream.skipBytes(I)I > > org/python/core/PackageManager.checkAccess(Ljava/io/InputStream;)I > > ... > > I find the stacktrace curious. Totally unrelated to the problem you are > having, but when a skip() call can cause a IOOB (perhaps because a > over/underflow of the temporary buffer allocated by skip) then > ZipInputStream are having serious internal problems. Perhaps OTI can be > convinced to take a closer look at the IOOB exception. > > >3. As mentioned, extract classes.zip to directory and add directory to -cp > >works fine. > >4. I also tried to jar classes/ directory into a classes.jar but that caused > >jython to complain "skip bad jar" > > > >Anyone has any idea the cause, or what to do further? > > As the OTI guy said, putting classes.zip on -cp isn't the solution (even > if it didn't throw a IOOB). > > I have made a very experimental feature that allow a tool (running under > java2 on windows or unix) to pre-index a zip/jar file. The pre-index is > then stored inside the zip file. > > If you want to try it out (and I really think you should because it > fixes the problems you are having with this) you will have to apply a > patch to SysPackageManager.java and install a new source file in > org/python/util/jythonjar.java. > > > http://sourceforge.net/tracker/index.php?func=detail&aid=454329&group_id=128 67&atid=312867 > > When you have compiled the changes to jython, you run the indexer tool > like this: > > java org.python.util.jythonjar -usecp -cp classes.zip jython.jar > > After this the jython.jar file is updated with a lot of entries called > > META-INF/JYTHON-PACKAGES-java > META-INF/JYTHON-PACKAGES-java.lang > ... > > These entries will be used when the cache dir doesn't contain entries > for the packages. As a result classes.zip doesn't need to be on the -cp. > > > regards, > finn > > _______________________________________________ > Jython-users mailing list > Jyt...@li... > http://lists.sourceforge.net/lists/listinfo/jython-users > |
From: Brian Z. <bri...@ya...> - 2001-08-26 18:26:46
Attachments:
Import_re.zip
|
It works! But a few observations and questions: 1. I saw entries like JYTHON-PACKAGE-com.ibm.oti.vm in the pre-indexed jython.jar, does that mean this jython.jar is bootstrap classes specific? Can I use the same jython.jar for Sun Personal Java for WinCE/ARM? 2. I'm thinking about document all this, but will this pre-index feature be in the next release? 3. The previous pystone boost was not by VAME 1.4 upgrade. Using pre-indexed jython.jar pystone falls back to 48-49. It was more because I happened to extract the classes.zip into a directory. This also indicates pre-index in the jar has some overhead. 4. "import re" throws StackOverflownError while "import _sre" works. Attached is the stack trace. Thanks for the great work! -Brian ----- Original Message ----- From: "Finn Bock" <bc...@wo...> To: <jyt...@li...> Sent: Friday, August 24, 2001 1:00 PM Subject: Re: [Jython-users] jython on WinCE/iPaq update > [Brian Zhou] > > >Hi all, > > > >About two months ago I experimented with jython on WinCE/iPaq and had some > >success, now VAME (IBM visual age micro edition) has released 1.4 (== 1.3.0 > >jvm), so I tried the new version. > > > >Good news is I don't have to copy Sun's rt.jar, and pystone shows an > >improvement from 48 to 52. But adding \vame1.4\lib\jclMax\classes.zip to the > >classpath option does not work, I have to work around by using a 9M > >extracted .class tree. > > > >Here's the updated instruction: > >... > > Sounds like a good candidate for a faq entry: > > 2.7 How do I install jython on my iPAQ > > > > >Here's the part I hope someone can give me some insight, I want to know why > >classes.zip cannot be in classpath: > > > >1. If I leave the classpath as "-cp:\jython-2.1a1\jython.jar", I can launch > >jython fine, do all the python stuff, while "import java" shows "no module > >named java" > >2. If I use "-cp:\vame1.4\lib\jclMax\classes.zip;\jython-2.1a1\jython.jar", > >I got error message: > >*sys-package-mgr*: processing new jar, '\vame1.4\lib\jclMax\classes.zip' > >java.lang.IndexOutOfBoundsException > > > >Stack trace: > > java/lang/Throwable.<init>()V > > java/lang/Throwable.<init>(Ljava/lang/String;)V > > java/lang/IndexOutOfBoundsException.<init>(Ljava/lang/String;)V > > java/util/zip/ZipInputStream.read([BII)I > > java/util/zip/ZipInputStream.skip(J)J > > java/io/DataInputStream.skipBytes(I)I > > org/python/core/PackageManager.checkAccess(Ljava/io/InputStream;)I > > ... > > I find the stacktrace curious. Totally unrelated to the problem you are > having, but when a skip() call can cause a IOOB (perhaps because a > over/underflow of the temporary buffer allocated by skip) then > ZipInputStream are having serious internal problems. Perhaps OTI can be > convinced to take a closer look at the IOOB exception. > > >3. As mentioned, extract classes.zip to directory and add directory to -cp > >works fine. > >4. I also tried to jar classes/ directory into a classes.jar but that caused > >jython to complain "skip bad jar" > > > >Anyone has any idea the cause, or what to do further? > > As the OTI guy said, putting classes.zip on -cp isn't the solution (even > if it didn't throw a IOOB). > > I have made a very experimental feature that allow a tool (running under > java2 on windows or unix) to pre-index a zip/jar file. The pre-index is > then stored inside the zip file. > > If you want to try it out (and I really think you should because it > fixes the problems you are having with this) you will have to apply a > patch to SysPackageManager.java and install a new source file in > org/python/util/jythonjar.java. > > > http://sourceforge.net/tracker/index.php?func=detail&aid=454329&group_id=128 67&atid=312867 > > When you have compiled the changes to jython, you run the indexer tool > like this: > > java org.python.util.jythonjar -usecp -cp classes.zip jython.jar > > After this the jython.jar file is updated with a lot of entries called > > META-INF/JYTHON-PACKAGES-java > META-INF/JYTHON-PACKAGES-java.lang > ... > > These entries will be used when the cache dir doesn't contain entries > for the packages. As a result classes.zip doesn't need to be on the -cp. > > > regards, > finn > > _______________________________________________ > Jython-users mailing list > Jyt...@li... > http://lists.sourceforge.net/lists/listinfo/jython-users > |
From: <bc...@wo...> - 2001-08-26 19:02:25
|
[Brian Zhou] >It works! > >But a few observations and questions: > >1. I saw entries like > > JYTHON-PACKAGE-com.ibm.oti.vm > > in the pre-indexed jython.jar, does that mean this jython.jar is >bootstrap classes specific? Yes to some extend. >Can I use the same jython.jar for Sun Personal Java for WinCE/ARM? Yes, but you can't import any of the sun specific non-public classes. Since you shouldn't do that anyway, it is no great loss. >2. I'm thinking about document all this, but will this pre-index feature be >in the next release? I don't know yet. It depends on how usefull it is. Feedback like this makes it easier to decide. >3. The previous pystone boost was not by VAME 1.4 upgrade. Using pre-indexed >jython.jar pystone falls back to 48-49. It was more because I happened to >extract the classes.zip into a directory. This also indicates pre-index in >the jar has some overhead. It should be minimal but the feature does add an addition lookup for a resource with the name JYTHON-PACKAGE-* when an import statement doesn't find any another match. >4. "import re" throws StackOverflownError while "import _sre" works. >Attached is the stack trace. At first look it doesn't seem like a bug but a real stack overflow. Can you extend the amount of stack space allocated? It looks like the javaCC parser isn't optimized for small stacks (but neither if jython). regards, finn |