You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tomcat.apache.org by co...@apache.org on 2003/04/11 22:23:46 UTC
cvs commit: jakarta-tomcat-connectors/jk/java/org/apache/jk/apr AprImpl.java
costin 2003/04/11 13:23:46
Modified: jk/java/org/apache/jk/apr AprImpl.java
Log:
Make sure init is called, better messages.
Revision Changes Path
1.27 +23 -7 jakarta-tomcat-connectors/jk/java/org/apache/jk/apr/AprImpl.java
Index: AprImpl.java
===================================================================
RCS file: /home/cvs/jakarta-tomcat-connectors/jk/java/org/apache/jk/apr/AprImpl.java,v
retrieving revision 1.26
retrieving revision 1.27
diff -u -r1.26 -r1.27
--- AprImpl.java 19 Sep 2002 06:26:17 -0000 1.26
+++ AprImpl.java 11 Apr 2003 20:23:45 -0000 1.27
@@ -59,10 +59,12 @@
package org.apache.jk.apr;
-import java.io.*;
-import java.lang.reflect.*;
-import java.util.*;
-import org.apache.jk.core.*;
+import java.io.FileOutputStream;
+import java.io.IOException;
+import java.io.PrintStream;
+import java.util.Hashtable;
+import org.apache.jk.core.JkHandler;
+import org.apache.jk.core.MsgContext;
/** Implements the interface with the APR library. This is for internal-use
* only. The goal is to use 'natural' mappings for user code - for example
@@ -77,6 +79,7 @@
String soExt="so";
static boolean ok=true;
+ boolean initialized=false;
// Handlers for native callbacks
Hashtable jkHandlers=new Hashtable();
@@ -240,18 +243,28 @@
public void init() throws IOException {
try {
+ initialized=true;
loadNative();
initialize();
jkSetAttribute(0, 0, "channel:jni", "starting");
+
log.info("JK2: Initialized apr" );
+
} catch( Throwable t ) {
- throw new IOException( t.getMessage() );
+ throw new IOException( t.toString() );
}
ok=true;
}
public boolean isLoaded() {
+ if( ! initialized ) {
+ try {
+ init();
+ } catch( Throwable t ) {
+ log.info("Apr not loaded: " + t);
+ }
+ }
return ok;
}
@@ -288,7 +301,7 @@
return;
}
try {
- System.out.println("Loading " + jniModeSo);
+ log.info("Loading " + jniModeSo);
if( jniModeSo!= null ) System.load( jniModeSo );
} catch( Throwable ex ) {
// ignore
@@ -319,12 +332,14 @@
try {
if( nativeSo == null ) {
// This will load libjkjni.so or jkjni.dll in LD_LIBRARY_PATH
+ log.debug("Loading jkjni from " + System.getProperty("java.library.path"));
System.loadLibrary( "jkjni" );
} else {
System.load( nativeSo );
}
} catch( Throwable ex ) {
ok=false;
+ ex.printStackTrace();
throw ex;
}
}
@@ -334,7 +349,8 @@
System.load( libPath );
} catch( Throwable ex ) {
ok=false;
- ex.printStackTrace();
+ if( log.isDebugEnabled() )
+ log.debug( "Error loading native library ", ex.printStackTrace());
}
}
private static org.apache.commons.logging.Log log=
---------------------------------------------------------------------
To unsubscribe, e-mail: tomcat-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tomcat-dev-help@jakarta.apache.org