+ /**
+ * Method addAdditionalPort()
+ * <p>
+ * Add a new port for new connections for any objects in the program.
+ * This newly generated port number will be recorded.
+ *
+ * @return int One new port
+ */
+ public int addAdditionalPort(String sAObject) {
+
+ hmActiveObj.put(sAObject, iNumOfObjects);
+
+ int iAdditionalPort = 0;
+ do {
+ iAdditionalPort = random.nextInt(INT_MAX_PORT - INT_MIN_PORT + 1) + INT_MIN_PORT;
+ // Check port existence in HashMap
+ } while (portIsAvailable(iAdditionalPort) == false);
+ hmAdditionalPort.put(iNumOfObjects, iAdditionalPort);
+
+ iNumOfObjects++;
+
+ return iAdditionalPort;
+ }
+