Use eclipselink.cache.coordination.protocol
to specify the cache coordination protocol to use. Depending on the cache configuration for each descriptor, this will broadcast cache updates or inserts to the cluster to update or invalidate each session's cache.
Values
Table 5-12 describes this persistence property's values.
Table 5-12 Valid Values for cache.coordination.protocol
Value | Description |
---|---|
|
Use Java Message Service (JMS) to broadcast changes. |
|
Use an EJB MessageDrivenBean to be used to broadcast changes. You must configure the MessageDrivenBean separately. |
|
Use Java Remote Method Invocation (RMI) to broadcast changes. |
|
Use RMI over the Internet Inter-Orb Protocol (IIOP) to broadcast changes. |
ClassName |
The name of a subclass implementation of the |
Usage
You must specify the cache.coordination.protocol
for every persistence unit and session in the cluster.
Examples
Example 5-6 shows how to configure JMS cache coordination in the persistence.xml
file.
Example 5-6 Configuring JMS Cache Coordination in persistence.xml
<property name="eclipselink.cache.coordination.protocol" value="jms" /> <property name="eclipselink.cache.coordination.jms.topic" value="jms/EmployeeTopic" /> <property name="eclipselink.cache.coordination.jms.factory" value="jms/EmployeeTopicConnectionFactory" />
If your application is not running in a cluster, you must provide the URL:
<property name="eclipselink.cache.coordination.jms.host" value="t3://myserver:7001/" />
You can also include a username and password, if required, to access the server (for example, if on a separate domain):
<property name="eclipselink.cache.coordination.jndi.user" value="weblogic" /> <property name="eclipselink.cache.coordination.jndi.password" value="welcome1" />
Example 5-7 Configuring RMI Cache Coordination in persistence.xml
<property name="eclipselink.cache.coordination.protocol" value="rmi" />
If your application is not running in a cluster, you must provide the URL:
<property name="eclipselink.cache.coordination.rmi.url" value="t3://myserver:7001/" />
You can also include a username and password, if required, to access the server (for example, if on a separate domain):
<property name="eclipselink.cache.coordination.jndi.user" value="weblogic" /> <property name="eclipselink.cache.coordination.jndi.password" value="welcome1" />
By default, RMI cache coordination broadcasts are asynchronous. You can override this, if needed:
<property name="eclipselink.cache.coordination.propagate-asynchronously" value="false" />
If you have multiple applications on the same server or network, you can specify a separate cache coordination channel for each application:
<property name="eclipselink.cache.coordination.channel" value="EmployeeChannel" />
RMI cache coordination uses a multicast socket to allow servers to find each other. You can configure the multicast settings, if needed:
<property name="eclipselink.cache.coordination.rmi.announcement-delay" value="1000" /> <property name="eclipselink.cache.coordination.rmi.multicast-group" value="239.192.0.0" /> <property name="eclipselink.cache.coordination.rmi.multicast-group.port" value="3121" /> <property name="eclipselink.cache.coordination.packet-time-to-live" value="2" />
See Also
For more information, see:
Cache Coordination Examples
http://wiki.eclipse.org/EclipseLink/Examples/JPA/CacheCoordination
"Clustering and Cache Coordination"
http://wiki.eclipse.org/EclipseLink/UserGuide/JPA/Basic_JPA_Development/Caching/Coordination