You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@cocoon.apache.org by Doug Herold <do...@gmail.com> on 2006/06/02 18:41:43 UTC

cocoon actions implements threadsafe

Hi,

I have noticed that some of our programers are using threadsafe when
creating a class for actions.*

public* *class* StudentSearchAction *extends* AbstractAction
*implements*SingleThreaded {

I read that you should never use SingleThreaded and that it was going to
be depreciated.  Our server has a very large load, but we were having
problems with one user being able to see another users info.  I think this
is why the used this.  We are now having problems with performance.  Could
this cause performance issues.

Could someone point me to any good articles about the dangers
of SingleThread classes and what to do instead of using them.

Thanks in advance
Doug

Re: cocoon actions implements threadsafe

Posted by Ralph Goers <Ra...@dslextreme.com>.
Why would an action be pooled?  Actions should, if at all possible, be 
ThreadSafe.  In this case there will only be one instance of the Action 
and multiple threads can execute it concurrently.  Since actions 
generally only have one method this should be easy to achieve.

Joerg Heinicke wrote:
> On 02.06.2006 20:28, Doug Herold wrote:
>> If I have an action that is SingleThreaded and I have 2 clients 
>> logged in (2
>> sessions).  Does one client have to wait on the other client's thread to
>> finish or is the SingleThreaded per session.
>
> You have to think of it as a pool. It is no problem as long as there 
> are no more concurrent requests than you have instances in the pool. 
> But it gets a bottleneck if there are more requests.
>
> Jörg
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
> For additional commands, e-mail: users-help@cocoon.apache.org
>

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
For additional commands, e-mail: users-help@cocoon.apache.org


Re: cocoon actions implements threadsafe

Posted by Joerg Heinicke <jo...@gmx.de>.
On 02.06.2006 20:28, Doug Herold wrote:
> If I have an action that is SingleThreaded and I have 2 clients logged 
> in (2
> sessions).  Does one client have to wait on the other client's thread to
> finish or is the SingleThreaded per session.

You have to think of it as a pool. It is no problem as long as there are 
no more concurrent requests than you have instances in the pool. But it 
gets a bottleneck if there are more requests.

Jörg

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
For additional commands, e-mail: users-help@cocoon.apache.org


Re: cocoon actions implements threadsafe

Posted by Doug Herold <do...@gmail.com>.
If I have an action that is SingleThreaded and I have 2 clients logged in (2
sessions).  Does one client have to wait on the other client's thread to
finish or is the SingleThreaded per session.

On 6/2/06, Ralph Goers <Ra...@dslextreme.com> wrote:
>
> It is interesting that you say that they are using threadsafe and then
> show an example that says SingleThreaded.  These are not the same thing.
> Look at http://excalibur.apache.org/developing/framework.html.  Actions
> only have a single act method so in most cases they should be able to
> implement ThreadSafe. Marking them as SingleThreaded would almost
> certainly be a bottleneck.
>
> Ralph
>
> Doug Herold wrote:
>
> > Hi,
> >
> > I have noticed that some of our programers are using threadsafe when
> > creating a class for actions.
> >
> > public *class* StudentSearchAction *extends* AbstractAction *
> > implements* SingleThreaded {
> >
> > I read that you should never use SingleThreaded and that it was going
> > to be depreciated.  Our server has a very large load, but we were
> > having problems with one user being able to see another users info.  I
> > think this is why the used this.  We are now having problems with
> > performance.  Could this cause performance issues.
> >
> > Could someone point me to any good articles about the dangers
> > of SingleThread classes and what to do instead of using them.
> >
> > Thanks in advance
> > Doug
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
> For additional commands, e-mail: users-help@cocoon.apache.org
>
>

Re: cocoon actions implements threadsafe

Posted by Bruno Dumon <br...@outerthought.org>.
On Fri, 2006-06-02 at 14:11 -0400, Doug Herold wrote:
> I am sorry I meant SingleThreaded.  So you would think that this is a
> bottle neck.

Unless your actions require heavy initialisation, implementing
ThreadSafe or not will only result in minor performance differences (if
you call multiple actions during the processing of a request, at best
you'll see a difference of a few msecs -- its the difference between
directly using an object or having to look it up from the component
manager).

So sure, implement ThreadSafe if possible, but if you have serious
performance issues with your application they are likely to be somewhere
else...

>         
>         Doug Herold wrote:
>         
>         > Hi,
>         >
>         > I have noticed that some of our programers are using
>         threadsafe when
>         > creating a class for actions.
>         >
>         > public *class* StudentSearchAction *extends* AbstractAction
>         * 
>         > implements* SingleThreaded {
>         >
>         > I read that you should never use SingleThreaded and that it
>         was going
>         > to be depreciated.  Our server has a very large load, but we
>         were
>         > having problems with one user being able to see another
>         users info.  I 
>         > think this is why the used this.  We are now having problems
>         with
>         > performance.  Could this cause performance issues.
>         >
>         > Could someone point me to any good articles about the
>         dangers
>         > of SingleThread classes and what to do instead of using
>         them. 
>         >
>         > Thanks in advance
>         > Doug

-- 
Bruno Dumon                             http://outerthought.org/
Outerthought - Open Source, Java & XML Competence Support Center
bruno@outerthought.org                          bruno@apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
For additional commands, e-mail: users-help@cocoon.apache.org


Re: cocoon actions implements threadsafe

Posted by Doug Herold <do...@gmail.com>.
I am sorry I meant SingleThreaded.  So you would think that this is a bottle
neck.

On 6/2/06, Ralph Goers <Ra...@dslextreme.com> wrote:
>
> It is interesting that you say that they are using threadsafe and then
> show an example that says SingleThreaded.  These are not the same thing.
> Look at http://excalibur.apache.org/developing/framework.html.  Actions
> only have a single act method so in most cases they should be able to
> implement ThreadSafe. Marking them as SingleThreaded would almost
> certainly be a bottleneck.
>
> Ralph
>
> Doug Herold wrote:
>
> > Hi,
> >
> > I have noticed that some of our programers are using threadsafe when
> > creating a class for actions.
> >
> > public *class* StudentSearchAction *extends* AbstractAction *
> > implements* SingleThreaded {
> >
> > I read that you should never use SingleThreaded and that it was going
> > to be depreciated.  Our server has a very large load, but we were
> > having problems with one user being able to see another users info.  I
> > think this is why the used this.  We are now having problems with
> > performance.  Could this cause performance issues.
> >
> > Could someone point me to any good articles about the dangers
> > of SingleThread classes and what to do instead of using them.
> >
> > Thanks in advance
> > Doug
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
> For additional commands, e-mail: users-help@cocoon.apache.org
>
>

Re: cocoon actions implements threadsafe

Posted by Ralph Goers <Ra...@dslextreme.com>.
It is interesting that you say that they are using threadsafe and then 
show an example that says SingleThreaded.  These are not the same thing. 
Look at http://excalibur.apache.org/developing/framework.html.  Actions 
only have a single act method so in most cases they should be able to 
implement ThreadSafe. Marking them as SingleThreaded would almost 
certainly be a bottleneck.

Ralph

Doug Herold wrote:

> Hi,
>  
> I have noticed that some of our programers are using threadsafe when 
> creating a class for actions.
>  
> public *class* StudentSearchAction *extends* AbstractAction * 
> implements* SingleThreaded {
>  
> I read that you should never use SingleThreaded and that it was going 
> to be depreciated.  Our server has a very large load, but we were 
> having problems with one user being able to see another users info.  I 
> think this is why the used this.  We are now having problems with 
> performance.  Could this cause performance issues.
>  
> Could someone point me to any good articles about the dangers 
> of SingleThread classes and what to do instead of using them.
>  
> Thanks in advance
> Doug



---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
For additional commands, e-mail: users-help@cocoon.apache.org