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 2002/01/06 09:40:44 UTC

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

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  Changes    Path
  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 -0000	1.1
  +++ AprImpl.java	6 Jan 2002 08:40:44 -0000	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:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>