Threads
}
You just try, it is not an order. It tries but not always sleeps!
Hi, Is there somebody who can tell me why my thread sleeps longer then I told
him to do...
I have a thread that has to sleep for 60000 millesec. But every 4, 5 minutes
it sleeps for 61000 millesec.? I have to built an application that get the
time every minute, but with this sleep I can t trust the java threads.
So can somebody tell me what is going wrong???
Answer: Really JDK never give you warranty that will wake your thread after XXX
ms.
You can be sure only
that your thread will not be waked up before!
For good timing you should take another, better for real time perfomance, VM.
For example PERC from
Nemonics.com
or something else...
I have created a program with a main method that instantiates and starts three
threads, the first two of which are daemons. Why daemons does die when normal
thread die?
Answer: Because of nature of daemon threads. They are alive if exists at least one
"normal user s" thread. Otherwise they die immediately
Q: Does anyone know if there is a way for two threads to find each other if they
are started in two different JVM?
In other words, I start a thread in one JVM, then I want to PipeWrite to another
Thread that is doing a PipeReader. Any help would be appreciated!
Answer: Use of Piped streams is only supported inside the same JVM. If you want
IPC, you have to use sockets or xfer data using files. I would recommend the sockets
approach, it has the added advantage of working not only between process, but
across the network as well.
Use of other IPC mechanisms, like shared memory, pipes, mail boxes, etc, are not
supported by the JVM core. You could always roll your own native code, but why
bother when you have access to sockets?
RMI is another possibility but it all depends on what you want to do. I ll let the RMI
experts talk about this option.
And CORBA, if you want to get real fancy.
Joe
Q: When will a Thread Object be garbage collected?
I would like to ask a question about garbage collection of Thread Object.
When will a Thread Object be garbage collected?
When the reference count to it becomes zero, or when it enters the "Dead" state, i.e.
the run() member function terminates?
file:///F|/a_jsite/350_tips/threads.htm (2 of 4) [2001 07 08 11:25:00]
footer
Visionwebhosting.net Business web hosting division of Web
Design Plus. All rights reserved