costin 02/04/18 15:59:20 Modified: jk/java/org/apache/jk/apr AprImpl.java jk/java/org/apache/jk/common Shm.java Log: The java side of the changes. For now it's just a "Hello World" sent between Apache and tomcat, but it works fine - and that was the hard part. Now follows the hard part, implementing a protocol that is flexible enough to support both worker status but also config updates and other status and config info. Luckily there is a backup plan - to use the exact same format as in jserv ( at least to get things started ) Revision Changes Path 1.11 +25 -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.10 retrieving revision 1.11 diff -u -r1.10 -r1.11 --- AprImpl.java 18 Apr 2002 17:42:26 -0000 1.10 +++ AprImpl.java 18 Apr 2002 22:59:20 -0000 1.11 @@ -94,10 +94,35 @@ public native long shmAttach( long pool, String file ); + public native long shmCreate( long pool, long size, String file ); + + public native long shmBaseaddrGet( long pool, long shmP ); + + public native long shmSizeGet( long pool, long shmP ); + public native long shmDetach( long pool, long shmP ); public native long shmDestroy( long pool, long shmP ); + public native int shmRead( long pool, long mP, + byte buf[], int off, int len ); + + public native int shmWrite( long pool, long mP, + 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 ); + // -------------------- java to C -------------------- // Temp - interface will evolve 1.3 +22 -1 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.2 retrieving revision 1.3 diff -u -r1.2 -r1.3 --- Shm.java 18 Apr 2002 17:44:49 -0000 1.2 +++ Shm.java 18 Apr 2002 22:59:20 -0000 1.3 @@ -121,9 +121,30 @@ if( aprShmP== 0 ) { // no shared mem. This is normal result, but create should throw log.info("Can't attach, try to create " + file ); + aprShmP= apr.shmCreate( aprShmPoolP, 8196, file ); + } + if( aprShmP== 0 ) { + // no shared mem. This is normal result, but create should throw + log.info("Can't create " + file ); + return; + } + + long base=apr.shmBaseaddrGet( aprShmPoolP, aprShmP ); + long size=apr.shmSizeGet( aprShmPoolP, aprShmP ); + + log.info("Got shared memory at " + base + " " + size ); + + byte b1[]=new byte[16]; + + apr.shmRead( aprShmPoolP, base, b1, 0, b1.length ); + + System.out.println("Read: " + new String( b1 )); + + byte helloW[]="hello World".getBytes(); + + apr.shmWrite( aprShmPoolP, base, helloW, 0, helloW.length ); - //XXX not implemented. } catch( Throwable ex ) { log.error( "Can't initialize shared memory " + ex.toString() ); apr=null;
-- To unsubscribe, e-mail: <mailto:[EMAIL PROTECTED]> For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>