Esempio n. 1
0
  /**
   * Remove a port mapping from the active list
   *
   * @param portMap PortMapping
   * @return boolean
   */
  private final boolean removePortMapping(PortMapping portMap) {

    //	Remove the port mapping from the active lists

    Integer key = new Integer(portMap.hashCode());
    Object removedObj = m_mappings.remove(key);

    key =
        new Integer(PortMapping.generateHashCode(portMap.getProgramId(), 0, portMap.getProtocol()));
    m_noVerMappings.remove(key);

    //	Return a status indicating if the mapping was removed

    return removedObj != null ? true : false;
  }
Esempio n. 2
0
  /**
   * Add a port mapping to the active list
   *
   * @param portMap PortMapping
   * @return boolean
   */
  private final boolean addPortMapping(PortMapping portMap) {

    //	Check if there is an existing port mapping that matches the new port

    Integer key = new Integer(portMap.hashCode());
    if (m_mappings.get(key) != null) return false;

    //	Add the port mapping

    m_mappings.put(key, portMap);

    //	Add a port mapping with a version id of zero

    key =
        new Integer(PortMapping.generateHashCode(portMap.getProgramId(), 0, portMap.getProtocol()));
    m_noVerMappings.put(key, portMap);

    //	Indicate that the mapping was added

    return true;
  }