aspose file tools*
The moose likes Java in General and the fly likes Possible to transfer control of thread from one jvm to another? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Java in General
Bookmark "Possible to transfer control of thread from one jvm to another?" Watch "Possible to transfer control of thread from one jvm to another?" New topic
Author

Possible to transfer control of thread from one jvm to another?

Matt Senecal
Ranch Hand

Joined: Dec 01, 2000
Posts: 255
Anyone know if this is possible?


There's nothing more dangerous than a resourceful idiot. ---Dilbert
Mark Herschberg
Sheriff

Joined: Dec 04, 2000
Posts: 6037
Well, hrm, I think the following is true:
Each JVM is a seperate process. To truly suspend the process, you'd need some C code to talk to the OS.
However, you can have different JVM's communicate with each other. You can always have the executing thread in one, alert the other. When the first alerts the second, the first thread goes into a wait loop. When the second is done, it can go into a wait loop just after it renotifies the first. The only catch is whether or not you need to prevent other threads from running in the paused JVM. This is possible, somewhat (e.g. you can't stop the GC thread form running), but can be made to be more or less moot (unless you're really getting into counting processor cycles, memory usage, etc).
Does that help?
--Mark
Matt Senecal
Ranch Hand

Joined: Dec 01, 2000
Posts: 255
Yes, that helps some. Thank you.
Originally posted by Mark Herschberg:
Well, hrm, I think the following is true:
Each JVM is a seperate process. To truly suspend the process, you'd need some C code to talk to the OS.
However, you can have different JVM's communicate with each other. You can always have the executing thread in one, alert the other. When the first alerts the second, the first thread goes into a wait loop. When the second is done, it can go into a wait loop just after it renotifies the first. The only catch is whether or not you need to prevent other threads from running in the paused JVM. This is possible, somewhat (e.g. you can't stop the GC thread form running), but can be made to be more or less moot (unless you're really getting into counting processor cycles, memory usage, etc).
Does that help?
--Mark

 
It is sorta covered in the JavaRanch Style Guide.
 
subject: Possible to transfer control of thread from one jvm to another?