A friendly place for programming greenhorns!
Big Moose Saloon
Register / Login
Win a copy of
EJB 3 in Action
this week in the
EJB and other Java EE Technologies
A thread calling a method on another thread
Joined: Jul 01, 2011
Jul 13, 2011 21:07:36
Is there a way for Thread 2 to call a method that will go on Thread 1's stack and interrupt whatever Thread 1 is currently doing?
Thread 1: Running happily along
Thread 2: Comes along and calls a method that will go on Thread 1's stack, NOT Thread 2's stack; method runs to completion; Thread 1 resumes what it was doing
Joined: Jan 06, 2011
Jul 13, 2011 21:56:18
I don't believe there is any notion of threads sharing stacks in Java.
Joined: Oct 14, 2005
Jul 13, 2011 23:16:42
Nope. Was that idea supposed to be a solution to some problem, or was it just a question out of general interest? If there was an actual problem involved, it would be better to just ask about that problem.
Joined: Oct 13, 2005
Jul 14, 2011 00:58:56
And welcome to the Ranch
It is of course possible for methods running in two threads to call methods on a particular object simultaneously and interfere with each other. Which is why you need synchronisation or similar.
Did you see how Paul
cut 87% off of his electric heat bill with 82 watts of micro heaters
subject: A thread calling a method on another thread
MDB-concurrency , serializing and reentrant?
Message Driven Beans
how to "control" the sequence of two threads ?
How does this actually solve Towers of Hanoi?
All times are in JavaRanch time: GMT-6 in summer, GMT-7 in winter
| Powered by
Copyright © 1998-2014