Brendan,
I got this test running with an out-of-the-box Inline::Java 0.30 on:
- Linux i386 RedHat 7.1.
- perl 5.6.0
- Apache 1.3.19
- mod_perl 1.24
What are your platform details? That 'dev/null' stuff is weird indeed...
Note: Under this scenario, the first Apache child starts the JVM and it is
then shared
by all the other children. When Apache is shutdown, the JVM is stopped. Note
that if
Apache dies unexpextedly the JVM may remain up, but when you restart Apache
the
first child will pick up that same existing JVM and continue.
Cheers,
Patrick
-----8<-----
# Package declaration
package Apache::IJTest ;
use strict ;
use Inline (
Java => qq|
class counter {
static private int i = 0 ;
static public int incr(){
i++ ;
return i ;
}
}
|,
DIRECTORY => '/home/patrickl/perl/dev/Apache/_Inline',
BIN => '/usr/java/jdk1.3.1/bin',
NAME => 'Apache::IJTest',
SHARED_JVM => 1,
) ;
Inline::Java::reconnect_JVM() ;
# Here is the Apache handler that is called for each request
# The above stuff is run only once at module load up.
sub handler {
my $r = shift ;
my $nb = Apache::IJTest::counter->incr() ;
print <<HTML;
Content-type: text/html
<HTML>
<BODY>
Inline-Java this page received $nb hits!
</BODY>
</HTML>
HTML
return Apache::Constants::OK() ;
}
1 ;