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

2004-10-14 Thread billbarker
billbarker2004/10/14 21:42:25

  Modified:jk/java/org/apache/jk/common ChannelJni.java
  Log:
  Make the message properly empty for the first part of the POST body.
  
  This is a bit ugly, but then so is the rest of ChannelJni ;-).
  
  Fix for Bug #31722
  
  Revision  ChangesPath
  1.18  +2 -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.17
  retrieving revision 1.18
  diff -u -r1.17 -r1.18
  --- ChannelJni.java   31 May 2004 04:48:54 -  1.17
  +++ ChannelJni.java   15 Oct 2004 04:42:25 -  1.18
  @@ -71,7 +71,8 @@
   log.debug(No send() prior to receive(), no data buffer);
   // No sent() was done prior to receive.
   msg.reset();
  -return 0;
  +msg.end();
  +sentResponse = msg;
   }
   
   sentResponse.processHeader();
  
  
  

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



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

2002-09-19 Thread mturk

mturk   2002/09/18 23:26:52

  Modified:jk/java/org/apache/jk/common ChannelJni.java
  Log:
  Add the INFO log message when the channel is initialized.
  
  Revision  ChangesPath
  1.14  +3 -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.13
  retrieving revision 1.14
  diff -u -r1.13 -r1.14
  --- ChannelJni.java   11 Jun 2002 00:11:03 -  1.13
  +++ ChannelJni.java   19 Sep 2002 06:26:52 -  1.14
  @@ -91,7 +91,9 @@
   if( apr==null ) return;
   
   // We'll be called from C. This deals with that.
  -apr.addJkHandler( channelJni, this );
  +apr.addJkHandler( channelJni, this );
  +log.info(JK2: listening on channel.jni:jni );
  +
   if( next==null ) {
   if( nextName!=null ) 
   setNext( wEnv.getHandler( nextName ) );
  
  
  

--
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 ChannelJni.java

2002-06-10 Thread costin

costin  2002/06/10 17:11:03

  Modified:jk/java/org/apache/jk/common ChannelJni.java
  Log:
  Fix for POST in in-process.
  
  This is a very tricky code - we must 'simulate' a 2-thread model ( i.e.
  one tomcat thread sending/receiving messages with apache, and one apache
  thread ) in a 1-thread model, with no context switch.
  
  We do this by requiring a certain behavior from the invoked method - the
  send() will marshal the response back into the same buffer, and next
  receive() will just read it.
  
  While a cleaner solution may be possible, this has the main benefit of
  minimizing the most expensive operation in jni - moving data between java
  heap and C ( we have a single java buffer that is pinned ). Of course,
  the rest of the code must deal with that - and make sure the buffer is
  not used for something else.
  
  Since we simulate the send/response in 2-thread model, the receive() will
  be called imediately after send(), so things are not too bad.
  
  The problem with POST was the 'special' chunk sent imediately after the
  request data. In tcp mode, that optimize the case of small requests
  ( since it eliminates one round trip - well, it's not too much and
  it may be worth removing it for cleaner code ). In JNI mode, there
  is no such thing.
  
  The fix is to check if the receive() is the result of a sent(), and
  return an empty message otherwise.
  
  Revision  ChangesPath
  1.13  +35 -3 
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.12
  retrieving revision 1.13
  diff -u -r1.12 -r1.13
  --- ChannelJni.java   1 Jun 2002 08:29:34 -   1.12
  +++ ChannelJni.java   11 Jun 2002 00:11:03 -  1.13
  @@ -111,6 +111,25 @@
   throws IOException
   {
   Msg sentResponse=(Msg)ep.getNote( receivedNote );
  +ep.setNote( receivedNote, null );
  +
  +if( sentResponse == null ) {
  +if( log.isDebugEnabled() )
  +log.debug(No send() prior to receive(), no data buffer);
  +// No sent() was done prior to receive.
  +msg.reset();
  +return 0;
  +}
  +
  +sentResponse.processHeader();
  +
  +if( log.isTraceEnabled() )
  +sentResponse.dump(received response );
  +
  +if( msg != sentResponse ) {
  +log.error( Error, in JNI mode the msg used for receive() must be 
identical with the one used for send());
  +}
  +
   return 0;
   }
   
  @@ -121,8 +140,15 @@
   public int send( Msg msg, MsgContext ep )
   throws IOException
   {
  +if( log.isDebugEnabled() ) log.debug(ChannelJni.send:   +  msg );
  +
   int rc=super.nativeDispatch( msg, ep, JK_HANDLE_JNI_DISPATCH, 0);
  +
  +// nativeDispatch will put the response in the same buffer.
  +// Next receive() will just get it from there. Very tricky to do
  +// things in one thread instead of 2.
   ep.setNote( receivedNote, msg );
  +
   return rc;
   }
   
  @@ -146,23 +172,28 @@
*  if anyone asks for it - same lazy behavior as in 3.3 ).
*/
   public  int invoke(Msg msg, MsgContext ep )  throws IOException {
  -if( log.isDebugEnabled() ) log.debug(ChannelJni.invoke:   + ep );
  -
   if( apr==null ) return -1;
   
   long xEnv=ep.getJniEnv();
   long cEndpointP=ep.getJniContext();
   
   int type=ep.getType();
  +if( log.isDebugEnabled() ) log.debug(ChannelJni.invoke:   + ep +   + 
type);
   
   switch( type ) {
   case JkHandler.HANDLE_RECEIVE_PACKET:
   return receive( msg, ep );
   case JkHandler.HANDLE_SEND_PACKET:
  +ep.setNote( receivedNote, null );
   return send( msg, ep );
   case JkHandler.HANDLE_FLUSH:
  +ep.setNote( receivedNote, null );
   return 0;
   }
  +
  +// Reset receivedNote. It'll be visible only after a SEND and before a 
receive.
  +ep.setNote( receivedNote, null );
  +
   // Default is FORWARD - called from C 
   try {
   // first, we need to get an endpoint. It should be
  @@ -171,7 +202,8 @@
   
   // The endpoint will store the message pt.
   msg.processHeader();
  -//if( log.isInfoEnabled() ) msg.dump(Incoming msg );
  +
  +if( log.isTraceEnabled() ) msg.dump(Incoming msg );
   
   int status= next.invoke(  msg, ep );
   
  
  
  

--
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 ChannelJni.java HandlerRequest.java JniHandler.java

2002-06-01 Thread costin

costin  2002/06/01 01:29:34

  Modified:jk/java/org/apache/jk/apr AprImpl.java
   jk/java/org/apache/jk/common ChannelJni.java
HandlerRequest.java JniHandler.java
  Log:
  Minor fixes, deal with the new callback cases.
  
  Things are a bit tricky, after we do a bit of refactoring on Coyote Action
  I expect to simplify a lot the model.
  
  The invoke() method is used in both ways, for calls from lower layers and
  also from higher layers ( with dispatch by action code - but we have 2 kinds
  of action codes, one is Coyote and the other is jk - the packet type ). This
  can be easily simplified using hooks, with each layer defining its own hooks.
  
  For now things are ok, I don't expect more complexity in the current code,
  but the first thing after releases is dealing with ActionCode and creating
  a unified hook mechanism.
  
  Revision  ChangesPath
  1.19  +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.18
  retrieving revision 1.19
  diff -u -r1.18 -r1.19
  --- AprImpl.java  1 Jun 2002 02:50:11 -   1.18
  +++ AprImpl.java  1 Jun 2002 08:29:34 -   1.19
  @@ -206,7 +206,7 @@
   */
   try {
   System.out.println(Loading  + jniModeSo);
  -System.load( jniModeSo );
  +if( jniModeSo!= null ) System.load( jniModeSo );
   } catch( Throwable ex ) {
   // ignore
   ex.printStackTrace();
  
  
  
  1.12  +2 -0  
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.11
  retrieving revision 1.12
  diff -u -r1.11 -r1.12
  --- ChannelJni.java   28 May 2002 22:51:11 -  1.11
  +++ ChannelJni.java   1 Jun 2002 08:29:34 -   1.12
  @@ -160,6 +160,8 @@
   return receive( msg, ep );
   case JkHandler.HANDLE_SEND_PACKET:
   return send( msg, ep );
  +case JkHandler.HANDLE_FLUSH:
  +return 0;
   }
   // Default is FORWARD - called from C 
   try {
  
  
  
  1.14  +2 -1  
jakarta-tomcat-connectors/jk/java/org/apache/jk/common/HandlerRequest.java
  
  Index: HandlerRequest.java
  ===
  RCS file: 
/home/cvs/jakarta-tomcat-connectors/jk/java/org/apache/jk/common/HandlerRequest.java,v
  retrieving revision 1.13
  retrieving revision 1.14
  diff -u -r1.13 -r1.14
  --- HandlerRequest.java   28 May 2002 22:51:11 -  1.13
  +++ HandlerRequest.java   1 Jun 2002 08:29:34 -   1.14
  @@ -388,7 +388,8 @@
   
return OK;
   default:
  -/*DEBUG*/ try {throw new Exception(); } catch(Exception ex) 
{ex.printStackTrace();}
  +System.err.println(Unknown message  + type );
  +msg.dump(Unknown message );
}
   
   return OK;
  
  
  
  1.8   +4 -3  
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.7
  retrieving revision 1.8
  diff -u -r1.7 -r1.8
  --- JniHandler.java   1 Jun 2002 02:55:55 -   1.7
  +++ JniHandler.java   1 Jun 2002 08:29:34 -   1.8
  @@ -268,8 +268,9 @@
nativeJkHandlerP,
nativeContext,
code, msg.getBuffer(), 0, msg.getLen(), raw ); 
  -if( status != 0 )
  +if( status != 0  status != 2 ) {
   log.error( nativeDispatch: error  + status );
  +}
   
   if( log.isDebugEnabled() ) log.debug( Sending packet - done  + status);
   return status;
  @@ -292,10 +293,10 @@
   
   apr.jkRecycle(xEnv, ep.getJniContext());
   
  -if(log.isInfoEnabled() ) log.info(Shm invoke status  + status);
  +if(log.isInfoEnabled() ) log.info(Jni invoke status  + status);

   apr.releaseJkEnv( xEnv );
  -   return 0;
  +return 0;
   }
   
   private static org.apache.commons.logging.Log log=
  
  
  

