I have a Class
named Foo
which calls a non-static
method barMethod()
of Bar
. Bar
extends Fiber
.
Inside barMethod()
there is a call to park()
. Now which Fiber
will be parked? Foo
instance or Bar
instance?
Signature of park()
(It is defined static
and this is the main reason for my confusion):
public static void park()
throws SuspendExecution
If the answer is Foo
(It seems to be so), How can I park Bar
? I mainly intend to suspend (park)
Bar
not Foo
.
And if you provide me an answer about how to park Bar
instance, then please tell me that since I want to park Bar
, not Foo
, should barMethod()
throw SuspendExecution
? It will not be access by any instance of Bar
, and I don't want to park any instance of Foo
inside this method (only Bar
).
Please also provide answer for all the same questions about unpark()
. Will it be applied to current Fiber
(Foo
instance in this case) or it affects Bar
instance? If latter, then how can I unpark Bar
instance, not Foo
instance?