You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by Guifre <gu...@yahoo.es> on 2004/02/23 11:10:22 UTC

PlugIn TimerTask

Hello,

I have implemented an automatic process in
Struts/Tomcat by starting a Timer and scheduling a
TimerTask in the init() method of a PlugIn class.

It works pretty well, except for one thing: if I stop
Tomcat while the task is running, according to the
Timer specification the task should be allowed to
finish, but in fact it is ended in the middle of its
process.

Is this a Struts effect? Can someone figure out how to
fix this?

Thanks!

Guifre


___________________________________________________
Yahoo! Messenger - Nueva versión GRATIS
Super Webcam, voz, caritas animadas, y más...
http://messenger.yahoo.es

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


RE: Struts/JBoss Developers

Posted by Yibing Li <yl...@gnx.com>.
Folks,

We are actively looking for middle level java developers at GlobalNetXChange
(www.gnx.com). If you have 2-3 years of industry experience using
Struts/JBoss and are looking for a job, please send me your resume at
yli@gnx.com.

Thanks,

Yibing



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


Re: PlugIn TimerTask

Posted by Guifre <gu...@yahoo.es>.
Yes, that's exactly how I'm bypassing the problem, but
I   would very much prefer to have something so basic
working as expected: it might affect other similar
situations.

I hope someone can explain why the task is ended?

Guifre

 --- Niall Pemberton
<ni...@blueyonder.co.uk> escribió: > How
about have your TimerTask set a flag in your
> Plugin when its running,
> then in your Plugin.destroy() method, cancel the
> timer and wait until any
> running task is finished.
> 
> public class MyPlugin implements Plugin {
>  public void setTaskRunning(boolean taskRunning) {
>      this.taskRunning = taskRunning;
>  }
>  public void init(ActionServlet servlet,
> ModuleConfig config) {
>       timer.schedule(new MyTimerTask(this),
> .......);
>  }
>  public void destroy() {
>     Timer.cancel();
>      while (taskRunning = true) {
>          wait(1000);
>      }
>  }
> }
> ----- Original Message ----- 
> From: "Guifre" <gu...@yahoo.es>
> To: <st...@jakarta.apache.org>
> Sent: Monday, February 23, 2004 10:10 AM
> Subject: PlugIn TimerTask
> 
> 
> > Hello,
> >
> > I have implemented an automatic process in
> > Struts/Tomcat by starting a Timer and scheduling a
> > TimerTask in the init() method of a PlugIn class.
> >
> > It works pretty well, except for one thing: if I
> stop
> > Tomcat while the task is running, according to the
> > Timer specification the task should be allowed to
> > finish, but in fact it is ended in the middle of
> its
> > process.
> >
> > Is this a Struts effect? Can someone figure out
> how to
> > fix this?
> >
> > Thanks!
> >
> > Guifre
> >
> >
> >
> ___________________________________________________
> > Yahoo! Messenger - Nueva versión GRATIS
> > Super Webcam, voz, caritas animadas, y más...
> > http://messenger.yahoo.es
> >
> >
>
---------------------------------------------------------------------
> > To unsubscribe, e-mail:
> struts-user-unsubscribe@jakarta.apache.org
> > For additional commands, e-mail:
> struts-user-help@jakarta.apache.org
> >
> >
> 
> 
> 
>
---------------------------------------------------------------------
> To unsubscribe, e-mail:
> struts-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail:
> struts-user-help@jakarta.apache.org
>  

___________________________________________________
Yahoo! Messenger - Nueva versión GRATIS
Super Webcam, voz, caritas animadas, y más...
http://messenger.yahoo.es

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


Re: PlugIn TimerTask

Posted by Niall Pemberton <ni...@blueyonder.co.uk>.
How about have your TimerTask set a flag in your Plugin when its running,
then in your Plugin.destroy() method, cancel the timer and wait until any
running task is finished.

public class MyPlugin implements Plugin {
 public void setTaskRunning(boolean taskRunning) {
     this.taskRunning = taskRunning;
 }
 public void init(ActionServlet servlet, ModuleConfig config) {
      timer.schedule(new MyTimerTask(this), .......);
 }
 public void destroy() {
    Timer.cancel();
     while (taskRunning = true) {
         wait(1000);
     }
 }
}
----- Original Message ----- 
From: "Guifre" <gu...@yahoo.es>
To: <st...@jakarta.apache.org>
Sent: Monday, February 23, 2004 10:10 AM
Subject: PlugIn TimerTask


> Hello,
>
> I have implemented an automatic process in
> Struts/Tomcat by starting a Timer and scheduling a
> TimerTask in the init() method of a PlugIn class.
>
> It works pretty well, except for one thing: if I stop
> Tomcat while the task is running, according to the
> Timer specification the task should be allowed to
> finish, but in fact it is ended in the middle of its
> process.
>
> Is this a Struts effect? Can someone figure out how to
> fix this?
>
> Thanks!
>
> Guifre
>
>
> ___________________________________________________
> Yahoo! Messenger - Nueva versión GRATIS
> Super Webcam, voz, caritas animadas, y más...
> http://messenger.yahoo.es
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: struts-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: struts-user-help@jakarta.apache.org
>
>



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


