[Remoterengine-commits] r159 - in pkg/RemoteREngine/inst/java_src: . lib src/client/org/rosuda/REngine/remote/client src/common/org/rosuda/REngine/remote/common src/server/org/rosuda/REngine/remote/server
noreply at r-forge.r-project.org
noreply at r-forge.r-project.org
Fri Sep 18 16:20:22 CEST 2009
Author: romain
Date: 2009-09-18 16:20:22 +0200 (Fri, 18 Sep 2009)
New Revision: 159
Modified:
pkg/RemoteREngine/inst/java_src/build.xml
pkg/RemoteREngine/inst/java_src/lib/REngine.jar
pkg/RemoteREngine/inst/java_src/src/client/org/rosuda/REngine/remote/client/RemoteREngine.java
pkg/RemoteREngine/inst/java_src/src/common/org/rosuda/REngine/remote/common/JRIEngineGlobalVariables.java
pkg/RemoteREngine/inst/java_src/src/server/org/rosuda/REngine/remote/server/RemoteREngine_Server.java
Log:
updated REngine patch
Modified: pkg/RemoteREngine/inst/java_src/build.xml
===================================================================
--- pkg/RemoteREngine/inst/java_src/build.xml 2009-09-18 13:18:38 UTC (rev 158)
+++ pkg/RemoteREngine/inst/java_src/build.xml 2009-09-18 14:20:22 UTC (rev 159)
@@ -74,7 +74,6 @@
<pathelement location="${server.dir}" />
<pathelement location="${rengine.jar}" />
<pathelement location="${jriengine.jar}" />
- <pathelement location="${jri.jar}" />
</path>
@@ -115,7 +114,6 @@
<pathelement location="${common.dir}" />
<pathelement location="${rengine.jar}" />
<pathelement location="${jriengine.jar}" />
- <pathelement location="${jri.jar}" />
</path>
<target name="server" depends="common">
@@ -170,7 +168,6 @@
<pathelement location="${client.dir}" />
<pathelement location="${rengine.jar}" />
<pathelement location="${jriengine.jar}" />
- <pathelement location="${jri.jar}" />
</path>
@@ -274,7 +271,6 @@
<!-- server jar -->
<unjar src="${jriengine.jar}" dest="${server.dir}" />
- <unjar src="${jri.jar}" dest="${server.dir}" />
<unjar src="${rengine.jar}" dest="${server.dir}" />
<jar jarfile="${jar.dir}/RemoteREngine-server.jar" manifest="build/MANIFEST.MF">
Modified: pkg/RemoteREngine/inst/java_src/lib/REngine.jar
===================================================================
(Binary files differ)
Modified: pkg/RemoteREngine/inst/java_src/src/client/org/rosuda/REngine/remote/client/RemoteREngine.java
===================================================================
--- pkg/RemoteREngine/inst/java_src/src/client/org/rosuda/REngine/remote/client/RemoteREngine.java 2009-09-18 13:18:38 UTC (rev 158)
+++ pkg/RemoteREngine/inst/java_src/src/client/org/rosuda/REngine/remote/client/RemoteREngine.java 2009-09-18 14:20:22 UTC (rev 159)
@@ -30,7 +30,6 @@
import java.rmi.registry.LocateRegistry;
import java.rmi.registry.Registry;
import java.rmi.server.UnicastRemoteObject;
-import java.util.Map;
import org.rosuda.REngine.REXP;
import org.rosuda.REngine.REXPMismatchException;
@@ -38,9 +37,9 @@
import org.rosuda.REngine.REXPReference;
import org.rosuda.REngine.REngine;
import org.rosuda.REngine.REngineException;
-import org.rosuda.REngine.REnginePool;
+import org.rosuda.REngine.REngineRegistry;
+import org.rosuda.REngine.UniqueID;
import org.rosuda.REngine.remote.client.callbacks.ClientCallbackDispatcher;
-import org.rosuda.REngine.remote.common.CommandLineArgs;
import org.rosuda.REngine.remote.common.JRIEngineGlobalVariables;
import org.rosuda.REngine.remote.common.RemoteREngineClient;
import org.rosuda.REngine.remote.common.RemoteREngineConstants;
@@ -95,7 +94,7 @@
/**
* the hashcode of the server this shadows
*/
- private int serverHashCode ;
+ private UniqueID engine_id ;
/**
* Is this engine valid ?
@@ -119,6 +118,8 @@
if (name == null || name.length()==0) {
System.err.println("RMI Name of remote engine not defined");
}
+ nullValue = new REXPNull() ;
+
try{
Registry reg = LocateRegistry.getRegistry(registryHost, port);
engine = (RemoteREngineInterface) reg.lookup(name);
@@ -128,18 +129,18 @@
UnicastRemoteObject.exportObject(this) ;
JRIEngineGlobalVariables variables = engine.subscribe(this) ;
callbackDispatcher = new ClientCallbackDispatcher(this) ;
- callbackDispatcher.start();
- serverHashCode = variables.hashCode ;
- globalEnv = variables.globalEnv ;
- emptyEnv = variables.emptyEnv ;
- baseEnv = variables.baseEnv ;
- nullValueRef = variables.nullValueRef ;
- nullValue = variables.nullValue ;
+ engine_id = variables.engine_id ;
+ globalEnv = new REXPReference( this, new Long( variables.p_globalEnv ) ) ;
+ emptyEnv = new REXPReference( this, new Long( variables.p_emptyEnv ) );
+ baseEnv = new REXPReference( this, new Long( variables.p_baseEnv)) ;
+ nullValueRef = new REXPReference( this, new Long( variables.p_nullValueRef ) );
+
/* store this engine in the pool */
- REnginePool.add( this, serverHashCode );
+ REngineRegistry.add( this, engine_id );
+ callbackDispatcher.start();
+
valid = true;
-
} catch ( NotBoundException nb) {
System.out.println("Unable to locate " + name + " within RMI Registry");
} catch( Exception e ){
@@ -471,7 +472,7 @@
baseEnv = null ;
nullValueRef = null;
nullValue = null;
- serverHashCode = Integer.MIN_VALUE ;
+ engine_id = null;
}
/**
Modified: pkg/RemoteREngine/inst/java_src/src/common/org/rosuda/REngine/remote/common/JRIEngineGlobalVariables.java
===================================================================
--- pkg/RemoteREngine/inst/java_src/src/common/org/rosuda/REngine/remote/common/JRIEngineGlobalVariables.java 2009-09-18 13:18:38 UTC (rev 158)
+++ pkg/RemoteREngine/inst/java_src/src/common/org/rosuda/REngine/remote/common/JRIEngineGlobalVariables.java 2009-09-18 14:20:22 UTC (rev 159)
@@ -21,8 +21,8 @@
import java.io.Serializable;
-import org.rosuda.REngine.REXPNull;
import org.rosuda.REngine.REXPReference;
+import org.rosuda.REngine.UniqueID;
/**
* Encapsulates global variables of the JRIEngine
@@ -35,41 +35,35 @@
private static final long serialVersionUID = 1L;
/** reference to the global environment */
- public REXPReference globalEnv ;
+ public long p_globalEnv ;
/** reference to the empty environment */
- public REXPReference emptyEnv ;
+ public long p_emptyEnv ;
/** reference to the base environment */
- public REXPReference baseEnv ;
+ public long p_baseEnv ;
/** reference to the NULL value */
- public REXPReference nullValueRef;
+ public long p_nullValueRef;
+
+ /** identifier of the server side (real) engine */
+ public UniqueID engine_id;
- /** canonical NULL object */
- public REXPNull nullValue;
-
- /** hash code of the engine */
- public int hashCode ;
-
/**
* Constructor. Holds the values of the engine
- * @param r Real server side R engine
- */
+ */
public JRIEngineGlobalVariables(
- REXPReference globalEnv,
- REXPReference emptyEnv,
- REXPReference baseEnv,
- REXPReference nullValueRef,
- REXPNull nullValue,
- int hashCode
+ long p_globalEnv,
+ long p_emptyEnv,
+ long p_baseEnv,
+ long p_nullValueRef,
+ UniqueID engine_id
){
- this.globalEnv = globalEnv ;
- this.emptyEnv = emptyEnv ;
- this.baseEnv = baseEnv ;
- this.nullValue = nullValue ;
- this.nullValueRef = nullValueRef ;
- this.hashCode = hashCode ;
+ this.p_globalEnv = p_globalEnv ;
+ this.p_emptyEnv = p_emptyEnv ;
+ this.p_baseEnv = p_baseEnv ;
+ this.p_nullValueRef = p_nullValueRef ;
+ this.engine_id = engine_id ;
}
}
Modified: pkg/RemoteREngine/inst/java_src/src/server/org/rosuda/REngine/remote/server/RemoteREngine_Server.java
===================================================================
--- pkg/RemoteREngine/inst/java_src/src/server/org/rosuda/REngine/remote/server/RemoteREngine_Server.java 2009-09-18 13:18:38 UTC (rev 158)
+++ pkg/RemoteREngine/inst/java_src/src/server/org/rosuda/REngine/remote/server/RemoteREngine_Server.java 2009-09-18 14:20:22 UTC (rev 159)
@@ -34,7 +34,9 @@
import org.rosuda.JRI.Rengine;
import org.rosuda.REngine.REXP;
import org.rosuda.REngine.REXPMismatchException;
+import org.rosuda.REngine.REXPReference;
import org.rosuda.REngine.REngineException;
+import org.rosuda.REngine.REngineRegistry;
import org.rosuda.REngine.JRI.JRIEngine;
import org.rosuda.REngine.remote.common.JRIEngineGlobalVariables;
import org.rosuda.REngine.remote.common.RemoteREngineClient;
@@ -163,8 +165,11 @@
/* capture global variables of the JRIEngine */
variables = new JRIEngineGlobalVariables(
- r.globalEnv, r.emptyEnv, r.baseEnv,
- r.nullValueRef, r.nullValue,r.hashCode() ) ;
+ getPointer( r.globalEnv ),
+ getPointer( r.emptyEnv ) ,
+ getPointer( r.baseEnv ),
+ getPointer( r.nullValueRef) ,
+ REngineRegistry.getId(r) ) ;
try {
// Locate a local registry as RMI Servers can't register with Remote Registries
@@ -210,7 +215,7 @@
System.out.println( "R Engine bound as `"+ name +"` as a service on port " + servicePort + " to local RMIRegistry running on port " + registryPort );
running = true;
}
-
+
/**
* Constructor initializing R with the default arguments - service will run on a randomly assigned port
*
@@ -574,5 +579,10 @@
return callbackListeners ;
}
+
+ private long getPointer( REXPReference ref){
+ return ( (Long)ref.getHandle() ).longValue() ;
+ }
+
}
More information about the Remoterengine-commits
mailing list