cvs commit: jakarta-tomcat-connectors/jk/java/org/apache/jk/apr AprImpl.java

2005-03-24 Thread remm
remm2005/03/24 07:31:16

  Modified:jk/java/org/apache/jk/common ChannelSocket.java
ChannelJni.java
   jk/java/org/apache/jk/server JkCoyoteHandler.java
   jk/java/org/apache/jk/apr AprImpl.java
  Log:
  - Fix messages.
  
  Revision  ChangesPath
  1.53  +4 -4  
jakarta-tomcat-connectors/jk/java/org/apache/jk/common/ChannelSocket.java
  
  Index: ChannelSocket.java
  ===
  RCS file: 
/home/cvs/jakarta-tomcat-connectors/jk/java/org/apache/jk/common/ChannelSocket.java,v
  retrieving revision 1.52
  retrieving revision 1.53
  diff -u -r1.52 -r1.53
  --- ChannelSocket.java29 Jan 2005 19:29:55 -  1.52
  +++ ChannelSocket.java24 Mar 2005 15:31:16 -  1.53
  @@ -59,7 +59,7 @@
   */
   
   /**
  - *  Jk2 can use multiple protocols/transports.
  + *  Jk can use multiple protocols/transports.
*  Various container adapters should load this object ( as a bean ),
*  set configurations and use it. Note that the connector will handle
*  all incoming protocols - it's not specific to ajp1x. The protocol
  @@ -70,7 +70,7 @@
   /** Accept ( and send ) TCP messages.
*
* @author Costin Manolache
  - * @jmx:mbean name=jk2:service=ChannelSocket
  + * @jmx:mbean name=jk:service=ChannelSocket
*description=Accept socket connections
* @jmx:notification name=org.apache.coyote.INVOKE
* @jmx:notification-handler name=org.apache.jk.JK_SEND_PACKET
  @@ -336,7 +336,7 @@
   if (startPort == 0) {
   port = 0;
   if(log.isInfoEnabled())
  -log.info(JK2: ajp13 disabling channelSocket);
  +log.info(JK: ajp13 disabling channelSocket);
   running = true;
   return;
   }
  @@ -363,7 +363,7 @@
   return;
   }
   if(log.isInfoEnabled())
  -log.info(JK2: ajp13 listening on  + getAddress() + : + port 
);
  +log.info(JK: ajp13 listening on  + getAddress() + : + port );
   
   // If this is not the base port and we are the 'main' channleSocket 
and
   // SHM didn't already set the localId - we'll set the instance id
  
  
  
  1.19  +1 -1  
jakarta-tomcat-connectors/jk/java/org/apache/jk/common/ChannelJni.java
  
  Index: ChannelJni.java
  ===
  RCS file: 
/home/cvs/jakarta-tomcat-connectors/jk/java/org/apache/jk/common/ChannelJni.java,v
  retrieving revision 1.18
  retrieving revision 1.19
  diff -u -r1.18 -r1.19
  --- ChannelJni.java   15 Oct 2004 04:42:25 -  1.18
  +++ ChannelJni.java   24 Mar 2005 15:31:16 -  1.19
  @@ -43,7 +43,7 @@
   
   // We'll be called from C. This deals with that.
   apr.addJkHandler( channelJni, this );
  -log.info(JK2: listening on channel.jni:jni );
  +log.info(JK: listening on channel.jni:jni );
   
   if( next==null ) {
   if( nextName!=null ) 
  
  
  
  1.60  +1 -1  
jakarta-tomcat-connectors/jk/java/org/apache/jk/server/JkCoyoteHandler.java
  
  Index: JkCoyoteHandler.java
  ===
  RCS file: 
/home/cvs/jakarta-tomcat-connectors/jk/java/org/apache/jk/server/JkCoyoteHandler.java,v
  retrieving revision 1.59
  retrieving revision 1.60
  diff -u -r1.59 -r1.60
  --- JkCoyoteHandler.java  3 Feb 2005 03:36:57 -   1.59
  +++ JkCoyoteHandler.java  24 Mar 2005 15:31:16 -  1.60
  @@ -53,7 +53,7 @@
   import org.apache.tomcat.util.http.MimeHeaders;
   import org.apache.tomcat.util.net.SSLSupport;
   
  -/** Plugs Jk2 into Coyote. Must be named type=JkHandler,name=container
  +/** Plugs Jk into Coyote. Must be named type=JkHandler,name=container
*
* @jmx:notification-handler name=org.apache.jk.SEND_PACKET
* @jmx:notification-handler name=org.apache.coyote.ACTION_COMMIT
  
  
  
  1.32  +1 -1  
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.31
  retrieving revision 1.32
  diff -u -r1.31 -r1.32
  --- AprImpl.java  31 May 2004 04:48:54 -  1.31
  +++ AprImpl.java  24 Mar 2005 15:31:16 -  1.32
  @@ -207,7 +207,7 @@
   initialize();
   jkSetAttribute(0, 0, channel:jni, starting);
   
  -log.info(JK2: Initialized apr );
  +log.info(JK: Initialized apr );
   
   } catch( Throwable t ) {
   throw new IOException( t.toString() );
  
  
  

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For 

cvs commit: jakarta-tomcat-connectors/jk/java/org/apache/jk/apr AprImpl.java

2002-09-19 Thread mturk

mturk   2002/09/18 23:26:17

  Modified:jk/java/org/apache/jk/apr AprImpl.java
  Log:
  Add LogFactory to the class. This will prevent starting in case of error
  in the classloader code.
  
  Revision  ChangesPath
  1.26  +3 -0  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.25
  retrieving revision 1.26
  diff -u -r1.25 -r1.26
  --- AprImpl.java  14 Jul 2002 13:30:04 -  1.25
  +++ AprImpl.java  19 Sep 2002 06:26:17 -  1.26
  @@ -244,6 +244,7 @@
   
   initialize();
   jkSetAttribute(0, 0, channel:jni, starting);
  +log.info(JK2: Initialized apr );
   } catch( Throwable t ) {
   throw new IOException( t.getMessage() );
   }
  @@ -336,4 +337,6 @@
   ex.printStackTrace();
   }
   }
  +private static org.apache.commons.logging.Log log=
  +org.apache.commons.logging.LogFactory.getLog( AprImpl.class );
   }
  
  
  

--
To unsubscribe, e-mail:   mailto:[EMAIL PROTECTED]
For additional commands, e-mail: mailto:[EMAIL PROTECTED]




cvs commit: jakarta-tomcat-connectors/jk/java/org/apache/jk/apr AprImpl.java

2002-07-14 Thread mturk

mturk   2002/07/14 06:30:04

  Modified:jk/java/org/apache/jk/apr AprImpl.java
  Log:
  Added Apache Software License prolog
  
  Revision  ChangesPath
  1.25  +60 -1 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.24
  retrieving revision 1.25
  diff -u -r1.24 -r1.25
  --- AprImpl.java  1 Jul 2002 23:12:33 -   1.24
  +++ AprImpl.java  14 Jul 2002 13:30:04 -  1.25
  @@ -1,4 +1,63 @@
  -package org.apache.jk.apr;
  +/*
  + * 
  + *
  + * The Apache Software License, Version 1.1
  + *
  + * Copyright (c) 1999 The Apache Software Foundation.  All rights
  + * reserved.
  + *
  + * Redistribution and use in source and binary forms, with or without
  + * modification, are permitted provided that the following conditions
  + * are met:
  + *
  + * 1. Redistributions of source code must retain the above copyright
  + *notice, this list of conditions and the following disclaimer.
  + *
  + * 2. Redistributions in binary form must reproduce the above copyright
  + *notice, this list of conditions and the following disclaimer in
  + *the documentation and/or other materials provided with the
  + *distribution.
  + *
  + * 3. The end-user documentation included with the redistribution, if
  + *any, must include the following acknowlegement:
  + *   This product includes software developed by the
  + *Apache Software Foundation (http://www.apache.org/).
  + *Alternately, this acknowlegement may appear in the software itself,
  + *if and wherever such third-party acknowlegements normally appear.
  + *
  + * 4. The names The Jakarta Project, Tomcat, and Apache Software
  + *Foundation must not be used to endorse or promote products derived
  + *from this software without prior written permission. For written
  + *permission, please contact [EMAIL PROTECTED]
  + *
  + * 5. Products derived from this software may not be called Apache
  + *nor may Apache appear in their names without prior written
  + *permission of the Apache Group.
  + *
  + * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
  + * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
  + * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
  + * DISCLAIMED.  IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
  + * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
  + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
  + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
  + * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
  + * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
  + * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
  + * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
  + * SUCH DAMAGE.
  + * 
  + *
  + * This software consists of voluntary contributions made by many
  + * individuals on behalf of the Apache Software Foundation.  For more
  + * information on the Apache Software Foundation, please see
  + * http://www.apache.org/.
  + *
  + * [Additional notices, if required by prior licensing conditions]
  + *
  + */
  + 
  + package org.apache.jk.apr;
   
   import java.io.*;
   import java.lang.reflect.*;
  
  
  