Re: PlugIn TimerTask

Posted by Guifre <gu...@yahoo.es>.
I'm using just Timer() to avoid the "daemon" effect.
As for the Tomcat list, I've considered it, but I
think that having Struts at the center of the action
will raise every suspicion... 

Guifre

 --- Hubert Rabago <ja...@yahoo.com> escribió: >
How are you creating your Timer() object?  If you're
> passing true ("new
> Timer(true)") then the jvm will kill your timer task
> when then app ends.  If
> you're just using "new Timer()" or passing false,
> well, then maybe you can
> ask the Tomcat list.  :)
> 
> --- Guifre <gu...@yahoo.es> wrote:
> > Hello,
> > 
> > I have implemented an automatic process in
> > Struts/Tomcat by starting a Timer and scheduling a
> > TimerTask in the init() method of a PlugIn class.
> > 
> > It works pretty well, except for one thing: if I
> stop
> > Tomcat while the task is running, according to the
> > Timer specification the task should be allowed to
> > finish, but in fact it is ended in the middle of
> its
> > process.
> > 
> > Is this a Struts effect? Can someone figure out
> how to
> > fix this?
> > 
> > Thanks!
> > 
> > Guifre
> > 
> 
> __________________________________
> Do you Yahoo!?
> Yahoo! Mail SpamGuard - Read only the mail you want.
> http://antispam.yahoo.com/tools
> 
>
---------------------------------------------------------------------
> To unsubscribe, e-mail:
> struts-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail:
> struts-user-help@jakarta.apache.org
>  

___________________________________________________
Yahoo! Messenger - Nueva versión GRATIS
Super Webcam, voz, caritas animadas, y más...
http://messenger.yahoo.es

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


Re: PlugIn TimerTask

Posted by Hubert Rabago <ja...@yahoo.com>.
How are you creating your Timer() object?  If you're passing true ("new
Timer(true)") then the jvm will kill your timer task when then app ends.  If
you're just using "new Timer()" or passing false, well, then maybe you can
ask the Tomcat list.  :)

--- Guifre <gu...@yahoo.es> wrote:
> Hello,
> 
> I have implemented an automatic process in
> Struts/Tomcat by starting a Timer and scheduling a
> TimerTask in the init() method of a PlugIn class.
> 
> It works pretty well, except for one thing: if I stop
> Tomcat while the task is running, according to the
> Timer specification the task should be allowed to
> finish, but in fact it is ended in the middle of its
> process.
> 
> Is this a Struts effect? Can someone figure out how to
> fix this?
> 
> Thanks!
> 
> Guifre
> 

__________________________________
Do you Yahoo!?
Yahoo! Mail SpamGuard - Read only the mail you want.
http://antispam.yahoo.com/tools

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


Problem with tiles

Posted by Michiel Slot <sl...@productandconcept.com>.
Ok, fixed my previous problem:
'org.apache.struts.tiles.ActionComponentServlet' has been removed.

So instead of that I now use the plug-in tag. Strangely enough it returns
white pages with an empty HTML body with only a queer ONUNLOAD in it,
sometimes. What goes wrong? With Struts 1.1 everything goes fine...

Web.xml:
	
<servlet-class>org.apache.struts.action.ActionServlet</servlet-class>

	...

	<taglib>
		<taglib-uri>/tags/struts-nested</taglib-uri>
	
<taglib-location>/WEB-INF/struts-nested.tld</taglib-location>
	</taglib>


Struts-config.xml:
<controller processorClass="org.apache.struts.tiles.TilesRequestProcessor">

<plug-in className="org.apache.struts.tiles.TilesPlugin" >
<set-property property="definitions-config" value="/WEB-INF/tiles-defs.xml"
/>
<set-property property="definitions-parser-validate" value="true" />
<set-property property="moduleAware" value="true" />
</plug-in>

Thanks


-----Ursprüngliche Nachricht-----
Gesendet: Montag, 23. Februar 2004 11:34
An: 'Struts Users Mailing List'
Betreff: ServletException: Class
`org.apache.struts.tiles.ActionComponentServlet' 


I've chosen to upgrade to Struts 1.2 to apply wildmatches to my
Tiles-actions.. After upgrading from Struts 1.1 to 1.2(I've tried several
recent nightly builds) I get the following error while opening a page:

javax.servlet.ServletException: Class 
`org.apache.struts.tiles.ActionComponentServlet' 

What is happening? When I explore the package org.apache.struts.tiles it
seems to me that ActionComponentServlet is gone... what to do now? 




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



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


ServletException: Class `org.apache.struts.tiles.ActionComponentServlet'

Posted by Michiel Slot <sl...@productandconcept.com>.
I've chosen to upgrade to Struts 1.2 to apply wildmatches to my
Tiles-actions.. After upgrading from Struts 1.1 to 1.2(I've tried several
recent nightly builds) I get the following error while opening a page:

javax.servlet.ServletException: Class 
`org.apache.struts.tiles.ActionComponentServlet' 

What is happening? When I explore the package org.apache.struts.tiles it
seems to me that ActionComponentServlet is gone... what to do now? 




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