User: starksm 
  Date: 01/11/20 01:42:57

  Modified:    src/main/org/jboss/util Tag: Branch_2_4
                        ClassPathExtension.java CounterService.java
                        Info.java MBeanProxy.java Scheduler.java
                        ServiceControl.java ServiceMBeanSupport.java
                        Shutdown.java XmlHelper.java
  Removed:     src/main/org/jboss/util Tag: Branch_2_4 Executor.java
                        ExecutorMBean.java SystemProperties.java
                        SystemPropertiesMBean.java
  Log:
  Change to the unified log4j based org.jboss.logging.Logger class.
  
  Revision  Changes    Path
  No                   revision
  
  
  No                   revision
  
  
  1.10.6.1  +10 -11    jboss/src/main/org/jboss/util/Attic/ClassPathExtension.java
  
  Index: ClassPathExtension.java
  ===================================================================
  RCS file: 
/cvsroot/jboss/jboss/src/main/org/jboss/util/Attic/ClassPathExtension.java,v
  retrieving revision 1.10
  retrieving revision 1.10.6.1
  diff -u -r1.10 -r1.10.6.1
  --- ClassPathExtension.java   2001/01/16 21:23:14     1.10
  +++ ClassPathExtension.java   2001/11/20 09:42:56     1.10.6.1
  @@ -6,13 +6,15 @@
    */
   package org.jboss.util;
   
  -import java.io.*;
  -import java.net.*;
  -
  -import javax.management.*;
  +import java.io.File;
  +import java.net.MalformedURLException;
  +import java.net.URL;
  +import javax.management.MBeanRegistration;
  +import javax.management.MBeanServer;
  +import javax.management.ObjectName;
   import javax.management.loading.MLet;
   
  -import org.jboss.logging.Log;
  +import org.jboss.logging.Logger;
   import org.jboss.util.ServiceMBeanSupport;
   
   /**
  @@ -20,20 +22,18 @@
    *      
    *   @see <related>
    *   @author Rickard �berg ([EMAIL PROTECTED])
  - *   @version $Revision: 1.10 $
  + *   @version $Revision: 1.10.6.1 $
    */
   public class ClassPathExtension
      implements ClassPathExtensionMBean, MBeanRegistration
   {
      // Constants -----------------------------------------------------
      public static final String OBJECT_NAME = ":service=ClassPathExtension";
  -    
  +   static Logger log = Logger.getLogger(ClassPathExtension.class);
      // Attributes ----------------------------------------------------
      String url;
      String name;
      
  -   Log log = Log.createLog("Classpath extension");
  -   
      // Static --------------------------------------------------------
   
      // Constructors --------------------------------------------------
  @@ -125,7 +125,7 @@
               }
            } catch (Throwable ex)
            {
  -             log.warning("Classpath extension "+u+" is invalid.");
  +             log.warn("Classpath extension "+u+" is invalid.");
               ex.printStackTrace();
            }
         } else
  @@ -154,8 +154,7 @@
                  log.debug("Added library:"+url);
               } catch (MalformedURLException ex)
               {
  -               log.warning("Classpath extension "+u+" is invalid.");
  -               log.exception(ex);
  +               log.warn("Classpath extension "+u+" is invalid.", ex);
               }
            }
         }
  
  
  
  1.1.4.1   +0 -1      jboss/src/main/org/jboss/util/CounterService.java
  
  Index: CounterService.java
  ===================================================================
  RCS file: /cvsroot/jboss/jboss/src/main/org/jboss/util/CounterService.java,v
  retrieving revision 1.1
  retrieving revision 1.1.4.1
  diff -u -r1.1 -r1.1.4.1
  --- CounterService.java       2001/04/04 04:49:52     1.1
  +++ CounterService.java       2001/11/20 09:42:56     1.1.4.1
  @@ -9,7 +9,6 @@
   import javax.naming.Reference;
   import javax.naming.StringRefAddr;
   import org.jboss.util.ServiceMBeanSupport;
  -import org.jboss.logging.Log;
   import org.jboss.naming.NonSerializableFactory;
   
   /** A service offering accumulator style counters to help in diagnosing
  
  
  
  1.5.4.1   +9 -11     jboss/src/main/org/jboss/util/Info.java
  
  Index: Info.java
  ===================================================================
  RCS file: /cvsroot/jboss/jboss/src/main/org/jboss/util/Info.java,v
  retrieving revision 1.5
  retrieving revision 1.5.4.1
  diff -u -r1.5 -r1.5.4.1
  --- Info.java 2001/05/09 14:47:54     1.5
  +++ Info.java 2001/11/20 09:42:57     1.5.4.1
  @@ -13,7 +13,7 @@
   import javax.management.*;
   import javax.management.loading.MLet;
   
  -import org.jboss.logging.Log;
  +import org.jboss.logging.Logger;
   
   /**
    *   <description> 
  @@ -21,18 +21,16 @@
    *   @see <related>
    *   @author Rickard �berg ([EMAIL PROTECTED])
    *   @author [EMAIL PROTECTED]
  - *   @version $Revision: 1.5 $
  + *   @version $Revision: 1.5.4.1 $
    */
   public class Info
      implements InfoMBean, MBeanRegistration
   {
      // Constants -----------------------------------------------------
      public static final String OBJECT_NAME = ":service=Info";
  -    
  +   private static Logger log = Logger.getLogger(Info.class);
      // Attributes ----------------------------------------------------
  -   
  -   Log log = Log.createLog("Info");
  -   
  +
      // Static --------------------------------------------------------
   
      // Constructors --------------------------------------------------
  @@ -42,9 +40,9 @@
         throws java.lang.Exception
      {
         // Dump out basic info as INFO priority msgs
  -      log.log("Java version: 
"+System.getProperty("java.version")+","+System.getProperty("java.vendor"));
  -      log.log("Java VM: "+System.getProperty("java.vm.name")+" 
"+System.getProperty("java.vm.version")+","+System.getProperty("java.vm.vendor"));
  -      log.log("System: "+System.getProperty("os.name")+" 
"+System.getProperty("os.version")+","+System.getProperty("os.arch"));
  +      log.info("Java version: 
"+System.getProperty("java.version")+","+System.getProperty("java.vendor"));
  +      log.info("Java VM: "+System.getProperty("java.vm.name")+" 
"+System.getProperty("java.vm.version")+","+System.getProperty("java.vm.vendor"));
  +      log.info("System: "+System.getProperty("os.name")+" 
"+System.getProperty("os.version")+","+System.getProperty("os.arch"));
         // Now dump out the entire System properties as DEBUG priority msgs
         log.debug("+++ Full System Properties Dump");
         Enumeration names = System.getProperties().propertyNames();
  @@ -54,10 +52,10 @@
             log.debug(pname+": "+System.getProperty(pname));
         }
            
  -       // MF TODO: say everything that needs to be said here: copyright, included 
libs and TM, contributor and (C) jboss org 2000
  +      // MF TODO: say everything that needs to be said here: copyright, included 
libs and TM, contributor and (C) jboss org 2000
         return new ObjectName(OBJECT_NAME);
      }
  -   
  +
      public void postRegister(java.lang.Boolean registrationDone)
      {
      }
  
  
  
  1.4.6.1   +1 -2      jboss/src/main/org/jboss/util/MBeanProxy.java
  
  Index: MBeanProxy.java
  ===================================================================
  RCS file: /cvsroot/jboss/jboss/src/main/org/jboss/util/MBeanProxy.java,v
  retrieving revision 1.4
  retrieving revision 1.4.6.1
  diff -u -r1.4 -r1.4.6.1
  --- MBeanProxy.java   2000/12/07 15:45:20     1.4
  +++ MBeanProxy.java   2001/11/20 09:42:57     1.4.6.1
  @@ -13,7 +13,6 @@
   import javax.management.*;
   import javax.management.loading.MLet;
   
  -import org.jboss.logging.Log;
   import org.jboss.proxy.Proxy;
   import org.jboss.proxy.InvocationHandler;
   
  @@ -22,7 +21,7 @@
    *      
    *   @see <related>
    *   @author Rickard �berg ([EMAIL PROTECTED])
  - *   @version $Revision: 1.4 $
  + *   @version $Revision: 1.4.6.1 $
    */
   public class MBeanProxy
      implements InvocationHandler
  
  
  
  1.4.4.1   +413 -305  jboss/src/main/org/jboss/util/Scheduler.java
  
  Index: Scheduler.java
  ===================================================================
  RCS file: /cvsroot/jboss/jboss/src/main/org/jboss/util/Scheduler.java,v
  retrieving revision 1.4
  retrieving revision 1.4.4.1
  diff -u -r1.4 -r1.4.4.1
  --- Scheduler.java    2001/06/11 06:32:31     1.4
  +++ Scheduler.java    2001/11/20 09:42:57     1.4.4.1
  @@ -30,7 +30,6 @@
   import javax.naming.Reference;
   import javax.naming.StringRefAddr;
   
  -import org.jboss.logging.Log;
   import org.jboss.naming.NonSerializableFactory;
   import org.jboss.util.ServiceMBeanSupport;
   
  @@ -41,21 +40,21 @@
    * @author Andreas Schaefer ([EMAIL PROTECTED])
    **/
   public class Scheduler
  -   extends ServiceMBeanSupport
  -   implements SchedulerMBean
  +extends ServiceMBeanSupport
  +implements SchedulerMBean
   {
  -
  +   
      // -------------------------------------------------------------------------
      // Constants
  -   // -------------------------------------------------------------------------  
  -
  +   // -------------------------------------------------------------------------
  +   
      public static String JNDI_NAME = "scheduler:domain";
      public static String JMX_NAME = "scheduler";
  -
  +   
      // -------------------------------------------------------------------------
      // Members
  -   // -------------------------------------------------------------------------  
  -
  +   // -------------------------------------------------------------------------
  +   
      private String mName;
      
      private long mActualSchedulePeriod;
  @@ -68,7 +67,7 @@
      private boolean mWaitForNextCallToStop = false;
      private boolean mStartOnStart = false;
      private boolean mIsRestartPending = true;
  -
  +   
      // Pending values which can be different to the actual ones
      private Class mSchedulableClass;
      private String mSchedulableArguments;
  @@ -78,11 +77,11 @@
      private Date mStartDate;
      private long mSchedulePeriod;
      private long mInitialRepetitions;
  -
  +   
      // -------------------------------------------------------------------------
      // Constructors
  -   // -------------------------------------------------------------------------  
  -
  +   // -------------------------------------------------------------------------
  +   
      /**
       * Default (no-args) Constructor
       **/
  @@ -90,7 +89,7 @@
      {
         mName = null;
      }
  -
  +   
      /**
       * Constructor with the necessary attributes to be set
       *
  @@ -100,7 +99,7 @@
      {
         mName = pName;
      }
  -
  +   
      /**
       * Constructor with the necessary attributes to be set
       *
  @@ -113,8 +112,8 @@
         String pInitTypes,
         long pInitialStartDate,
         long pSchedulePeriod,
  -      long pNumberOfRepetitions
  -   ) {
  +      long pNumberOfRepetitions)
  +   {
         mName = pName;
         mStartOnStart = true;
         setSchedulableClass( pSchedulableClass );
  @@ -124,254 +123,311 @@
         setSchedulePeriod( pSchedulePeriod );
         setInitialRepetitions( pNumberOfRepetitions );
      }
  -
  +   
      // -------------------------------------------------------------------------
      // SchedulerMBean Methods
  -   // -------------------------------------------------------------------------  
  +   // -------------------------------------------------------------------------
      
  -   public void startSchedule() {
  +   public void startSchedule()
  +   {
         // Check if not already started
  -      if( !isStarted() ) {
  -         try {
  +      if( !isStarted() )
  +      {
  +         try
  +         {
               // Check the given attributes if correct
  -            if( mSchedulableClass == null ) {
  +            if( mSchedulableClass == null )
  +            {
                  throw new InvalidParameterException(
  -                  "Schedulable Class must be set"
  +               "Schedulable Class must be set"
                  );
               }
  -            if( mSchedulableArgumentList.length != 
mSchedulableArgumentTypeList.length ) {
  +            if( mSchedulableArgumentList.length != 
mSchedulableArgumentTypeList.length )
  +            {
                  throw new InvalidParameterException(
  -                  "Schedulable Class Arguments and Types do not match in length"
  +               "Schedulable Class Arguments and Types do not match in length"
                  );
               }
  -            if( mSchedulePeriod <= 0 ) {
  +            if( mSchedulePeriod <= 0 )
  +            {
                  throw new InvalidParameterException(
  -                  "Schedule Period must be set and greater than 0 (ms)"
  +               "Schedule Period must be set and greater than 0 (ms)"
                  );
               }
               // Create all the Objects for the Constructor to be called
               Object[] lArgumentList = new Object[ 
mSchedulableArgumentTypeList.length ];
  -            try {
  -               for( int i = 0; i < mSchedulableArgumentTypeList.length; i++ ) {
  +            try
  +            {
  +               for( int i = 0; i < mSchedulableArgumentTypeList.length; i++ )
  +               {
                     Class lClass = mSchedulableArgumentTypeList[ i ];
  -                  if( lClass == Boolean.TYPE ) {
  +                  if( lClass == Boolean.TYPE )
  +                  {
                        lArgumentList[ i ] = new Boolean( mSchedulableArgumentList[ i 
] );
  -                  } else
  -                  if( lClass == Integer.TYPE ) {
  +                  }
  +                  else if( lClass == Integer.TYPE )
  +                  {
                        lArgumentList[ i ] = new Integer( mSchedulableArgumentList[ i 
] );
  -                  } else
  -                  if( lClass == Long.TYPE ) {
  +                  }
  +                  else if( lClass == Long.TYPE )
  +                  {
                        lArgumentList[ i ] = new Long( mSchedulableArgumentList[ i ] );
  -                  } else
  -                  if( lClass == Short.TYPE ) {
  +                  }
  +                  else if( lClass == Short.TYPE )
  +                  {
                        lArgumentList[ i ] = new Short( mSchedulableArgumentList[ i ] 
);
  -                  } else
  -                  if( lClass == Float.TYPE ) {
  +                  }
  +                  else if( lClass == Float.TYPE )
  +                  {
                        lArgumentList[ i ] = new Float( mSchedulableArgumentList[ i ] 
);
  -                  } else
  -                  if( lClass == Double.TYPE ) {
  +                  }
  +                  else if( lClass == Double.TYPE )
  +                  {
                        lArgumentList[ i ] = new Double( mSchedulableArgumentList[ i ] 
);
  -                  } else
  -                  if( lClass == Byte.TYPE ) {
  +                  }
  +                  else if( lClass == Byte.TYPE )
  +                  {
                        lArgumentList[ i ] = new Byte( mSchedulableArgumentList[ i ] );
  -                  } else
  -                  if( lClass == Character.TYPE ) {
  +                  }
  +                  else if( lClass == Character.TYPE )
  +                  {
                        lArgumentList[ i ] = new Character( mSchedulableArgumentList[ 
i ].charAt( 0 ) );
  -                  } else {
  -                     Constructor lConstructor = lClass.getConstructor( new Class[] 
{ String.class } );
  -                     lArgumentList[ i ] = lConstructor.newInstance( new Object[] { 
mSchedulableArgumentList[ i ] } );
  +                  }
  +                  else
  +                  {
  +                     Constructor lConstructor = lClass.getConstructor( new Class[]
  +                        { String.class } );
  +                     lArgumentList[ i ] = lConstructor.newInstance( new Object[]
  +                        { mSchedulableArgumentList[ i ] } );
                     }
                  }
               }
  -            catch( Exception e ) {
  +            catch( Exception e )
  +            {
                  throw new InvalidParameterException( "Could not load or create a 
constructor argument" );
               }
  -            try {
  +            try
  +            {
                  // Check if constructor is found
                  Constructor lSchedulableConstructor = 
mSchedulableClass.getConstructor( mSchedulableArgumentTypeList );
                  // Create an instance of it
                  mSchedulable = (Schedulable) lSchedulableConstructor.newInstance( 
lArgumentList );
               }
  -            catch( Exception e ) {
  +            catch( Exception e )
  +            {
                  throw new InvalidParameterException( "Could not find the constructor 
or create the Schedulable Instance" );
               }
               // Register the notificaiton listener at the MBeanServer
               getServer().addNotificationListener(
  -               mTimer, 
  -               new Listener( mSchedulable ),
  -               // No filter
  -               null,
  -               // No object handback necessary
  -               null
  +            mTimer,
  +            new Listener( mSchedulable ),
  +            // No filter
  +            null,
  +            // No object handback necessary
  +            null
               );
               mRemainingRepetitions = mInitialRepetitions;
               mActualSchedulePeriod = mSchedulePeriod;
               // Register the Schedule at the Timer
  -            if( mStartDate == null || mStartDate.getTime() < new Date().getTime() ) 
{
  +            if( mStartDate == null || mStartDate.getTime() < new Date().getTime() )
  +            {
                  mStartDate = new Date( new Date().getTime() + 1000 );
                  // Start Schedule now
                  System.out.println( "Start regular Schedule with period: " + 
mActualSchedulePeriod );
  -               if( mRemainingRepetitions > 0 ) {
  +               if( mRemainingRepetitions > 0 )
  +               {
                     System.out.println( "Start Schedule wtih " + 
mRemainingRepetitions + " reps." );
                     mActualSchedule = ( (Integer) getServer().invoke(
  -                     mTimer,
  -                     "addNotification",
  -                     new Object[] {
  -                        "Schedule",
  -                        "Scheduler Notification",
  -                        null,
  -                        new Date( new Date().getTime() + 1000 ),
  -                        new Long( mActualSchedulePeriod ),
  -                        new Long( mRemainingRepetitions )
  -                     },
  -                     new String[] {
  -                        "".getClass().getName(),
  -                        "".getClass().getName(),
  -                        Object.class.getName(),
  -                        Date.class.getName(),
  -                        Long.TYPE.getName(),
  -                        Long.TYPE.getName()
  -                     }
  +                  mTimer,
  +                  "addNotification",
  +                  new Object[]
  +                  {
  +                     "Schedule",
  +                     "Scheduler Notification",
  +                     null,
  +                     new Date( new Date().getTime() + 1000 ),
  +                     new Long( mActualSchedulePeriod ),
  +                     new Long( mRemainingRepetitions )
  +                  },
  +                  new String[]
  +                  {
  +                     "".getClass().getName(),
  +                     "".getClass().getName(),
  +                     Object.class.getName(),
  +                     Date.class.getName(),
  +                     Long.TYPE.getName(),
  +                     Long.TYPE.getName()
  +                  }
                     ) ).intValue();
                  }
  -               else {
  +               else
  +               {
                     System.out.println( "Start Schedule with unlimited reps." );
                     mActualSchedule = ( (Integer) getServer().invoke(
  -                     mTimer,
  -                     "addNotification",
  -                     new Object[] {
  -                        "Schedule",
  -                        "Scheduler Notification",
  -                        null,
  -                        new Date( new Date().getTime() + 1000 ),
  -                        new Long( mActualSchedulePeriod )
  -                     },
  -                     new String[] {
  -                        String.class.getName(),
  -                        String.class.getName(),
  -                        Object.class.getName(),
  -                        Date.class.getName(),
  -                        Long.TYPE.getName()
  -                     }
  -                  ) ).intValue();
  -               }
  -            }
  -            else {
  -               // Add an initial call
  -               mActualSchedule = ( (Integer) getServer().invoke(
                     mTimer,
                     "addNotification",
  -                  new Object[] {
  +                  new Object[]
  +                  {
                        "Schedule",
                        "Scheduler Notification",
  -                     mStartDate
  +                     null,
  +                     new Date( new Date().getTime() + 1000 ),
  +                     new Long( mActualSchedulePeriod )
                     },
  -                  new String[] {
  +                  new String[]
  +                  {
                        String.class.getName(),
                        String.class.getName(),
  +                     Object.class.getName(),
                        Date.class.getName(),
  +                     Long.TYPE.getName()
                     }
  +                  ) ).intValue();
  +               }
  +            }
  +            else
  +            {
  +               // Add an initial call
  +               mActualSchedule = ( (Integer) getServer().invoke(
  +               mTimer,
  +               "addNotification",
  +               new Object[]
  +               {
  +                  "Schedule",
  +                  "Scheduler Notification",
  +                  mStartDate
  +               },
  +               new String[]
  +               {
  +                  String.class.getName(),
  +                  String.class.getName(),
  +                  Date.class.getName(),
  +               }
                  ) ).intValue();
               }
               mScheduleIsStarted = true;
               mIsRestartPending = false;
            }
  -         catch( Exception e ) {
  +         catch( Exception e )
  +         {
               e.printStackTrace();
            }
         }
      }
      
      public void stopSchedule(
  -      boolean pDoItNow
  -   ) {
  -      try {
  -         if( pDoItNow ) {
  +   boolean pDoItNow
  +   )
  +   {
  +      try
  +      {
  +         if( pDoItNow )
  +         {
               // Remove notification listener now
               mWaitForNextCallToStop = false;
               getServer().invoke(
  -               mTimer,
  -               "removeNotification",
  -               new Object[] {
  -                  new Integer( mActualSchedule )
  -               },
  -               new String[] {
  -                  Integer.TYPE.getName(),
  -               }
  +            mTimer,
  +            "removeNotification",
  +            new Object[]
  +            {
  +               new Integer( mActualSchedule )
  +            },
  +            new String[]
  +            {
  +               Integer.TYPE.getName(),
  +            }
               );
               mActualSchedule = -1;
               mScheduleIsStarted = false;
            }
  -         else {
  +         else
  +         {
               mWaitForNextCallToStop = true;
            }
         }
  -      catch( Exception e ) {
  +      catch( Exception e )
  +      {
            e.printStackTrace();
         }
      }
      
  -   public void restartSchedule() {
  +   public void restartSchedule()
  +   {
         stopSchedule( true );
         startSchedule();
      }
      
  -   public String getSchedulableClass() {
  -      if( mSchedulableClass == null ) {
  +   public String getSchedulableClass()
  +   {
  +      if( mSchedulableClass == null )
  +      {
            return null;
         }
         return mSchedulableClass.getName();
      }
      
      public void setSchedulableClass( String pSchedulableClass )
  -      throws InvalidParameterException
  +   throws InvalidParameterException
      {
  -      if( pSchedulableClass == null || pSchedulableClass.equals( "" ) ) {
  +      if( pSchedulableClass == null || pSchedulableClass.equals( "" ) )
  +      {
            throw new InvalidParameterException( "Schedulable Class cannot be empty or 
undefined" );
         }
  -      try {
  +      try
  +      {
            // Try to load the Schedulable Class
            mSchedulableClass = 
Thread.currentThread().getContextClassLoader().loadClass( pSchedulableClass );
            // Check if instance of Schedulable
            Class[] lInterfaces = mSchedulableClass.getInterfaces();
            boolean lFound = false;
  -         for( int i = 0; i < lInterfaces.length; i++ ) {
  -            if( lInterfaces[ i ] == Schedulable.class ) {
  +         for( int i = 0; i < lInterfaces.length; i++ )
  +         {
  +            if( lInterfaces[ i ] == Schedulable.class )
  +            {
                  lFound = true;
                  break;
               }
            }
  -         if( !lFound ) {
  +         if( !lFound )
  +         {
               throw new InvalidParameterException(
  -               "Given class " + pSchedulableClass + " is not instance of 
Schedulable"
  +            "Given class " + pSchedulableClass + " is not instance of Schedulable"
               );
            }
         }
  -      catch( ClassNotFoundException cnfe ) {
  +      catch( ClassNotFoundException cnfe )
  +      {
            throw new InvalidParameterException(
  -            "Given class " + pSchedulableClass + " is not valid or not found"
  +         "Given class " + pSchedulableClass + " is not valid or not found"
            );
         }
         mIsRestartPending = true;
      }
      
  -   public String getSchedulableArguments() {
  +   public String getSchedulableArguments()
  +   {
         return mSchedulableArguments;
      }
      
  -   public void setSchedulableArguments( String pArgumentList ) {
  -      if( pArgumentList == null || pArgumentList.equals( "" ) ) {
  +   public void setSchedulableArguments( String pArgumentList )
  +   {
  +      if( pArgumentList == null || pArgumentList.equals( "" ) )
  +      {
            mSchedulableArgumentList = new String[ 0 ];
         }
  -      else {
  +      else
  +      {
            StringTokenizer lTokenizer = new StringTokenizer( pArgumentList, "," );
            Vector lList = new Vector();
  -         while( lTokenizer.hasMoreTokens() ) {
  +         while( lTokenizer.hasMoreTokens() )
  +         {
               String lToken = lTokenizer.nextToken().trim();
  -            if( lToken.equals( "" ) ) {
  +            if( lToken.equals( "" ) )
  +            {
                  lList.add( "null" );
               }
  -            else {
  +            else
  +            {
                  lList.add( lToken );
               }
            }
  @@ -381,55 +437,70 @@
         mIsRestartPending = true;
      }
      
  -   public String getSchedulableArgumentTypes() {
  +   public String getSchedulableArgumentTypes()
  +   {
         return mSchedulableArgumentTypes;
      }
      
      public void setSchedulableArgumentTypes( String pTypeList )
  -      throws InvalidParameterException
  +   throws InvalidParameterException
      {
  -      if( pTypeList == null || pTypeList.equals( "" ) ) {
  +      if( pTypeList == null || pTypeList.equals( "" ) )
  +      {
            mSchedulableArgumentTypeList = new Class[ 0 ];
         }
  -      else {
  +      else
  +      {
            StringTokenizer lTokenizer = new StringTokenizer( pTypeList, "," );
            Vector lList = new Vector();
  -         while( lTokenizer.hasMoreTokens() ) {
  +         while( lTokenizer.hasMoreTokens() )
  +         {
               String lToken = lTokenizer.nextToken().trim();
               // Get the class
               Class lClass = null;
  -            if( lToken.equals( "short" ) ) {
  -              lClass = Short.TYPE;
  -            } else
  -            if( lToken.equals( "int" ) ) {
  -              lClass = Integer.TYPE;
  -            } else
  -            if( lToken.equals( "long" ) ) {
  -              lClass = Long.TYPE;
  -            } else
  -            if( lToken.equals( "byte" ) ) {
  -              lClass = Byte.TYPE;
  -            } else
  -            if( lToken.equals( "char" ) ) {
  -              lClass = Character.TYPE;
  -            } else
  -            if( lToken.equals( "float" ) ) {
  -              lClass = Float.TYPE;
  -            } else
  -            if( lToken.equals( "double" ) ) {
  -              lClass = Double.TYPE;
  +            if( lToken.equals( "short" ) )
  +            {
  +               lClass = Short.TYPE;
               } else
  -            if( lToken.equals( "boolean" ) ) {
  -              lClass = Boolean.TYPE;
  -            }
  -            if( lClass == null ) {
  -               try {
  +               if( lToken.equals( "int" ) )
  +               {
  +                  lClass = Integer.TYPE;
  +               } else
  +                  if( lToken.equals( "long" ) )
  +                  {
  +                     lClass = Long.TYPE;
  +                  } else
  +                     if( lToken.equals( "byte" ) )
  +                     {
  +                        lClass = Byte.TYPE;
  +                     } else
  +                        if( lToken.equals( "char" ) )
  +                        {
  +                           lClass = Character.TYPE;
  +                        } else
  +                           if( lToken.equals( "float" ) )
  +                           {
  +                              lClass = Float.TYPE;
  +                           } else
  +                              if( lToken.equals( "double" ) )
  +                              {
  +                                 lClass = Double.TYPE;
  +                              } else
  +                                 if( lToken.equals( "boolean" ) )
  +                                 {
  +                                    lClass = Boolean.TYPE;
  +                                 }
  +            if( lClass == null )
  +            {
  +               try
  +               {
                     // Load class to check if available
                     lClass = 
Thread.currentThread().getContextClassLoader().loadClass( lToken );
                  }
  -               catch( ClassNotFoundException cnfe ) {
  +               catch( ClassNotFoundException cnfe )
  +               {
                     throw new InvalidParameterException(
  -                     "The argument type: " + lToken + " is not a valid class or 
could not be found"
  +                  "The argument type: " + lToken + " is not a valid class or could 
not be found"
                     );
                  }
               }
  @@ -441,246 +512,286 @@
         mIsRestartPending = true;
      }
      
  -   public long getSchedulePeriod() {
  +   public long getSchedulePeriod()
  +   {
         return mSchedulePeriod;
      }
      
  -   public void setSchedulePeriod( long pPeriod ) {
  -      if( pPeriod <= 0 ) {
  +   public void setSchedulePeriod( long pPeriod )
  +   {
  +      if( pPeriod <= 0 )
  +      {
            throw new InvalidParameterException( "Schedulable Period may be not less 
or equals than 0" );
         }
         mSchedulePeriod = pPeriod;
         mIsRestartPending = true;
      }
      
  -   public long getInitialRepetitions() {
  +   public long getInitialRepetitions()
  +   {
         return mInitialRepetitions;
      }
      
  -   public void setInitialRepetitions( long pNumberOfCalls ) {
  -      if( pNumberOfCalls <= 0 ) {
  +   public void setInitialRepetitions( long pNumberOfCalls )
  +   {
  +      if( pNumberOfCalls <= 0 )
  +      {
            pNumberOfCalls = -1;
         }
         mInitialRepetitions = pNumberOfCalls;
         mIsRestartPending = true;
      }
  -
  -   public long getRemainingRepetitions() {
  +   
  +   public long getRemainingRepetitions()
  +   {
         return mRemainingRepetitions;
      }
      
  -   public boolean isStarted() {
  +   public boolean isStarted()
  +   {
         return mScheduleIsStarted;
      }
  -
  -   public boolean isRestartPending() {
  +   
  +   public boolean isRestartPending()
  +   {
         return mIsRestartPending;
      }
  -
  +   
      // -------------------------------------------------------------------------
      // Methods
  -   // -------------------------------------------------------------------------  
  -
  +   // -------------------------------------------------------------------------
  +   
      public ObjectName getObjectName(
  -      MBeanServer pServer,
  -      ObjectName pName
  +   MBeanServer pServer,
  +   ObjectName pName
      )
  -      throws MalformedObjectNameException
  +   throws MalformedObjectNameException
      {
         return pName;
      }
      
  -   public String getJNDIName() {
  -      if( mName != null ) {
  +   public String getJNDIName()
  +   {
  +      if( mName != null )
  +      {
            return JMX_NAME + ":" + mName;
         }
  -      else {
  +      else
  +      {
            return JMX_NAME;
         }
      }
      
  -   public String getName() {
  +   public String getName()
  +   {
         return "JBoss Scheduler MBean";
      }
      
      // -------------------------------------------------------------------------
      // ServiceMBean - Methods
  -   // -------------------------------------------------------------------------  
  -
  +   // -------------------------------------------------------------------------
  +   
      protected void initService()
  -        throws Exception
  +   throws Exception
      {
      }
      
      protected void startService()
  -        throws Exception
  +   throws Exception
      {
         bind( this );
  -      try {
  +      try
  +      {
            // Create Timer MBean
            mTimer = new ObjectName( "DefaultDomain", "service", "Timer" );
            getServer().createMBean( "javax.management.timer.Timer", mTimer );
            // Now start the Timer
            getServer().invoke(
  -            mTimer,
  -            "start",
  -            new Object[] {},
  -            new String[] {}
  +         mTimer,
  +         "start",
  +         new Object[]
  +         {},
  +         new String[]
  +         {}
            );
         }
  -      catch( Exception e ) {
  +      catch( Exception e )
  +      {
            e.printStackTrace();
         }
  -      if( mStartOnStart ) {
  +      if( mStartOnStart )
  +      {
            startSchedule();
         }
      }
      
  -   protected void stopService() {
  -      try {
  +   protected void stopService()
  +   {
  +      try
  +      {
            unbind();
         }
  -      catch( Exception e ) {
  -         log.exception( e );
  +      catch( Exception e )
  +      {
  +         log.error("Failed to unbind", e);
         }
      }
  -
  +   
      // -------------------------------------------------------------------------
      // Helper methods to bind/unbind the Management class
      // -------------------------------------------------------------------------
  -
  -     private void bind( Scheduler pScheduler )
  -      throws
  -         NamingException
  +   
  +   private void bind( Scheduler pScheduler )
  +      throws  NamingException
      {
  -             Context lContext = new InitialContext();
  -             String lJNDIName = getJNDIName();
  -
  -             // Ah ! JBoss Server isn't serializable, so we use a helper class
  -             NonSerializableFactory.bind( lJNDIName, pScheduler );
  -
  +      Context lContext = new InitialContext();
  +      String lJNDIName = getJNDIName();
  +      
  +      // Ah ! JBoss Server isn't serializable, so we use a helper class
  +      NonSerializableFactory.bind( lJNDIName, pScheduler );
  +      
         //AS Don't ask me what I am doing here
  -             Name lName = lContext.getNameParser("").parse( lJNDIName );
  -             while( lName.size() > 1 ) {
  -                     String lContextName = lName.get( 0 );
  -                     try {
  -                             lContext = (Context) lContext.lookup(lContextName);
  -                     }
  -                     catch( NameNotFoundException e )        {
  -                             lContext = lContext.createSubcontext(lContextName);
  -                     }
  -                     lName = lName.getSuffix( 1 );
  -             }
  -
  -             // The helper class NonSerializableFactory uses address type nns, we 
go on to
  -             // use the helper class to bind the javax.mail.Session object in JNDI
  -             StringRefAddr lAddress = new StringRefAddr( "nns", lJNDIName );
  -             Reference lReference = new Reference(
  +      Name lName = lContext.getNameParser("").parse( lJNDIName );
  +      while( lName.size() > 1 )
  +      {
  +         String lContextName = lName.get( 0 );
  +         try
  +         {
  +            lContext = (Context) lContext.lookup(lContextName);
  +         }
  +         catch( NameNotFoundException e )
  +         {
  +            lContext = lContext.createSubcontext(lContextName);
  +         }
  +         lName = lName.getSuffix( 1 );
  +      }
  +      
  +      // The helper class NonSerializableFactory uses address type nns, we go on to
  +      // use the helper class to bind the javax.mail.Session object in JNDI
  +      StringRefAddr lAddress = new StringRefAddr( "nns", lJNDIName );
  +      Reference lReference = new Reference(
            Scheduler.class.getName(),
            lAddress,
            NonSerializableFactory.class.getName(),
            null
  -      );
  -             lContext.bind( lName.get( 0 ), lReference );
  -
  -             log.log( "JBoss Scheduler Service '" + getJNDIName() + "' bound to " + 
lJNDIName );
  -     }
  -
  -     private void unbind() throws NamingException {
  +         );
  +      lContext.bind( lName.get( 0 ), lReference );
  +      
  +      log.info( "JBoss Scheduler Service '" + getJNDIName() + "' bound to " + 
lJNDIName );
  +   }
  +   
  +   private void unbind() throws NamingException
  +   {
         String lJNDIName = getJNDIName();
  -
  +      
         new InitialContext().unbind( lJNDIName );
         NonSerializableFactory.unbind( lJNDIName );
  -      log.log("JBoss Scheduler service '" + lJNDIName + "' removed from JNDI" );
  -     }
  -
  +      log.info("JBoss Scheduler service '" + lJNDIName + "' removed from JNDI" );
  +   }
  +   
      // -------------------------------------------------------------------------
      // Inner Classes
      // -------------------------------------------------------------------------
  -
  -   public class Listener
  -      implements NotificationListener
  +   
  +   public class Listener implements NotificationListener
      {
         
         private Schedulable mDelegate;
         
  -      public Listener( Schedulable pDelegate ) {
  +      public Listener( Schedulable pDelegate )
  +      {
            mDelegate = pDelegate;
         }
         
         public void handleNotification(
  -         Notification pNotification,
  -         Object pHandback 
  -      ) {
  +      Notification pNotification,
  +      Object pHandback
  +      )
  +      {
            System.out.println( "Listener.handleNotification(), notification: " + 
pNotification );
  -         try {
  +         try
  +         {
               // If schedule is started invoke the schedule method on the Schedulable 
instance
  -            if( isStarted() ) {
  -               if( getRemainingRepetitions() > 0 || getRemainingRepetitions() < 0 ) 
{
  +            if( isStarted() )
  +            {
  +               if( getRemainingRepetitions() > 0 || getRemainingRepetitions() < 0 )
  +               {
                     mDelegate.perform(
  -                     new Date(),
  -                     getRemainingRepetitions()
  +                  new Date(),
  +                  getRemainingRepetitions()
                     );
  -                  if( mRemainingRepetitions > 0 ) {
  +                  if( mRemainingRepetitions > 0 )
  +                  {
                        mRemainingRepetitions--;
                     }
  -                  if( getRemainingRepetitions() == 0 || mWaitForNextCallToStop ) {
  +                  if( getRemainingRepetitions() == 0 || mWaitForNextCallToStop )
  +                  {
                        stopSchedule( true );
                     }
  -                  else {
  -                     if( "InitialCall".equals( pNotification.getType() ) ) {
  +                  else
  +                  {
  +                     if( "InitialCall".equals( pNotification.getType() ) )
  +                     {
                           // When Initial Call then setup the regular schedule
                           // By first removing the initial one and then adding the
                           // regular one.
                           getServer().invoke(
  -                           mTimer,
  -                           "removeNotification",
  -                           new Object[] {
  -                              new Integer( mActualSchedule )
  -                           },
  -                           new String[] {
  -                              Integer.TYPE.getName(),
  -                           }
  +                        mTimer,
  +                        "removeNotification",
  +                        new Object[]
  +                        {
  +                           new Integer( mActualSchedule )
  +                        },
  +                        new String[]
  +                        {
  +                           Integer.TYPE.getName(),
  +                        }
                           );
                           // Add regular schedule
                           mActualSchedule = ( (Integer) getServer().invoke(
  -                           mTimer,
  -                           "addNotification",
  -                           new Object[] {
  -                              "Schedule",
  -                              "Scheduler Notification",
  -                              new Date( new Date().getTime() + 1000 ),
  -                              new Long( mActualSchedulePeriod ),
  -                              new Long( getRemainingRepetitions() )
  -                           },
  -                           new String[] {
  -                              "".getClass().getName(),
  -                              "".getClass().getName(),
  -                              Date.class.getName(),
  -                              Long.TYPE.getName(),
  -                              Long.TYPE.getName()
  -                           }
  +                        mTimer,
  +                        "addNotification",
  +                        new Object[]
  +                        {
  +                           "Schedule",
  +                           "Scheduler Notification",
  +                           new Date( new Date().getTime() + 1000 ),
  +                           new Long( mActualSchedulePeriod ),
  +                           new Long( getRemainingRepetitions() )
  +                        },
  +                        new String[]
  +                        {
  +                           "".getClass().getName(),
  +                           "".getClass().getName(),
  +                           Date.class.getName(),
  +                           Long.TYPE.getName(),
  +                           Long.TYPE.getName()
  +                        }
                           ) ).intValue();
                        }
                     }
                  }
               }
  -            else {
  +            else
  +            {
                  // Schedule is stopped therefore remove the Schedule
                  getServer().invoke(
  -                  mTimer,
  -                  "removeNotification",
  -                  new Object[] {
  -                     new Integer( mActualSchedule )
  -                  },
  -                  new String[] {
  -                     Integer.TYPE.getName(),
  -                  }
  +               mTimer,
  +               "removeNotification",
  +               new Object[]
  +               {
  +                  new Integer( mActualSchedule )
  +               },
  +               new String[]
  +               {
  +                  Integer.TYPE.getName(),
  +               }
                  );
                  mActualSchedule = -1;
               }
            }
  -         catch( Exception e ) {
  +         catch( Exception e )
  +         {
               e.printStackTrace();
            }
         }
  @@ -696,24 +807,21 @@
         private String mName;
         private int mValue;
         
  -      public SchedulableExample(
  -         String pName,
  -         int pValue
  -      ) {
  +      public SchedulableExample(String pName, int pValue)
  +      {
            mName = pName;
            mValue = pValue;
         }
  -      
  +
         /**
          * Just log the call
          **/
  -      public void perform(
  -         Date pTimeOfCall,
  -         long pRemainingRepetitions
  -      ) {
  -         System.out.println( "Schedulable Examples is called at: " + pTimeOfCall +
  -            ", remaining repetitions: " + pRemainingRepetitions +
  -            ", test, name: " + mName + ", value: " + mValue );
  +      public void perform(Date pTimeOfCall,
  +         long pRemainingRepetitions)
  +      {
  +         System.out.println("Schedulable Examples is called at: " + pTimeOfCall +
  +         ", remaining repetitions: " + pRemainingRepetitions +
  +         ", test, name: " + mName + ", value: " + mValue );
         }
      }
   }
  
  
  
  1.9.4.1   +20 -27    jboss/src/main/org/jboss/util/Attic/ServiceControl.java
  
  Index: ServiceControl.java
  ===================================================================
  RCS file: /cvsroot/jboss/jboss/src/main/org/jboss/util/Attic/ServiceControl.java,v
  retrieving revision 1.9
  retrieving revision 1.9.4.1
  diff -u -r1.9 -r1.9.4.1
  --- ServiceControl.java       2001/04/13 19:06:59     1.9
  +++ ServiceControl.java       2001/11/20 09:42:57     1.9.4.1
  @@ -6,13 +6,13 @@
    */
   package org.jboss.util;
   
  -import java.io.*;
  -import java.net.*;
  -import java.util.*;
  -
  +import java.util.ArrayList;
  +import java.util.Iterator;
  +import java.util.List;
  +import java.util.ListIterator;
   import javax.management.*;
   
  -import org.jboss.logging.Log;
  +import org.jboss.logging.Logger;
   
   
   /** ServiceControl manages the JBoss services lifecycle.
  @@ -20,18 +20,17 @@
    *   @see org.jboss.util.Service
    *   @author Rickard �berg ([EMAIL PROTECTED])
    *   @author Hugo Pinto (mailto:[EMAIL PROTECTED])
  - *   @author [EMAIL PROTECTED]
  - *   @version $Revision: 1.9 $
  + *   @author [EMAIL PROTECTED]
  + *   @version $Revision: 1.9.4.1 $
    */
   public class ServiceControl
      implements ServiceControlMBean, MBeanRegistration
   {
      // Constants -----------------------------------------------------
      public static final String OBJECT_NAME = ":service=ServiceControl";
  +   static Logger log = Logger.getLogger(ServiceControl.class);
   
  -    
      // Attributes ----------------------------------------------------
  -   Log log = Log.createLog("Service Control");
      
      List mbeans = new ArrayList();
      // Static --------------------------------------------------------
  @@ -42,7 +41,7 @@
      public void init()
         throws Exception
      {
  -      log.log("Initializing "+mbeans.size()+" MBeans");
  +      log.info("Initializing "+mbeans.size()+" MBeans");
         
         List mbeansCopy = new ArrayList(mbeans);
         Iterator enum = mbeansCopy.iterator();
  @@ -57,17 +56,16 @@
            }
            catch(Throwable e)
            {
  -            log.error("Could not initialize "+service);
  -            log.exception(e);
  +            log.error("Could not initialize "+service, e);
            }
         }
  -      log.log("Initialized "+mbeansCopy.size()+" services");
  +      log.info("Initialized "+mbeansCopy.size()+" services");
      }
      
      public void start()
         throws Exception
      { 
  -      log.log("Starting "+mbeans.size()+" MBeans");
  +      log.info("Starting "+mbeans.size()+" MBeans");
         
         List mbeansCopy = new ArrayList(mbeans);
         Iterator enum = mbeansCopy.iterator();
  @@ -83,16 +81,15 @@
            }
            catch(Throwable e)
            {
  -            log.error("Could not start "+service);
  -            log.exception(e);
  +            log.error("Could not start "+service, e);
            }
         }
  -      log.log("Started "+mbeansCopy.size()+" services");
  +      log.info("Started "+mbeansCopy.size()+" services");
      }
      
      public void stop()
      {
  -      log.log("Stopping "+mbeans.size()+" MBeans");
  +      log.info("Stopping "+mbeans.size()+" MBeans");
         
         List mbeansCopy = new ArrayList(mbeans);
         ListIterator enum = mbeansCopy.listIterator();
  @@ -109,16 +106,15 @@
            }
            catch (Throwable e)
            {
  -            log.error("Could not stop "+service);           
  -            log.exception(e);
  +            log.error("Could not stop "+service, e);
            }
         }
  -      log.log("Stopped "+mbeansCopy.size()+" services");
  +      log.info("Stopped "+mbeansCopy.size()+" services");
      }
      
      public void destroy()
      {
  -      log.log("Destroying "+mbeans.size()+" MBeans");
  +      log.info("Destroying "+mbeans.size()+" MBeans");
         
         List mbeansCopy = new ArrayList(mbeans);
         ListIterator enum = mbeansCopy.listIterator();
  @@ -135,11 +131,10 @@
            }
            catch (Throwable e)
            {
  -            log.error("Could not destroy"+service);           
  -            log.exception(e);
  +            log.error("Could not destroy"+service, e);
            }
         }
  -      log.log("Destroyed "+mbeansCopy.size()+" services");
  +      log.info("Destroyed "+mbeansCopy.size()+" services");
      }
   
      public void register(Service service)
  @@ -172,5 +167,3 @@
      }
   
   }
  -
  -
  
  
  
  1.13.4.4  +46 -45    jboss/src/main/org/jboss/util/Attic/ServiceMBeanSupport.java
  
  Index: ServiceMBeanSupport.java
  ===================================================================
  RCS file: 
