Both the org.wildfly.clustering.registry.Registry and org.wildfly.clustering.provider.ServiceProviderRegistry currently store references to a Node object in their respective caches. The AddressableNode implementation currently serializes:
- The logical name (typically a host name)
- The socket binding address/port of its transport
This is overkill. The Node should only need to serialize enough information to reconstruct itself using a NodeFactory<Address>, which should only include:
- its Address
- something to minimally identify the NodeFactory<Address>, with which to use to reconstruct the Node, e.g. a group name
Unfortunately, getting a reference to the NodeFactory during deserialization isn't trivial, as these are on-demand services.
Another approach, is to avoid referencing the Node in cache keys/values altogether. Currently, Registry<K, V> uses a Cache<Node, Map.Entry<K, V>> and ServiceProviderRegistry<K> uses a Cache<K, Set<Node>>. In both cases, we can replace Node with Address, and thus avoid unnecessary marshalling of the logical name and physical address of a member.