--
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 ChannelJni.java HandlerRequest.java MsgAjp.java Shm.java

2002-05-28 Thread costin

costin  02/05/28 15:51:11

  Modified:jk/java/org/apache/jk/common ChannelJni.java
HandlerRequest.java MsgAjp.java Shm.java
  Log:
  Minor fixes and updates.
  
  Revision  ChangesPath
  1.11  +1 -3  
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.10
  retrieving revision 1.11
  diff -u -r1.10 -r1.11
  --- ChannelJni.java   22 May 2002 23:52:13 -  1.10
  +++ ChannelJni.java   28 May 2002 22:51:11 -  1.11
  @@ -121,11 +121,9 @@
   public int send( Msg msg, MsgContext ep )
   throws IOException
   {
  -int rc=super.nativeDispatch( msg, ep, JK_HANDLE_JNI_DISPATCH);
  +int rc=super.nativeDispatch( msg, ep, JK_HANDLE_JNI_DISPATCH, 0);
   ep.setNote( receivedNote, msg );
   return rc;
  -
  -
   }
   
   /** Receive a packet from the C side. This is called from the C
  
  
  
  1.13  +2 -0  
jakarta-tomcat-connectors/jk/java/org/apache/jk/common/HandlerRequest.java
  
  Index: HandlerRequest.java
  ===
  RCS file: 
/home/cvs/jakarta-tomcat-connectors/jk/java/org/apache/jk/common/HandlerRequest.java,v
  retrieving revision 1.12
  retrieving revision 1.13
  diff -u -r1.12 -r1.13
  --- HandlerRequest.java   10 May 2002 23:56:49 -  1.12
  +++ HandlerRequest.java   28 May 2002 22:51:11 -  1.13
  @@ -387,6 +387,8 @@
   System.exit(0);
   
return OK;
  +default:
  +/*DEBUG*/ try {throw new Exception(); } catch(Exception ex) 
{ex.printStackTrace();}
}
   
   return OK;
  
  
  
  1.7   +1 -0  
