You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@commons.apache.org by "Lars J. Nilsson" <we...@larsan.net> on 2005/03/07 17:17:45 UTC

[Jelly] Concurrent threads

Hello,

My apologies on beforehand if this is explained elsewhere, but I could 
not find any information on thread-safety or synchronization. My 
assumptions are:

   1) The JellyContext is thread safe.
   2) Script's are generally thread sage; but...
   3) It is possibly to write a non-thread safe custom tag.

As you understand I am thinking of using Jelly in a multi-threaded 
environment. Can anyone give me a few pointers?

Thanks
- Lars



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


Re: [Jelly] Concurrent threads

Posted by Paul Libbrecht <pa...@activemath.org>.
Le 7 mars 05, à 17:17, Lars J. Nilsson a écrit :
> My apologies on beforehand if this is explained elsewhere, but I could
> not find any information on thread-safety or synchronization. My
> assumptions are:
>   1) The JellyContext is thread safe.

There may be holes or the need for a thread-safe wrapper class but, in 
principle, yes it should. I'd rather go on a wrapper since synchronized 
blocks are evilly expensive and, I think, multi-threaded contexts are 
rare.

>   2) Script's are generally thread safe; but...

Scripts are only results of compilation, they store no state except a 
reference, attached to a thread, to their tags.

>   3) It is possibly to write a non-thread safe custom tag.

Tags are not meant for multi-threadededness.... a tag should only be 
used by a single thread and this is why we create a new tag for each 
thread that visits a tag-script.

> As you understand I am thinking of using Jelly in a multi-threaded
> environment. Can anyone give me a few pointers?

Can you be more precise on your intent ?
In general the rationale:
- context store for explicit states
- tags store for modelled states, but only one per thread
seemed to fit me well...

hope that helps.

paul


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