You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by Gurpreet Dhanoa <gu...@smartdatainc.com> on 2003/12/10 06:54:57 UTC

PlugIn Scheduler

hi 

I have created the following plug-in and using it into my  application. The problem which I am facing is when I am running tomcat. The plug -in is not starting. The basic idea behind this plugin is to start a thread and peform some logic after some interval of time.

ANy suggestions will be of great help.

Following is the code for Plugin Class and the struts-config.xml


PlugTest.java
package efit;

import java.io.PrintStream;

import javax.servlet.ServletException;

import org.apache.struts.action.ActionServlet;

import org.apache.struts.action.PlugIn;

import org.apache.struts.config.ApplicationConfig;

public class PluginTest

implements PlugIn, Runnable

{

public PluginTest()

{

t = null;

}

public void init(ActionServlet servlet, ApplicationConfig applicationConfig)

throws ServletException

{

System.out.println("The Plugin is starting");

t = new Thread(this);

t.start();

}

public void destroy()

{

System.err.println("\u2212\u2212\u2212\u2212>The Plugin is stopping<\u2212\u2212\u2212\u2212");

}

public void run()

{

do

{

System.out.println("Plugin is Running");

try

{

Thread.sleep(1000L);

}

catch(Exception t)

{

System.out.println("Exception in Thread" + t.getMessage());

}

} while(true);

}

Thread t;

}





in the Struts-config.xml I m using the plugin usiong the following tag

    <plug-in className="efit.PluginTest"/>



Thanks

Gary


Re: PlugIn Scheduler

Posted by Gurpreet Dhanoa <gu...@smartdatainc.com>.
hi ALl

It worked perfectly fine. Soon i will be posting the code for all of the
buddies so that they can use it into there application.


----- Original Message -----
From: "Gurpreet Dhanoa" <gu...@smartdatainc.com>
To: "Struts Users Mailing List" <st...@jakarta.apache.org>
Sent: Wednesday, December 10, 2003 11:24 AM
Subject: PlugIn Scheduler


hi

I have created the following plug-in and using it into my  application. The
problem which I am facing is when I am running tomcat. The plug -in is not
starting. The basic idea behind this plugin is to start a thread and peform
some logic after some interval of time.

ANy suggestions will be of great help.

Following is the code for Plugin Class and the struts-config.xml


PlugTest.java
package efit;

import java.io.PrintStream;

import javax.servlet.ServletException;

import org.apache.struts.action.ActionServlet;

import org.apache.struts.action.PlugIn;

import org.apache.struts.config.ApplicationConfig;

public class PluginTest

implements PlugIn, Runnable

{

public PluginTest()

{

t = null;

}

public void init(ActionServlet servlet, ApplicationConfig applicationConfig)

throws ServletException

{

System.out.println("The Plugin is starting");

t = new Thread(this);

t.start();

}

public void destroy()

{

System.err.println("\u2212\u2212\u2212\u2212>The Plugin is
stopping<\u2212\u2212\u2212\u2212");

}

public void run()

{

do

{

System.out.println("Plugin is Running");

try

{

Thread.sleep(1000L);

}

catch(Exception t)

{

System.out.println("Exception in Thread" + t.getMessage());

}

} while(true);

}

Thread t;

}





in the Struts-config.xml I m using the plugin usiong the following tag

    <plug-in className="efit.PluginTest"/>



Thanks

Gary


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