Class InterfaceToNodeCacheDaoImpl

    • Constructor Detail

      • InterfaceToNodeCacheDaoImpl

        public InterfaceToNodeCacheDaoImpl()
      • InterfaceToNodeCacheDaoImpl

        public InterfaceToNodeCacheDaoImpl​(long refreshRate)
    • Method Detail

      • getNodeDao

        public NodeDao getNodeDao()
      • setNodeDao

        public void setNodeDao​(NodeDao nodeDao)
      • setIpInterfaceDao

        public void setIpInterfaceDao​(IpInterfaceDao ipInterfaceDao)
      • dataSourceSync

        @Transactional
        public void dataSourceSync()
        Clears and synchronizes the internal known IP address cache with the current information contained in the database. To synchronize the cache the method opens a new connection to the database, loads the address, and then closes it's connection.
        Specified by:
        dataSourceSync in interface InterfaceToNodeCache
        Throws:
        SQLException - Thrown if the connection cannot be created or a database error occurs.
      • getNodeId

        public Iterable<Integer> getNodeId​(String location,
                                           InetAddress address)
        Returns the nodeid for the IP Address

        If multiple nodes hav assigned interfaces with the same IP, this returns all known nodes sorted by the interface management priority.

        Specified by:
        getNodeId in interface InterfaceToNodeCache
        Parameters:
        address - The IP Address to query.
        Returns:
        The node ID of the IP Address if known.
      • setNodeId

        @Transactional
        public boolean setNodeId​(String location,
                                 InetAddress addr,
                                 int nodeid)
        Sets the IP Address and Node ID in the Map.
        Specified by:
        setNodeId in interface InterfaceToNodeCache
        Parameters:
        addr - The IP Address to add.
        nodeid - The Node ID to add.
        Returns:
        The nodeid if it existed in the map.
      • removeNodeId

        public boolean removeNodeId​(String location,
                                    InetAddress address,
                                    int nodeId)
        Removes an address from the node ID map.
        Specified by:
        removeNodeId in interface InterfaceToNodeCache
        Parameters:
        address - The address to remove from the node ID map.
        Returns:
        The nodeid that was in the map.