Chapter 10. Run Red Hat JBoss Data Grid in Library Mode (Multi-Node Setup)

10.1. Sharing JGroup Channels

Red Hat JBoss Data Grid offers an easy to use form of clustering using JGroups as the network transport. As a result, JGroups manages the initial operations required to form a cluster for JBoss Data Grid.
All caches created from a single CacheManager share the same JGroups channel by default. This JGroups channel is used to multiplex replication/distribution messages.
In the following example, all three caches used the same JGroups channel:

Example 10.1. Shared JGroups Channel

EmbeddedCacheManager cm = $LOCATION
Cache<Object, Object> cache1 = cm.getCache("replSyncCache");
Cache<Object, Object> cache2 = cm.getCache("replAsyncCache");
Cache<Object, Object> cache3 = cm.getCache("invalidationSyncCache");
Substitute $LOCATION with the CacheManager's location.