You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by André Lopes <af...@gmail.com> on 2009/12/09 14:58:13 UTC

Time to process request

Hi all,

I'm working on an application that makes requests to several backend
services, and i need to establish a max time in wich the struts application
must send the http response. Is it possible to define such timeout? I've
been searching for a way to do this, but i haven't found anything.

Cheers,
-- 
André Lopes

Re: Time to process request

Posted by André Lopes <af...@gmail.com>.
For a tipical web browser application that should be a good approach, but in
this case, my application acts as a gateway, so all operations are a one
shot operation.

I will go to extend the class TilesRequestProcessor, and implement my own
protected ActionForward processActionPerform(...) overriding the method
implemented in the base class of TilesRequestProcessor, RequestProcessor.

In this method i will create a new Thread that will call the method
Action.execute(...) while the created RequestProcessor will control the time
spent on the Action.execute(...) method.

If the given time is passed, then the new RequestProcessor will return a
specific forward, otherwise it will return the forward returned by the
Action.execute(...) method.

I have implemented this ideia, out side, my application, and works for a
single request. Now i'm going to test with multiple requests. Some of them
will give the timeout, and others will not. This way i will evaluate
possible memory issues and other stuff.

Am i missing some obvious problems that will occur?

Cheers,

On Wed, Dec 9, 2009 at 6:48 PM, Kawczynski, David <
david_kawczynski@merck.com> wrote:

