This content has been marked as final. Show 4 replies
You do not necessarily need to put anything inside the accept() method; in our AddressProvider implementation this method is empty. You do not call anything on the AddressProvider, you just put it into the correct places in the configuration file(s) and Coherence will call it. I know the Java Docs say that methods are called by the "client" but that really means called by Coherence.
The only method you really must implement is the getNextAddress() method so that it returns an InetSocketAddress whenever Coherence asks for one. In theory you could just keep returning the same address over and over again and everything would work (providing the address is valid).
As the Java Docs say, the accept() method is called after Coherence has successfully used the address you gave it to connect. The reject() method is called if Coherence tried to use the address that it was given for something but the operation failed.
Removed the content
Edited by: Shiva K on Apr 4, 2013 2:45 PM
It works on client side in remote-cache-scheme definition.
Not on the cluster/server side. cache-server.cmd/DefaultCacheServer hangs. As soon as I hardcode the addresses ( <socket-address>), it comes up without any issue.
What do you think I am missing..
Edited by: Shiva K on Apr 4, 2013 2:46 PM
It depends what your AddressProvider is doing. If all it does in getNextAddress is keep returning the same address, and if that address is not reachable then Coherence will get stuck in a loop calling your provider, trying to connect to the socket, failing to connect, then calling your provider again and so on.
If you are going to use an AddressProvider for WKA then you need to implement the reject method so that you know not to return failed addresses next time the provider is asked for one. If you have used up all the addresses, i.e. they all failed, then you return null from getNextAddress.