Adjustments in stubs and skeletons for callback in callback; using different ports...
[iot2.git] / iotjava / iotruntime / slave / IoTSlave.java
index a2def7c4e486768d7ed952bf488407579f4079c3..856431a1f1fbe5d95f1c02ea854df100a01402cc 100644 (file)
@@ -31,6 +31,7 @@ import java.rmi.RemoteException;
 import java.rmi.AlreadyBoundException;
 import java.rmi.NotBoundException;
 import java.rmi.server.UnicastRemoteObject;
+import java.util.Arrays;
 import java.util.Properties;
 import java.util.HashMap;
 import java.util.Map;
@@ -202,7 +203,7 @@ public class IoTSlave {
         * @return  void
         */
        private void createCapabBasedRMIJava(MessageCreateObject sMessage) throws 
-               ClassNotFoundException, NoSuchMethodException {
+               ClassNotFoundException, NoSuchMethodException, UnknownHostException {
 
                // Instantiate the skeleton and put in the object
                String strObjSkelName = STR_OBJ_CLS_PFX + "." + sMessage.getObjectClass() +
@@ -438,7 +439,8 @@ public class IoTSlave {
                Class<?> clsStub = Class.forName(strObjStubName);       // Port number is integer
                Class[] clsStubParams = { int.class, String.class, String.class, int.class, int[].class };
                Constructor<?> objStubCons = clsStub.getDeclaredConstructor(clsStubParams);
-               int[] ports = { sMessage.getRMIRegPort() };             // TODO: Change this temporary use of reg port for callbacks
+               Integer[] portsInteger = sMessage.getRMICallbackPorts();
+               int[] ports = Arrays.stream(portsInteger).mapToInt(Integer::intValue).toArray();
                int rev = 0;
                String callbackAddress = InetAddress.getLocalHost().getHostAddress();   // Callback address is this machine's address
                Object objStubParams[] = { sMessage.getRMIStubPort(), sMessage.getHostAddress(), callbackAddress,