AWT problem with SWiM Motif 1.2 under alpha 117v2 port
I just upgraded to the jdk117_alpha21164a_bin and am having trouble with some of the demo programs seg faulting or aborting while using SWiM Motif. They all work fine when I set my LD_LIBRARY_PATH to use lesstif 0.87. So this is not a critical bug. But it is interesting nonetheless. An example would be the appletviewer GraphicsTest/example1.html It opens the appletviewer box, then immediately crashes before displaying anything. See the end of this message for an error outputs. I'm using a 533Mhz LX processor. Redhat 5.2 kernel 2.0.35 glibc-2.0.7 The SVGA_XF86 driver supporting my Millenium SVGA. SWiM Motif 1.2.4. The Afterstep window manager. JAVA_HOME, CLASSPATH, JDK_HOME are all unset. I have not applied any of the kernel patches in the appendix yet. Other AWT things like the MoleculeViewer work fine. And I haven't had a problem with any Swing-1.0.2 examples I tried so far. But the following demos from the binary distribution all failed. CardTest DitherTest DrawTest GraphicsTest I exhaustively tried the other demos and they all worked just fine. (Good job Mr Gatgul!) [dump with LD_LIBRARY_PATH set to /usr/X11/lib for SWiM] java: ../../../../src/genunix/java/green_threads/src/dl-malloc.c:1257: do_check_inuse_chunk: Assertion `mchunkptr)(((char*)(p))+((p)->size & ~0x1)))->size) & 0x1)' failed. SIGABRT 6* abort (generated by abort(3) routine) Full thread dump: "Screen Updater" (TID:0x15556046b00, sys_thread_t:0x15557a95d98, state:CW) prio=4 java.lang.Object.wait(Object.java) sun.awt.ScreenUpdater.nextEntry(ScreenUpdater.java:70) sun.awt.ScreenUpdater.run(ScreenUpdater.java:90) "AWT-Motif" (TID:0x155560428b0, sys_thread_t:0x15557a73d98, state:CW) prio=5 java.lang.Thread.run(Thread.java) "AWT-Input" (TID:0x155560428f0, sys_thread_t:0x15557a51d98, state:R) prio=5 "AWT-EventQueue-0" (TID:0x15556042920, sys_thread_t:0x15557a2fd98, state:MW) prio=5 sun.awt.motif.MComponentPeer.handleEvent(MComponentPeer.java:265) java.awt.Component.dispatchEventImpl(Component.java:1862) java.awt.Container.dispatchEventImpl(Container.java:949) java.awt.Component.dispatchEvent(Component.java:1741) java.awt.EventDispatchThread.run(EventDispatchThread.java:79) "thread applet-GraphicsTest.class" (TID:0x155560411c0, sys_thread_t:0x1655d98, state:R) prio=5 *current thread* sun.awt.motif.MComponentPeer.setBounds(MComponentPeer.java:593) sun.awt.motif.MComponentPeer.reshape(MComponentPeer.java:631) sun.awt.motif.MComponentPeer.initialize(MComponentPeer.java:88) sun.awt.motif.MChoicePeer.initialize(MChoicePeer.java:34) sun.awt.motif.MComponentPeer.init(MComponentPeer.java:129) sun.awt.motif.MComponentPeer.(MComponentPeer.java:133) sun.awt.motif.MChoicePeer.(MChoicePeer.java:38) sun.awt.motif.MToolkit.createChoice(MToolkit.java:108) java.awt.Choice.addNotify(Choice.java:105) java.awt.Container.addNotify(Container.java:1175) java.awt.Panel.addNotify(Panel.java:78) java.awt.Container.addNotify(Container.java:1175) java.awt.Panel.addNotify(Panel.java:78) java.awt.Container.addImpl(Container.java:306) java.awt.Container.add(Container.java:182) GraphicsTest.init(GraphicsTest.java:88) sun.applet.AppletPanel.run(AppletPanel.java:281) java.lang.Thread.run(Thread.java) "Finalizer thread" (TID:0x1555601e450, sys_thread_t:0x1633d98, state:R) prio=1 "Async Garbage Collector" (TID:0x1555601e5c0, sys_thread_t:0x1611d98, state:R) prio=1 "Idle thread" (TID:0x1555601e570, sys_thread_t:0x15efd98, state:R) prio=0 "Clock" (TID:0x1555601e110, sys_thread_t:0x15cdd98, state:CW) prio=12 "main" (TID:0x1555601e160, sys_thread_t:0x12015dbb0, state:CW) prio=5 Monitor Cache Dump: java.lang.Object@llector": owner "thread applet-GraphicsTest.class" (0x1655d98, 6 entries) Waiting to enter: "AWT-EventQueue-0" (0x15557a2fd98) [EMAIL PROTECTED]": Waiting to be notified: "Screen Updater" (0x15557a95d98) (0x1804b28): owner "thread applet-GraphicsTest.class" (0x1655d98, 1 entry) [EMAIL PROTECTED]": owner "thread applet-GraphicsTest.class" (0x1655d98, 1 entry) Waiting to be notified: "AWT-Motif" (0x15557a73d98) Registered Monitor Dump: Verifier lock: Thread queue lock: Waiting to be notified: "main" (0x12015dbb0) Name and type hash table lock: String intern lock: JNI pinning lock: JNI global reference lock: BinClass lock: Class loading lock: Java stack lock: Code rewrite lock: Heap lock: Has finalization queue lock: Finalize me queue lock: Dynamic loading lock: Monitor IO lock: Child death monitor: Event monitor: I/O monitor: owner "AWT-Input" (0x15557a51d98, 1 entry)
JDBC for Oracle (was: RE: Retrieving a fully qualified hostname under NT)
On Fri, 13 Nov 1998, Rudhuwan Abu Bakar wrote: > > hello > > sorry for this. > > Where can I get a type 4(?) JDBC driver? I am testing an Oracle server and > want to use a Java-based client. > > Thank you for your time. > > regards > duan > I believe Oracle includes their JDBC driver with the database, and that it is a pure java driver. (I'm more certain of the first than the last). If you can't find it I'm sure you can download it from www.oracle.com somewhere ... /Urban --- Urban Widmark [EMAIL PROTECTED] Svenska Test AB +46 90 71 71 23
Re: JDBC for Oracle (was: RE: Retrieving a fully qualifiedhostname under NT)
On Fri, 13 Nov 1998, Urban Widmark wrote: > I believe Oracle includes their JDBC driver with the database, and that it > is a pure java driver. (I'm more certain of the first than the last). Yes, this is correct. We have Oracle system 8 and it includes JDBC drivers, which are 100% pure Java. This means that I am able to use it from my Linux box, and my students can use it from their Wintel boxes. Just need to get the JDBC drivers zip file (classes111.zip for Oracle 8) to your machine. > If you can't find it I'm sure you can download it from www.oracle.com > somewhere ... For earlier versions of Oracle, I believe the JDBC drivers were not included by default. However, I remember having downloaded free JDBC drivers for Oracle 7 before. These did require a certain version of Oracle, I think 7.3 or above, so wouldn't work with the 7.1 system that we had before. Check your Oracle version before looking for drivers. Cheers, Robert. - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - Robert P Biuk-Aghai, University of Macau, Faculty of Science and Technology http://hyperg.sftw.umac.mo/robert/tel: +853-3974365fax: +853-838314 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - Microsoft isn't the answer. Microsoft is the question and the answer is no.
Re: [Java-Linux] about this list ...
> >I also want to ask everyone there to *please* skip all the irrelevant > >when they include a message for a reply... > sound nice, but how are you going to define "irrelevant", e.g. which > part of your message should I leave out ?? Leave just enough information so that people can figure out what your answer relates to. If it's a simple topic, all can be left out at times. > Usually I delete a message > which contains just a question that I can't answer (so basically all ;-) ) > and just keep the replies, thats why it is so nice to have the original > message included. It is a recognised point of 'Net courtesy to not waste bandwith, such as including the entire message. I think that this comes down to courtesy vs. personal convenience. In my opinion, forcing a lot of people to pay for unneccesary bandwidth is discourteous. Not everybody has a T1. :-) I cut-and-paste relevant information into a small database for even faster finding of information. This may cause me a little immediate inconvenience, but it saves time to retrieve information later, and saves other people inconvenience and money. Just my two bits. James
PLAF Motif Button reduce external Padding or Interspacing
In Swing 1.1 Beta 2 the CDE/Motif PLAF seems to put a large gap size or interspacing between components. I have a three JButtons with an image icon aligned right and text label aligned to the right inside of a normal JPanel. The JPanel is managed by a custom row column layout manager which forces the bounds of the components. In the Metal PLAF this displays very nicely with buttons layed very close together. However when I switch to the CDE/Motif PLAF the interspace between buttons expands, consequently the JButton look a little __squoshed__! I have tried AbstractButton.setMargins( new Insets( 1,1,1,1 ) ) But this does not work. I think the Motif PLAF UI adds the interspacing but I dont know where to find it. If I can find it, perhaps it just possible I can override it. Any Ideas?
Two problems.
Hi all, i am relatively new to Java and i am trying to learn the UI (or the awt). Below is the code that i compiled ... ---Code begins --- import java.awt.*; import java.awt.event.*; import java.applet.*; public class Buttons extends Applet { private Button btnOk, btnExit; ActionListener myLis_Exit = new ActionListener() { public void actionPerformed(ActionEvent e) { stop(); destroy(); System.exit(0); } }; ActionListener myLis_Ok = new ActionListener() { public void actionPerformed(ActionEvent e) { System.out.println("This is Ok"); } }; public void init() { btnOk = new Button("Ok"); btnExit = new Button("Exit"); btnExit.addActionListener(myLis_Exit); btnOk.addActionListener(myLis_Ok); add(btnOk); add(btnExit); } //void init(); } //public class Buttons extends Applet Code Ends-- The code compiles ok, but then when i click on the "Exit" in the appletviewer i get a load of exceptions thrown. If the System.exit() is commented out, the applet still does not close. 1. how do i terminate an applet? 2. If i click the middle-mouse btn (btn# 3), the appletviewer crashes. I run RedHat 5.1 on a P2-400. Thanks, -Karthik. ++ | Karthik Vishwanath | National Centre for Biological Sciences| | [EMAIL PROTECTED] | TIFR Centre, IISc Campus, PO Box 1234 | | 80-334-5615 or 4062 or 3035 | Bangalore 560012, INDIA| | Fax 80-334-3851 | | ++
mergemem kernel patch
I've just been reading about the mergemem kernel patch. I haven't noticed any reference to it on this list before, so thought I'd draw it to your attention and ask if anyone has any experience with it. For details see: http://www.mondoshawan.ml.org/mergemem/ http://www.complang.tuwien.ac.at/ulrich/mergemem/ In brief, mergemem examines the memory belonging to processes running the same program and marks identical pages as 'read-only and 'copy-on-write'. This is in addition to the normal steps that the Linux kernel takes to share memory. The JVM initialises large amounts of data memory when it loads its class files. Most of this memory will never be written to during the life of the JVM, and separate instances of the JVM will load the same stuff. There thus seems to be considerable scope for sharing memory. At the mergemem site they quote memory usage figures for JDK 1.1.3 running some of the demo applets: First instance of JVM12488 kB Further instance w/o mergemem 7612 kB Further intstance with mergemem 2452 kB This looks like a very promising approach for those who need to run multiple instances of the JVM. Ron Yorstondirect phone: +44 1628 587074 PGS Tigress, phone: +44 1628 587000 Grenfell House, Grenfell Road, fax: +44 1628 587111 Maidenhead, Berks, e-mail: [EMAIL PROTECTED] SL6 1ES, UK
Re: AWT problem with SWiM Motif 1.2 under alpha 117v2 port
is swim motif avail ( free ? ) Eric Bohm wrote: > I just upgraded to the jdk117_alpha21164a_bin and am having trouble > with some of the demo programs seg faulting or aborting while using > SWiM Motif. >
RE: Retrieving a fully qualified hostname under NT
I think it should work to get the IPAddress and then create a new InetAddress: InetAddress add = InetAddress.getByName("xxx.xxx.xx.x"); Now you can use add.getHostName() and you should get the fully qualified hostname. Markus On 12-Nov-98 Mark Hofmann wrote: > Hi all, > > I've posted that question a few days ago to java.lang.programmer > but got no response :-( > But, since this problem is really bugging me, and there might be some > people in this list that run there progs under NT and Linux, just as me, > I hope to find a solution here. > Anyway, here is the problem, easy and simple > > when I use > String localhostname=(InetAddress.getLocalHost()).getHostName(); > under Linux I get the fully qualified hostname, under NT just the local > hostname, eg. host instead of host.my.domain.com > > Our admin says that its an NT feature/problem (you never know) because it > stores both names separately and returns usually only the local hostname. > > Is there a workaround for that, so I can get the fully qualyfied hostname or > do I just have to live with that? Or even better is our system misconfigured > and I can tell our admin that he's wrong (which is always fun ;-) ) > > Thanks in advance > > Mark > > > > -- > M a r k H o f m a n n > Department of Computer Science > University of Stellenbosch / South Africa > phone: +27-82-7449880
Failed to locate native library
hi! after decompressing the x86 and x86_native, and setting THREADS_FLAG, i get the following message after trying to execute 'appletviewer applet.html': "Failed to locate native library" am i missing something here? thanks, alex a. __ Get Your Private, Free Email at http://www.hotmail.com
Deprecated `Thread.stop()' in forthcoming JDK 1.2. Why?
I read somewhere that Thread.stop() is now deprecated. Now how on earth do we stop a thread ? I thought the solution would be Thread.interrupt() but that only works when the thread is sleeping, at least in JDK 1.1 documentation. I do not have the JDK 1.2 to hand, and I have started use multiple threads in Swing/JFC/. It seems to be idiocy to have a start method and not have a stop method. The stop() method justs halts the thread object and the garbage collector collects any rubbish. Thoughts? Pete
Re: Retrieving a fully qualified hostname under NT
Try using a reverse DNS lookup with that host's IP address , you should get a fully qualified host name from that. This obviously means you will have to use the DNS protocol on an open socket. The problem with NT is it is using WINS ( NT DNS) to resolve the name and that name returned is a host name known to the NT Promary Domain controller and the WINS Service. Mark Hofmann wrote: > Hi all, > > I've posted that question a few days ago to java.lang.programmer > but got no response :-( > But, since this problem is really bugging me, and there might be some > people in this list that run there progs under NT and Linux, just as > me, > I hope to find a solution here. > Anyway, here is the problem, easy and simple > > when I use > String > localhostname=(InetAddress.getLocalHost()).getHostName(); > under Linux I get the fully qualified hostname, under NT just the > local > hostname, eg. host instead of host.my.domain.com > > Our admin says that its an NT feature/problem (you never know) because > it > stores both names separately and returns usually only the local > hostname. > > Is there a workaround for that, so I can get the fully qualyfied > hostname or > do I just have to live with that? Or even better is our system > misconfigured > and I can tell our admin that he's wrong (which is always fun ;-) ) > > Thanks in advance > > Mark > > -- > M a r k H o f m a n n > Department of Computer Science > University of Stellenbosch / South Africa > phone: +27-82-7449880
Re: JDBC for Oracle (was: RE: Retrieving a fully qualified hostname under NT)
Urban Widmark wrote: > On Fri, 13 Nov 1998, Rudhuwan Abu Bakar wrote: > > > > > hello > > > > sorry for this. > > > > Where can I get a type 4(?) JDBC driver? I am testing an Oracle server and > > want to use a Java-based client. > > > > Thank you for your time. > > > > regards > > duan > > > > I believe Oracle includes their JDBC driver with the database, and that it > is a pure java driver. (I'm more certain of the first than the last). > > If you can't find it I'm sure you can download it from www.oracle.com > somewhere ... > > /Urban > > --- > Urban Widmark [EMAIL PROTECTED] > Svenska Test AB +46 90 71 71 23 They have both type 4 and type 2 drivers for Linux. I had some problems with the type 4 driver (they call them JDBC Thin) since it does not support LOBs (or at least I wasn't able to get them working). You can get these for Oracle 7/8 at http://www.oracle.com/products/free_software/index.html. The type 2 drivers for Linux were just released recently along with the database engine, you can get these from http://technet.oracle.com. (Warning: you need to register and this package is ~100M, I don't believe you can just download the type 2 drivers by themself.) Jason
Re: Retrieving a fully qualified hostname under NT
On Fri, 13 Nov 1998 10:01:30 -0800, Christopher Hinds wrote: >Try using a reverse DNS lookup with that host's IP address , you should >get >a fully qualified host name from that. This obviously means you will >have to use the DNS protocol on an open socket. The problem with NT is >it is using >WINS ( NT DNS) to resolve the name and that name returned is a host name >known to the NT Promary Domain controller and the WINS Service. >Mark Hofmann wrote: You should not need to do that much work - the JVM will do it for you when you give InetAddress an IP address and then as it for the host name. However, you are correct, the machine would need to be in DNS to support this. Note that if you are not DNS named, a fully qualified name will have little meaning. Michael Sinz -- Director of Research & Development, NextBus Inc. mailto:[EMAIL PROTECTED] - http://www.nextbus.com My place on the web ---> http://www.users.fast.net/~michael_sinz
Re: Deprecated `Thread.stop()' in forthcoming JDK 1.2. Why?
On Fri, 13 Nov 1998 15:15:29 +, [EMAIL PROTECTED] wrote: > I read somewhere that Thread.stop() is now deprecated. Now how on > earth do we stop a thread ? > I thought the solution would be Thread.interrupt() > but that only works when the thread is sleeping, at least in JDK 1.1 > documentation. > > I do not have the JDK 1.2 to hand, and I have started use multiple > threads in Swing/JFC/. It seems to be idiocy to have a start method > and not have a stop method. The stop() method justs halts the thread > object and the garbage collector collects any rubbish. > > Thoughts? There are reasons for some of the thread changes, mainly that the JVM can not control the threads as well on native threading systems (even more so when the thread is maybe running on another CPU) There would be far too much overhead in normal operation. You can implement your own thread operations but you would then need to have the overhead only in those cases. (It also will have the same problems with multi-processor/native thread operations and the like but if you really want a harsh stop(), it may be the only way) I too like the feature but it is easy enough to have your own notification. A harsh stop may not be able to control what is happening at the moment or it would have to only check at certain points within the operations. Michael Sinz -- Director of Research & Development, NextBus Inc. mailto:[EMAIL PROTECTED] - http://www.nextbus.com My place on the web ---> http://www.users.fast.net/~michael_sinz
Re: Deprecated `Thread.stop()' in forthcoming JDK 1.2. Why?
Have a method, such as stop(), that sets a boolean, and in the thread that's running, have it loop testing if the boolean has been set by stop() or not, and if so, then exit itself. Stopping a thread otherwise is problematic because it is not clear where it was when it was stopped (it's an ugly stop). I've heard it mentioned that it can also leave some threads in a bad a state, but that seems more like a bug with the JVM not doing clean-up to me. But stopping nicely is always best... David
Re: AWT problem with SWiM Motif 1.2 under alpha 117v2 port
> "George" == Uncle George <[EMAIL PROTECTED]> writes: George> is swim motif avail ( free ? ) Eric Bohm wrote: Unfortunately, no. It is a commercial motif implementation much like Mootif. >> I just upgraded to the jdk117_alpha21164a_bin and am having >> trouble with some of the demo programs seg faulting or aborting >> while using SWiM Motif. >>
Re: Deprecated `Thread.stop()' in forthcoming JDK 1.2. Wh
Ok fair enough you can periodically check at interval on synchronised boolean to cancel an operation. But I am disappointed. The reason why I asked is because I use the JDBC. The current JDBC API does not allow the operator to have a callback or to read selective rows from the database. In other words: Class.forName( "org.blackdown.jdbc.AnyOldDriver" ); Connection con = DriverManager.getConnection( url, username, password ); Statement stmt = con.createStatement( "select * from JDK_RELEASES" ); stmt.executeQuery(); // One atomic call with no way to run to !!! Here is a case where it is NOT EASY to apply your notification if your table had 10 rows. I have a spawn threads to execute the above SQL query and then allowed to operator to kill the thread if the query was slow. Hope fully the GC will clean up afterwards. [In fact the forthcoming Xenon-SQL depends on it] I guess the way to go will be: 1) Not to write API atomic slow methods like `executeQuery' Instead use an Iterator or Cursor whatever man 2) Hopefully JDBC 2.0 will provide a method to retrieve N rows at a time. A cursor. Pete __ Reply Separator _ Subject: Re: Deprecated `Thread.stop()' in forthcoming JDK 1.2. Wh Author: Michael.Sinz ([EMAIL PROTECTED]) at lon-mime Date:13/11/98 15:32 On Fri, 13 Nov 1998 15:15:29 +, [EMAIL PROTECTED] wrote: > I read somewhere that Thread.stop() is now deprecated. Now how on > earth do we stop a thread ? > I thought the solution would be Thread.interrupt() > but that only works when the thread is sleeping, at least in JDK 1.1 > documentation. > > I do not have the JDK 1.2 to hand, and I have started use multiple > threads in Swing/JFC/. It seems to be idiocy to have a start method > and not have a stop method. The stop() method justs halts the thread > object and the garbage collector collects any rubbish. > > Thoughts? There are reasons for some of the thread changes, mainly that the JVM can not control the threads as well on native threading systems (even more so when the thread is maybe running on another CPU) There would be far too much overhead in normal operation. You can implement your own thread operations but you would then need to have the overhead only in those cases. (It also will have the same problems with multi-processor/native thread operations and the like but if you really want a harsh stop(), it may be the only way) I too like the feature but it is easy enough to have your own notification. A harsh stop may not be able to control what is happening at the moment or it would have to only check at certain points within the operations. Michael Sinz -- Director of Research & Development, NextBus Inc. mailto:[EMAIL PROTECTED] - http://www.nextbus.com My place on the web ---> http://www.users.fast.net/~michael_sinz
Reusable threads?
Now that we have the option of native threads, I'd like to start using thread resource pools. But, the Java semantics and/or the implementation appears to make it problematic with regard to applications without a known exit condition... here's my problem: I want my application to exit when all computation is done - for purposes of discussion, consider a fractal image generator which uses threads to farm out work. Let's say I create a pool of 10 threads to do the work: If they are normal threads, the threads in the pool need to be in a wait state (e.g. when idle) - but waiting (or interrupted) is still active, so the vm will not exit even when all the threads are idle. If they are daemon threads, the VM will likely exit too early, because running daemons alone aren't enough to keep the VM alive. I want to write my thread pool as a generic class, so I want to avoid introducing an otherwise external sync point (work all done) to actually kill the threads in the pool at job completion time. So - the question is, does Java Thread semantics allow the sort of behavior I'd like at all. If so, do either of the Linux threading options actually support it. If not (bummer), I guess I must introduce explicit end state detection (My problem is, of course, rather more complex than the example given here, but the issues are similar). Thanks, - Michael Thome [EMAIL PROTECTED]
Re: Deprecated `Thread.stop()' in forthcoming JDK 1.2. Why?
> I read somewhere that Thread.stop() is now deprecated. Yes, and it's very good. > Now how on earth do we stop a thread ? Just allow it to exit from its run() method. Try to use this pattern: pattern is (run() can be in Thread subclass or in Thread Runnable)) private boolean runEnabled_ = true; private Object stopsync_ = new Object(); public void run() { while(isRunEnabled()) { ... // do things in your thread } } public void stop() // call this function from other thread when you want to stop thread { syncrhonized(stopsync_) { runEnabled_ = false; } } public boolean isRunEnabled() { boolean result; synchronized(stopsync_) { result = runEnabled_; } return result; } > I thought the solution would be Thread.interrupt() > but that only works when the thread is sleeping, at least in JDK 1.1 > documentation. Yes, it is just to awake waiting, joining or sleeping thread. >It seems to be idiocy to have a start method and not have a stop method. In single thread You can call method from outside but you cannot stop it until it leaves (things like Ctrl-C do the trick but there is destroy() method in Thread API that is the analog of such unnormal killer). What do you think it is strange here? See also http://java.sun.com/products/jdk/1.2/docs/guide/misc/threadPrimitiveDeprecation.html Hope this help Pavel
Re: Deprecated `Thread.stop()' in forthcoming JDK 1.2. Why?
> "Peter" == peter pilgrim <[EMAIL PROTECTED]> writes: Peter> I read somewhere that Thread.stop() is now deprecated. Now Peter> how on earth do we stop a thread... There are compelling reasons for deprecating this method (along with Thread.suspend() and Thread.resume()); I understand the second edition of Doug Lea's excellent book "Concurrent Programming in Java" explains in detail. I was fortunate to attend a seminar offered by Lea at OOPSLA '97, during which he offered justification for the pending removal of these methods. Peter> The stop() method justs halts the thread object and the garbage Peter> collector collects any rubbish. Unfortunately, it isn't that simple. Stopping a thread via Thread.stop() is a violent act that rips away a thread's context. Lea writes: "Thread.stop generates logically asynchronous signals, which means that activities can be terminated while they are in the midst of operations or code segments that absolutely must complete for the sake of program safety and object consistency." Naturally, there are alternatives to Thread.stop(). See the following URLs for more information: http://gee.cs.oswego.edu/dl/cpj/cancel.html http://www.acl.lanl.gov/Pooma96/abstracts/fleiner.html Regards, -- - David E. Young Fujitsu Network Communications "I claim not to have controlled ([EMAIL PROTECTED])events, but confess plainly that events have controlled me." -- Abraham Lincoln (1864) "Programming should be fun, programs should be beautiful" -- P. Graham
Re: Two problems.
I don't know that an applet can exactly terminate itself... Typically this is controlled by the browser/appletviewer.. When a web page containing an applet is unloaded the browser should call the stop() method followed by the destroy() method (when the applets resources are to be reclaimed) of each applet in the page.. You must override these methods only if you want any special cleanup done.. destroy() is the opposite of init() which gets called the first time the applet is loaded.. stop() is the opposite of start() which gets called every time an applet is accessed again by the browser.. Paul Schroeder JavaOS Software Engineer NCSD Division, IBM Corp 512-838-9675 [EMAIL PROTECTED] [EMAIL PROTECTED] on 13/11/98 06:04:19 Please respond to [EMAIL PROTECTED] To: [EMAIL PROTECTED] cc: Subject: Two problems. Hi all, i am relatively new to Java and i am trying to learn the UI (or the awt). Below is the code that i compiled ... ---Code begins --- import java.awt.*; import java.awt.event.*; import java.applet.*; public class Buttons extends Applet { private Button btnOk, btnExit; ActionListener myLis_Exit = new ActionListener() { public void actionPerformed(ActionEvent e) { stop(); destroy(); System.exit(0); } }; ActionListener myLis_Ok = new ActionListener() { public void actionPerformed(ActionEvent e) { System.out.println("This is Ok"); } }; public void init() { btnOk = new Button("Ok"); btnExit = new Button("Exit"); btnExit.addActionListener(myLis_Exit); btnOk.addActionListener(myLis_Ok); add(btnOk); add(btnExit); } //void init(); } //public class Buttons extends Applet Code Ends-- The code compiles ok, but then when i click on the "Exit" in the appletviewer i get a load of exceptions thrown. If the System.exit() is commented out, the applet still does not close. 1. how do i terminate an applet? 2. If i click the middle-mouse btn (btn# 3), the appletviewer crashes. I run RedHat 5.1 on a P2-400. Thanks, -Karthik. ++ | Karthik Vishwanath | National Centre for Biological Sciences| | [EMAIL PROTECTED] | TIFR Centre, IISc Campus, PO Box 1234 | | 80-334-5615 or 4062 or 3035 | Bangalore 560012, INDIA| | Fax 80-334-3851 | | ++
Re: Deprecated `Thread.stop()' in forthcoming JDK 1.2. Why?
This thread hasn't had anything to do with Linux. I'd really prefer to keep non-Linux discussion off this list. However, I'll now gamely try to bring this back to a java-linux discussion - >Have a method, such as stop(), that sets a boolean, and in the thread >that's running, have it loop testing if the boolean has been set by >stop() or not, and if so, then exit itself. Right. But what if the thing running the thread you're trying to stop is hostile or buggy and you can't count on it to check that flag? Are there any low-level "terminate" type methods left in 1.2? >Stopping a thread otherwise is problematic because it is not clear where it >was when it was stopped (it's an ugly stop). The story I've been told when they deprecated Thread.stop() in 1.1 is they couldn't guarantee that monitors were released correctly with Thread.stop(). So rather than fix the VM, they took it out of Thread. Maybe there's a problem with the spec. All this is just to say that Java's threading model is severely broken. The JVM is about 3/4 of an OS. But it's missing a crucial part, a decent threading model. Hence, my Linux-related point - Wouldn't it be wonderful if we were allowed to hack up Sun's reference implementation, to add in better threading support and donate that code back to Sun for consideration and inclusion into the standard Java? They don't need to be afraid of us polluting the language (a la Microsoft) because we'd do it all open and free. My understanding is that the new Linux licensing stuff has been carefully written to not allow this sort of extra access to the system. Is that true? (Another example - some folks presented a really nice piece of work at OOPSLA, adding per-thread memory and CPU usage accounting to Java. Stop denial of service attacks from applets! But they had to hack it all in to an opaque JVM (Microsoft's) without any support from the VM itself, because the VM is closed. Ick! Useful work is being impeded by the closed nature of Java implementations.) [EMAIL PROTECTED] . . . .. . . . http://www.media.mit.edu/~nelson/
Re: Deprecated `Thread.stop()' in forthcoming JDK 1.2. Why?
Pavel Tolkachev writes: > > I read somewhere that Thread.stop() is now deprecated. > Yes, and it's very good. > > Now how on earth do we stop a thread ? > Just allow it to exit from its run() method. So there is no way to stop a thread that is waiting for user input? daniel dulitz Valley Technologies, Inc. Peak Performance Real-Time DSP State College, PA
Re: Deprecated `Thread.stop()' in forthcoming JDK 1.2. Wh
[EMAIL PROTECTED] wrote: ... > Class.forName( "org.blackdown.jdbc.AnyOldDriver" ); > Connection con = DriverManager.getConnection( url, username, password ); > Statement stmt = con.createStatement( "select * from JDK_RELEASES" ); > > stmt.executeQuery(); // One atomic call with no way to run to !!! > I have a spawn threads to execute the above SQL query and then allowed to > operator to kill the thread if the query was slow. Can stmt.setQueryTimeout(someTimeout) help you? Your software could even compute different timeouts depending on expected query complexity. Pavel
Re: Deprecated `Thread.stop()' in forthcoming JDK 1.2. Why?
David Wall writes: > Have a method, such as stop(), that sets a boolean, and in the thread that's > running, have it loop testing if the boolean has been set by stop() or not, > and if so, then exit itself. > > Stopping a thread otherwise is problematic because it is not clear where it > was when it was stopped (it's an ugly stop). I've heard it mentioned that > it can also leave some threads in a bad a state, but that seems more like a > bug with the JVM not doing clean-up to me. But stopping nicely is always > best... This, in effect, is that the interrupt mechanism does. It sets an interrupted flag in the thread that user code can watch for, and I think it breaks you out of Thread.sleep or other thread related operations. User code can loop looking for the thread to be interrupted, and gracefully exit when it has been. Steve
Re: Deprecated `Thread.stop()' in forthcoming JDK 1.2. Wh
Pass! I have no idea. But it is not really useful in a GUI. [EXECUTE] SQL query[ABORT] SQL query What timeout should I have set BEFOREHAND. Should it be 1 ms , 1sec , and 1 hour For a non-deterministic application like an event driven GUI. I think not, I'm afraid. For application threads which you and have source for now. It is better to use a synchronised interval work scheduling as other people have graciously suggested. And yes, I agree this is best way for native thread support. However if the API does not support it, then you are truly buggered. Most SQL queries will be short and hopefully JDBC 2.0 will improve the situation with some sort row iterator. Get rows 1 to 100, then 101 to 200, 201 to 301 and so on. May be even how many rows will I be returned from this query if database can tell you (percentage driven JProgressBar taar daa!). but for now ... [ABORT] ---> queryThread.stop() Unfortunately my weekend begins here. Pete __ Reply Separator _ Subject: Re: Deprecated `Thread.stop()' in forthcoming JDK 1.2. Wh Author: paul ([EMAIL PROTECTED]) at lon-mime Date:13/11/98 17:29 [EMAIL PROTECTED] wrote: ... > Class.forName( "org.blackdown.jdbc.AnyOldDriver" ); > Connection con = DriverManager.getConnection( url, username, password ); > Statement stmt = con.createStatement( "select * from JDK_RELEASES" ); > > stmt.executeQuery(); // One atomic call with no way to run to !!! > I have a spawn threads to execute the above SQL query and then allowed to > operator to kill the thread if the query was slow. Can stmt.setQueryTimeout(someTimeout) help you? Your software could even compute different timeouts depending on expected query complexity. Pavel
Re: Deprecated `Thread.stop()' in forthcoming JDK 1.2. Wh
Ahh Well done JavaSoft!!! the default transaction isolation level of the underlying database is used for the result set that is created. Note that this code is just JDBC 1.0 code, and that it produces the same type of result set that would have been produced by JDBC 1.0. Connection con = DriverManager.getConnection( "jdbc:my_subprotocol:my_subname"); Statement stmt = con.createStatement(); ResultSet rs = stmt.executeQuery( "SELECT emp_no, salary FROM employees"); The next example creates a scrollable result set that is updatable and sensitive to updates. Rows of data are requested to be fetched twenty-five at-a-time from the database. Connection con = DriverManager.getConnection( "jdbc:my_subprotocol:my_subname"); Statement stmt = con.createStatement( ResultSet.TYPE_SCROLL_SENSITIVE, ResultSet.CONCUR_UPDATABLE); stmt.setFetchSize(25); ResultSet rs = stmt.executeQuery( "SELECT emp_no, salary FROM employees"); ``setFetchSize( N )'' Surf to: http://www.javasoft.com/products/jdk/1.2/docs/guide/jdbc/spec2/jdbc2.0.frame5.ht ml Over to all you JDBC implementors Pete __ Reply Separator _ Subject: Re: Deprecated `Thread.stop()' in forthcoming JDK 1.2. Wh Author: Peter Pilgrim at London Date:13/11/98 18:00 Pass! I have no idea. But it is not really useful in a GUI. [EXECUTE] SQL query[ABORT] SQL query What timeout should I have set BEFOREHAND. Should it be 1 ms , 1sec , and 1 hour For a non-deterministic application like an event driven GUI. I think not, I'm afraid. For application threads which you and have source for now. It is better to use a synchronised interval work scheduling as other people have graciously suggested. And yes, I agree this is best way for native thread support. However if the API does not support it, then you are truly buggered. Most SQL queries will be short and hopefully JDBC 2.0 will improve the situation with some sort row iterator. Get rows 1 to 100, then 101 to 200, 201 to 301 and so on. May be even how many rows will I be returned from this query if database can tell you (percentage driven JProgressBar taar daa!). but for now ... [ABORT] ---> queryThread.stop() Unfortunately my weekend begins here. Pete __ Reply Separator _ Subject: Re: Deprecated `Thread.stop()' in forthcoming JDK 1.2. Wh Author: paul ([EMAIL PROTECTED]) at lon-mime Date:13/11/98 17:29 [EMAIL PROTECTED] wrote: ... > Class.forName( "org.blackdown.jdbc.AnyOldDriver" ); > Connection con = DriverManager.getConnection( url, username, password ); > Statement stmt = con.createStatement( "select * from JDK_RELEASES" ); > > stmt.executeQuery(); // One atomic call with no way to run to !!! > I have a spawn threads to execute the above SQL query and then allowed to > operator to kill the thread if the query was slow. Can stmt.setQueryTimeout(someTimeout) help you? Your software could even compute different timeouts depending on expected query complexity. Pavel
RE: Deprecated `Thread.stop()' in forthcoming JDK 1.2. Why?
My understanding is that the folks at Sun considered Thread.stop() to be somewhat unstable (please correct me if I'm wrong) and therefore deprecated it. What they suggested in the JDK1.2 documentation is that you allow the Thread.run() method to normally end to stop the thread. Thus, you would need to set some class variable that the run method would need to check periodically to see if it should keep going. Hope this helps. -Andy > -Original Message- > From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]] > Sent: Friday, November 13, 1998 10:15 AM > To: [EMAIL PROTECTED] > Subject: Deprecated `Thread.stop()' in forthcoming JDK 1.2. Why? > > > I read somewhere that Thread.stop() is now deprecated. Now how on > earth do we stop a thread ? > I thought the solution would be Thread.interrupt() > but that only works when the thread is sleeping, at least in JDK 1.1 > documentation. > > I do not have the JDK 1.2 to hand, and I have started use multiple > threads in Swing/JFC/. It seems to be idiocy to have a start method > and not have a stop method. The stop() method justs halts the thread > object and the garbage collector collects any rubbish. > > Thoughts? > > Pete > >
Re: Reusable threads?
On Fri, 13 Nov 1998 11:20:36 -0500 (EST), Michael Thome wrote: >Now that we have the option of native threads, I'd like to start using >thread resource pools. But, the Java semantics and/or the >implementation appears to make it problematic with regard to >applications without a known exit condition... here's my problem: > >I want my application to exit when all computation is done - for >purposes of discussion, consider a fractal image generator which uses >threads to farm out work. > >Let's say I create a pool of 10 threads to do the work: > >If they are normal threads, the threads in the pool need to be in a >wait state (e.g. when idle) - but waiting (or interrupted) is still >active, so the vm will not exit even when all the threads are idle. > >If they are daemon threads, the VM will likely exit too early, because >running daemons alone aren't enough to keep the VM alive. > >I want to write my thread pool as a generic class, so I want to avoid >introducing an otherwise external sync point (work all done) to >actually kill the threads in the pool at job completion time. I have a generic thread pool class that works for me. It is not complete for public use (yet) but it does the job. It knows when it has no threads in use. It also dynamically expands as peak loading increases. The trick is that you need a "front-end" class to the thread class and then a class that manages the set of threads. Michael Sinz -- Director of Research & Development, NextBus Inc. mailto:[EMAIL PROTECTED] - http://www.nextbus.com My place on the web ---> http://www.users.fast.net/~michael_sinz
Re: native thread question
Hi, On Mon, 09 Nov 1998, Keith T. Garner wrote: >I've been experimenting with the new native threading code, beating on it >to see how it holds up, doing that sort of beta test that people dream of. >(I've found a memory bug, but that's for a different piece of mail...) > >Anyway, while watching the process table, I noticed that most of the >threads that are created are niced to at least 5, with one or two being at >10, and another one or two (my threads?) are at 0. I figured the thread >that was niced at 10 is the garbage collectiong thread, and a few of the >other threads at 5 are created by the VM at start-up for various VM tasks. > >This got me curios as to what determines the niceness. By the java spec, >thread priorities can be ignored, but I'm wondering that if in this case, >are thread priorities being mapped to a niceness level? > >Any comments? I did a lot of the port. I mapped Java priority 10 to Linux priority 0 and Java Priority 0 to Linux priority 10. It give the right sort of scheduling between threads ... unfortunately .. only a superuser can increase a priority. The nice stuff is rather out of user control as it is dependent upon CPU usage. Phill -- __ Phill Edwards [EMAIL PROTECTED] Tel: 01395 515131 Mobile: 0802 402 195 "One has to keep building higher and higher fences to see just how far one can really jump"
Re: Reusable threads?
Michael Sinz wrote: > > I have a generic thread pool class that works for me. It is not > complete for public use (yet) but it does the job. It knows when > it has no threads in use. It also dynamically expands as peak > loading increases. I believe one was also written in conjuction w/ the java apache project (http://java.apache.org) jason -- Jason Gilbert | http://www.scott.net/~jason/ | http://www.homewood.net -- I wish I could make the garbage collector thread in my brain less agressive.
RE: Retrieving a fully qualified hostname under NT
Try oracle.com --jason On 13-Nov-98 Rudhuwan Abu Bakar wrote: > > hello > > sorry for this. > > Where can I get a type 4(?) JDBC driver? I am testing an Oracle server and > want to use a Java-based client. > > Thank you for your time. > > regards > duan
Re: Retrieving a fully qualified hostname under NT
You should not have too, but if you want FQDN, then it looks like this might be the best way. Otherwise you will have to jump throgh lots of hoops to check if the value the jvm returns is really a FQDN. --jason On 13-Nov-98 Michael Sinz wrote: > On Fri, 13 Nov 1998 10:01:30 -0800, Christopher Hinds wrote: > >>Try using a reverse DNS lookup with that host's IP address , you should >>get >>a fully qualified host name from that. This obviously means you will >>have to use the DNS protocol on an open socket. The problem with NT is >>it is using >>WINS ( NT DNS) to resolve the name and that name returned is a host name >>known to the NT Promary Domain controller and the WINS Service. >>Mark Hofmann wrote: > > You should not need to do that much work - the JVM will do it for you > when you give InetAddress an IP address and then as it for the host > name. However, you are correct, the machine would need to be in DNS > to support this. > > Note that if you are not DNS named, a fully qualified name will have > little meaning. > > Michael Sinz -- Director of Research & Development, NextBus Inc. > mailto:[EMAIL PROTECTED] - http://www.nextbus.com > My place on the web ---> http://www.users.fast.net/~michael_sinz
remove from list
Swing on Blackdown jdk1.1.6
I got an app from someone. It included swing.jar.I "un-jarred" it. But seriously.. should it be in the same directory subtree under "src" with "lang" "io" and other stuff? Or should it be in "lib" with classes.zip ? Just wondering email to: [EMAIL PROTECTED]
November 1998 java-linux FAQ
Other than some shuffling, the document hasn't changed a great deal, but it does reflect some of the changes related to JDK 1.1.7. Comments and corrections welcome. Stephen Wynne <[EMAIL PROTECTED]> PGP Key 1024/D54C69B9 Fingerprint: 2C 54 C6 F3 9C FF 11 D3 90 56 DD 85 37 E3 1F AA [EMAIL PROTECTED] FAQ by Stephen Wynne November 12, 1998 This document attempts to answer the most commonly-asked questions on the [EMAIL PROTECTED] mailing list. Its focus is the Blackdown JDK. More information on running Java on Linux is available at http://www.blackdown.org/java-linux.html. __ Table of Contents: 1. Introduction to the Blackdown JDK and Mailing List User Guide 1.1.Last Update 1.2.What is the Blackdown JDK? 1.3.Suggestions for List Participants 1.4.How can I get subscribed? Unsubscribed? 1.5.Where Can I Find Archived Postings from this List? 2. An Overview of the Blackdown JDK 2.1.Last Update 2.2.Could You Give Me An Overview of Running Java on Linux? 2.3.What is the Currently-supported Version of the Blackdown JDK? 2.4.What System Configuration do I Need to Run the JDK? 2.5.OK, Which Version of the JDK Should I Download? 2.5.1. JDK 1.02 2.5.2. JDK 1.1 2.6.What are These Files? 2.7.What Other JDK Ports are Available for Linux? 2.8.There's a pure Java Package I Want to Run. Can I? 2.9.When is the JDK 1.2 Going to be Released for Linux? 2.10. Can I Take a Look at the JDK 1.2 on Linux Now Anyway? 2.11. Is Javasoft Going to Support Java on Linux? 2.12. What are Green Threads? 2.13. Is There a Native Threads Port of the Blackdown JDK? 2.14. Does Javasoft's Activator JVM work on Linux with Netscape? 2.15. Is there a JIT (Just in Time Compiler) for the Blackdown JDK? 2.16. What Other Java Resources are Available at Blackdown? 2.17. Other Sources of Information about Java on Linux 3. Blackdown JDK Installation Questions 3.1.Last Update 3.2.Where to obtain JDK 1.02 and 1.1? 3.3.How Do I Install the JDK? 4. Troubleshooting the Blackdown JDK on Linux 4.1.Last Update 4.2.Typical Questions to Ask Yourself When Debugging Problems 4.3.Kaffe and the Blackdown JDK 1.1 are Installed. Neither Work! 4.4.I Have the Blackdown JDK 1.1.x and RMI is Giving Me Fits! 4.5.Help, I've Upgraded to ld.so-1.9.9 and Now the JDK Coredumps! 4.6.Help, Java Said it Ran out of Memory! 4.7.How Do I Add Swap Space? 4.8.Where Can I Report Bugs? 4.8.1. What Should I Report? 4.9.Are There Any Debugging Techniques I Can Try Myself? 4.10. That Didn't Help. What Else Can I Do? 5. Detail on Running The Blackdown JDK 5.1.Last Update 5.2.I'm on What Do I Need? 5.2.1. Missing libXp 5.2.2. The glibc versus libc5 Problem 5.2.3. RedHat Installation Tips 5.2.3.1.RedHat RPM Availability 5.2.3.2.RedHat/RPM Environment Variable Issues 5.2.4. Debian 5.2.5. Slackware 5.2.6. Other Linux Distributions 5.3.Is There Anything Different About Native Interfaces on Linux? 5.3.1. Compiling Library Code for JNI 5.4.What about Green Threads and Console Priority? 5.5.Is There a Problem with Green Threads and the JVM Invocation API? 5.5.1. Green Threads and Wrapped System Services 5.5.2. Hacking Around the System Service Wrappers 5.6.Can I Display and Input Kanji with the Blackdown JDK? 5.6.1. Library Issues 5.6.1.1.Libc5 Systems 5.6.1.2.Libc6 (glibc) Systems 5.6.2. Entering Two Byte Kanji with XIM 6. Questions about Non-i386 Blackdown JDK Ports 6.1.Last Update 6.2.What's the Status of the SPARC Port? 6.3.Is there an Alpha Port? 6.4.Is there a PowerPC Port? 7. General Questions about Java 7.1.Last Update 7.2.Where Can I Learn More about Java? 8. General Questions about Linux 8.1.Last Update 8.2.Where Can I Find Linux FAQs, Mailing Lists, and Documentation? 8.3.What is glibc, and Why Does it Matter? 9. Compiling the Blackdown JDK from Source 9.1.Last Update 9.2.Can I Build Java Myself? 9.3.Could You Give Me a Pointer to Sun's Licensing Agreement? 9.4.How do I Build the JDK Now that I Have the Source? 9.5.What about Motif? Don't I Need That? 9.6.When I Build and Install, I Get Unsatisfied Link Errors at Runtime! 9.7.Can I Try Builds of the Latest JDK Port in Development? 10. About the People Behind the Blackdown JDK 10.1. Last Update 10.2. Who Ported the Blackdown JDK? 10.3. Who is Steve Byrne? 10.4. Who is Karl Asha? 11. Information on the Java-Linux FAQ 11.1. Last Update 11.2. Who Maintains the FAQ?