--
To unsubscribe, e-mail:   mailto:[EMAIL PROTECTED]
For additional commands, e-mail: mailto:[EMAIL PROTECTED]




cvs commit: jakarta-tomcat-connectors/jk/java/org/apache/jk/apr AprImpl.java

2002-06-30 Thread mturk

mturk   2002/06/30 02:59:02

  Modified:jk/java/org/apache/jk/apr AprImpl.java
  Log:
  Removed the jkStatus native call.
  Use the jkSetAttribute for TC startup signaling.
  
  Revision  ChangesPath
  1.23  +1 -11 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.22
  retrieving revision 1.23
  diff -u -r1.22 -r1.23
  --- AprImpl.java  29 Jun 2002 07:43:24 -  1.22
  +++ AprImpl.java  30 Jun 2002 09:59:02 -  1.23
  @@ -119,9 +119,6 @@
*/
   public native void jkRecycle(long xEnv, long endpointP);
   
  -/* Send a TC status code to the server */
  -public static native void jkStatus(int code);
  -
   //  Called from C 
   // XXX Check security, add guard or other protection
   // It's better to do it the other way - on init 'push' AprImpl into
  @@ -166,6 +163,7 @@
   loadNative();
   
   initialize();
  +jkSetAttribute(0, 0, channel:jni, starting);
   } catch( Throwable t ) {
   throw new IOException( t.getMessage() );
   }
  @@ -183,14 +181,6 @@
   jniMode=true;
   }
   
  -public static void jniStatus(int code) throws IOException {
  -try {
  -jkStatus( code);
  -} catch( Throwable t) {   
  -throw new IOException( t.getMessage() );
  -}
  -}
  -
   /** This method of loading the libs doesn't require setting
*   LD_LIBRARY_PATH. Assuming a 'right' binary distribution,
*   or a correct build all files will be in their right place.
  
  
  

--
To unsubscribe, e-mail:   mailto:[EMAIL PROTECTED]
For additional commands, e-mail: mailto:[EMAIL PROTECTED]




cvs commit: jakarta-tomcat-connectors/jk/java/org/apache/jk/apr AprImpl.java

2002-06-29 Thread mturk

mturk   2002/06/29 00:43:24

  Modified:jk/java/org/apache/jk/apr AprImpl.java
  Log:
  Introduced new native function jkStatus that signals the
  TC startup status to the server for now.
  
  Revision  ChangesPath
  1.22  +9 -0  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.21
  retrieving revision 1.22
  diff -u -r1.21 -r1.22
  --- AprImpl.java  11 Jun 2002 22:48:46 -  1.21
  +++ AprImpl.java  29 Jun 2002 07:43:24 -  1.22
  @@ -119,6 +119,8 @@
*/
   public native void jkRecycle(long xEnv, long endpointP);
   
  +/* Send a TC status code to the server */
  +public static native void jkStatus(int code);
   
   //  Called from C 
   // XXX Check security, add guard or other protection
  @@ -181,6 +183,13 @@
   jniMode=true;
   }
   
  +public static void jniStatus(int code) throws IOException {
  +try {
  +jkStatus( code);
  +} catch( Throwable t) {   
  +throw new IOException( t.getMessage() );
  +}
  +}
   
   /** This method of loading the libs doesn't require setting
*   LD_LIBRARY_PATH. Assuming a 'right' binary distribution,
  
  
  

--
To unsubscribe, e-mail:   mailto:[EMAIL PROTECTED]
For additional commands, e-mail: mailto:[EMAIL PROTECTED]




cvs commit: jakarta-tomcat-connectors/jk/java/org/apache/jk/apr AprImpl.java

2002-06-10 Thread costin

costin  2002/06/10 14:26:25

  Modified:jk/java/org/apache/jk/apr AprImpl.java
  Log:
  Patch from Mladen Turk, to use RegisterNative.
  
  I changed it to make 'inprocess' the default ( better than null ).
  
  Revision  ChangesPath
  1.20  +5 -2  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.19
  retrieving revision 1.20
  diff -u -r1.19 -r1.20
  --- AprImpl.java  1 Jun 2002 08:29:34 -   1.19
  +++ AprImpl.java  10 Jun 2002 21:26:25 -  1.20
  @@ -22,7 +22,7 @@
   Hashtable jkHandlers=new Hashtable();
   
   // Name of the so used in inprocess mode 
  -String jniModeSo;
  +String jniModeSo=inprocess;
   // name of the so used by java. If not set we'll loadLibrary(jkjni ),
   // if set we load( nativeSo )
   String nativeSo;
  @@ -58,7 +58,6 @@
   /** Name of the so used in inprocess mode
*/
   public void setJniModeSo(String jniModeSo ) {
  -System.out.println(XXX native so  + jniModeSo);
   this.jniModeSo=jniModeSo;
   }
   
  @@ -204,6 +203,10 @@
  This seems the cleanest solution that works with multiple
  VMs.
   */
  +if (jniModeSo.equals(inprocess)) {
  +ok=true;
  +return;
  +}
   try {
   System.out.println(Loading  + jniModeSo);
   if( jniModeSo!= null ) System.load( jniModeSo );
  
  
  

--
To unsubscribe, e-mail:   mailto:[EMAIL PROTECTED]
For additional commands, e-mail: mailto:[EMAIL PROTECTED]




cvs commit: jakarta-tomcat-connectors/jk/java/org/apache/jk/apr AprImpl.java AprInputStream.java AprOutputStream.java AprSocketServer.java

2002-05-31 Thread costin

costin  2002/05/31 19:50:11

  Modified:jk/java/org/apache/jk/apr AprImpl.java
  Removed: jk/java/org/apache/jk/apr AprInputStream.java
AprOutputStream.java AprSocketServer.java
  Log:
  Remove deprecated stuff.
  
  We use a single method for crossing so we can optimize the buffer
  allocation - JNI is very slow if you're not carefull.
  
  Revision  ChangesPath
  1.18  +0 -31 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.17
  retrieving revision 1.18
  diff -u -r1.17 -r1.18
  --- AprImpl.java  28 May 2002 22:50:04 -  1.17
  +++ AprImpl.java  1 Jun 2002 02:50:11 -   1.18
  @@ -76,37 +76,6 @@
   
   public native int terminate();
   
  -//  Unix sockets 
  -
  -// @deprecated. We'll use the same invocation path as for the jni channel
  -
  -public native long unSocketClose( long socket, int type );
  -
  -/** Create a unix socket and start listening. 
  - *  @param file the name of the socket
  - *  @param bl backlog
  - */
  -public native long unSocketListen( String file, int bl );
  -
  -/** Create a unix socket and connect. 
  - *  @param file the name of the socket
  - *  @param bl backlog
  - */
  -public native long unSocketConnect( String file );
  -
  -/** Accept a connection.
  - */
  -public native long unAccept(  long unListeningSocket );
  -
  -public native int unRead(  long unSocket,
  -   byte buf[], int off, int len );
  -
  -public native int unWrite(  long unSocket,
  -byte buf[], int off, int len );
  -
  -//   Interface to jk components 
  -// 
  -
   /*  Access to the jk_env_t  */
   
   /* The jk_env_t provide temporary storage ( pool ), logging, common services
  
  
  

--
To unsubscribe, e-mail:   mailto:[EMAIL PROTECTED]
For additional commands, e-mail: mailto:[EMAIL PROTECTED]




cvs commit: jakarta-tomcat-connectors/jk/java/org/apache/jk/apr AprImpl.java

2002-05-26 Thread costin

costin  02/05/26 00:13:02

  Modified:jk/java/org/apache/jk/apr AprImpl.java
  Log:
  - removed the mutex code, the normal invocation mechanism will be used ( i.e.
  the ajp 'bridge' ).
  
  - cleanup a bit the unix socket, preparing for the removal ( again the same
  mechanism will be used - I don't want to do the direct buffer and optimizations
  in 2 places )
  
  - added some of the methods that were missing. Note that signal is not complete,
  I want ( again ) to use the same code for java-C invocation.
  
  Based on the various tests I made so far and what I've seen in other systems,
  'straight' use of JNI is not a good solution ( look at Mozilla and all other
  projects that integrate java with C applications ). There are some fine
  optimizations that can be made in JDK1.4, and some other that would
  work in 1.3 - but it's easier to code the critical code in few methods
  ( the 2 methods that call java from C and C from java ).
  
  Revision  ChangesPath
  1.16  +48 -33jakarta-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.15
  retrieving revision 1.16
  diff -u -r1.15 -r1.16
  --- AprImpl.java  22 May 2002 23:50:02 -  1.15
  +++ AprImpl.java  26 May 2002 07:13:02 -  1.16
  @@ -58,6 +58,7 @@
   /** Name of the so used in inprocess mode
*/
   public void setJniModeSo(String jniModeSo ) {
  +System.out.println(XXX native so  + jniModeSo);
   this.jniModeSo=jniModeSo;
   }
   
  @@ -75,55 +76,42 @@
   
   public native int terminate();
   
  -public native long poolCreate(long parentPool);
  +//  Unix sockets 
   
  -public native long poolClear(long pool);
  +// @deprecated. We'll use the same invocation path as for the jni channel
   
  -//  Unix sockets 
  -// XXX Will be 'apr sockets' as soon as APR supports unix domain sockets.
  -// For the moment there is little benefit of using APR TCP sockets, since
  -// the VM abstraction is decent. However poll and other advanced features
  -// are not available - and will be usefull. For the next release.
  -
  -public native long unSocketClose( long pool, long socket, int type );
  +public native long unSocketClose( long socket, int type );
   
   /** Create a unix socket and start listening. 
*  @param file the name of the socket
*  @param bl backlog
*/
  -public native long unSocketListen( long pool, String file, int bl );
  +public native long unSocketListen( String file, int bl );
   
   /** Create a unix socket and connect. 
*  @param file the name of the socket
*  @param bl backlog
*/
  -public native long unSocketConnect( long pool, String file );
  +public native long unSocketConnect( String file );
   
   /** Accept a connection.
*/
  -public native long unAccept( long pool, long unListeningSocket );
  +public native long unAccept(  long unListeningSocket );
   
  -public native int unRead( long pool, long unSocket,
  -byte buf[], int off, int len );
  +public native int unRead(  long unSocket,
  +   byte buf[], int off, int len );
   
  -public native int unWrite( long pool, long unSocket,
  +public native int unWrite(  long unSocket,
   byte buf[], int off, int len );
   
  -//  Mutexes 
  -
  -public native long mutexCreate( long pool, String file, int type );
  -
  -public native long mutexLock( long pool, long mutexP );
  -
  -public native long mutexUnLock( long pool, long mutexP );
  -
  -public native long mutexTryLock( long pool, long mutexP );
  -
  -public native long mutexDestroy( long pool, long mutexP );
  -
   //   Interface to jk components 
   // 
   
  +/*  Access to the jk_env_t  */
  +
  +/* The jk_env_t provide temporary storage ( pool ), logging, common services
  + */
  +
   /* Return a jk_env_t, used to keep the execution context ( temp pool, etc )
*/
   public native long getJkEnv();
  @@ -132,8 +120,11 @@
*/
   public native void releaseJkEnv(long xEnv);
   
  -public native void jkRecycle(long xEnv, long endpointP);
  -
  +/*  Interface to the jk_bean object  */
  +/* Each jk component is 'wrapped' as a bean, with a specified lifecycle
  + *
  + */
  +
   /** Get a native component
*  @return 0 if the component is not 

cvs commit: jakarta-tomcat-connectors/jk/java/org/apache/jk/apr AprImpl.java

2002-05-22 Thread costin

costin  02/05/22 16:50:03

  Modified:jk/java/org/apache/jk/apr AprImpl.java
  Log:
  Remove the hardcoded path, make it configurable. Still have to test it.
  
  Revision  ChangesPath
  1.15  +29 -3 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.14
  retrieving revision 1.15
  diff -u -r1.14 -r1.15
  --- AprImpl.java  9 May 2002 00:12:00 -   1.14
  +++ AprImpl.java  22 May 2002 23:50:02 -  1.15
  @@ -21,6 +21,12 @@
   // Handlers for native callbacks
   Hashtable jkHandlers=new Hashtable();
   
  +// Name of the so used in inprocess mode 
  +String jniModeSo;
  +// name of the so used by java. If not set we'll loadLibrary(jkjni ),
  +// if set we load( nativeSo )
  +String nativeSo;
  +
   public AprImpl() {
   aprSingleton=this;
   }
  @@ -49,6 +55,19 @@
   jkHandlers.put( type, cb );
   }
   
  +/** Name of the so used in inprocess mode
  + */
  +public void setJniModeSo(String jniModeSo ) {
  +this.jniModeSo=jniModeSo;
  +}
  +
  +/** name of the so used by java. If not set we'll loadLibrary(jkjni ),
  +if set we load( nativeSo )
  +*/
  +public void setNativeSo( String nativeSo ) {
  +this.nativeSo=nativeSo;
  +}
  +
   //  Apr generic utils 
   /** Initialize APR
*/
  @@ -190,10 +209,12 @@
   }
   
   static boolean jniMode=false;
  +
   
   public static void jniMode() {
   jniMode=true;
   }
  +
   
   /** This method of loading the libs doesn't require setting
*   LD_LIBRARY_PATH. Assuming a 'right' binary distribution,
  @@ -217,8 +238,8 @@
  VMs.
   */
   try {
  -System.out.println(Loading mod_jk.so);
  -System.load( /opt/apache2/modules/mod_jk2.so );
  +System.out.println(Loading  + jniModeSo);
  +System.load( jniModeSo );
   } catch( Throwable ex ) {
   // ignore
   ex.printStackTrace();
  @@ -246,7 +267,12 @@
 }
   */
   try {
  -System.loadLibrary( jkjni );
  +if( nativeSo == null ) {
  +// This will load libjkjni.so or jkjni.dll in LD_LIBRARY_PATH
  +System.loadLibrary( jkjni );
  +} else {
  +System.load( nativeSo );
  +}
   } catch( Throwable ex ) {
   ok=false;
   throw ex;
  
  
  

--
To unsubscribe, e-mail:   mailto:[EMAIL PROTECTED]
For additional commands, e-mail: mailto:[EMAIL PROTECTED]




cvs commit: jakarta-tomcat-connectors/jk/java/org/apache/jk/apr AprImpl.java

2002-05-06 Thread costin

costin  02/05/06 15:53:18

  Modified:jk/java/org/apache/jk/apr AprImpl.java
  Log:
  Added a flag to indicate if we are loaded from jni.
  
  Use mod_jk.so ( which includes all the functions we need, including the jni
  stuff ) if in-process. ( XXX need to make this configurable or try to
  detect IIS - when Nacho gets IIS working with JNI we can fix it ).
  
  JNI code is used for in-process worker and also for unix socket and
  to register tomcat.
  
  I also removed the load() for apr, there is no way to make this work
  in JDK1.4 unless we compile jkjni with -lapr -lcrypt.
  
  Tested jkjni with all VMs I have ( except 1.1 - this is not supported with 1.1),
  seesm to work fine with all.
  
  Revision  ChangesPath
  1.13  +46 -20jakarta-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.12
  retrieving revision 1.13
  diff -u -r1.12 -r1.13
  --- AprImpl.java  25 Apr 2002 18:17:24 -  1.12
  +++ AprImpl.java  6 May 2002 22:53:18 -   1.13
  @@ -17,7 +17,7 @@
   String aprHome;
   String soExt=so;
   
  -boolean ok=true;
  +static boolean ok=true;
   // Handlers for native callbacks
   Hashtable jkHandlers=new Hashtable();
   
  @@ -209,6 +209,12 @@
   public boolean isLoaded() {
   return ok;
   }
  +
  +static boolean jniMode=false;
  +
  +public static void jniMode() {
  +jniMode=true;
  +}
   
   /** This method of loading the libs doesn't require setting
*   LD_LIBRARY_PATH. Assuming a 'right' binary distribution,
  @@ -224,29 +230,49 @@
   public void loadNative() throws Throwable {
   if( aprHome==null )
   aprHome=baseDir;
  -if( aprHome==null ) {
  -// Use load()
  +
  +// XXX Update for windows
  +if( jniMode ) {
  +/* In JNI mode we use mod_jk for the native functions.
  +   This seems the cleanest solution that works with multiple
  +   VMs.
  +*/
   try {
  -System.loadLibrary( apr );
  -System.loadLibrary( jkjni );
  +System.out.println(Loading mod_jk.so);
  +System.load( /opt/apache2/modules/mod_jk2.so );
   } catch( Throwable ex ) {
  -ok=false;
  -throw ex;
  +// ignore
  +ex.printStackTrace();
  +return;
   }
  -} else {
  -File dir=new File(aprHome);
  -// XXX platform independent, etc...
  -File apr=new File( dir, libapr. + soExt );
  -
  -loadNative( apr.getAbsolutePath() );
  -
  -dir=new File(baseDir);
  -File jniConnect=new File( dir, jni_connect. + soExt );
  -
  -loadNative( jniConnect.getAbsolutePath() );
  +ok=true;
  +return;
   }
  -}
  -
  +
  +/*
  +  jkjni _must_ be linked with apr and crypt -
  +  this seem the only ( decent ) way to support JDK1.4 and
  +  JDK1.3 at the same time
  +  try {
  +  System.loadLibrary( crypt );
  +  } catch( Throwable ex ) {
  +  // ignore
  +  ex.printStackTrace();
  +  }
  +  try {
  +  System.loadLibrary( apr );
  +  } catch( Throwable ex ) {
  +  System.out.println(can't load apr, that's fine);
  +  ex.printStackTrace();
  +  }
  +*/
  +try {
  +System.loadLibrary( jkjni );
  +} catch( Throwable ex ) {
  +ok=false;
  +throw ex;
  +}
  +} 
   
   public void loadNative(String libPath) {
   try {
  
  
  

--
To unsubscribe, e-mail:   mailto:[EMAIL PROTECTED]
For additional commands, e-mail: mailto:[EMAIL PROTECTED]




cvs commit: jakarta-tomcat-connectors/jk/java/org/apache/jk/apr AprImpl.java

2002-04-25 Thread costin

costin  02/04/25 11:17:24

  Modified:jk/java/org/apache/jk/apr AprImpl.java
  Log:
  Added a couple of methods to expose the jk objects.
  
  Instead of duplicating the code to work with the shm and unix channel ( in
  a jk 'component' and in the jni wrapper/java code ) we just use the
  same code.
  
  This also greatly simplifies the native code - and makes use of the optimizations
  used in the jni channel ( to avoid expensive string conversions and object
  creation ). It also minimizes the ammount of jni 'crossings' ( each JNI invocation
  has a significang performance hit ).
  
  In addition the same code can be used for in-process and out-of process,
  and for ajp14
  
  Revision  ChangesPath
  1.12  +27 -6 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.11
  retrieving revision 1.12
  diff -u -r1.11 -r1.12
  --- AprImpl.java  18 Apr 2002 22:59:20 -  1.11
  +++ AprImpl.java  25 Apr 2002 18:17:24 -  1.12
  @@ -123,16 +123,37 @@
   
   public native long mutexDestroy( long pool, long mutexP );
   
  -//   java to C 
  +//   Interface to jk components 
  +// 
  +
  +/* Return a jk_env_t, used to keep the execution context ( temp pool, etc )
  + */
  +public native long getJkEnv();
  +
  +/** Clean the temp pool, put back the env in the pool
  + */
  +public native void releaseJkEnv(long xEnv);
  +
  +public native void jkRecycle(long xEnv, long endpointP);
  +
  +/** Get a native component
  + *  @return 0 if the component is not found.
  + */
  +public native long getJkHandler(long xEnv, String compName );
  +
  +public native long createJkHandler(long xEnv, String compName );
  +
  +/** Get the id of a method.
  + *  @return -1 if the method is not found.
  + */
  +public native int jkGetId(long xEnv, String ns, String name );
   
  -// Temp - interface will evolve
  -
   /** Send the packet to the C side. On return it contains the response
*  or indication there is no response. Asymetrical because we can't
*  do things like continuations.
*/
  -public static native int sendPacket(long xEnv, long endpointP,
  -byte data[], int len);
  +public static native int jkInvoke(long xEnv, long componentP, long endpointP,
  +  int code, byte data[], int len);
   
   
   //  Called from C 
  @@ -177,7 +198,7 @@
   public void init() throws IOException {
   try {
   loadNative();
  -
  +
   initialize();
   } catch( Throwable t ) {
   throw new IOException( t.getMessage() );
  
  
  

--
To unsubscribe, e-mail:   mailto:[EMAIL PROTECTED]
For additional commands, e-mail: mailto:[EMAIL PROTECTED]




cvs commit: jakarta-tomcat-connectors/jk/java/org/apache/jk/apr AprImpl.java

2002-04-18 Thread costin

costin  02/04/18 10:42:26

  Modified:jk/java/org/apache/jk/apr AprImpl.java
  Log:
  Removed the startup hack.
  
  Added a property to check if apr is loaded.
  
  Revision  ChangesPath
  1.10  +6 -75 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.9
  retrieving revision 1.10
  diff -u -r1.9 -r1.10
  --- AprImpl.java  18 Apr 2002 00:14:34 -  1.9
  +++ AprImpl.java  18 Apr 2002 17:42:26 -  1.10
  @@ -155,11 +155,15 @@
   
   initialize();
   } catch( Throwable t ) {
  -log.error(Native code not initialized, disabling UnixSocket and JNI 
channels:  + t.toString());
  -return;
  +throw new IOException( t.getMessage() );
   }
  +ok=true;
   }
   
  +public boolean isLoaded() {
  +return ok;
  +}
  +
   /** This method of loading the libs doesn't require setting
*   LD_LIBRARY_PATH. Assuming a 'right' binary distribution,
*   or a correct build all files will be in their right place.
  @@ -206,77 +210,4 @@
   ex.printStackTrace();
   }
   }
  -
  -// Hack for Catalina who hungs the calling thread.
  -public static void main( String args[] ) {
  -System.err.println(Main);
  -try {
  -// Find the class
  -Class c=null;
  -int i=0;
  -
  -for( i=0; iargs.length; i++ ) {
  -String classN=args[i];
  -if( -.equals( classN ) ) {
  -// end of options.
  -break;
  -}
  -if( c!=null ) continue;
  -try {
  -System.err.println(Try  + classN);
  -c=Class.forName( classN );
  -} catch( ClassNotFoundException ex  ) {
  -continue;
  -}
  -}
  -
  -i++;
  -if( c==null ) {
  -System.err.println(No class found );
  -return;
  -}
  -
  -if( args.length = i ) {
  -String newArgs[]=new String[ args.length - i  ];
  -System.out.println(Replacing args:  + i +   + args.length);
  -for( int j=0; jnewArgs.length; j++ ) {
  -newArgs[j]=args[i+j];
  -System.out.println(ARG:  + newArgs[j]);
  -}
  -args=newArgs;
  -} else {
  -System.out.println(No extra args:  + i +   + args.length);
  -args=new String[0];
  -}
  -
  -System.err.println(Starting);
  -Thread startThread=new Thread( new TomcatStartThread(c, args));
  -startThread.start();
  -} catch (Throwable t ) {
  -t.printStackTrace(System.err);
  -}
  -}
  -
  -static class TomcatStartThread implements Runnable {
  -Class c;
  -String args[];
  -TomcatStartThread( Class c, String args[] ) {
  -this.c=c;
  -this.args=args;
  -}
  -
  -public void run() {
  -try {
  -Class argClass=args.getClass();
  -Method m=c.getMethod( main, new Class[] {argClass} );
  -m.invoke( c, new Object[] { args } );
  -} catch( Throwable t ) {
  -t.printStackTrace(System.err);
  -}
  -}
  -}
  -
  -private static org.apache.commons.logging.Log log=
  -org.apache.commons.logging.LogFactory.getLog( AprImpl.class );
  -
   }
  
  
  

--
To unsubscribe, e-mail:   mailto:[EMAIL PROTECTED]
For additional commands, e-mail: mailto:[EMAIL PROTECTED]




cvs commit: jakarta-tomcat-connectors/jk/java/org/apache/jk/apr AprImpl.java

2002-04-17 Thread costin

costin  02/04/17 15:43:58

  Modified:jk/java/org/apache/jk/apr AprImpl.java
  Log:
  Added shm native calls.
  
  Cleanup the interfaces - now use the normal JkHandler interface for
  configuration.
  
  AprImpl must be loaded in the main classloader, with common-logging and
  jk.core in order to get JNI-channel to work ( that will be fixed later, it is
  also possible to get around the class loaders by pushing the objects via
  native calles instead of loading them with FindClass )
  ( normal jni will work anyway ).
  
  For callbacks we use normal JkHandler and MsgContext - it
  coresponds to an apache hook and behaves in a similar way. ( ok, the
  concept is identical to a Valve for 4.0 people, with an Action for Remy,
  and close enough to an Interceptor for 3.3 people ).
  
  Revision  ChangesPath
  1.8   +109 -85   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.7
  retrieving revision 1.8
  diff -u -r1.7 -r1.8
  --- AprImpl.java  16 Apr 2002 00:21:37 -  1.7
  +++ AprImpl.java  17 Apr 2002 22:43:58 -  1.8
  @@ -2,23 +2,53 @@
   
   import java.io.*;
   import java.util.*;
  +import org.apache.jk.core.*;
   
   /** 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
*  java.net.Socket for unix-domain sockets, etc. 
* 
*/
  -public class AprImpl {
  -static AprImpl aprSingleton=new AprImpl();
  +public class AprImpl extends JkHandler { // This will be 
o.a.t.util.handler.TcHandler - lifecycle and config
  +static AprImpl aprSingleton=null;
   
   String baseDir;
   String aprHome;
   String soExt=so;
   
  -public static AprImpl getAprImpl() {
  -return aprSingleton;
  +boolean ok=true;
  +// Handlers for native callbacks
  +Hashtable jkHandlers=new Hashtable();
  +
  +public AprImpl() {
  +aprSingleton=this;
  +}
  +
  +//  Properties 
  +
  +/** Native libraries are located based on base dir.
  + *  XXX Add platform, version, etc
  + */
  +public void setBaseDir(String s) {
  +baseDir=s;
  +}
  +
  +public void setSoExt(String s ) {
  +soExt=s;
   }
   
  +// XXX maybe install the jni lib in apr-home ?
  +public void setAprHome( String s ) {
  +aprHome=s;
  +}
  +
  +/** Add a Handler for jni callbacks.
  + */
  +public void addJkHandler(String type, JkHandler cb) {
  +jkHandlers.put( type, cb );
  +}
  +
  +//  Apr generic utils 
   /** Initialize APR
*/
   public native int initialize();
  @@ -29,6 +59,12 @@
   
   public native long poolClear(long pool);
   
  +//  Unix sockets 
  +// XXX Will be 'apr sockets' as soon as APR supports unix domain sockets.
  +// For the moment there is little benefit of using APR TCP sockets, since
  +// the VM abstraction is decent. However poll and other advanced features
  +// are not available - and will be usefull. For the next release.
  +
   public native long unSocketClose( long pool, long socket, int type );
   
   /** Create a unix socket and start listening. 
  @@ -53,22 +89,76 @@
   public native int unWrite( long pool, long unSocket,
   byte buf[], int off, int len );
   
  -/** Native libraries are located based on base dir.
  - *  XXX Add platform, version, etc
  +//  Shared memory methods 
  +
  +public native long shmAttach( long pool, String file );
  +
  +public native long shmDetach( long pool, long shmP );
  +
  +public native long shmDestroy( long pool, long shmP );
  +
  +//   java to C 
  +
  +// Temp - interface will evolve
  +
  +/** Send the packet to the C side. On return it contains the response
  + *  or indication there is no response. Asymetrical because we can't
  + *  do things like continuations.
*/
  -public void setBaseDir(String s) {
  -baseDir=s;
  -}
  +public static native int sendPacket(long xEnv, long endpointP,
  +byte data[], int len);
  +
   
  -public void setSoExt(String s ) {
  -soExt=s;
  -}
  +//  Called from C 
  +// XXX Check security, add guard or other protection
  +// It's better to do it the other way - on init 'push' AprImpl into
  +// the native library, and have native code call instance 

cvs commit: jakarta-tomcat-connectors/jk/java/org/apache/jk/apr AprImpl.java

2002-04-17 Thread costin

costin  02/04/17 17:14:34

  Modified:jk/java/org/apache/jk/apr AprImpl.java
  Log:
  The quick hack I mentioned in the previous commit.
  
  Now both 3.3 and 4.1 ( and I suppose 4.0 didn't changed since yesterday ) are
  working with all 3 channels.
  
  ( httpd -X for jni channel please - shm is not yet ready :-)
  
  That doesn't mean everything is fine - requests are forwarded but the
  response is 'no context' in 4.1 ( even if the standalone is working fine ).
  Still investigating.
  
  Revision  ChangesPath
  1.9   +70 -0 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.8
  retrieving revision 1.9
  diff -u -r1.8 -r1.9
  --- AprImpl.java  17 Apr 2002 22:43:58 -  1.8
  +++ AprImpl.java  18 Apr 2002 00:14:34 -  1.9
  @@ -1,6 +1,7 @@
   package org.apache.jk.apr;
   
   import java.io.*;
  +import java.lang.reflect.*;
   import java.util.*;
   import org.apache.jk.core.*;
   
  @@ -206,6 +207,75 @@
   }
   }
   
  +// Hack for Catalina who hungs the calling thread.
  +public static void main( String args[] ) {
  +System.err.println(Main);
  +try {
  +// Find the class
  +Class c=null;
  +int i=0;
  +
  +for( i=0; iargs.length; i++ ) {
  +String classN=args[i];
  +if( -.equals( classN ) ) {
  +// end of options.
  +break;
  +}
  +if( c!=null ) continue;
  +try {
  +System.err.println(Try  + classN);
  +c=Class.forName( classN );
  +} catch( ClassNotFoundException ex  ) {
  +continue;
  +}
  +}
  +
  +i++;
  +if( c==null ) {
  +System.err.println(No class found );
  +return;
  +}
  +
  +if( args.length = i ) {
  +String newArgs[]=new String[ args.length - i  ];
  +System.out.println(Replacing args:  + i +   + args.length);
  +for( int j=0; jnewArgs.length; j++ ) {
  +newArgs[j]=args[i+j];
  +System.out.println(ARG:  + newArgs[j]);
  +}
  +args=newArgs;
  +} else {
  +System.out.println(No extra args:  + i +   + args.length);
  +args=new String[0];
  +}
  +
  +System.err.println(Starting);
  +Thread startThread=new Thread( new TomcatStartThread(c, args));
  +startThread.start();
  +} catch (Throwable t ) {
  +t.printStackTrace(System.err);
  +}
  +}
  +
  +static class TomcatStartThread implements Runnable {
  +Class c;
  +String args[];
  +TomcatStartThread( Class c, String args[] ) {
  +this.c=c;
  +this.args=args;
  +}
  +
  +public void run() {
  +try {
  +Class argClass=args.getClass();
  +Method m=c.getMethod( main, new Class[] {argClass} );
  +m.invoke( c, new Object[] { args } );
  +} catch( Throwable t ) {
  +t.printStackTrace(System.err);
  +}
  +}
  +}
  +
   private static org.apache.commons.logging.Log log=
   org.apache.commons.logging.LogFactory.getLog( AprImpl.class );
   
  
  
  

--
To unsubscribe, e-mail:   mailto:[EMAIL PROTECTED]
For additional commands, e-mail: mailto:[EMAIL PROTECTED]




cvs commit: jakarta-tomcat-connectors/jk/java/org/apache/jk/apr AprImpl.java

2002-04-15 Thread costin

costin  02/04/15 17:01:33

  Modified:jk/java/org/apache/jk/apr AprImpl.java
  Log:
  Added a more efficient interface to deal with callbacks from C to java
  ( code from channel_jni ).
  
  The idea is to avoid allocations and unneeded calls. I'll also try to
  add some experimental #ifdefed code to use pinning - that would eliminate
  the memcpy.
  
  Eventually this will be used for the unix channel and other callbacks from
  APR to java ( signals, etc ).
  
  Revision  ChangesPath
  1.6   +74 -0 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.5
  retrieving revision 1.6
  diff -u -r1.5 -r1.6
  --- AprImpl.java  11 Apr 2002 05:46:51 -  1.5
  +++ AprImpl.java  16 Apr 2002 00:01:33 -  1.6
  @@ -1,6 +1,7 @@
   package org.apache.jk.apr;
   
   import java.io.*;
  +import java.util.*;
   
   /** 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
  @@ -8,9 +9,15 @@
* 
*/
   public class AprImpl {
  +static AprImpl aprSingleton=new AprImpl();
  +
   String baseDir;
   String aprHome;
   String soExt=so;
  +
  +public static AprImpl getAprImpl() {
  +return aprSingleton;
  +}
   
   /** Initialize APR
*/
  @@ -109,6 +116,73 @@
   ex.printStackTrace();
   }
   }
  +
  +// Mostly experimental, the interfaces need to be cleaned up - after everything 
works
   
  +Hashtable jniContextFactories=new Hashtable();
  +
  +public void addJniContextFactory(String type, JniContextFactory cb) {
  +jniContextFactories.put( type, cb );
  +}
  +
  +public static interface JniContext {
  +
  +/** Each context contains a number of byte[] buffers used for communication.
  + *  The C side will contain a char * equivalent - both buffers are 
long-lived
  + *  and recycled.
  + *
  + *  This will be called at init time. A long-lived global reference to the 
byte[]
  + *  will be stored in the C context.
  + */
  +public byte[] getBuffer(  int id );
  +
  +
  +/** Invoke a java hook. The xEnv is the representation of the current 
execution
  + *  environment ( the jni_env_t * )
  + */
  +public int jniInvoke(  long xEnv );
  +}
  +
  +public static interface JniContextFactory {
  +
  +/** Create a Jni context - it is the corespondent of a C context, 
represented
  + *by a pointer
  + *
  + *  The 'context' is a long-lived object ( recycled ) that manages state for
  + *  each jk operation.
  + */
  +public JniContext createJniContext( String type, long cContext );
  +}
  +
   
  +//  Called from C 
  +
  +public static Object createJavaContext(String type, long cContext) {
  +JniContextFactory 
cb=(JniContextFactory)AprImpl.getAprImpl().jniContextFactories.get( type );
  +if( cb==null ) return null;
  +
  +return cb.createJniContext( type, cContext );
  +}
  +
  +/** Return a buffer associated with the ctx.
  + */
  +public static byte[] getBuffer( Object ctx, int id ) {
  +return ((JniContext)ctx).getBuffer(  id );
  +}
  +
  +public static int jniInvoke( long jContext, Object ctx ) {
  +return ((JniContext)ctx).jniInvoke(  jContext );
  +   }
  +
  +//   java to C 
  +
  +// Temp - interface will evolve
  +
  +/** Send the packet to the C side. On return it contains the response
  + *  or indication there is no response. Asymetrical because we can't
  + *  do things like continuations.
  + */
  +public static native int sendPacket(long xEnv, long endpointP,
  +byte data[], int len);
  +
   }
  
  
  

--
To unsubscribe, e-mail:   mailto:[EMAIL PROTECTED]
For additional commands, e-mail: mailto:[EMAIL PROTECTED]




cvs commit: jakarta-tomcat-connectors/jk/java/org/apache/jk/apr AprImpl.java

2002-01-11 Thread costin

costin  02/01/11 20:01:47

  Modified:jk/java/org/apache/jk/apr AprImpl.java
  Log:
  Few more enhancements. Load libapr.so ( yes, I know - it works only on Unix
  at this moment, .so is hardcoded and few other things ). This is
  required to get it working without having to set LD_LIBRARY_PATH.
  
  Also use the base dir to locate the library - the idea is that we can assume
  a 'fixed' layout ( or a set of layouts ).
  
  Revision  ChangesPath
  1.3   +48 -11jakarta-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.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- AprImpl.java  6 Jan 2002 08:40:44 -   1.2
  +++ AprImpl.java  12 Jan 2002 04:01:47 -  1.3
  @@ -1,12 +1,16 @@
   package org.apache.jk.apr;
   
  +import java.io.*;
  +
   /** 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
*  java.net.Socket for unix-domain sockets, etc. 
* 
*/
   public class AprImpl {
  -
  +String baseDir;
  +String aprHome;
  +
   /** Initialize APR
*/
   public native int initialize();
  @@ -41,18 +45,51 @@
   public native int unWrite( long pool, long unSocket,
   byte buf[], int off, int len );
   
  +/** Native libraries are located based on base dir.
  + *  XXX Add platform, version, etc
  + */
  +public void setBaseDir(String s) {
  +baseDir=s;
  +}
  +
  +// XXX maybe install the jni lib in apr-home ?
  +public void setAprHome( String s ) {
  +aprHome=s;
  +}
  +
  +/** This method of loading the libs doesn't require setting
  + *   LD_LIBRARY_PATH. Assuming a 'right' binary distribution,
  + *   or a correct build all files will be in their right place.
  + *
  + *  The burden is on our code to deal with platform specific
  + *  extensions and to keep the paths consistent - not easy, but
  + *  worth it if it avoids one extra step for the user.
  + *
  + *  Of course, this can change to System.load() and putting the
  + *  libs in LD_LIBRARY_PATH.
  + */
  +public void loadNative() {
  +if( aprHome==null )
  +aprHome=baseDir;
  +File dir=new File(aprHome);
  +// XXX platform independent, etc...
  +File apr=new File( dir, libapr.so);
  +
  +loadNative( apr.getAbsolutePath() );
  +
  +dir=new File(baseDir);
  +File jniConnect=new File( dir, jni_connect.so);
  +
  +loadNative( jniConnect.getAbsolutePath() );
  +}
  +
  +boolean ok=true;
  +
   public void loadNative(String libPath) {
   try {
  -if( libPath==null )
  -libPath=jni_connect;
  -// XXX use load() for full path
  -if( libPath.indexOf( / ) =0 ||
  -libPath.indexOf( \\ ) =0 ) {
  -System.load( libPath );
  -} else {
  -System.loadLibrary( libPath );
  -}
  -} catch( RuntimeException ex ) {
  +System.load( libPath );
  +} catch( Throwable ex ) {
  +ok=false;
   ex.printStackTrace();
   }
   }
  
  
  

--
To unsubscribe, e-mail:   mailto:[EMAIL PROTECTED]
For additional commands, e-mail: mailto:[EMAIL PROTECTED]




cvs commit: jakarta-tomcat-connectors/jk/java/org/apache/jk/apr AprImpl.java

2002-01-06 Thread costin

costin  02/01/06 00:40:44

  Modified:jk/java/org/apache/jk/apr AprImpl.java
  Log:
  Added unix socket native methods. ( JFC already commited another impl, and it
  seems better - so I'll probably replace mine )
  
  Revision  ChangesPath
  1.2   +46 -9 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.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- AprImpl.java  31 Dec 2001 19:04:59 -  1.1
  +++ AprImpl.java  6 Jan 2002 08:40:44 -   1.2
  @@ -7,18 +7,55 @@
*/
   public class AprImpl {
   
  -private native void initApr();
  -
  -private void loadNative() {
  +/** Initialize APR
  + */
  +public native int initialize();
   
  +public native int terminate();
   
  -}
  +public native long poolCreate(long parentPool);
  +
  +public native long poolClear(long pool);
  +
  +public native long unSocketClose( long pool, long socket, int type );
  +
  +/** Create a unix socket and start listening. 
  + *  @param file the name of the socket
  + *  @param bl backlog
  + */
  +public native long unSocketListen( long pool, String file, int bl );
   
  -/** Temp - testing only, will be moved to separate file
  +/** Create a unix socket and connect. 
  + *  @param file the name of the socket
  + *  @param bl backlog
*/
  -public void main(String args[] ) {
  -
  -}
  -
  +public native long unSocketConnect( long pool, String file );
   
  +/** Accept a connection.
  + */
  +public native long unAccept( long pool, long unListeningSocket );
  +
  +public native int unRead( long pool, long unSocket,
  +byte buf[], int off, int len );
  +
  +public native int unWrite( long pool, long unSocket,
  +byte buf[], int off, int len );
  +
  +public void loadNative(String libPath) {
  +try {
  +if( libPath==null )
  +libPath=jni_connect;
  +// XXX use load() for full path
  +if( libPath.indexOf( / ) =0 ||
  +libPath.indexOf( \\ ) =0 ) {
  +System.load( libPath );
  +} else {
  +System.loadLibrary( libPath );
  +}
  +} catch( RuntimeException ex ) {
  +ex.printStackTrace();
  +}
  +}
  +
  +
   }
  
  
  

--
To unsubscribe, e-mail:   mailto:[EMAIL PROTECTED]
For additional commands, e-mail: mailto:[EMAIL PROTECTED]




cvs commit: jakarta-tomcat-connectors/jk/java/org/apache/jk/apr AprImpl.java

2001-12-31 Thread costin

costin  01/12/31 11:04:59

  Added:   jk/java/org/apache/jk/apr AprImpl.java
  Log:
  Nothing inside yet, just the skeleton. This will have the native
  methods coresponding to the JNI code, needed to implement pipes,
  signals, etc.
  
  Revision  ChangesPath
  1.1  jakarta-tomcat-connectors/jk/java/org/apache/jk/apr/AprImpl.java
  
  Index: AprImpl.java
  ===
  package org.apache.jk.apr;
  
  /** 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
   *  java.net.Socket for unix-domain sockets, etc. 
   * 
   */
  public class AprImpl {
  
  private native void initApr();
  
  private void loadNative() {
  
  
  }
  
  /** Temp - testing only, will be moved to separate file
   */
  public void main(String args[] ) {
  
  }
  
  
  }
  
  
  

--
To unsubscribe, e-mail:   mailto:[EMAIL PROTECTED]
For additional commands, e-mail: mailto:[EMAIL PROTECTED]