[libinline-java-perl] 154/398: Lots of fixes for lots of things

Jonas Smedegaard dr at jones.dk
Thu Feb 26 11:42:59 UTC 2015


This is an automated email from the git hooks/post-receive script.

js pushed a commit to tag 0.55
in repository libinline-java-perl.

commit 43713a55715cf6c55b3d45e912de9d31f427c027
Author: patrick_leb <>
Date:   Mon Jan 28 21:19:05 2002 +0000

    Lots of fixes for lots of things
---
 Java.pm                                      | 10 +++-
 Java/Init.pm                                 |  7 ++-
 Java/JNI.xs                                  | 16 ++++--
 Java/JVM.pm                                  | 68 +++++++++++++++++++---
 Java/Protocol.pm                             | 19 +++++++
 t/03_objects.t                               | 13 ++++-
 t/09_usages.t                                | 69 +++++++++++++++++++++++
 t/{09_shared_alone.t => 10_1_shared_alone.t} | 18 +-----
 t/{09_shared_alone.t => 10_2_shared_start.t} | 27 +++------
 t/{09_shared_alone.t => 10_3_shared_use.t}   | 25 +++------
 t/{09_shared_alone.t => 10_4_shared_stop.t}  | 27 +++------
 t/{11_shared_fork.t => 10_5_shared_fork.t}   | 30 +++-------
 t/10_shared_mult.t                           | 84 ----------------------------
 t/13_callbacks.t                             | 11 +++-
 t/CGI.cgi                                    | 33 +++++++++++
 t/MOD_PERL.pm                                | 37 ++++++++++++
 t/counter.java                               | 19 +++++++
 t/shared.java                                |  4 ++
 t/t1.pl                                      |  3 +
 19 files changed, 326 insertions(+), 194 deletions(-)

diff --git a/Java.pm b/Java.pm
index 7c9d693..f87c8de 100644
--- a/Java.pm
+++ b/Java.pm
@@ -73,7 +73,7 @@ sub done {
 	
 	Inline::Java::debug("exiting with $ec") ;
 
-	exit($ec) ;
+	CORE::exit($ec) ;
 }
 
 
