[libinline-java-perl] 73/398: *** empty log message ***

Jonas Smedegaard dr at jones.dk
Thu Feb 26 11:42:49 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 819557209e4d9d3c181f2cbfd2acc77f2274b574
Author: patrick <>
Date:   Fri Apr 20 16:00:43 2001 +0000

    *** empty log message ***
---
 Java/Init.pm |  7 +++++--
 Java/JVM.pm  | 44 ++++++++++++++++----------------------------
 2 files changed, 21 insertions(+), 30 deletions(-)

diff --git a/Java/Init.pm b/Java/Init.pm
index 1fcf8e8..bc97ae5 100644
--- a/Java/Init.pm
+++ b/Java/Init.pm
@@ -58,6 +58,7 @@ import java.lang.reflect.* ;
 */
 public class InlineJavaServer {
 	public ServerSocket ss ;
+	public Socket client ;
 	boolean debug = false ;
 
 	public HashMap objects = new HashMap() ;
@@ -77,7 +78,7 @@ public class InlineJavaServer {
 
 		try {
 			ss = new ServerSocket(port) ;
-			Socket client = ss.accept() ;
+			client = ss.accept() ;
 
 			BufferedReader br = new BufferedReader(
 				new InputStreamReader(client.getInputStream())) ;
@@ -117,6 +118,8 @@ public class InlineJavaServer {
 			}
 		}
 		else{
+			// Probably connection dropped...
+			debug("  Lost connection with client") ;
 			System.exit(1) ;
 		}
 
@@ -164,7 +167,7 @@ public class InlineJavaServer {
 	public static InlineJavaServer jni_main(boolean debug) {
 		return new InlineJavaServer(debug) ;
 	}
-
+	
 
 	<INLINE_JAVA_OBJECT>
 
diff --git a/Java/JVM.pm b/Java/JVM.pm
index 65e3de2..2300fcb 100644
--- a/Java/JVM.pm
+++ b/Java/JVM.pm
@@ -36,34 +36,25 @@ sub new {
 	else{
 		Inline::Java::debug("  Client/Server mode") ;
 
-		my $pid = fork() ;
-		if (! defined($pid)){
-			croak "Can't fork to start JVM" ;
-		}
+		my $debug = (Inline::Java::get_DEBUG() ? "true" : "false") ;
 
 		my $port = $o->{Java}->{PORT} ;
-		if ($pid){
-			$this->{pid} = $pid ;
-			$this->{socket}	= $this->setup_socket($port, $o->{Java}->{STARTUP_DELAY}) ;
-		}
-		else{
-			my $debug = (Inline::Java::get_DEBUG() ? "true" : "false") ;
+		my $java = $o->{Java}->{BIN} . "/java" . Inline::Java::portable("EXE_EXTENSION") ;
+		my $pjava = Inline::Java::portable("RE_FILE", $java) ;
 
-			my $java = $o->{Java}->{BIN} . "/java" . Inline::Java::portable("EXE_EXTENSION") ;
-			my $pjava = Inline::Java::portable("RE_FILE", $java) ;
+		my $cmd = "\"$pjava\" InlineJavaServer $debug $port" ;
+		Inline::Java::debug($cmd) ;
 
-			my @cmd = ($pjava, 'InlineJavaServer', $debug, $port) ;
-			Inline::Java::debug(join(" ", @cmd)) ;
+		if ($o->{config}->{UNTAINT}){
+			($cmd) = $cmd =~ /(.*)/ ;
+		}
 
-			if ($o->{config}->{UNTAINT}){
-				foreach my $cmd (@cmd){
-					($cmd) = $cmd =~ /(.*)/ ;
-				}
-			}
+		open(JVM, "$cmd|") or croak "Can't exec JVM: $!" ;
+		
+		# Use JVM to shut up the 'possible typo' warning...
+		Inline::Java::debug(*JVM) ;
 
-			exec(@cmd)
-				or croak "Can't exec JVM" ;
-		}
+		$this->{socket}	= $this->setup_socket($port, $o->{Java}->{STARTUP_DELAY}) ;
 	}
 
 	return $this ;
@@ -154,13 +145,10 @@ sub DESTROY {
 		if ($sock->connected()){
 			print $sock "die\n" ;
 		}
-		close($sock) ;
-		
-		my $pid = $this->{pid} ;
-		if ($pid){
-			my $ok = kill 9, $this->{pid} ;
-			Inline::Java::debug("killing $pid...", ($ok ? "ok" : "failed")) ;
+		else{
+			carp "Lost connection with Java virtual machine." ;
 		}
+		close($sock) ;
 	}
 
 	# For JNI we need to do nothing because the garbage collector will call

-- 
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