Re: [tcljava-user] Some questions ( no HTML now )
Brought to you by:
mdejong
From: D. J. H. <dha...@mi...> - 2001-05-20 16:57:52
|
"Jesus M. Salvo Jr." wrote: > D.J.: You mentioned that they would show as child processes with linux's "ps" > command. However, I tried that several times .... within a tclsh just after > "package require java", after a "[java::new ]" .... and I do not see such > child processes. Only if you start creating/running threads in the Java code. E.g., --------- TestThread.java --------------- public class TestThread implements Runnable { private boolean flag_ = true; private boolean interrupted_ = false; public void run() { while( !interrupted_ ) { System.out.println(flag_ ? "Tick" : "Tock"); System.out.flush(); flag_ = !flag_; try { Thread.sleep(1000L); } catch( InterruptedException ex ) { interrupted_ = true; } } } } ------------------------------------------ javac TestThread.java jtclsh package require java set tt [java::new Thread [java::new TestThread]] $tt start And now, on Linux, if your JVM is set to use native threads, you'll see a child process off your jtclsh process. If your JVM is set to use green threads, you will still only see one process. (on linux, green threads are a *lot* less resource intensive on a single-processor box). Hopefully Mo can answer your other questions, but some of it can really only be answered through tests. For instance, create two interps in tclsh, package require java into both of them, and then do something like: java::call System setProperty interp1prop Hi System properties are exclusive per VM, so if, in fact, there were two VMs created, the second interp would not be able to find the property you set in the first interp. With TclJava 1.2.6, this does not appear to be the case: % java::call System setProperty interp1prop Hi % % set ni [interp create] interp0 % $ni eval "package require java" 1.2.6 % $ni eval {java::call System getProperty interp1prop} Hi I don't have a thread-enabled Tcl to perform a similar test with threads, but perhaps you could do so with the interp that comes with Vignette? Hope this helps, -=- D. J. |