commons-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Marcus Deluigi <mdelu...@student.ethz.ch>
Subject Re: Javaflow: suspending a thread from outside the thread
Date Wed, 02 Aug 2006 13:14:49 GMT
I see your point.
But it is not trivial to periodically check a context variable if the  
thread performs complex calculation and uses other object's methods  
which take a long time to execute.
In java, I could just call Thread.stop(), even if it is depricated...
But this is not a Javaflow specific problem but merely a general  
thread problem that I should solve.

I think I can find a work around with introducing some overhead for  
the user so that he has to check the context during his calculations,  
although it will slow down the calculation.
Thanks a lot for your offer, but I think you don't need do find your  
old solution, I will keep with this way.

On Aug 2, 2006, at 6:05 AM, Torsten Curdt wrote:

>> I could make a public "suspend()" method within the thread that calls
>> "Continuation.suspend();", but the problem is that the second user
>> just gets a continuation object and has no reference to the actual
>> thread.
>
> Please note that you don't really need to make it "public" as
> Continuation.suspend() is a public static method. All that matters to
> the state of the continuation is kept in thread locals ...which is
> also why you cannot really have another thread like that inside a
> flow.
>
> Synchronization problems aside I remember I was playing with that and
> had it working to some extend - I'll try to dig that out. But I would
> not want to synchronize the methods just to support something that
> somehow just feels ...wrong.
>
> Maybe explain your usecase...
>
> cheers
> --
> Torsten
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: commons-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: commons-user-help@jakarta.apache.org
>


---------------------------------------------------------------------
To unsubscribe, e-mail: commons-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: commons-user-help@jakarta.apache.org


Mime
View raw message