-
1. Re: InetAddress from JGroup Address
galder.zamarreno Nov 11, 2011 9:07 AM (in response to mackerman)What's your use case for requiring the InetAddress of a node?
Also, are you looking for the IP address of a remote node? Or of the node running locally? Or both?
-
2. Re: InetAddress from JGroup Address
an1310 Nov 11, 2011 9:29 AM (in response to mackerman)1 of 1 people found this helpfulHere's something I used to get the primary data owner's address.
{code}
JGroupsTransport t = (JGroupsTransport) getCache().getAdvancedCache().getRpcManager().getTransport();
if (t.getChannel() != null) {
// The main data owner's address is always at the head of the list.
JGroupsAddress jAddr = (JGroupsAddress) locations.get(0);
org.jgroups.Address phys = (org.jgroups.Address) t.getChannel().down(new Event(Event.GET_PHYSICAL_ADDRESS, jAddr.getJGroupsAddress()));
if (phys instanceof org.jgroups.stack.IpAddress) {
bindAddress = ((org.jgroups.stack.IpAddress) phys).getIpAddress();
}
}
{code}
-
3. Re: InetAddress from JGroup Address
galder.zamarreno Nov 11, 2011 9:57 AM (in response to an1310)Sure, I can imagine the type of code you used, that's not my question.
My question is: why do you want this? what for? not how are you are retrieving it
-
4. Re: InetAddress from JGroup Address
an1310 Nov 11, 2011 10:07 AM (in response to galder.zamarreno)I used it intially for finding the primary data owner's address so I could use the eagerLockSingleNode optimization without incurring RPC calls (like remote locks) until transaction commit time.
This was before the days of the Distributed Executors where I could now pass in the affected keys and let the framework execute the task on the primary data owner.
-
5. Re: InetAddress from JGroup Address
galder.zamarreno Nov 11, 2011 10:21 AM (in response to an1310)Hmmm, so that explains what you used it for in the past, what about now? You still use it to get the primary data owner's IP address?
My point is this, if you know your local logical address, i.e. your node name plus a number, and you know the logical addresses of other nodes, assuming that you give them different node names, you should be able to figure out whether you'll stay local or not, without the need of IP addresses.
So tell us exactly what you're planning to do it now with this data and we'll be able to help you further.
-
6. Re: InetAddress from JGroup Address
mackerman Nov 11, 2011 10:33 AM (in response to galder.zamarreno)My use case is that I need to know the IP address of remote nodes joining the Infinispan cluster so that i can use it to add nodes to a HornetQ cluster. I'm running in an environment where multicast is not an option (Amazon), and Infinispan is configured using a Gossip Router, which allows us to discover nodes joining the cluster. HornetQ does not support that kind of dynamic discovery (it only supports multicast discovery & static clustering), so i'm trying to piggy back off of the Infinispan Cluster membership to configure HornetQ.
The solution I used was similar to that Posted by Erik. It looks like I could use
JGroupsTransport t = (JGroupsTransport) getCache().getAdvancedCache().getRpcManager().getTransport();
rather than changing DefaultCacheManager::getTransport to public. I'll give that a try.
thanks, Mitchell
-
7. Re: InetAddress from JGroup Address
an1310 Nov 11, 2011 10:38 AM (in response to galder.zamarreno)I don't plan on doing anything with this block of code now. I needed the primary address to bridge the gap between JGroups node naming convention and my own HTTP scheme. If anything, I use this for testing utilities for use in customer and QA labs (and that's probably code I haven't touched in a while)
But I wasn't the one asking the original question.
-
8. Re: InetAddress from JGroup Address
mackerman Nov 11, 2011 3:26 PM (in response to mackerman)Thanks, using
JGroupsTransport t = (JGroupsTransport) DefaultCacheManager.getCache("acachename").getAdvancedCache().getRpcManager().getTransport();
does work. However, I think the API would be easier to use if
DefaultCacheManager.getTransport();
were public.
-
9. Re: InetAddress from JGroup Address
galder.zamarreno Nov 14, 2011 3:00 AM (in response to mackerman)Hmmm, if you're having to maintain a cluster for Infinispan and then a cluster for HornetQ, where there appears to be an overlapp between the two, wouldn't you be better off by running AS7 instances that can run both Infinispan and HornetQ and they can simplify the cluster management by running a single cluster? Just a thought...
Well spotted Mitchell, I had forgotten that transport was accessible via the RpcManager. If you want a more simplified API (I don't see why that'd be a problem), could you open a jira?
-
10. Re: InetAddress from JGroup Address
mackerman Nov 14, 2011 7:46 PM (in response to galder.zamarreno)I would LOVE to do as you suggest, use AS7 cluster configuration to manage both Infinispan & HornetQ, but so far we can't figure out how to configure both of those products adequately in AS7 using the domain manager xml configuration, and have been forced to revert to embedded configuration. See earlier posts for issues that I was encountering, but as I recall there was the issue of configuring a gossip router for infinispan, and we were unable to configure Rest for HornetQ. If and when we can do that we will do so.
Thanks, I'll open i Jira issue for the api change.
Mitchell