> An easy alternative is to have a "processing" page meta-refresh to a struts
> action that checks the status of the long-running process(es).
> While the processing is still continuing, send the resonse back to the same
> "processing" page.
> When the processing is complete, send the response to a "complete" page.
>
>
> > -----Original Message-----
> > From: André Lopes [mailto:afsalopes@gmail.com]
> > Sent: Wednesday, December 09, 2009 12:44 PM
> > To: Struts Users Mailing List
> > Subject: Re: Time to process request
> >
> > I think execute and wait interceptor will do what i want that
> > is to give the
> > backend services an amount of time to do their job. If they
> > don't do it in
> > that time, the struts app should send a response message back
> > to the client.
> >
> >
> > The only problem with the interceptor is that it is not
> > available in struts
> > 1.2.4 (the application is old), so i'm going to have to make
> > the mechanism
> > myself.
> >
> > Thanks for the answer!
> >
> >
> > On Wed, Dec 9, 2009 at 2:39 PM, Wes Wannemacher
> > <we...@wantii.com> wrote:
> >
> > > Your question is a bit vague, which might be why you are having
> > > trouble finding a solution...
> > >
> > > If I understand the problem properly, perhaps using the "Execute and
> > > Wait" facility will help -
> > >
> > >
> > http://struts.apache.org/2.1.8.1/docs/execute-and-wait-interce
> ptor.html<http://struts.apache.org/2.1.8.1/docs/execute-and-wait-interce%0Aptor.html>
> > >
> > > As far as controlling the amount of time before giving up on the
> > > backend services (if that's your goal), you would have to build that
> > > mechanism yourself.
> > >
> > > -Wes
> > >
> > > 2009/12/9 André Lopes <af...@gmail.com>:
> > > > Hi all,
> > > >
> > > > I'm working on an application that makes requests to
> > several backend
> > > > services, and i need to establish a max time in wich the struts
> > > application
> > > > must send the http response. Is it possible to define
> > such timeout? I've
> > > > been searching for a way to do this, but i haven't found anything.
> > > >
> > > > Cheers,
> > > > --
> > > > André Lopes
> > > >
> > >
> > >
> > >
> > > --
> > > Wes Wannemacher
> > >
> > > Head Engineer, WanTii, Inc.
> > > Need Training? Struts, Spring, Maven, Tomcat...
> > > Ask me for a quote!
> > >
> > >
> > ---------------------------------------------------------------------
> > > To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
> > > For additional commands, e-mail: user-help@struts.apache.org
> > >
> > >
> >
> >
> > --
> > André Lopes
> > Ogden Nash
> > <http://www.brainyquote.com/quotes/authors/o/ogden_nash.html>  -
> > "The trouble with a kitten is that when it grows up, it's
> > always a cat."
> >
> Notice:  This e-mail message, together with any attachments, contains
> information of Merck & Co., Inc. (One Merck Drive, Whitehouse Station, New
> Jersey, USA 08889), and/or its affiliates Direct contact information for
> affiliates is available at http://www.merck.com/contact/contacts.html)
> that may be confidential, proprietary copyrighted and/or legally privileged.
> It is intended solely for the use of the individual or entity named on this
> message. If you are not the intended recipient, and have received this
> message in error, please notify us immediately by reply e-mail and then
> delete it from your system.
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
> For additional commands, e-mail: user-help@struts.apache.org
>
>


-- 
André Lopes
Charles de Gaulle<http://www.brainyquote.com/quotes/authors/c/charles_de_gaulle.html>
- "The better I get to know men, the more I find myself loving dogs."

RE: Time to process request

Posted by "Kawczynski, David" <da...@merck.com>.
An easy alternative is to have a "processing" page meta-refresh to a struts action that checks the status of the long-running process(es).
While the processing is still continuing, send the resonse back to the same "processing" page.
When the processing is complete, send the response to a "complete" page.


> -----Original Message-----
> From: André Lopes [mailto:afsalopes@gmail.com] 
> Sent: Wednesday, December 09, 2009 12:44 PM
> To: Struts Users Mailing List
> Subject: Re: Time to process request
> 
> I think execute and wait interceptor will do what i want that 
> is to give the
> backend services an amount of time to do their job. If they 
> don't do it in
> that time, the struts app should send a response message back 
> to the client.
> 
> 
> The only problem with the interceptor is that it is not 
> available in struts
> 1.2.4 (the application is old), so i'm going to have to make 
> the mechanism
> myself.
> 
> Thanks for the answer!
> 
> 
> On Wed, Dec 9, 2009 at 2:39 PM, Wes Wannemacher 
> <we...@wantii.com> wrote:
> 
> > Your question is a bit vague, which might be why you are having
> > trouble finding a solution...
> >
> > If I understand the problem properly, perhaps using the "Execute and
> > Wait" facility will help -
> >
> > 
> http://struts.apache.org/2.1.8.1/docs/execute-and-wait-interce
ptor.html
> >
> > As far as controlling the amount of time before giving up on the
> > backend services (if that's your goal), you would have to build that
> > mechanism yourself.
> >
> > -Wes
> >
> > 2009/12/9 André Lopes <af...@gmail.com>:
> > > Hi all,
> > >
> > > I'm working on an application that makes requests to 
> several backend
> > > services, and i need to establish a max time in wich the struts
> > application
> > > must send the http response. Is it possible to define 
> such timeout? I've
> > > been searching for a way to do this, but i haven't found anything.
> > >
> > > Cheers,
> > > --
> > > André Lopes
> > >
> >
> >
> >
> > --
> > Wes Wannemacher
> >
> > Head Engineer, WanTii, Inc.
> > Need Training? Struts, Spring, Maven, Tomcat...
> > Ask me for a quote!
> >
> > 
> ---------------------------------------------------------------------
> > To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
> > For additional commands, e-mail: user-help@struts.apache.org
> >
> >
> 
> 
> -- 
> André Lopes
> Ogden Nash 
> <http://www.brainyquote.com/quotes/authors/o/ogden_nash.html>  -
> "The trouble with a kitten is that when it grows up, it's 
> always a cat."
> 
Notice:  This e-mail message, together with any attachments, contains information of Merck & Co., Inc. (One Merck Drive, Whitehouse Station, New Jersey, USA 08889), and/or its affiliates Direct contact information for affiliates is available at http://www.merck.com/contact/contacts.html) that may be confidential, proprietary copyrighted and/or legally privileged. It is intended solely for the use of the individual or entity named on this message. If you are not the intended recipient, and have received this message in error, please notify us immediately by reply e-mail and then delete it from your system.


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


Re: Time to process request

Posted by André Lopes <af...@gmail.com>.
I think execute and wait interceptor will do what i want that is to give the
backend services an amount of time to do their job. If they don't do it in
that time, the struts app should send a response message back to the client.


The only problem with the interceptor is that it is not available in struts
1.2.4 (the application is old), so i'm going to have to make the mechanism
myself.

Thanks for the answer!


On Wed, Dec 9, 2009 at 2:39 PM, Wes Wannemacher <we...@wantii.com> wrote:

> Your question is a bit vague, which might be why you are having
> trouble finding a solution...
>
> If I understand the problem properly, perhaps using the "Execute and
> Wait" facility will help -
>
> http://struts.apache.org/2.1.8.1/docs/execute-and-wait-interceptor.html
>
> As far as controlling the amount of time before giving up on the
> backend services (if that's your goal), you would have to build that
> mechanism yourself.
>
> -Wes
>
> 2009/12/9 André Lopes <af...@gmail.com>:
> > Hi all,
> >
> > I'm working on an application that makes requests to several backend
> > services, and i need to establish a max time in wich the struts
> application
> > must send the http response. Is it possible to define such timeout? I've
> > been searching for a way to do this, but i haven't found anything.
> >
> > Cheers,
> > --
> > André Lopes
> >
>
>
>
> --
> Wes Wannemacher
>
> Head Engineer, WanTii, Inc.
> Need Training? Struts, Spring, Maven, Tomcat...
> Ask me for a quote!
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
> For additional commands, e-mail: user-help@struts.apache.org
>
>


-- 
André Lopes
Ogden Nash <http://www.brainyquote.com/quotes/authors/o/ogden_nash.html>  -
"The trouble with a kitten is that when it grows up, it's always a cat."

Re: Time to process request

Posted by Wes Wannemacher <we...@wantii.com>.
Your question is a bit vague, which might be why you are having
trouble finding a solution...

If I understand the problem properly, perhaps using the "Execute and
Wait" facility will help -

http://struts.apache.org/2.1.8.1/docs/execute-and-wait-interceptor.html

As far as controlling the amount of time before giving up on the
backend services (if that's your goal), you would have to build that
mechanism yourself.

-Wes

2009/12/9 André Lopes <af...@gmail.com>:
> Hi all,
>
> I'm working on an application that makes requests to several backend
> services, and i need to establish a max time in wich the struts application
> must send the http response. Is it possible to define such timeout? I've
> been searching for a way to do this, but i haven't found anything.
>
> Cheers,
> --
> André Lopes
>



-- 
Wes Wannemacher

Head Engineer, WanTii, Inc.
Need Training? Struts, Spring, Maven, Tomcat...
Ask me for a quote!

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