• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 1371
  • Last Modified:

defining startup classes

I want to define a startup class which extends the thread class to do some work.
This needs to run on server shutdown as well to do any clean up.

How can this be done in weblogic 8.1
0
inzaghi
Asked:
inzaghi
1 Solution
 
ECollinCommented:
Hi,

can you clarify a little bit what you want to do with threads ?

Anyway, follow this link to see how to create and deploy your startup class : http://e-docs.bea.com/wls/docs81/ConsoleHelp/startup_shutdown.html

Emmanuel
0
 
mohitbahlCommented:
Hi
      Creating startup class for weblogic is quite easy. You can easily do it from the weblogic console. As described in the article http://e-docs.bea.com/wls/docs81/ConsoleHelp/startup_shutdown.html
      But what I understand from your brief question is that you want to invoke a class which does a cleanup when the weblogic server is shutting down. And you want to extend the thread class for your startup class, because you want the cleaning up to continue parallel to the shutdown.
      There is a little code that will help you to create your startup class. Here startTestClass is your start up class and it calls the Cleanup class that extends Thread class. The code below will help you to create the startup class. You can play with the thread to do what you desire.
               i hope al this helps you. let me know.
Regards
mohitbahl

import javax.naming.*;
import weblogic.common.*;

public class startTestClass  implements T3StartupDef
{
      public void setServices(T3ServicesDef services) {}

      public String startup(String name, Hashtable args) throws Exception
      {
           System.out.println("Startup class invoked - " + name);
      
            Cleanup objCleanup =new Cleanup ();
            try
            {
                  objCleanup.start();
            }
            catch(InterruptedException exInterrupted)
            {
                  exInterrupted.printStackTrace();
            }
            return "ok";
      }
}

class objCleanup extends Thread      
{
      public void run()
      {
            //Put your cleaning up code here.
      }
}
0

Featured Post

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Tackle projects and never again get stuck behind a technical roadblock.
Join Now