jakarta-tomcat-connectors/jk/java/org/apache/jk/common/MsgAjp.java
  
  Index: MsgAjp.java
  ===
  RCS file: 
/home/cvs/jakarta-tomcat-connectors/jk/java/org/apache/jk/common/MsgAjp.java,v
  retrieving revision 1.6
  retrieving revision 1.7
  diff -u -r1.6 -r1.7
  --- MsgAjp.java   27 Feb 2002 06:41:18 -  1.6
  +++ MsgAjp.java   28 May 2002 22:51:11 -  1.7
  @@ -343,6 +343,7 @@
   int max=pos;
   if( len + 4  pos )
   max=len+4;
  +if( max 1000 ) max=1000;
   for( int j=0; j  max; j+=16 )
   System.out.println( hexLine( buf, j, len ));

  
  
  
  1.12  +3 -41 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.11
  retrieving revision 1.12
  diff -u -r1.11 -r1.12
  --- Shm.java  9 May 2002 23:46:33 -   1.11
  +++ Shm.java  28 May 2002 22:51:11 -  1.12
  @@ -101,13 +101,9 @@
   Vector groups=new Vector();
   
   // Will be dynamic ( getMethodId() ) after things are stable 
  -static final int SHM_SET_ATTRIBUTE=0;
   static final int SHM_WRITE_SLOT=2;
  -static final int SHM_ATTACH=3;
  -static final int SHM_DETACH=4;
   static final int SHM_RESET=5;
   static final int SHM_DUMP=6;
  -static final int SHM_DESTROY=7;
   
   public Shm() {
   }
  @@ -193,18 +189,8 @@
   setNativeAttribute( file, file );
   if( size  0 )
   setNativeAttribute( size, Integer.toString( size ) );
  -attach();
  -}
  -
  -public void attach() throws IOException {
  -if( apr==null ) return;
  -MsgContext mCtx=createMsgContext();
  -Msg msg=(Msg)mCtx.getMsg(0);
  -msg.reset();
  -
  -msg.appendByte( SHM_ATTACH );
   
  -this.invoke( msg, mCtx );
  +initJkComponent();
   }
   
   public void resetScoreboard() throws IOException {
  @@ -232,22 +218,6 @@
   this.invoke( msg, mCtx );
   }
   
  -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);
  -msg.reset();
  -
  -msg.appendByte( SHM_SET_ATTRIBUTE );
  -
  -appendString( msg, name, c2b);
  -
  -appendString(msg, val, c2b );
  -
  -this.invoke( msg, mCtx );
  -}
  -
   /** Register a tomcat instance
*  XXX make it more flexible
*/
  @@ -316,15 +286,7 @@
   }
   
   public void destroy() throws IOException {
  -if( apr==null ) return;
  -
  -MsgContext mCtx=createMsgContext();
  - 

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

2002-04-25 Thread costin

costin  02/04/25 11:22:54

  Modified:jk/java/org/apache/jk/common ChannelJni.java
  Log:
  Remove the duplicated code ( that moved to the parent class, JniHandler ).
  
  Use the new unified dispatch mechanism that will be used by all components
  to communicate with the C code.
  
  Revision  ChangesPath
  1.8   +15 -33
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.7
  retrieving revision 1.8
  diff -u -r1.7 -r1.8
  --- ChannelJni.java   18 Apr 2002 17:44:49 -  1.7
  +++ ChannelJni.java   25 Apr 2002 18:22:54 -  1.8
  @@ -77,22 +77,20 @@
*
* @author Costin Manolache
*/
  -public class ChannelJni extends JkHandler {
  +public class ChannelJni extends JniHandler {
   int receivedNote=1;
  -AprImpl apr;
  -
  +
   public ChannelJni() {
   // we use static for now, it's easier on the C side.
   // Easy to change after we get everything working
   }
   
   public void init() throws IOException {
  -// static field init, temp
  -apr=(AprImpl)wEnv.getHandler(apr);
  -if( apr==null || ! apr.isLoaded() ) { 
  -log.error(No apr, disabling jni channel );
  -return;
  -}
  +super.initNative(channel.jni:jni);
  +
  +if( apr==null ) return;
  +
  +// We'll be called from C. This deals with that.
   apr.addJkHandler( channelJni, this );
   if( next==null ) {
   if( nextName!=null ) 
  @@ -123,32 +121,13 @@
   public int send( Msg msg, MsgContext ep )
   throws IOException
   {
  -byte buf[]=msg.getBuffer();
  -
  -// send and get the response
  -if( log.isInfoEnabled() ) log.info( Sending packet );
  -msg.end();
  -
  -// Assert: apr initialized
  -// Will process the message in the current thread.
  -// No wait needed to receive the response
  -// 
  -int status=apr.sendPacket( ep.getJniEnv(), ep.getJniContext(),
  -   buf, msg.getLen() );
  -
  +int rc=super.nativeDispatch( msg, ep, JK_HANDLE_JNI_DISPATCH);
   ep.setNote( receivedNote, msg );
  -
  -if( log.isInfoEnabled() ) log.info( Sending packet - done );
  -return 0;
  -}
  +return rc;
  +
   
  -public MsgContext createMsgContext() {
  -MsgContext mc=new MsgContext();
  -mc.setMsg( 0, new MsgAjp());
  -mc.setNext( this );
  -return mc;
   }
  -
  +
   /** Receive a packet from the C side. This is called from the C
*  code using invocation, but only for the first packet - to avoid
*  recursivity and thread problems.
  @@ -169,7 +148,10 @@
*  if anyone asks for it - same lazy behavior as in 3.3 ).
*/
   public  int invoke(Msg msg, MsgContext ep )  throws IOException {
  -System.err.println(ChannelJni.invoke:   + ep );
  +if( log.isDebugEnabled() ) log.debug(ChannelJni.invoke:   + ep );
  +
  +if( apr==null ) return -1;
  +
   long xEnv=ep.getJniEnv();
   long cEndpointP=ep.getJniContext();
   
  
  
  

--
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 ChannelJni.java ChannelUn.java Shm.java

2002-04-18 Thread costin

costin  02/04/18 10:44:49

  Modified:jk/java/org/apache/jk/common ChannelJni.java ChannelUn.java
Shm.java
  Log:
  Deal with APR not available gracefully ( with a simple message ).
  
  If libapr.so and libjkjni.so are not in LD_LIBRARY_PATH, all native
  functions will be disabled.
  
  If it is - we'll use them. No configuration required ( except if you want
  to change the defaults - which should be reasonable )
  
  Revision  ChangesPath
  1.7   +1 -2  
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.6
  retrieving revision 1.7
  diff -u -r1.6 -r1.7
  --- ChannelJni.java   17 Apr 2002 22:37:50 -  1.6
  +++ ChannelJni.java   18 Apr 2002 17:44:49 -  1.7
  @@ -84,13 +84,12 @@
   public ChannelJni() {
   // we use static for now, it's easier on the C side.
   // Easy to change after we get everything working
  -log.info(Created channel jni );
   }
   
   public void init() throws IOException {
   // static field init, temp
   apr=(AprImpl)wEnv.getHandler(apr);
  -if( apr==null ) { 
  +if( apr==null || ! apr.isLoaded() ) { 
   log.error(No apr, disabling jni channel );
   return;
   }
  
  
  
  1.13  +6 -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.12
  retrieving revision 1.13
  diff -u -r1.12 -r1.13
  --- ChannelUn.java17 Apr 2002 22:38:16 -  1.12
  +++ ChannelUn.java18 Apr 2002 17:44:49 -  1.13
  @@ -127,8 +127,13 @@
   
   public void init() throws IOException {
   apr=(AprImpl)wEnv.getHandler(apr);
  -if( apr==null ) {
  +if( apr==null || ! apr.isLoaded() ) {
   log.error(Apr is not available, disabling unix channel );
  +apr=null;
  +return;
  +}
  +if( file==null ) {
  +log.error(No file, disabling unix channel);
   return;
   }
   if( next==null ) {
  
  
  
  1.2   +3 -2  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.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- Shm.java  17 Apr 2002 22:36:04 -  1.1
  +++ Shm.java  18 Apr 2002 17:44:49 -  1.2
  @@ -108,8 +108,9 @@
   }
   try {
   apr=(AprImpl)wEnv.getHandler(apr);
  -if( apr==null ) {
  +if( apr==null || ! apr.isLoaded() ) {
   log.error( Apr unavailable, disabling shared memory  );
  +apr=null;
   return;
   }
   
  @@ -119,7 +120,7 @@
   
   if( aprShmP== 0 ) {
   // no shared mem. This is normal result, but create should throw
  -log.info(Can't attach, try to create );
  +log.info(Can't attach, try to create  + file );
   }
   
   //XXX not implemented.
  
  
  

--
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 ChannelJni.java

2002-04-17 Thread costin

costin  02/04/17 15:37:50

  Modified:jk/java/org/apache/jk/common ChannelJni.java
  Log:
  Clean up the jni handler - use plain JkHandler methods and mechanisms.
  
  The whole idea is to have a single,  generic 'hook' mechanism used by all
  components - including jni.
  
  Revision  ChangesPath
  1.6   +67 -78
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.5
  retrieving revision 1.6
  diff -u -r1.5 -r1.6
  --- ChannelJni.java   16 Apr 2002 00:04:20 -  1.5
  +++ ChannelJni.java   17 Apr 2002 22:37:50 -  1.6
  @@ -77,14 +77,10 @@
*
* @author Costin Manolache
*/
  -public class ChannelJni extends Channel implements AprImpl.JniContextFactory {
  -private static org.apache.commons.logging.Log log=
  -org.apache.commons.logging.LogFactory.getLog( ChannelJni.class );
  -
  +public class ChannelJni extends JkHandler {
   int receivedNote=1;
  -AprImpl apr=AprImpl.getAprImpl();
  +AprImpl apr;
   
  -
   public ChannelJni() {
   // we use static for now, it's easier on the C side.
   // Easy to change after we get everything working
  @@ -93,11 +89,27 @@
   
   public void init() throws IOException {
   // static field init, temp
  -log.info(init );
  -apr.addJniContextFactory( channelJni, this );
  +apr=(AprImpl)wEnv.getHandler(apr);
  +if( apr==null ) { 
  +log.error(No apr, disabling jni channel );
  +return;
  +}
  +apr.addJkHandler( channelJni, this );
  +if( next==null ) {
  +if( nextName!=null ) 
  +setNext( wEnv.getHandler( nextName ) );
  +if( next==null )
  +next=wEnv.getHandler( dispatch );
  +if( next==null )
  +next=wEnv.getHandler( request );
  +if( log.isDebugEnabled() )
  +log.debug(Setting default next  + next.getClass().getName());
  +}
   }
   
  -// XXX Not used 
  +/** Receives does nothing - send will put the response
  + *  in the same buffer
  + */
   public int receive( Msg msg, MsgContext ep )
   throws IOException
   {
  @@ -114,8 +126,6 @@
   {
   byte buf[]=msg.getBuffer();
   
  -JniEndpoint epData=(JniEndpoint)ep;
  -
   // send and get the response
   if( log.isInfoEnabled() ) log.info( Sending packet );
   msg.end();
  @@ -124,7 +134,7 @@
   // Will process the message in the current thread.
   // No wait needed to receive the response
   // 
  -int status=apr.sendPacket( epData.xEnv, epData.jkEndpointP,
  +int status=apr.sendPacket( ep.getJniEnv(), ep.getJniContext(),
  buf, msg.getLen() );
   
   ep.setNote( receivedNote, msg );
  @@ -133,8 +143,46 @@
   return 0;
   }
   
  -public int receive( MsgContext ep, MsgAjp msg, long xEnv, long cEndpointP)
  -{
  +public MsgContext createMsgContext() {
  +MsgContext mc=new MsgContext();
  +mc.setMsg( 0, new MsgAjp());
  +mc.setNext( this );
  +return mc;
  +}
  +
  +/** Receive a packet from the C side. This is called from the C
  + *  code using invocation, but only for the first packet - to avoid
  + *  recursivity and thread problems.
  + *
  + *  This may look strange, but seems the best solution for the
  + *  problem ( the problem is that we don't have 'continuation' ).
  + *
  + *  sendPacket will move the thread execution on the C side, and
  + *  return when another packet is available. For packets that
  + *  are one way it'll return after it is processed too ( having
  + *  2 threads is far more expensive ).
  + *
  + *  Again, the goal is to be efficient and behave like all other
  + *  Channels ( so the rest of the code can be shared ). Playing with
  + *  java objects on C is extremely difficult to optimize and do
  + *  right ( IMHO ), so we'll try to keep it simple - byte[] passing,
  + *  the conversion done in java ( after we know the encoding and
  + *  if anyone asks for it - same lazy behavior as in 3.3 ).
  + */
  +public  int invoke(Msg msg, MsgContext ep )  throws IOException {
  +System.err.println(ChannelJni.invoke:   + ep );
  +long xEnv=ep.getJniEnv();
  +long cEndpointP=ep.getJniContext();
  +
  +int type=ep.getType();
  +
  +switch( type ) {
  +case JkHandler.HANDLE_RECEIVE_PACKET:
  +return receive( msg, ep );
  +case JkHandler.HANDLE_SEND_PACKET:
  +return send( msg, ep );
  + 

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

2002-04-15 Thread costin

costin  02/04/15 17:04:20

  Modified:jk/java/org/apache/jk/common ChannelJni.java
  Log:
  Refactored ChannelJni - it uses AprImpl to talk with the dark side.
  
  This will allow us to use the optimizations in channel_jni for other
  C-java calls ( basically avoid creating byte[] or objects per request and minimizing
  the number of JNI calls in the critical path )
  
  It seems the JNI worker is back ( of course, in single-process mode - the
  multip-process depends on shmem and autoconfiguration )
  
  Revision  ChangesPath
  1.5   +83 -107   
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.4
  retrieving revision 1.5
  diff -u -r1.4 -r1.5
  --- ChannelJni.java   6 Feb 2002 17:43:08 -   1.4
  +++ ChannelJni.java   16 Apr 2002 00:04:20 -  1.5
  @@ -77,35 +77,31 @@
*
* @author Costin Manolache
*/
  -public class ChannelJni extends Channel {
  +public class ChannelJni extends Channel implements AprImpl.JniContextFactory {
  +private static org.apache.commons.logging.Log log=
  +org.apache.commons.logging.LogFactory.getLog( ChannelJni.class );
   
   int receivedNote=1;
  +AprImpl apr=AprImpl.getAprImpl();
  +
  +
   public ChannelJni() {
   // we use static for now, it's easier on the C side.
   // Easy to change after we get everything working
  -chJni=this;
  +log.info(Created channel jni );
   }
   
   public void init() throws IOException {
   // static field init, temp
  -wEnvStatic=wEnv;
  +log.info(init );
  +apr.addJniContextFactory( channelJni, this );
   }
  -
  +
  +// XXX Not used 
   public int receive( Msg msg, MsgContext ep )
   throws IOException
   {
   Msg sentResponse=(Msg)ep.getNote( receivedNote );
  -// same buffer is used, no need to copy
  -if( msg==sentResponse ) {
  -if( dL  0 ) d(Returned previously received message );
  -return 0;
  -}
  -
  -if( dL  0 ) d(XXX Copy previously received message );
  -// send will alter the msg and insert the response.
  -// copy...
  -// XXX TODO
  -
   return 0;
   }
   
  @@ -117,59 +113,40 @@
   throws IOException
   {
   byte buf[]=msg.getBuffer();
  -EpData epData=(EpData)ep.getNote( epDataNote );
  +
  +JniEndpoint epData=(JniEndpoint)ep;
   
   // send and get the response
  -if( dL  0 ) d( Sending packet );
  +if( log.isInfoEnabled() ) log.info( Sending packet );
   msg.end();
  -// msg.dump(Outgoing: );
  -
  -int status=sendPacket( epData.jkEnvP, epData.jkEndpointP,
  -   epData.jkServiceP, buf, msg.getLen() );
  -ep.setNote( receivedNote, msg );
  -
  -if( dL  0 ) d( Sending packet - done );
  -return 0;
  -}
   
  -static int epDataNote=-1;
  +// Assert: apr initialized
  +// Will process the message in the current thread.
  +// No wait needed to receive the response
  +// 
  +int status=apr.sendPacket( epData.xEnv, epData.jkEndpointP,
  +   buf, msg.getLen() );
   
  -public MsgContext createEndpoint(long env, long epP) {
  -MsgContext ep=new MsgContext();
  -if( epDataNote==-1) 
  -epDataNote=wEnv.getNoteId(WorkerEnv.ENDPOINT_NOTE, epData);
  -
  -if( dL  0 ) d(createEndpointStatic()  + env +   + epP);
  +ep.setNote( receivedNote, msg );
   
  -EpData epData=new EpData();
  -epData.jkEnvP=env;
  -epData.jkEndpointP=epP;
  -ep.setNote( epDataNote, epData );
  -ep.setWorkerEnv( wEnv );
  -
  -ep.setChannel( this );
  -return ep;
  +if( log.isInfoEnabled() ) log.info( Sending packet - done );
  +return 0;
   }
   
  -public int receive( long env, long rP, MsgContext ep,
  -MsgAjp msg)
  +public int receive( MsgContext ep, MsgAjp msg, long xEnv, long cEndpointP)
   {
   try {
   // first, we need to get an endpoint. It should be
   // per/thread - and probably stored by the C side.
  -if( dL  0 ) d(Received request  + rP);
  +if( log.isInfoEnabled() ) log.info(Received request  + xEnv);
  +
   // The endpoint will store the message pt.
  -
   msg.processHeader();
  -if( dL  5 ) msg.dump(Incoming msg );
  +if( log.isInfoEnabled() ) msg.dump(Incoming msg );
   
  -EpData epData=(EpData)ep.getNote( 

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

2002-02-06 Thread costin

costin  02/02/06 09:43:08

  Modified:jk/java/org/apache/jk/common ChannelJni.java
ChannelSocket.java ChannelUn.java
  Log:
  Update for the api changes.
  
  Added isSameAddress from Ajp12Interceptor - will be used with the secret for
  the shutdown handler.
  
  Few changes in jni - less code in static methods ( we'll eventually remove all,
  but for now it's easier on the C side )
  
  Revision  ChangesPath
  1.4   +63 -47
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.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- ChannelJni.java   26 Jan 2002 07:24:37 -  1.3
  +++ ChannelJni.java   6 Feb 2002 17:43:08 -   1.4
  @@ -73,7 +73,7 @@
   import org.apache.jk.apr.*;
   
   
  -/** Pass messages using unix domain sockets.
  +/** Pass messages using jni 
*
* @author Costin Manolache
*/
  @@ -88,20 +88,20 @@
   
   public void init() throws IOException {
   // static field init, temp
  -wEnv=we;
  +wEnvStatic=wEnv;
   }
   
  -public int receive( Msg msg, Endpoint ep )
  +public int receive( Msg msg, MsgContext ep )
   throws IOException
   {
   Msg sentResponse=(Msg)ep.getNote( receivedNote );
   // same buffer is used, no need to copy
   if( msg==sentResponse ) {
  -d(Returned previously received message );
  +if( dL  0 ) d(Returned previously received message );
   return 0;
   }
   
  -d(XXX Copy previously received message );
  +if( dL  0 ) d(XXX Copy previously received message );
   // send will alter the msg and insert the response.
   // copy...
   // XXX TODO
  @@ -113,14 +113,14 @@
*  We could use 2 packets, or sendAndReceive().
*
*/
  -public int send( Msg msg, Endpoint ep )
  +public int send( Msg msg, MsgContext ep )
   throws IOException
   {
   byte buf[]=msg.getBuffer();
   EpData epData=(EpData)ep.getNote( epDataNote );
   
   // send and get the response
  -d( Sending packet );
  +if( dL  0 ) d( Sending packet );
   msg.end();
   // msg.dump(Outgoing: );
   
  @@ -128,43 +128,78 @@
  epData.jkServiceP, buf, msg.getLen() );
   ep.setNote( receivedNote, msg );
   
  -d( Sending packet - done );
  +if( dL  0 ) d( Sending packet - done );
   return 0;
   }
   
  -/*   */
  -
  -static WorkerEnv wEnv=null;
   static int epDataNote=-1;
  -static ChannelJni chJni=new ChannelJni();
   
  -static class EpData {
  -public long jkEnvP;
  -public long jkEndpointP;
  -public long jkServiceP;
  -}
  -
  -public static Endpoint createEndpointStatic(long env, long epP) {
  -Endpoint ep=new Endpoint();
  +public MsgContext createEndpoint(long env, long epP) {
  +MsgContext ep=new MsgContext();
   if( epDataNote==-1) 
   epDataNote=wEnv.getNoteId(WorkerEnv.ENDPOINT_NOTE, epData);
   
  -d(createEndpointStatic()  + env +   + epP);
  +if( dL  0 ) d(createEndpointStatic()  + env +   + epP);
  +
   EpData epData=new EpData();
   epData.jkEnvP=env;
   epData.jkEndpointP=epP;
   ep.setNote( epDataNote, epData );
  +ep.setWorkerEnv( wEnv );
  +
  +ep.setChannel( this );
   return ep;
   }
   
  +public int receive( long env, long rP, MsgContext ep,
  +MsgAjp msg)
  +{
  +try {
  +// first, we need to get an endpoint. It should be
  +// per/thread - and probably stored by the C side.
  +if( dL  0 ) d(Received request  + rP);
  +// The endpoint will store the message pt.
  +
  +msg.processHeader();
  +if( dL  5 ) msg.dump(Incoming msg );
  +
  +EpData epData=(EpData)ep.getNote( epDataNote );
  +
  +epData.jkServiceP=rP;
  +
  +int status= this.invoke(  msg, ep );
  +
  +if(dL  0 ) d(after processCallbacks  + status);
  +
  +return status;
  +} catch( Exception ex ) {
  +ex.printStackTrace();
  +}
  +return 0;
  +}
  +
  +/*   */
  +
  +static WorkerEnv wEnvStatic=null;
  +static ChannelJni chJni=new ChannelJni();
  +
  +static class EpData {
  +public long jkEnvP;
  +public long jkEndpointP;
  +

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

2002-01-25 Thread costin

costin  02/01/25 23:24:37

  Modified:jk/java/org/apache/jk/common ChannelJni.java
  Log:
  Yes, it's working ( at least at hello world level ). And I bet it's going to be
  much better now ( I only tested with the dummy container, 3.3/4.0 should be
  easy to add but need some more work )
  
  See the commits on the c side for details.
  
  Revision  ChangesPath
  1.3   +129 -40   
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.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- ChannelJni.java   16 Jan 2002 15:38:29 -  1.2
  +++ ChannelJni.java   26 Jan 2002 07:24:37 -  1.3
  @@ -77,60 +77,149 @@
*
* @author Costin Manolache
*/
  -public class ChannelJni extends JkChannel implements Channel {
  +public class ChannelJni extends Channel {
   
  +int receivedNote=1;
  +public ChannelJni() {
  +// we use static for now, it's easier on the C side.
  +// Easy to change after we get everything working
  +chJni=this;
  +}
   
  -/*   */
  -
  -static WorkerEnv wenv=null;
  +public void init() throws IOException {
  +// static field init, temp
  +wEnv=we;
  +}
   
  -public static int startup(String cmdLine,
  -  String stdout,
  -  String stderr)
  +public int receive( Msg msg, Endpoint ep )
  +throws IOException
   {
  -System.out.println(In startup);
  -System.err.println(In startup err);
  -if( wenv!=null ) {
  -d(Second call, ignored );
  -return 1;
  -}
  -
  -try {
  -if(null != stdout) {
  -PrintStream out=new PrintStream(new FileOutputStream(stdout));
  -System.setOut(out);
  -if( stderr==null ) 
  -System.setErr(out);
  -}
  -if(null != stderr) {
  -PrintStream err=new PrintStream(new FileOutputStream(stderr));
  -System.setErr(err);
  -if( stdout==null )
  -System.setOut(err);
  -}
  -if( stdout==null  stderr==null ) {
  -// no problem, use stderr - it'll go to error.log of the server.
  -System.setOut( System.err );
  -}
  -} catch(Throwable t) {
  +Msg sentResponse=(Msg)ep.getNote( receivedNote );
  +// same buffer is used, no need to copy
  +if( msg==sentResponse ) {
  +d(Returned previously received message );
  +return 0;
   }
  -System.out.println(New stream);
  -System.err.println(New err stream);
   
  -return 1;
  +d(XXX Copy previously received message );
  +// send will alter the msg and insert the response.
  +// copy...
  +// XXX TODO
  +
  +return 0;
   }
   
  -public static int service(long s, long l)
  +/** Send the packet. XXX This will modify msg !!!
  + *  We could use 2 packets, or sendAndReceive().
  + *
  + */
  +public int send( Msg msg, Endpoint ep )
  +throws IOException
   {
  -System.out.println(In service);
  +byte buf[]=msg.getBuffer();
  +EpData epData=(EpData)ep.getNote( epDataNote );
  +
  +// send and get the response
  +d( Sending packet );
  +msg.end();
  +// msg.dump(Outgoing: );
  +
  +int status=sendPacket( epData.jkEnvP, epData.jkEndpointP,
  +   epData.jkServiceP, buf, msg.getLen() );
  +ep.setNote( receivedNote, msg );
  +
  +d( Sending packet - done );
   return 0;
   }
   
  -public static void shutdown() {
  -System.out.println(In shutdown);
  +/*   */
  +
  +static WorkerEnv wEnv=null;
  +static int epDataNote=-1;
  +static ChannelJni chJni=new ChannelJni();
  +
  +static class EpData {
  +public long jkEnvP;
  +public long jkEndpointP;
  +public long jkServiceP;
  +}
  +
  +public static Endpoint createEndpointStatic(long env, long epP) {
  +Endpoint ep=new Endpoint();
  +if( epDataNote==-1) 
  +epDataNote=wEnv.getNoteId(WorkerEnv.ENDPOINT_NOTE, epData);
  +
  +d(createEndpointStatic()  + env +   + epP);
  +EpData epData=new EpData();
  +epData.jkEnvP=env;
  +epData.jkEndpointP=epP;
  +ep.setNote( epDataNote, epData );
  +return ep;
   }
   
  -private static final int dL=0;

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

2002-01-11 Thread costin

costin  02/01/11 20:03:42

  Modified:jk/java/org/apache/jk/common ChannelUn.java MsgAjp.java
  Added:   jk/java/org/apache/jk/common ChannelJni.java
  Log:
  Added the template for the jni channel. Work is underway on the C side as well.
  
  Few fixes/enhancements for the Unix channel ( to locate the native libs with less
  user intervention )
  
  Revision  ChangesPath
  1.2   +14 -8 
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.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- ChannelUn.java6 Jan 2002 08:42:09 -   1.1
  +++ ChannelUn.java12 Jan 2002 04:03:42 -  1.2
  @@ -82,6 +82,7 @@
   String file;
   Worker worker;
   ThreadPool tp=new ThreadPool();
  +String jkHome;
   
   /*  Tcp socket options  */
   
  @@ -101,6 +102,13 @@
   file=f;
   }
   
  +/** Set the base dir of the jk webapp. This is used to locate
  + *  the (fixed) path to the native lib.
  + */
  +public void setJkHome( String s ) {
  +jkHome=s;
  +}
  +
   /*   */
   long unixListenSocket;
   int socketNote=1;
  @@ -121,10 +129,10 @@
   
   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() );
  +File f=new File( jkHome );
  +File aprBase=new File( jkHome, /WEB-INF/jk2/jni );
  +apr.setBaseDir( aprBase.getAbsolutePath() );
  +apr.loadNative();
   
   apr.initialize();
   gPool=apr.poolCreate( 0 );
  @@ -191,15 +199,13 @@
   int pos = 0;
   int got;
   
  -if (dL  5) {
  -d(reading  #  + b +   + (b==null ? 0: b.length) +   + offset +  
 + len);
  -}
   while(pos  len) {
   got=apr.unRead( gPool, s.longValue(),
   b, pos + offset, len - pos);
   
   if (dL  5) {
  -d(read got #  + got);
  +d(reading  #  + b +   + (b==null ? 0: b.length) +   +
  +  offset +   + len +  got #  + got);
   }
   // connection just closed by remote. 
   if (got = 0) {
  
  
  
  1.3   +2 -3  
jakarta-tomcat-connectors/jk/java/org/apache/jk/common/MsgAjp.java
  
  Index: MsgAjp.java
  ===
  RCS file: 
/home/cvs/jakarta-tomcat-connectors/jk/java/org/apache/jk/common/MsgAjp.java,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- MsgAjp.java   6 Jan 2002 08:46:10 -   1.2
  +++ MsgAjp.java   12 Jan 2002 04:03:42 -  1.3
  @@ -173,7 +173,8 @@
   }
   
   public void appendByteChunk(ByteChunk bc) throws IOException {
  -if(bc==null || bc.isNull() ) {
  +if(bc==null ) {
  +System.out.println(XXX appending BC null + bc);
   appendInt( 0);
   appendByte(0);
   return;
  @@ -182,8 +183,6 @@
   byte[] bytes = bc.getBytes();
   int start=bc.getStart();
   appendInt( bc.getLength() );
  -System.out.println(XXX appending + bytes +   + bc.getLength() +
  - + new String( bytes, 0, bc.getLength()));
   cpBytes(bytes, start, bc.getLength());
   appendByte(0);
   }
  
  
  
  1.1  
jakarta-tomcat-connectors/jk/java/org/apache/jk/common/ChannelJni.java
  
  Index: ChannelJni.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
   *