/cvsroot/jboss/jboss/src/main/org/jboss/util/Attic/ServiceMBeanSupport.java,v
  retrieving revision 1.13.4.3
  retrieving revision 1.13.4.4
  diff -u -r1.13.4.3 -r1.13.4.4
  --- ServiceMBeanSupport.java  2001/09/09 04:40:57     1.13.4.3
  +++ ServiceMBeanSupport.java  2001/11/20 09:42:57     1.13.4.4
  @@ -14,11 +14,8 @@
   import javax.management.MBeanServer;
   import javax.management.ObjectName;
   
  -import org.apache.log4j.Category;
  -   
  -import org.jboss.logging.Log;
  -import org.jboss.logging.LogToCategory;
  -import org.jboss.logging.log4j.JBossCategory;
  +import org.apache.log4j.NDC;
  +import org.jboss.logging.Logger;
   
   /** An abstract base class JBoss services can subclass to implement a
   service that conforms to the ServiceMBean interface. Subclasses must
  @@ -30,8 +27,8 @@
   @see org.jboss.util.ServiceMBean
   
   @author Rickard �berg ([EMAIL PROTECTED])
  -@author [EMAIL PROTECTED]
  -@version $Revision: 1.13.4.3 $
  +@author [EMAIL PROTECTED]
  +@version $Revision: 1.13.4.4 $
   */
   public abstract class ServiceMBeanSupport
      extends NotificationBroadcasterSupport
  @@ -39,18 +36,16 @@
   {
      // Attributes ----------------------------------------------------
      private int state;
  -   private MBeanServer server;
  +   protected MBeanServer server;
      private int id = 0;
  -   protected Log log;
  -   protected JBossCategory category;
  +   protected Logger log;
   
      // Static --------------------------------------------------------
   
      // Constructors --------------------------------------------------
      public ServiceMBeanSupport()
      {
  -      category = (JBossCategory) JBossCategory.getInstance(getClass());
  -      log = new LogToCategory(category);
  +      log = Logger.getLogger(getClass());
      }
   
   
  @@ -75,22 +70,22 @@
       public void init()
               throws Exception
       {
  -        category.info("Initializing");
  -        log.setLog(log);
  +        log.info("Initializing");
  +        NDC.push(getName());
           try
  -        {
  +        {   
              initService();
           } catch (Exception e)
           {
  -           category.error("Initialization failed", e);
  +           log.error("Initialization failed", e);
              throw e;
           } finally
           {
  -           log.unsetLog();
  +           NDC.pop();
           }
  -        category.info("Initialized");
  +        log.info("Initialized");
       }
  -     
  +
      public void start()
         throws Exception
      {
  @@ -98,30 +93,35 @@
                return;
                        
         state = STARTING;
  -       //AS It seems that the first attribute is not needed anymore and use a long 
instead of a Date
  -      sendNotification(new AttributeChangeNotification(this, id++, new 
Date().getTime(), getName()+" starting", "State", "java.lang.Integer", new 
Integer(STOPPED), new Integer(STARTING)));
  -      category.info("Starting");
  -      log.setLog(log);
  +      //AS It seems that the first attribute is not needed anymore and use a long 
instead of a Date
  +      sendNotification(new AttributeChangeNotification(this, id++, new 
Date().getTime(), getName()+" starting",
  +         "State", "java.lang.Integer", new Integer(STOPPED), new 
Integer(STARTING)));
  +      log.info("Starting");
  +      NDC.push(getName());
         try
         {
            startService();
  -      } catch (Exception e)
  +      }
  +      catch (Exception e)
         {
            state = STOPPED;
  -          //AS It seems that the first attribute is not needed anymore and use a 
long instead of a Date
  -         sendNotification(new AttributeChangeNotification(this, id++, new 
Date().getTime(), getName()+" stopped", "State", "java.lang.Integer", new 
Integer(STARTING), new Integer(STOPPED)));
  -         category.error("Stopped", e);
  +         //AS It seems that the first attribute is not needed anymore and use a 
long instead of a Date
  +         sendNotification(new AttributeChangeNotification(this, id++, new 
Date().getTime(), getName()+" stopped",
  +            "State", "java.lang.Integer", new Integer(STARTING), new 
Integer(STOPPED)));
  +         log.error("Stopped", e);
            throw e;
  -      } finally
  +      }
  +      finally
         {
  -         log.unsetLog();
  +         NDC.pop();
         }
         state = STARTED;
         //AS It seems that the first attribute is not needed anymore and use a long 
instead of a Date
  -      sendNotification(new AttributeChangeNotification(this, id++, new 
Date().getTime(), getName()+" started", "State", "java.lang.Integer", new 
Integer(STARTING), new Integer(STARTED)));
  -      category.info("Started");
  +      sendNotification(new AttributeChangeNotification(this, id++, new 
Date().getTime(), getName()+" started",
  +         "State", "java.lang.Integer", new Integer(STARTING), new 
Integer(STARTED)));
  +      log.info("Started");
      }
  -   
  +
       public void stop()
       {
           if (getState() != STARTED)
  @@ -130,41 +130,42 @@
         state = STOPPING;
         //AS It seems that the first attribute is not needed anymore and use a long 
instead of a Date
         sendNotification(new AttributeChangeNotification(this, id++, new 
Date().getTime(), getName()+" stopping", "State", "java.lang.Integer", new 
Integer(STARTED), new Integer(STOPPING)));
  -      category.info("Stopping");
  -      log.setLog(log);
  +      log.info("Stopping");
  +      NDC.push(getName());
         
         try
         {
            stopService();
         } catch (Throwable e)
         {
  -         category.error(e);
  +         log.error(e);
         }
         
         state = STOPPED;
         //AS It seems that the first attribute is not needed anymore and use a long 
instead of a Date
  -      sendNotification(new AttributeChangeNotification(this, id++, new 
Date().getTime(), getName()+" stopped", "State", "java.lang.Integer", new 
Integer(STOPPING), new Integer(STOPPED)));
  -      category.info("Stopped");
  -      log.unsetLog();
  +      sendNotification(new AttributeChangeNotification(this, id++, new 
Date().getTime(), getName()+" stopped",
  +         "State", "java.lang.Integer", new Integer(STOPPING), new 
Integer(STOPPED)));
  +      NDC.pop();
  +      log.info("Stopped");
      }
  -   
  +
      public void destroy()
      {
           if (getState() != STOPPED)
                   stop();
        
  -     category.info("Destroying");
  -     log.setLog(log);
  +     log.info("Destroying");
  +        NDC.push(getName());
        try
        {
           destroyService();
        } catch (Exception e)
        {
  -        category.error(e);
  +        log.error(e);
        }
        
  -     log.unsetLog();
  -     category.info("Destroyed");
  +     NDC.pop();
  +     log.info("Destroyed");
      }
        
      public ObjectName preRegister(MBeanServer server, ObjectName name)
  @@ -178,7 +179,7 @@
      public void postRegister(java.lang.Boolean registrationDone)
      {
         if (!registrationDone.booleanValue()) {
  -         category.info( "Registration is not done -> destroy" );
  +         log.info( "Registration is not done -> destroy" );
            destroy();
         }
      }
  
  
  
  1.2.6.1   +9 -9      jboss/src/main/org/jboss/util/Attic/Shutdown.java
  
  Index: Shutdown.java
  ===================================================================
  RCS file: /cvsroot/jboss/jboss/src/main/org/jboss/util/Attic/Shutdown.java,v
  retrieving revision 1.2
  retrieving revision 1.2.6.1
  diff -u -r1.2 -r1.2.6.1
  --- Shutdown.java     2000/12/07 18:16:14     1.2
  +++ Shutdown.java     2001/11/20 09:42:57     1.2.6.1
  @@ -12,14 +12,14 @@
   
   import javax.management.*;
   
  -import org.jboss.logging.Log;
  +import org.jboss.logging.Logger;
   
   /**
    *   <description> 
    *      
    *   @see <related>
    *   @author Rickard �berg ([EMAIL PROTECTED])
  - *   @version $Revision: 1.2 $
  + *   @version $Revision: 1.2.6.1 $
    */
   public class Shutdown
      implements MBeanRegistration, ShutdownMBean
  @@ -28,8 +28,8 @@
      public static final String OBJECT_NAME = ":type=Shutdown";
       
      // Attributes ----------------------------------------------------
  -   Log log = Log.createLog("Shutdown");
  -   
  +   static Logger log = Logger.getLogger(Shutdown.class);
  +
      List mbeans = new ArrayList();
      MBeanServer server;
      
  @@ -58,14 +58,14 @@
                  System.out.println("Shutdown complete");
               }
            });
  -         log.log("Shutdown hook added");
  +         log.info("Shutdown hook added");
         } catch (Throwable e)
         {
  -         log.error("Could not add shutdown hook");
  +         log.error("Could not add shutdown hook", e);
         }
         return name == null ? new ObjectName(OBJECT_NAME) : name;
      }
  -   
  +
      public void postRegister(java.lang.Boolean registrationDone)
      {
      }
  @@ -87,7 +87,7 @@
            server.invoke(new ObjectName(":service=ServiceControl"), "stop", new 
Object[0] , new String[0]);
         } catch (Exception e)
         {
  -         e.printStackTrace();
  +         log.error("stop of ServiceControl failed", e);
         }
   
         try
  @@ -96,7 +96,7 @@
            server.invoke(new ObjectName(":service=ServiceControl"), "destroy", new 
Object[0] , new String[0]);
         } catch (Exception e)
         {
  -         e.printStackTrace();
  +         log.error("destroy of ServiceControl failed", e);
         }
      }
   }
  
  
  
  1.1.6.1   +1 -3      jboss/src/main/org/jboss/util/XmlHelper.java
  
  Index: XmlHelper.java
  ===================================================================
  RCS file: /cvsroot/jboss/jboss/src/main/org/jboss/util/XmlHelper.java,v
  retrieving revision 1.1
  retrieving revision 1.1.6.1
  diff -u -r1.1 -r1.1.6.1
  --- XmlHelper.java    2001/03/07 09:46:54     1.1
  +++ XmlHelper.java    2001/11/20 09:42:57     1.1.6.1
  @@ -11,13 +11,11 @@
   
   import org.w3c.dom.*;
   
  -import org.jboss.logging.Log;
  -
   /**
    *   A utility class to cover up the rough bits of xml parsing
    *      
    *   @author Chris Kimpton ( [EMAIL PROTECTED] )
  - *   @version $Revision: 1.1 $
  + *   @version $Revision: 1.1.6.1 $
    */
   public class XmlHelper
   {
  
  
  

_______________________________________________
Jboss-development mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/jboss-development

Reply via email to