directory-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From akaras...@apache.org
Subject svn commit: r373125 - in /directory/trunks/apacheds/standalone/daemon/src/main/java/org/apache/directory/server/standalone/daemon: Bootstrapper.java MainBootstrapper.java ProcrunBootstrapper.java
Date Sat, 28 Jan 2006 10:39:05 GMT
Author: akarasulu
Date: Sat Jan 28 02:39:00 2006
New Revision: 373125

URL: http://svn.apache.org/viewcvs?rev=373125&view=rev
Log:
changes ...

 o fixed bug where application cl was not used for thread context caused 
   reflection to fail in JNDI 
 o removed all start, stop, init, destroy methods which now use callXxxxx 
   instead for the procrun, and the main bootstrappers


Modified:
    directory/trunks/apacheds/standalone/daemon/src/main/java/org/apache/directory/server/standalone/daemon/Bootstrapper.java
    directory/trunks/apacheds/standalone/daemon/src/main/java/org/apache/directory/server/standalone/daemon/MainBootstrapper.java
    directory/trunks/apacheds/standalone/daemon/src/main/java/org/apache/directory/server/standalone/daemon/ProcrunBootstrapper.java

Modified: directory/trunks/apacheds/standalone/daemon/src/main/java/org/apache/directory/server/standalone/daemon/Bootstrapper.java
URL: http://svn.apache.org/viewcvs/directory/trunks/apacheds/standalone/daemon/src/main/java/org/apache/directory/server/standalone/daemon/Bootstrapper.java?rev=373125&r1=373124&r2=373125&view=diff
==============================================================================
--- directory/trunks/apacheds/standalone/daemon/src/main/java/org/apache/directory/server/standalone/daemon/Bootstrapper.java
(original)
+++ directory/trunks/apacheds/standalone/daemon/src/main/java/org/apache/directory/server/standalone/daemon/Bootstrapper.java
Sat Jan 28 02:39:00 2006
@@ -149,6 +149,7 @@
     
     public void callStart()
     {
+        Thread.currentThread().setContextClassLoader( application );
         Method op = null;
         
         try
@@ -170,11 +171,14 @@
             log.error( "Failed on " + startObjectClass.getName() + ".start()", e );
             System.exit( ExitCodes.START );
         }
+        
+        Thread.currentThread().setContextClassLoader( parent );
     }
     
 
     public void callStop()
     {
+        Thread.currentThread().setContextClassLoader( application );
         Class clazz = null;
         Method op = null;
         
@@ -225,11 +229,14 @@
             log.error( "Failed on " + stopClassName + ".stop()", e );
             System.exit( ExitCodes.STOP );
         }
+        
+        Thread.currentThread().setContextClassLoader( parent );
     }
 
     
     public void callDestroy()
     {
+        Thread.currentThread().setContextClassLoader( application );
         Method op = null;
         try
         {
@@ -250,78 +257,7 @@
             log.error( "Failed on " + stopClassName + ".destroy()", e );
             System.exit( ExitCodes.STOP );
         }
-    }
-
-    
-    // -----------------------------------------------------------------------
-    
-    
-    public void init( String[] args )
-    {
-        if ( log.isDebugEnabled() )
-        {
-            StringBuffer buf = new StringBuffer();
-            buf.append( "init(String[]) called with args: \n" );
-            for ( int ii = 0; ii < args.length; ii++ )
-            {
-                buf.append( "\t" ).append( args[ii] ).append( "\n" );
-            }
-            log.debug( buf.toString() );
-        }
-
-        if ( layout == null )
-        {
-            log.debug( "install was null: initializing it using first argument" );
-            setInstallationLayout( args[0] );
-        }
-
-        if ( parent == null )
-        {
-            log.debug( "parent ClassLoader was null: initializing it" );
-            setParentLoader( Thread.currentThread().getContextClassLoader() );
-        }
         
-        callInit();
-
-        // This is only needed for procrun but does not harm jsvc or runs 
-        // Leads me to think that we need to differentiate somehow between
-        // different daemon frameworks.  We can do this via command line args,
-        // system properties or by making them call different methods to start
-        // the process.  However not every framework may support calling 
-        // different methods which may also be somewhat error prone.
-        
-        while( true )
-        {
-            try
-            {
-                Thread.sleep( 2000 );
-            }
-            catch ( InterruptedException e )
-            {
-                e.printStackTrace();
-            }
-        }
-    }
-    
-    
-    public void start()
-    {
-        log.debug( "start() called" );
         Thread.currentThread().setContextClassLoader( parent );
-        callStart();
-    }
-
-
-    public void stop() throws Exception
-    {
-        log.debug( "stop() called" );
-        callStop();
-    }
-
-
-    public void destroy()
-    {
-        log.debug( "destroy() called" );
-        callDestroy();
     }
 }

