EHCache???????漯?????????
???????????? ???????[ 2016/3/8 13:45:22 ] ?????????????????? ???ù???
????ehcache??????????????????????????rmi??jgroup????jms????ehcache???????????????????????????????????????????????????
????Ehcache????????????????????RMI??JGroups??JMS???????????MRI??JGrpups????????Ehcache??e汾?1.5.0??????ehcache???????????ο?http://ehcache.sourceforge.net/EhcacheUserGuide.html??
????????jgroups???????ο?http://www.jgroups.org/manual/html_single/index.html??
???????????????? server1 ip??192.168.2.154??server2 ip??192.168.2.23
????1. RMI?????
????rmi??????????????????server1????????server2?????????ip????????
????a. ????PeerProvider??
????Xml????
????<cacheManagerPeerProviderFactory class="net.sf.ehcache.distribution.RMICacheManagerPeerProviderFactory"
????properties="peerDiscovery=manual??rmiUrls=//192.168.2.23:40001/userCache|//192.168.2.23:40001/resourceCache" />
??????????????????????sever2?е?userCache??resourceCache??
????b. ????CacheManagerPeerListener??
????Xml????
????<cacheManagerPeerListenerFactory class="net.sf.ehcache.distribution.RMICacheManagerPeerListenerFactory"
????properties="hostName=192.168.2.154?? port=40001??socketTimeoutMillis=2000" />
??????????server1????????40001????
????c. ??????cache?????cacheEventListener?????????£?
????Xml????
????<cache name="userCache" maxElementsInMemory="10000" eternal="true" overflowToDisk="true" timeToIdleSeconds="0" timeToLiveSeconds="0"diskPersistent="false" diskExpiryThreadIntervalSeconds="120">
????<cacheEventListenerFactory class="net.sf.ehcache.distribution.RMICacheReplicatorFactory" properties="replicateAsynchronously=true?? replicatePuts=true?? replicateUpdates=true??replicateUpdatesViaCopy= false?? replicateRemovals= true " />
????</cache>
????????????
?????????????
????name:??????????????????????棬Ω?
????maxElementsInMemory:??????д?????????
????maxElementsOnDisk????DiskStore?е??????????????0???????????
????eternal??????????????????????timeout????
????overflowToDisk?????memory?е???????????????浽Disk
??????????????
????timeToIdleSeconds?????????????????????
????timeToLiveSeconds???????????????????
????diskPersistent?????disk store?????????????????????false
????diskExpiryThreadIntervalSeconds:????disk??????????????120??
????memoryStoreEvictionPolicy?????????Eviction
??????????????
????cacheEventListenerFactory????????????????????????????????????put??remove??update????expire
????bootstrapCacheLoaderFactory:????????BootstrapCacheLoader???????????????棬?????????á?
?????ο????????????http://wozailongyou.javaeye.com/blog/230252????м???????
????2. JGroups?????
????ehcache 1.5.0???汾????????????????????????????
????a. ????PeerProvider?????tcp?????????????£?
????Xml????
<cacheManagerPeerProviderFactory class="net.sf.ehcache.distribution.jgroups.JGroupsCacheManagerPeerProviderFactory"
properties="connect=TCP(start_port=7800):
TCPPING(initial_hosts=192.168.2.154[7800]??192.168.2.23[7800];port_range=10;timeout=3000;
num_initial_members=3;up_thread=true;down_thread=true):
VERIFY_SUSPECT(timeout=1500;down_thread=false;up_thread=false):
pbcast.NAKACK(down_thread=true;up_thread=true;gc_lag=100;retransmit_timeout=3000):
pbcast.GMS(join_timeout=5000;join_retry_timeout=2000;shun=false;
print_local_addr=false;down_thread=true;up_thread=true)"
propertySeparator="::" />
????b.????cache???cacheEventListener??
????Xml????
<cache name="userCache" maxElementsInMemory="10000" eternal="true"
overflowToDisk="true" timeToIdleSeconds="0" timeToLiveSeconds="0"
diskPersistent="false" diskExpiryThreadIntervalSeconds="120">
<cacheEventListenerFactory class="net.sf.ehcache.distribution.jgroups.JGroupsCacheReplicatorFactory"
properties="replicateAsynchronously=true?? replicatePuts=true??
replicateUpdates=true?? replicateUpdatesViaCopy=false?? replicateRemovals=true"/>
</cache>
????JGroup????????????server??????????????????ж??server????initial_hosts?н?server ip??????ɡ?
?????????????ehcache.xml?????
????Xml????
<?xml version="1.0" encoding="UTF-8"?>
<ehcache xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="http://ehcache.sf.net/ehcache.xsd">
<diskStore path="java.io.tmpdir" />
<cacheManagerPeerProviderFactory class="net.sf.ehcache.distribution.jgroups.JGroupsCacheManagerPeerProviderFactory"
properties="connect=TCP(start_port=7800):
TCPPING(initial_hosts=192.168.2.154[7800]??192.168.2.23[7800];port_range=10;timeout=3000;
num_initial_members=3;up_thread=true;down_thread=true):
VERIFY_SUSPECT(timeout=1500;down_thread=false;up_thread=false):
pbcast.NAKACK(down_thread=true;up_thread=true;gc_lag=100;retransmit_timeout=3000):
pbcast.GMS(join_timeout=5000;join_retry_timeout=2000;shun=false;
print_local_addr=false;down_thread=true;up_thread=true)"
propertySeparator="::" />
??????
???·???
??????????????????
2023/3/23 14:23:39???д?ò??????????
2023/3/22 16:17:39????????????????????Щ??
2022/6/14 16:14:27??????????????????????????
2021/10/18 15:37:44???????????????
2021/9/17 15:19:29???·???????·
2021/9/14 15:42:25?????????????
2021/5/28 17:25:47??????APP??????????
2021/5/8 17:01:11