Removing callback port feature from master and slave
[iot2.git] / iotjava / iotruntime / master / CommunicationHandler.java
index def3e77b653e6e723f421ad7516b1e8bcd645df9..15db69022eeaf98d0c04adcac6f2d1c8847ea8c0 100644 (file)
@@ -67,8 +67,6 @@ public final class CommunicationHandler {
        private Map<Integer, Integer> hmRMIRegPort;
        private Map<Integer, Integer> hmRMIStubPort;
        private Set<Integer> hsDevicePort;
-       private Set<Integer> hsCallbackPort;
-       private Map<Integer, Integer[]> hmCallbackPort;
        private Map<Integer, Integer> hmAdditionalPort;
        private int iNumOfObjects;
        private int iNumOfHosts;
@@ -98,8 +96,6 @@ public final class CommunicationHandler {
                hmRMIRegPort = new HashMap<Integer, Integer>();
                hmRMIStubPort = new HashMap<Integer, Integer>();
                hsDevicePort = new HashSet<Integer>();
-               hsCallbackPort = new HashSet<Integer>();
-               hmCallbackPort = new HashMap<Integer, Integer[]>();
                hmAdditionalPort = new HashMap<Integer, Integer>();
                iNumOfObjects = 0;
                iNumOfHosts = 0;
@@ -186,61 +182,6 @@ public final class CommunicationHandler {
                listObjCrtInfo.add(objCrtInfo);
        }
 
-
-       /**
-        * Method getCallbackPort()
-        * <p>
-        * Get a new port for new connections for callback objects in the program.
-        * This newly generated port number will be recorded.
-        *
-        * @return  int[]       A set of callback ports
-        */
-       public int[] getCallbackPorts(int numOfPorts) {
-
-               int[] ports = new int[numOfPorts];
-
-               for(int i = 0; i < numOfPorts; i++) {
-                       do {
-                               ports[i] = random.nextInt(INT_MAX_PORT - INT_MIN_PORT + 1) + INT_MIN_PORT;
-                               // Check port existence in HashMap
-                       } while (portIsAvailable(ports[i]) == false);
-                       hsCallbackPort.add(ports[i]);
-               }
-
-               return ports;
-       }
-
-
-       /**
-        * Method getCallbackPorts()
-        * <p>
-        * Get a set of new ports for new connections for callback objects in the program.
-        * This newly generated port number will be recorded.
-        *
-        * @return  int[]       A set of callback ports
-        */
-       public Integer[] getCallbackPorts(String sAObject, int numOfPorts) {
-
-               Integer[] ports = new Integer[numOfPorts];
-               int iNumOfObject = hmActiveObj.get(sAObject);
-
-               if (!hmCallbackPort.containsKey(iNumOfObject)) {
-                       for(int i = 0; i < numOfPorts; i++) {
-                               do {
-                                       ports[i] = random.nextInt(INT_MAX_PORT - INT_MIN_PORT + 1) + INT_MIN_PORT;
-                                       // Check port existence in HashMap
-                               } while (portIsAvailable(ports[i]) == false);
-                               hsCallbackPort.add(ports[i]);
-                       }
-                       hmCallbackPort.put(iNumOfObject, ports);
-               } else {
-                       ports = hmCallbackPort.get(iNumOfObject);
-               }
-
-               return ports;
-       }
-
-
        /**
         * Method addDevicePort()
         * <p>
@@ -302,8 +243,6 @@ public final class CommunicationHandler {
                        return false;
                } else if (hsDevicePort.contains(iPortNumber) == true) {
                        return false;
-               } else if (hsCallbackPort.contains(iPortNumber) == true) {
-                       return false;
                } else {
                        return true;
                }
@@ -523,9 +462,6 @@ public final class CommunicationHandler {
                                RuntimeOutput.print("\n", bVerbose);
                        }
                }
-               for(Integer i : hsCallbackPort)
-                       RuntimeOutput.print("RMI callback Port: " + i, bVerbose);
-               RuntimeOutput.print("\n", bVerbose);
 
                for(int iPort : hsDevicePort) {
                        RuntimeOutput.print("Device Port: " + iPort, bVerbose);