Class InterfaceToNodeCacheDaoImpl

    • Constructor Detail

      • InterfaceToNodeCacheDaoImpl

        public InterfaceToNodeCacheDaoImpl()
      • InterfaceToNodeCacheDaoImpl

        public InterfaceToNodeCacheDaoImpl​(long refreshRate)
    • Method Detail

      • init

        @PostConstruct
        public void init()
      • destroy

        @PreDestroy
        public void destroy()
      • 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:
        java.sql.SQLException - Thrown if the connection cannot be created or a database error occurs.
      • getNodeId

        public java.lang.Iterable<java.lang.Integer> getNodeId​(java.lang.String location,
                                                               java.net.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​(java.lang.String location,
                                 java.net.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​(java.lang.String location,
                                    java.net.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.