@@ -587,6 +587,14 @@ sub load {
 	if (! $JVM){
 		$o->set_classpath($install) ;
 		$JVM = new Inline::Java::JVM($o) ;
+
+		my $pc = new Inline::Java::Protocol(undef, $o) ;
+		my $st = $pc->ServerType() ;
+		if ((($st eq "shared")&&(! $o->get_java_config('SHARED_JVM')))||
+			(($st eq "private")&&($o->get_java_config('SHARED_JVM')))){
+			set_DONE() ;
+			croak "JVM type mismatch on port " . $o->get_java_config('PORT') ;
+		}
 	}
 
 	# Add our Inline object to the list.
diff --git a/Java/Init.pm b/Java/Init.pm
index ab1b232..774eee3 100644
--- a/Java/Init.pm
+++ b/Java/Init.pm
@@ -124,7 +124,12 @@ public class InlineJavaServer {
 
 
 	private void init(){
-		instance = this ;		
+		instance = this ;
+	}
+
+	
+	public String GetType(){
+		return (shared_jvm ? "shared" : "private") ;
 	}
 
 
diff --git a/Java/JNI.xs b/Java/JNI.xs
index 141c139..8f57542 100644
--- a/Java/JNI.xs
+++ b/Java/JNI.xs
@@ -67,15 +67,23 @@ jstring JNICALL jni_callback(JNIEnv *env, jobject obj, jstring cmd){
 
 	SPAGAIN ;
 
+	/*
+		Here is is important to understand that we cannot croak,
+		because our caller is Java and not Perl. Croaking here
+		scrwes up the Java stack royally and causes crashes.
+	*/
+
 	/* Check the eval */
 	if (SvTRUE(ERRSV)){
 		STRLEN n_a ;
-		croak(SvPV(ERRSV, n_a)) ;
+		fprintf(stderr, "%s", SvPV(ERRSV, n_a)) ;
+		exit(-1) ;
 	}
 	else{
 		if (count != 2){
-			croak("Invalid return value from Inline::Java::Callback::InterceptCallback: %d",
+			fprintf(stderr, "%s", "Invalid return value from Inline::Java::Callback::InterceptCallback: %d",
 				count) ;
+			exit(-1) ;
 		}
 	}
 
@@ -115,7 +123,7 @@ new(CLASS, classpath, debug)
 
 	PREINIT:
 	JavaVMInitArgs vm_args ;
-	JavaVMOption options[2] ;
+	JavaVMOption options[8] ;
 	JNIEnv *env ;
 	JNINativeMethod nm ;
 	jint res ;
@@ -218,6 +226,7 @@ process_command(this, data)
 
 	CODE:
 	env = get_env(this) ;
+	printf(":%s:\n", data) ;
 	cmd = (*(env))->NewStringUTF(env, data) ;
 	check_exception(env, "Can't create java.lang.String") ;
 
@@ -234,4 +243,3 @@ process_command(this, data)
 
 	CLEANUP:
 	(*(env))->ReleaseStringUTFChars(env, resp, RETVAL) ;
-	(*(env))->DeleteLocalRef(env, resp) ;
diff --git a/Java/JVM.pm b/Java/JVM.pm
index 8304162..301fd18 100644
--- a/Java/JVM.pm
+++ b/Java/JVM.pm
@@ -8,6 +8,8 @@ $Inline::Java::JVM::VERSION = '0.31' ;
 use Carp ;
 use IPC::Open3 ;
 use IO::File ;
+use IO::Pipe ;
+use POSIX qw(setsid) ;
 
 my %SIGS = () ;
 
@@ -77,7 +79,12 @@ sub new {
 
 		my $pid = 0 ;
 		eval {
-			$pid = $this->launch($cmd) ;
+			if (Inline::Java::Portable::portable('GOT_FORK')){
+				$pid = $this->launch($cmd) ;
+			}	
+			else{
+				$pid = $this->launch($cmd) ;
+			}
 		} ;
 		croak "Can't exec JVM: $@" if $@ ;
 
@@ -98,10 +105,21 @@ sub launch {
 	my $this = shift ;
 	my $cmd = shift ;
 
-	my $in = new IO::File() ;
-	my $pid = open3($in, ">&STDOUT", ">&STDERR", $cmd) ;
-	# We won't be sending anything to the child in this fashion...
+	my $dn = File::Spec->devnull() ;
+	my $in = new IO::File("<$dn") ;
+	if (! defined($in)){
+		croak "Can't open $dn for reading" ;
+	}
+	my $out = new IO::File(">$dn") ;
+	if (! defined($out)){
+		croak "Can't open $dn for writing" ;
+	}
+	
+	local $SIG{__WARN__} = sub {} ;
+	my $pid = open3($in, $out, ">&STDERR", $cmd) ;
+
 	close($in) ;
+	close($out) ;
 
 	return $pid ;
 }
@@ -111,16 +129,48 @@ sub fork_launch {
 	my $this = shift ;
 	my $cmd = shift ;
 
-	my $pid = fork() ;
-	if (! $pid){
-		# Child 
-		$pid = $this->launch($cmd) ;
+	# Setup pipe with our child
+	my $c2p = new IO::Pipe() ;
+
+	my $gcpid = undef ;
+	my $cpid = fork() ;
+	if (! defined($cpid)){
+		croak("Can't fork to detach JVM: $!") ;
+	}
+	elsif(! $cpid){
+		# Child
+		$c2p->writer() ; autoflush $c2p 1 ;
+
+		# Now we need to get $gcpid back to our script...
+		eval {
+ 			$gcpid = $this->launch($cmd) ;
+		} ;
+		if ($@){
+			print $c2p "$@\n" ;
+		}
+		else{
+			print $c2p "pid: $gcpid\n" ;
+		}
+		close($c2p) ;
 		Inline::Java::set_DONE() ;
 		exit() ;
 	}
 	else{
-		waitpid($pid, 0) ;
+		# Parent
+		$c2p->reader() ;
+		my $line = <$c2p> ;
+		close($c2p) ;
+		chomp($line) ;
+		if ($line =~ /^pid: (.*)$/){
+			$gcpid = $1 ;
+		}
+		else{
+			croak $line ;
+		}
+		waitpid($cpid, 0) ;
 	}
+
+	return $gcpid ;
 }
 
 
diff --git a/Java/Protocol.pm b/Java/Protocol.pm
index 758aa55..8c8f6de 100644
--- a/Java/Protocol.pm
+++ b/Java/Protocol.pm
@@ -24,6 +24,17 @@ sub new {
 }
 
 
+sub ServerType {
+	my $this = shift ;
+
+	Inline::Java::debug("getting server type") ;
+
+	my $data = "server_type" ;
+
+	return $this->Send($data, 1) ;
+}
+
+
 sub Report {
 	my $this = shift ;
 	my $classes = shift ;
@@ -430,6 +441,9 @@ class InlineJavaProtocol {
 		else if (c.equals("get_member")){
 			GetJavaMember(st) ;
 		}		
+		else if (c.equals("server_type")){
+			ServerType(st) ;
+		}
 		else if (c.equals("report")){
 			Report(st) ;
 		}
@@ -521,6 +535,11 @@ class InlineJavaProtocol {
 	}
 
 
+	void ServerType(StringTokenizer st) throws InlineJavaException {
+		SetResponse(ijs.GetType()) ;
+	}
+
+
 	void ISA(StringTokenizer st) throws InlineJavaException {
 		String class_name = st.nextToken() ;
 		Class c = ijc.ValidateClass(class_name) ;
diff --git a/t/03_objects.t b/t/03_objects.t
index 86e2fa1..1be893a 100644
--- a/t/03_objects.t
+++ b/t/03_objects.t
@@ -10,7 +10,7 @@ use Inline(
 
 
 BEGIN {
-	plan(tests => 15) ;
+	plan(tests => 16) ;
 }
 
 
@@ -28,6 +28,10 @@ my $t = new types3() ;
 	ok($t->_obj1($obj11)->get_data(), "obj11") ;
 	eval {$t->_int($obj1)} ; ok($@, qr/Can't convert (.*) to primitive int/) ;
 	eval {$t->_obj11($obj1)} ; ok($@, qr/is not a kind of/) ;
+
+	# Inner class
+	my $in = new obj13::inner_obj13($obj1) ;
+	ok($in->{data}, "inner") ;
 	
 	# Receive an unbound object and send it back
 	my $unb = $t->get_unbound() ;
@@ -72,6 +76,13 @@ class obj13 {
 	public String get_data(){
 		return data ;
 	}
+
+	public class inner_obj13 {
+		public String data = "inner" ;
+
+		public inner_obj13(){
+		}
+	}
 }
 
 class obj113 extends obj13 {
diff --git a/t/09_usages.t b/t/09_usages.t
new file mode 100755
index 0000000..59ffa58
--- /dev/null
+++ b/t/09_usages.t
@@ -0,0 +1,69 @@
+use strict ;
+use Test ;
+
+
+use Inline Config => 
+           DIRECTORY => './_Inline_test';
+
+
+BEGIN {
+	if ($ENV{PERL_INLINE_JAVA_JNI}){
+		plan(tests => 0) ;
+		exit ;
+	}
+	else{
+		plan(tests => 4) ;
+	}
+}
+
+
+
+package t09::p1 ;
+use Inline(
+	Java => qq |
+		class t09p1 {
+			public static String name = "p1" ;
+
+			public t09p1(){
+			}
+		}
+	|,
+	CLASSPATH => '[PERL_INLINE_JAVA=t09::p1, t09::p2, t09::p3]',
+	NAME => 't09::p1',
+) ;
+
+
+package t09::p2 ;
+use Inline(
+	Java => qq |
+		class t09p2 {
+			public static String name = "p2" ;
+		}
+	|,
+	NAME => 't09::p2',
+) ;
+
+
+
+package t09::p3 ;
+Inline->bind(
+	Java => qq |
+		class t09p3 {
+			public static String name = "p3" ;
+		}
+	|,
+	NAME => 't09::p3',
+) ;
+
+
+package main ;
+
+my $t = new t09::p1::t09p1() ;
+
+{
+	ok($t->{name}, "p1") ;
+	ok($t09::p2::t09p2::name . $t09::p3::t09p3::name, "p2p3") ;
+	ok($t09::p2::t09p2::name . $t09::p3::t09p3::name, "p2p3") ;
+}
+
+ok($t->__get_private()->{proto}->ObjectCount(), 1) ;
diff --git a/t/09_shared_alone.t b/t/10_1_shared_alone.t
old mode 100644
new mode 100755
similarity index 75%
copy from t/09_shared_alone.t
copy to t/10_1_shared_alone.t
index 50abe86..b8bc973
--- a/t/09_shared_alone.t
+++ b/t/10_1_shared_alone.t
@@ -17,12 +17,12 @@ use Inline Config =>
            DIRECTORY => './_Inline_test' ;
 
 use Inline (
-	Java => 'DATA',
+	Java => 't/shared.java',
 	SHARED_JVM => 1,
 ) ;
 
 
-my $t = new t9() ;
+my $t = new t10() ;
 
 {
 	ok($t->{i}, 5) ;
@@ -30,17 +30,3 @@ my $t = new t9() ;
 }
 
 ok($t->__get_private()->{proto}->ObjectCount(), 1) ;
-
-
-__END__
-
-__Java__
-
-class t9 {
-	static public int i = 5 ;
-
-	public t9(){
-	}
-}
-
-
diff --git a/t/09_shared_alone.t b/t/10_2_shared_start.t
old mode 100644
new mode 100755
similarity index 62%
copy from t/09_shared_alone.t
copy to t/10_2_shared_start.t
index 50abe86..dc26382
--- a/t/09_shared_alone.t
+++ b/t/10_2_shared_start.t
@@ -1,3 +1,5 @@
+package t10 ;
+
 use strict ;
 use Test ;
 
@@ -8,7 +10,7 @@ BEGIN {
 		exit ;
 	}
 	else{
-		plan(tests => 3) ;
+		plan(tests => 4) ;
 	}
 }
 
@@ -17,30 +19,19 @@ use Inline Config =>
            DIRECTORY => './_Inline_test' ;
 
 use Inline (
-	Java => 'DATA',
+	Java => 't/shared.java',
 	SHARED_JVM => 1,
+	NAME => 't10',
 ) ;
 
 
-my $t = new t9() ;
-
+my $t = new t10::t10() ;
 {
-	ok($t->{i}, 5) ;
+	ok($t->{i}++, 5) ;
 	ok(Inline::Java::i_am_JVM_owner()) ;
+	Inline::Java::release_JVM() ;
+	ok(! Inline::Java::i_am_JVM_owner()) ;
 }
 
 ok($t->__get_private()->{proto}->ObjectCount(), 1) ;
 
-
-__END__
-
-__Java__
-
-class t9 {
-	static public int i = 5 ;
-
-	public t9(){
-	}
-}
-
-
diff --git a/t/09_shared_alone.t b/t/10_3_shared_use.t
old mode 100644
new mode 100755
similarity index 63%
copy from t/09_shared_alone.t
copy to t/10_3_shared_use.t
index 50abe86..c6fc169
--- a/t/09_shared_alone.t
+++ b/t/10_3_shared_use.t
@@ -1,3 +1,5 @@
+package t10 ;
+
 use strict ;
 use Test ;
 
@@ -17,30 +19,17 @@ use Inline Config =>
            DIRECTORY => './_Inline_test' ;
 
 use Inline (
-	Java => 'DATA',
+	Java => 't/shared.java',
 	SHARED_JVM => 1,
+	NAME => 't10',
 ) ;
 
 
-my $t = new t9() ;
-
+my $t = new t10::t10() ;
 {
-	ok($t->{i}, 5) ;
-	ok(Inline::Java::i_am_JVM_owner()) ;
+	ok($t->{i}++, 6) ;
+	ok(! Inline::Java::i_am_JVM_owner()) ;
 }
 
 ok($t->__get_private()->{proto}->ObjectCount(), 1) ;
 
-
-__END__
-
-__Java__
-
-class t9 {
-	static public int i = 5 ;
-
-	public t9(){
-	}
-}
-
-
diff --git a/t/09_shared_alone.t b/t/10_4_shared_stop.t
old mode 100644
new mode 100755
similarity index 62%
rename from t/09_shared_alone.t
rename to t/10_4_shared_stop.t
index 50abe86..8441237
--- a/t/09_shared_alone.t
+++ b/t/10_4_shared_stop.t
@@ -1,3 +1,5 @@
+package t10 ;
+
 use strict ;
 use Test ;
 
@@ -8,7 +10,7 @@ BEGIN {
 		exit ;
 	}
 	else{
-		plan(tests => 3) ;
+		plan(tests => 4) ;
 	}
 }
 
@@ -17,30 +19,19 @@ use Inline Config =>
            DIRECTORY => './_Inline_test' ;
 
 use Inline (
-	Java => 'DATA',
+	Java => 't/shared.java',
 	SHARED_JVM => 1,
+	NAME => 't10',
 ) ;
 
 
-my $t = new t9() ;
-
+my $t = new t10::t10() ;
 {
-	ok($t->{i}, 5) ;
+	ok($t->{i}, 7) ;
+	ok(! Inline::Java::i_am_JVM_owner()) ;
+	Inline::Java::capture_JVM() ;
 	ok(Inline::Java::i_am_JVM_owner()) ;
 }
 
 ok($t->__get_private()->{proto}->ObjectCount(), 1) ;
 
-
-__END__
-
-__Java__
-
-class t9 {
-	static public int i = 5 ;
-
-	public t9(){
-	}
-}
-
-
diff --git a/t/11_shared_fork.t b/t/10_5_shared_fork.t
old mode 100644
new mode 100755
similarity index 75%
rename from t/11_shared_fork.t
rename to t/10_5_shared_fork.t
index 6114008..d3af20e
--- a/t/11_shared_fork.t
+++ b/t/10_5_shared_fork.t
@@ -1,3 +1,5 @@
+package t10 ;
+
 use strict ;
 use Test ;
 
@@ -14,8 +16,9 @@ use Inline Config =>
            DIRECTORY => './_Inline_test' ;
 
 use Inline (
-	Java => 'DATA',
+	Java => 't/shared.java',
 	SHARED_JVM => 1,
+	NAME => 't10',
 ) ;
 
 
@@ -30,7 +33,7 @@ my $nb = 10 ;
 plan(tests => $nb + 1) ;
 
 
-$t13::i = 0 ;
+$t10::t10::i = 0 ;
 
 my $sum = (($nb) * ($nb + 1)) / 2 ;
 for (my $i = 0 ; $i < $nb ; $i++){
@@ -46,7 +49,7 @@ for (my $i = 0 ; $i < $nb ; $i++){
 	ok(1) ;
 }
 
-ok($t13::i, $sum) ;
+ok($t10::t10::i, $sum) ;
 
 
 sub do_child {
@@ -54,26 +57,9 @@ sub do_child {
 
 	Inline::Java::reconnect_JVM() ;
 
-	my $t = new t13() ;
+	my $t = new t10::t10() ;
 	for (my $j = 0 ; $j <= $i ; $j++){
-		$t->incr_i() ;
+		$t->incr() ;
 	}
 	exit ;
 }
-
-
-__DATA__
-
-__Java__
-
-
-class t13 {
-	static public int i = 0 ;
-
-	public t13(){
-	}
-
-	public void incr_i(){
-		i++ ;
-	}
-}
diff --git a/t/10_shared_mult.t b/t/10_shared_mult.t
deleted file mode 100644
index d206057..0000000
--- a/t/10_shared_mult.t
+++ /dev/null
@@ -1,84 +0,0 @@
-package t10 ;
-
-use strict ;
-use Test ;
-
-
-BEGIN {
-	if ($ENV{PERL_INLINE_JAVA_JNI}){
-		plan(tests => 0) ;
-		exit ;
-	}
-	else{
-		plan(tests => 8) ;
-	}
-}
-
-
-use Inline Config => 
-           DIRECTORY => './_Inline_test' ;
-
-use Inline (
-	Java => 't/shared.java',
-	SHARED_JVM => 1,
-	NAME => 't10',
-) ;
-
-
-eval <<CODE1;
-	my \$t = new t10::t10() ;
-	{
-		ok(\$t->{i}++, 5) ;
-		ok(Inline::Java::i_am_JVM_owner()) ;
-		Inline::Java::release_JVM() ;
-		ok(! Inline::Java::i_am_JVM_owner()) ;
-	}
-CODE1
-if ($@){
-	die($@) ;
-}
-
-my $JVM1 = Inline::Java::__get_JVM() ;
-$JVM1->{destroyed} = 1 ;
-Inline::Java::__clear_JVM() ;
-
-eval <<CODE2;
-	use Inline (
-		Java => 't/shared.java',
-		SHARED_JVM => 1,
-		NAME => 't10',
-	) ;
-
-	my \$t = new t10::t10() ;
-	{
-		ok(\$t->{i}++, 6) ;
-		ok(! Inline::Java::i_am_JVM_owner()) ;
-	}
-CODE2
-if ($@){
-	die($@) ;
-}
-
-my $JVM2 = Inline::Java::__get_JVM() ;
-$JVM2->{destroyed} = 1 ;
-Inline::Java::__clear_JVM() ;
-
-eval <<CODE3;
-	use Inline (
-		Java => 't/shared.java',
-		SHARED_JVM => 1,
-		NAME => 't10',
-	) ;
-
-	my \$t = new t10::t10() ;
-	{
-		ok(\$t->{i}, 7) ;
-		ok(! Inline::Java::i_am_JVM_owner()) ;
-		Inline::Java::capture_JVM() ;
-		ok(Inline::Java::i_am_JVM_owner()) ;
-	}
-CODE3
-if ($@){
-	die($@) ;
-}
-
diff --git a/t/13_callbacks.t b/t/13_callbacks.t
index 7e26893..6aa7fb6 100644
--- a/t/13_callbacks.t
+++ b/t/13_callbacks.t
@@ -14,7 +14,11 @@ use Inline::Java qw(caught) ;
 
 
 BEGIN {
-	plan(tests => 20) ;
+	my $cnt = 20 ;
+	if ($ENV{PERL_INLINE_JAVA_JNI}){
+		$cnt-- ;
+	}
+	plan(tests => $cnt) ;
 }
 
 my $t = new t15() ;
@@ -60,7 +64,10 @@ my $t = new t15() ;
 
 		ok($t->perlt()->add(5, 6), 11) ;
 
-		eval {$t->perldummy()} ; ok($@, qr/Can't propagate non-/) ;
+		if (! $ENV{PERL_INLINE_JAVA_JNI}){
+			# This a fatal error under JNI.
+			eval {$t->perldummy()} ; ok($@, qr/Can't propagate non-/) ;
+		}
 	} ;
 	if ($@){
 		if (caught("java.lang.Throwable")){
diff --git a/t/CGI.cgi b/t/CGI.cgi
new file mode 100755
index 0000000..a1b9716
--- /dev/null
+++ b/t/CGI.cgi
@@ -0,0 +1,33 @@
+#!/usr/bin/perl
+
+package t::CGI ;
+
+use strict ;
+
+use CGI ;
+
+use Inline (
+	Java => '/home/patrickl/perl/dev/Inline-Java/t/counter.java',
+	DIRECTORY => '/home/patrickl/perl/dev/Inline-Java/_Inline_web_test',
+	BIN => '/usr/java/jdk1.3.1/bin',
+	SHARED_JVM => 1,
+	NAME => 't::CGI',
+) ;
+
+Inline::Java::release_JVM() ;
+
+my $cnt = new t::CGI::counter() ;
+
+my $gnb = $cnt->gincr() ;
+my $nb = $cnt->incr() ;
+
+my $q = new CGI() ;
+print "Content-type: text/html\n\n" ;
+print 
+	$q->start_html() .
+	"Inline-Java says this page received $gnb hits!<BR>" .
+	"Inline-Java says this CGI ($$) served $nb of those hits." .
+	$q->end_html() ;		
+
+
+1 ;
diff --git a/t/MOD_PERL.pm b/t/MOD_PERL.pm
new file mode 100755
index 0000000..f845a0a
--- /dev/null
+++ b/t/MOD_PERL.pm
@@ -0,0 +1,37 @@
+#!/usr/bin/perl
+
+package t::MOD_PERL ;
+
+use strict ;
+
+use CGI ;
+
+use Inline (
+	Java => '/home/patrickl/perl/dev/Inline-Java/t/counter.java',
+	DIRECTORY => '/home/patrickl/perl/dev/Inline-Java/_Inline_web_test',
+	BIN => '/usr/java/jdk1.3.1/bin',
+	NAME => 't::MOD_PERL',
+	SHARED_JVM => 1,
+) ;
+
+
+Inline::Java::release_JVM() ;
+
+my $cnt = new t::MOD_PERL::counter() ;
+
+
+sub handler {
+	my $gnb = $cnt->gincr() ;
+	my $nb = $cnt->incr() ;
+
+	my $q = new CGI() ;
+	print 
+		$q->start_html() .
+		"Inline-Java says this page received $gnb hits!<BR>" .
+		"Inline-Java says this MOD_PERL ($$) served $nb of those hits." .
+		$q->end_html() ;
+}
+
+
+1 ;
+
diff --git a/t/counter.java b/t/counter.java
new file mode 100644
index 0000000..2c0c4e5
--- /dev/null
+++ b/t/counter.java
@@ -0,0 +1,19 @@
+class counter {
+	static private int global_i = 0 ;
+	private int i = 0 ;
+
+	public counter(){
+	}
+
+	static public int gincr(){
+		global_i++ ;
+		return global_i ;
+	}
+
+	public int incr(){
+		i++ ;
+		return i ;
+	}
+}
+
+
diff --git a/t/shared.java b/t/shared.java
index 9c7c2a1..c6c45d7 100644
--- a/t/shared.java
+++ b/t/shared.java
@@ -3,5 +3,9 @@ class t10 {
 
 	public t10(){
 	}
+
+	public void incr(){
+		i++ ;
+	}
 }
 
diff --git a/t/t1.pl b/t/t1.pl
index 9e6fa3d..664a66f 100755
--- a/t/t1.pl
+++ b/t/t1.pl
@@ -19,8 +19,11 @@ use Inline (
 			}
 		}
 	|, 
+	SHARED_JVM => 1,
 ) ;
 
+Inline::Java::release_JVM() ;
+
 my $t = new t() ;
 $t::s++ ;
 $t::s++ ;

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-perl/packages/libinline-java-perl.git



More information about the Pkg-perl-cvs-commits mailing list