cvs commit: jakarta-tomcat-connectors/jk/java/org/apache/jk/common ChannelUn.java

2004-03-21 Thread billbarker
billbarker2004/03/21 16:42:13

  Modified:jk/java/org/apache/jk/common ChannelUn.java
  Log:
  Fix thread unregistration.
  
  Revision  ChangesPath
  1.27  +2 -0  
jakarta-tomcat-connectors/jk/java/org/apache/jk/common/ChannelUn.java
  
  Index: ChannelUn.java
  ===
  RCS file: 
/home/cvs/jakarta-tomcat-connectors/jk/java/org/apache/jk/common/ChannelUn.java,v
  retrieving revision 1.26
  retrieving revision 1.27
  diff -u -r1.26 -r1.27
  --- ChannelUn.java24 Feb 2004 08:48:42 -  1.26
  +++ ChannelUn.java22 Mar 2004 00:42:13 -  1.27
  @@ -248,6 +248,8 @@
   MsgAjp endM = new MsgAjp();
   endM.reset();
   endM.appendByte((byte)HANDLE_THREAD_END);
  +endM.end();
  +endM.processHeader();
   next.invoke(endM, ep);
   } catch( Exception ee) {
   log.error( Error, releasing connection,ee);
  
  
  

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



cvs commit: jakarta-tomcat-connectors/jk/java/org/apache/jk/common ChannelUn.java

2004-01-16 Thread billbarker
billbarker2004/01/16 21:19:28

  Modified:jk/java/org/apache/jk/common ChannelUn.java
  Log:
  Handle unregistering Requests for ChannelUnix.
  
  This is an easy one, since it works like ChannelSocket.
  
  Revision  ChangesPath
  1.25  +8 -0  
jakarta-tomcat-connectors/jk/java/org/apache/jk/common/ChannelUn.java
  
  Index: ChannelUn.java
  ===
  RCS file: 
/home/cvs/jakarta-tomcat-connectors/jk/java/org/apache/jk/common/ChannelUn.java,v
  retrieving revision 1.24
  retrieving revision 1.25
  diff -u -r1.24 -r1.25
  --- ChannelUn.java18 Sep 2003 16:21:00 -  1.24
  +++ ChannelUn.java17 Jan 2004 05:19:28 -  1.25
  @@ -287,6 +287,14 @@
   }
   if( log.isDebugEnabled() )
   log.debug( Closing un channel);
  +try{
  +MsgAjp endM = new MsgAjp();
  +endM.reset();
  +endM.appendByte((byte)HANDLE_THREAD_END);
  +next.invoke(endM, ep);
  +} catch( Exception ee) {
  +log.error( Error, releasing connection,ee);
  +}
   this.close( ep );
   } catch( Exception ex ) {
   ex.printStackTrace();
  
  
  

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



Re: cvs commit: jakarta-tomcat-connectors/jk/java/org/apache/jk/common ChannelUn.java

2004-01-16 Thread Bill Barker

- Original Message - 
From: [EMAIL PROTECTED]
To: [EMAIL PROTECTED]
Sent: Friday, January 16, 2004 9:19 PM
Subject: cvs commit: jakarta-tomcat-connectors/jk/java/org/apache/jk/common
ChannelUn.java


 billbarker2004/01/16 21:19:28

   Modified:jk/java/org/apache/jk/common ChannelUn.java
   Log:
   Handle unregistering Requests for ChannelUnix.

   This is an easy one, since it works like ChannelSocket.

   Revision  ChangesPath
   1.25  +8 -0
jakarta-tomcat-connectors/jk/java/org/apache/jk/common/ChannelUn.java


I could use some help to fix ChannelJni (Costin/Mladen ?).  In this case,
the threads die in the native code, so I have no way to get notified in the
Java code (short of adding a 'finalize' method, which is just too hideous to
think about :).


This message is intended only for the use of the person(s) listed above as the 
intended recipient(s), and may contain information that is PRIVILEGED and 
CONFIDENTIAL.  If you are not an intended recipient, you may not read, copy, or 
distribute this message or any attachment. If you received this communication in 
error, please notify us immediately by e-mail and then delete all copies of this 
message and any attachments.

In addition you should be aware that ordinary (unencrypted) e-mail sent through the 
Internet is not secure. Do not send confidential or sensitive information, such as 
social security numbers, account numbers, personal identification numbers and 
passwords, to us via ordinary (unencrypted) e-mail.

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

cvs commit: jakarta-tomcat-connectors/jk/java/org/apache/jk/common ChannelUn.java

2002-05-28 Thread remm

remm02/05/28 19:17:40

  Modified:jk/java/org/apache/jk/common ChannelUn.java
  Log:
  - Remove errors and stack traces (users file bugs otherwise).
  - IMO, the default configuration should not produce any stack trace.
  
  Revision  ChangesPath
  1.20  +3 -2  
jakarta-tomcat-connectors/jk/java/org/apache/jk/common/ChannelUn.java
  
  Index: ChannelUn.java
  ===
  RCS file: 
/home/cvs/jakarta-tomcat-connectors/jk/java/org/apache/jk/common/ChannelUn.java,v
  retrieving revision 1.19
  retrieving revision 1.20
  diff -u -r1.19 -r1.20
  --- ChannelUn.java28 May 2002 22:50:04 -  1.19
  +++ ChannelUn.java29 May 2002 02:17:40 -  1.20
  @@ -103,8 +103,9 @@
   
   public void init() throws IOException {
   if( file==null ) {
  -log.error(No file, disabling unix channel);
  -throw new IOException( No file for the unix socket channel);
  +log.info(No file, disabling unix channel);
  +return;
  +//throw new IOException( No file for the unix socket channel);
   }
   if( wEnv.getLocalId() != 0 ) {
   file=file+ wEnv.getLocalId();
  
  
  

--
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/common ChannelUn.java JniHandler.java

2002-05-26 Thread costin

costin  02/05/26 00:13:59

  Modified:jk/java/org/apache/jk/common ChannelUn.java JniHandler.java
  Log:
  Update the unix socket channel.
  
  Make sure the endpoint is initialized ( thanks Nacho )
  
  Revision  ChangesPath
  1.18  +6 -9  
jakarta-tomcat-connectors/jk/java/org/apache/jk/common/ChannelUn.java
  
  Index: ChannelUn.java
  ===
  RCS file: 
/home/cvs/jakarta-tomcat-connectors/jk/java/org/apache/jk/common/ChannelUn.java,v
  retrieving revision 1.17
  retrieving revision 1.18
  diff -u -r1.17 -r1.18
  --- ChannelUn.java25 Apr 2002 23:13:24 -  1.17
  +++ ChannelUn.java26 May 2002 07:13:59 -  1.18
  @@ -113,10 +113,9 @@
   int isNote=2;
   int osNote=3;
   AprImpl apr;
  -long gPool;
   
   public void accept( MsgContext ep ) throws IOException {
  -long l= apr.unAccept(gPool, unixListenSocket);
  +long l= apr.unAccept(unixListenSocket);
   /* We could create a real java.net.Socket, or a UnixSocket, etc
*/
   ep.setNote( socketNote, new Long( l ) );
  @@ -150,8 +149,6 @@
   }
   
   tp=new ThreadPool();
  -if( log.isDebugEnabled() ) log.debug( Creating pool  + gPool );
  -gPool=apr.poolCreate( 0 );
   
   File socketFile=new File( file );
   if( socketFile.exists() ) {
  @@ -159,7 +156,7 @@
   if (!socketFile.delete())
 throw(new IOException(Cannot remove  + file));
   }
  -unixListenSocket=apr.unSocketListen( gPool, file, 10 );
  +unixListenSocket=apr.unSocketListen( file, 10 );
   if (unixListenSocket0)
   throw(new IOException(Cannot create listening socket  + file));
   
  @@ -178,7 +175,7 @@
   public void close(MsgContext ep) throws IOException {
   if( apr==null ) return;
   Long s=(Long)ep.getNote( socketNote );
  -apr.unSocketClose(gPool, s.longValue(),3);
  +apr.unSocketClose(s.longValue(),3);
   }
   
   public void destroy() throws IOException {
  @@ -188,7 +185,7 @@
   tp.shutdown();
   
   if(apr !=null ) 
  -apr.unSocketClose(gPool, unixListenSocket,3);
  +apr.unSocketClose( unixListenSocket,3);
   } catch(Exception e) {
   e.printStackTrace();
   }
  @@ -205,7 +202,7 @@
   
   Long s=(Long)ep.getNote( socketNote );
   
  -apr.unWrite( gPool, s.longValue(), buf, 0, len );
  +apr.unWrite(  s.longValue(), buf, 0, len );
   return len;
   }
   
  @@ -285,7 +282,7 @@
   int got;
   
   while(pos  len) {
  -got=apr.unRead( gPool, s.longValue(),
  +got=apr.unRead( s.longValue(),
   b, pos + offset, len - pos);
   
   if (log.isDebugEnabled()) {
  
  
  
  1.5   +1 -0  
jakarta-tomcat-connectors/jk/java/org/apache/jk/common/JniHandler.java
  
  Index: JniHandler.java
  ===
  RCS file: 
/home/cvs/jakarta-tomcat-connectors/jk/java/org/apache/jk/common/JniHandler.java,v
  retrieving revision 1.4
  retrieving revision 1.5
  diff -u -r1.4 -r1.5
  --- JniHandler.java   9 May 2002 23:46:33 -   1.4
  +++ JniHandler.java   26 May 2002 07:13:59 -  1.5
  @@ -173,6 +173,7 @@
   msgCtx.setJniEnv( xEnv );
   
   long epP=apr.createJkHandler(xEnv, endpoint);
  +apr.jkInit( xEnv, epP );
   msgCtx.setJniContext( epP );
   
   }
  
  
  

--
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/common ChannelUn.java

2002-04-25 Thread costin

costin  02/04/25 11:24:18

  Modified:jk/java/org/apache/jk/common ChannelUn.java
  Log:
  Add checks - if jni/apr is not available, nothing will happen at shutdown
  ( since nothing happened at startup )
  
  Revision  ChangesPath
  1.15  +5 -3  
jakarta-tomcat-connectors/jk/java/org/apache/jk/common/ChannelUn.java
  
  Index: ChannelUn.java
  ===
  RCS file: 
/home/cvs/jakarta-tomcat-connectors/jk/java/org/apache/jk/common/ChannelUn.java,v
  retrieving revision 1.14
  retrieving revision 1.15
  diff -u -r1.14 -r1.15
  --- ChannelUn.java18 Apr 2002 19:12:36 -  1.14
  +++ ChannelUn.java25 Apr 2002 18:24:18 -  1.15
  @@ -182,9 +182,11 @@
   
   public void destroy() throws IOException {
   try {
  -tp.shutdown();
  -
  -apr.unSocketClose(gPool, unixListenSocket,3);
  +if( tp != null )
  +tp.shutdown();
  +
  +if(apr !=null ) 
  +apr.unSocketClose(gPool, unixListenSocket,3);
   } catch(Exception e) {
   e.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/common ChannelUn.java Shm.java

2002-04-25 Thread costin

costin  02/04/25 15:04:00

  Modified:jk/java/org/apache/jk/common ChannelUn.java Shm.java
  Log:
  Extra checks for APR presence.
  
  Revision  ChangesPath
  1.16  +3 -0  
jakarta-tomcat-connectors/jk/java/org/apache/jk/common/ChannelUn.java
  
  Index: ChannelUn.java
  ===
  RCS file: 
/home/cvs/jakarta-tomcat-connectors/jk/java/org/apache/jk/common/ChannelUn.java,v
  retrieving revision 1.15
  retrieving revision 1.16
  diff -u -r1.15 -r1.16
  --- ChannelUn.java25 Apr 2002 18:24:18 -  1.15
  +++ ChannelUn.java25 Apr 2002 22:04:00 -  1.16
  @@ -176,11 +176,13 @@
   
   
   public void close(MsgContext ep) throws IOException {
  +if( apr==null ) return;
   Long s=(Long)ep.getNote( socketNote );
   apr.unSocketClose(gPool, s.longValue(),3);
   }
   
   public void destroy() throws IOException {
  +if( apr==null ) return;
   try {
   if( tp != null )
   tp.shutdown();
  @@ -315,6 +317,7 @@
   void acceptConnections() {
   if( log.isDebugEnabled() )
   log.debug(Accepting ajp connections on  + file);
  +if( apr==null ) return;
   while( running ) {
   try {
   MsgContext ep=new MsgContext();
  
  
  
  1.5   +5 -0  jakarta-tomcat-connectors/jk/java/org/apache/jk/common/Shm.java
  
  Index: Shm.java
  ===
  RCS file: /home/cvs/jakarta-tomcat-connectors/jk/java/org/apache/jk/common/Shm.java,v
  retrieving revision 1.4
  retrieving revision 1.5
  diff -u -r1.4 -r1.5
  --- Shm.java  25 Apr 2002 18:25:49 -  1.4
  +++ Shm.java  25 Apr 2002 22:04:00 -  1.5
  @@ -102,6 +102,7 @@
   
   public void init() throws IOException {
   super.initNative( shm );
  +if( apr==null ) return;
   if( file==null ) {
   log.error(No shm file, disabling shared memory);
   apr=null;
  @@ -116,6 +117,7 @@
   }
   
   public void attach() throws IOException {
  +if( apr==null ) return;
   MsgContext mCtx=createMsgContext();
   Msg msg=(Msg)mCtx.getMsg(0);
   msg.reset();
  @@ -126,6 +128,7 @@
   }
   
   public void setNativeAttribute(String name, String val) throws IOException {
  +if( apr==null ) return;
   MsgContext mCtx=createMsgContext();
   Msg msg=(Msg)mCtx.getMsg(0);
   C2BConverter c2b=(C2BConverter)mCtx.getNote(C2B_NOTE);
  @@ -143,6 +146,7 @@
   public void registerTomcat(String host, int port)
   throws IOException
   {
  +if( apr==null ) return;
   MsgContext mCtx=createMsgContext();
   Msg msg=(Msg)mCtx.getMsg(0);
   msg.reset();
  @@ -172,6 +176,7 @@
   public  int invoke(Msg msg, MsgContext ep )
   throws IOException
   {
  +if( apr==null ) return;
   System.err.println(ChannelShm.invoke:   + ep );
   super.nativeDispatch( msg, ep, JK_HANDLE_SHM_DISPATCH );
   return 0;
  
  
  

--
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/common ChannelUn.java

2002-04-15 Thread costin

costin  02/04/15 17:04:42

  Modified:jk/java/org/apache/jk/common ChannelUn.java
  Log:
  Singleton use.
  
  Revision  ChangesPath
  1.10  +2 -1  
jakarta-tomcat-connectors/jk/java/org/apache/jk/common/ChannelUn.java
  
  Index: ChannelUn.java
  ===
  RCS file: 
/home/cvs/jakarta-tomcat-connectors/jk/java/org/apache/jk/common/ChannelUn.java,v
  retrieving revision 1.9
  retrieving revision 1.10
  diff -u -r1.9 -r1.10
  --- ChannelUn.java11 Apr 2002 05:46:51 -  1.9
  +++ ChannelUn.java16 Apr 2002 00:04:42 -  1.10
  @@ -126,7 +126,7 @@
   }
   
   public void init() throws IOException {
  -apr=new AprImpl();
  +apr=AprImpl.getAprImpl();
   if( aprHome==null  jkHome != null ) {
   File f=new File( jkHome );
   File aprBase=new File( jkHome, jk2/jni );
  @@ -141,6 +141,7 @@
   apr.loadNative();
   
   apr.initialize();
  +
   if( log.isDebugEnabled() ) log.debug( Creating pool  + gPool );
   gPool=apr.poolCreate( 0 );
   
  
  
  

--
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/common ChannelUn.java

2002-04-15 Thread costin

costin  02/04/15 17:21:37

  Modified:jk/java/org/apache/jk/apr AprImpl.java
   jk/java/org/apache/jk/common ChannelUn.java
  Log:
  Gracefully deal with wrong LD_LIBRARY_PATH or unavailable libs. If
  libapr.so and libjkjni.so are found in the path ( or /usr/lib or ld.so.conf ) - the
  unix channel will be enabled. If not - we'll just report and go on.
  
  Revision  ChangesPath
  1.7   +2 -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.6
  retrieving revision 1.7
  diff -u -r1.6 -r1.7
  --- AprImpl.java  16 Apr 2002 00:01:33 -  1.6
  +++ AprImpl.java  16 Apr 2002 00:21:37 -  1.7
  @@ -80,7 +80,7 @@
*  Of course, this can change to System.load() and putting the
*  libs in LD_LIBRARY_PATH.
*/
  -public void loadNative() {
  +public void loadNative() throws Throwable {
   if( aprHome==null )
   aprHome=baseDir;
   if( aprHome==null ) {
  @@ -90,7 +90,7 @@
   System.loadLibrary( jkjni );
   } catch( Throwable ex ) {
   ok=false;
  -ex.printStackTrace();
  +throw ex;
   }
   } else {
   File dir=new File(aprHome);
  
  
  
  1.11  +7 -3  
jakarta-tomcat-connectors/jk/java/org/apache/jk/common/ChannelUn.java
  
  Index: ChannelUn.java
  ===
  RCS file: 
/home/cvs/jakarta-tomcat-connectors/jk/java/org/apache/jk/common/ChannelUn.java,v
  retrieving revision 1.10
  retrieving revision 1.11
  diff -u -r1.10 -r1.11
  --- ChannelUn.java16 Apr 2002 00:04:42 -  1.10
  +++ ChannelUn.java16 Apr 2002 00:21:37 -  1.11
  @@ -137,10 +137,14 @@
   if( aprHome != null ) {
   apr.setBaseDir( aprHome );
   }
  -
  -apr.loadNative();
  +try {
  +apr.loadNative();
   
  -apr.initialize();
  +apr.initialize();
  +} catch( Throwable t ) {
  +log.error(Native code not initialized, disabling UnixSocket and JNI 
channels:  + t.toString());
  +return;
  +}
   
   if( log.isDebugEnabled() ) log.debug( Creating pool  + gPool );
   gPool=apr.poolCreate( 0 );
  
  
  

--
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/common ChannelUn.java

2002-04-03 Thread costin

costin  02/04/03 16:55:35

  Modified:jk/java/org/apache/jk/common ChannelUn.java
  Log:
  Remove the custom log, use common-logging
  
  Revision  ChangesPath
  1.7   +20 -22
jakarta-tomcat-connectors/jk/java/org/apache/jk/common/ChannelUn.java
  
  Index: ChannelUn.java
  ===
  RCS file: 
/home/cvs/jakarta-tomcat-connectors/jk/java/org/apache/jk/common/ChannelUn.java,v
  retrieving revision 1.6
  retrieving revision 1.7
  diff -u -r1.6 -r1.7
  --- ChannelUn.java6 Feb 2002 17:43:08 -   1.6
  +++ ChannelUn.java4 Apr 2002 00:55:35 -   1.7
  @@ -114,8 +114,8 @@
*/
   ep.setNote( socketNote, new Long( l ) );
   
  -if(dL0 )
  -d(Accepted socket  + l );
  +if( log.isDebugEnabled() )
  +log.debug(Accepted socket  + l );
   }
   
   public void init() throws IOException {
  @@ -127,7 +127,7 @@
   
   apr.initialize();
   gPool=apr.poolCreate( 0 );
  -if( dL  0 ) d( Create pool  + gPool );
  +if( log.isDebugEnabled() ) log.debug( Create pool  + gPool );
   
   File socketFile=new File( file );
   if( socketFile.exists() ) {
  @@ -170,8 +170,8 @@
   byte buf[]=msg.getBuffer();
   int len=msg.getLen();
   
  -if(dL  5 )
  -d(send()  + len +   + buf[4] );
  +if(log.isDebugEnabled() )
  +log.debug(send()  + len +   + buf[4] );
   
   Long s=(Long)ep.getNote( socketNote );
   
  @@ -182,8 +182,8 @@
   public int receive( Msg msg, MsgContext ep )
   throws IOException
   {
  -if (dL  0) {
  -d(receive());
  +if (log.isDebugEnabled()) {
  +log.debug(receive());
   }
   
   byte buf[]=msg.getBuffer();
  @@ -215,18 +215,18 @@
   total_read = this.read(ep, buf, hlen, blen);
   
   if (total_read = 0) {
  -d(can't read body, waited # + blen);
  +log.warn(can't read body, waited # + blen);
   return  -1;
   }
   
   if (total_read != blen) {
  - d( incomplete read, waited # + blen +
  + log.warn( incomplete read, waited # + blen +
got only  + total_read);
   return -2;
   }
   
  -if (dL  0)
  - d(receive:  total read =  + total_read);
  +if (log.isDebugEnabled())
  + log.debug(receive:  total read =  + total_read);
return total_read;
   }
   
  @@ -258,8 +258,8 @@
   got=apr.unRead( gPool, s.longValue(),
   b, pos + offset, len - pos);
   
  -if (dL  5) {
  -d(reading  #  + b +   + (b==null ? 0: b.length) +   +
  +if (log.isDebugEnabled()) {
  +log.debug(reading  #  + b +   + (b==null ? 0: b.length) +   +
 offset +   + len +  got #  + got);
   }
   // connection just closed by remote. 
  @@ -286,8 +286,8 @@
   /** Accept incoming connections, dispatch to the thread pool
*/
   void acceptConnections() {
  -if( dL0 )
  -d(Accepting ajp connections on  + file);
  +if( log.isDebugEnabled() )
  +log.debug(Accepting ajp connections on  + file);
   while( running ) {
   try {
   MsgContext ep=this.createEndpoint();
  @@ -304,8 +304,8 @@
   /** Process a single ajp connection.
*/
   void processConnection(MsgContext ep) {
  -if( dL  0 )
  -d( New ajp connection );
  +if( log.isDebugEnabled() )
  +log.debug( New ajp connection );
   try {
   MsgAjp recv=new MsgAjp();
   while( running ) {
  @@ -321,11 +321,9 @@
   ex.printStackTrace();
   }
   }
  -
  -private static final int dL=10;
  -private static void d(String s ) {
  -System.err.println( ChannelUn:  + s );
  -}
  +
  +private static org.apache.commons.logging.Log log=
  +org.apache.commons.logging.LogFactory.getLog( ChannelUn.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/common ChannelUn.java

2002-01-06 Thread costin

costin  02/01/06 00:42:09

  Added:   jk/java/org/apache/jk/common ChannelUn.java
  Log:
  My unix-socket channel. Will be replaced with ChannelUnixSocket ( but for now most
  of my stuff has been used/tested with this one ).
  
  Revision  ChangesPath
  1.1  
jakarta-tomcat-connectors/jk/java/org/apache/jk/common/ChannelUn.java
  
  Index: ChannelUn.java
  ===
  /*
   * 
   *
   * 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.common;
  
  import java.io.*;
  
  import java.net.*;
  import java.util.*;
  
  import org.apache.tomcat.util.buf.*;
  import org.apache.tomcat.util.http.*;
  
  import org.apache.tomcat.util.threads.*;
  
  import org.apache.jk.core.*;
  import org.apache.jk.apr.*;
  
  
  /** Pass messages using unix domain sockets.
   *
   * @author Costin Manolache
   */
  public class ChannelUn extends Channel {
  
  String file;
  Worker worker;
  ThreadPool tp=new ThreadPool();
  
  /*  Tcp socket options  */
  
  public ThreadPool getThreadPool() {
  return tp;
  }
  
  public void setWorker( Worker w ) {
  worker=w;
  }
  
  public Worker getWorker() {
  return worker;
  }
  
  public void setFile( String f ) {
  file=f;
  }
  
  /*   */
  long unixListenSocket;
  int socketNote=1;
  int isNote=2;
  int osNote=3;
  AprImpl apr;
  long gPool;
  
  public void accept( Endpoint ep ) throws IOException {
  long l= apr.unAccept(gPool, unixListenSocket);
  /* We could create a real java.net.Socket, or a UnixSocket, etc
   */
  ep.setNote( socketNote, new Long( l ) );
  
  if(dL0 )
  d(Accepted socket  + l );
  }
  
  public void init() throws IOException {
  apr=new AprImpl();
  File f=new File( ../jk2/jni/libapr.so );
  apr.loadNative( f.getAbsolutePath() );
  f=new File( ../jk2/jni/jni_connect.so );
  apr.loadNative( f.getAbsolutePath() );
  
  apr.initialize();