Raúl Kripalani created IGNITE-1237:
--------------------------------------

             Summary: IP Finders should have a lifecycle
                 Key: IGNITE-1237
                 URL: https://issues.apache.org/jira/browse/IGNITE-1237
             Project: Ignite
          Issue Type: Improvement
          Components: general
            Reporter: Raúl Kripalani
            Assignee: Raúl Kripalani


Currently TCP Discovery IP Finders do not have a lifecycle. As a consequence, 
in all existing implementations, calls to the {{registerAddresses}}, 
{{unregisterAddresses}}, {{getRegisteredAddresses}} end up performing lazy 
initialisation (via a private {{init}} method).

Unfortunately this design doesn't give an IP Finder a chance to destroy any 
resources cleanly.

I tried overriding the parent's {{onSpiContextInitialized}} and 
{{onSpiContextDestroyed}}, but unfortunately I did not get any callbacks. At 
least not when initializing the grid from a JUnit test:

{code}
public void testOneIgniteNodeIsAlone() throws Exception {
        TcpDiscoveryZookeeperIpFinder zkIpFinder = new 
TcpDiscoveryZookeeperIpFinder();
        zkIpFinder.setZkUrl(zkCluster.getConnectString());

        IgniteConfiguration config = newIgniteConfigWithZk(zkIpFinder);

        startGrid("zkgrid", config);

        Assert.assertEquals(1, grid().cluster().metrics().getTotalNodes());


    }

    private IgniteConfiguration 
newIgniteConfigWithZk(TcpDiscoveryZookeeperIpFinder zkIpFinder) throws 
Exception {
        IgniteConfiguration configuration = super.getConfiguration();
        TcpDiscoverySpi tcpDisco = (TcpDiscoverySpi) 
configuration.getDiscoverySpi();
        tcpDisco.setIpFinder(zkIpFinder);
        return configuration;
    }
{code}

(just pasting my code here in case the culprit of not receiving callbacks is 
the way I start the grid)



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

Reply via email to