Modified: directory/trunks/apacheds/standalone/daemon/src/main/java/org/apache/directory/server/standalone/daemon/MainBootstrapper.java
URL: http://svn.apache.org/viewcvs/directory/trunks/apacheds/standalone/daemon/src/main/java/org/apache/directory/server/standalone/daemon/MainBootstrapper.java?rev=373125&r1=373124&r2=373125&view=diff
==============================================================================
--- directory/trunks/apacheds/standalone/daemon/src/main/java/org/apache/directory/server/standalone/daemon/MainBootstrapper.java
(original)
+++ directory/trunks/apacheds/standalone/daemon/src/main/java/org/apache/directory/server/standalone/daemon/MainBootstrapper.java
Sat Jan 28 02:39:00 2006
@@ -73,17 +73,18 @@
         {
             if ( command.equalsIgnoreCase( "start" ) )
             {
-                log.debug( "calling init(String[]) from main(String[])" );
-                instance.init( args );
+                log.debug( "calling callInit(String[]) from main(String[])" );
+                instance.callInit();
 
-                log.debug( "calling start() from main(String[])" );
-                instance.start();
+                log.debug( "calling callStart() from main(String[])" );
+                instance.callStart();
             }
             else if ( command.equalsIgnoreCase( "stop" ) )
             {
-                log.debug( "calling stop() from main(String[])" );
-                instance.stop();
-                instance.destroy();
+                log.debug( "calling callStop() from main(String[])" );
+                instance.callStop();
+                log.debug( "calling callDestroy() from main(String[])" );
+                instance.callDestroy();
             }
             else
             {
@@ -96,7 +97,7 @@
         {
             log.error( "Encountered error while processing command: " + command );
             t.printStackTrace();
-            System.exit( 4 );
+            System.exit( ExitCodes.UNKNOWN );
         }
     }
 

Modified: directory/trunks/apacheds/standalone/daemon/src/main/java/org/apache/directory/server/standalone/daemon/ProcrunBootstrapper.java
URL: http://svn.apache.org/viewcvs/directory/trunks/apacheds/standalone/daemon/src/main/java/org/apache/directory/server/standalone/daemon/ProcrunBootstrapper.java?rev=373125&r1=373124&r2=373125&view=diff
==============================================================================
--- directory/trunks/apacheds/standalone/daemon/src/main/java/org/apache/directory/server/standalone/daemon/ProcrunBootstrapper.java
(original)
+++ directory/trunks/apacheds/standalone/daemon/src/main/java/org/apache/directory/server/standalone/daemon/ProcrunBootstrapper.java
Sat Jan 28 02:39:00 2006
@@ -58,11 +58,24 @@
             instance.setInstallationLayout( args[0] );
             instance.setParentLoader( Bootstrapper.class.getClassLoader() );
 
-            log.debug( "prunsrvStart(String[]) calling init(String[])" );
-            instance.init( args );
+            log.debug( "prunsrvStart(String[]) calling callInit()" );
+            instance.callInit();
 
-            log.debug( "prunsrvStart(String[]) calling start()" );
-            instance.start();
+            log.debug( "prunsrvStart(String[]) calling callStart()" );
+            instance.callStart();
+
+            // This is only needed for procrun 
+            while( true )
+            {
+                try
+                {
+                    Thread.sleep( 2000 );
+                }
+                catch ( InterruptedException e )
+                {
+                    e.printStackTrace();
+                }
+            }
         }
         catch ( Throwable t )
         {
@@ -91,10 +104,10 @@
             instance.setInstallationLayout( args[0] );
             instance.setParentLoader( Bootstrapper.class.getClassLoader() );
 
-            log.debug( "prunsrvStop(String[]) calling stop()" );
-            instance.stop();
-            log.debug( "prunsrvStop(String[]) calling destroy()" );
-            instance.destroy();
+            log.debug( "prunsrvStop(String[]) calling callStop()" );
+            instance.callStop();
+            log.debug( "prunsrvStop(String[]) calling callDestroy()" );
+            instance.callDestroy();
         }
         catch ( Throwable t )
         {



Mime
View raw message