One of the great features of JBoss/Remoting is the ability to listen for NetworkRegistry notifications to auto-detect servers coming on and offline.
However, I have a problem. In my scenario, I have a client (call him X) that is running in an environment where there will be alot of remote servers running at any one time. But, X is only interested in talking to one of those remote servers - when X starts up, he is configured to talk specifically to one and only one of those remote servers running out on the network. X is listening to the notifications emitted by the NetworkRegistry and comparing the InvokerLocator objects in those notifications with the InvokerLocator he is configured to talk to (if you recall, the NetworkNotification object provides you with the InvokerLocator of the server that triggered the notification).
But InvokerLocator.equals() does a simple String.equals() on the URI string of the locator. This means that the remote server has to have a character-for-character identical invoker locator that X is looking for. If I understand JBoss/Remoting correctly, this won't always be the case. For example, the remote server might be on socket://localhost:12345 but X might want to talk to socket://localhost:12345/?foo=bar where foo=bar is some client-side parameter. They technically are the same remote server endpoint (socket transport on localhost listening on port 12345) but the InvokerLocator.equals() check fails - it thinks they are different locators.
Or, X might be looking for socket://127.0.0.1:12345 (where it uses the IP address but the server is using the DNS name). Again, technically the same server endpoint, but InvokerLocator.equals() doesn't see it that way and thinks they are different.
Is there another way for me to compare two InvokerLocator objects and have it tell me if they truely are the same remote server endpoint?
How do others use the NetworkNotification? I assume other folks are comparing the given locator found in the notification with some other known locators that you are looking for - how do you unambiguously compare them?