ehcache rmi 动态节点,代码创建,分布式配置。
来源:互联网 发布:vb与sql数据库连接 编辑:程序博客网 时间:2024/06/06 02:27
通常配置ehcache分布式,都是在xml中配置的。例如:
<cacheManagerPeerListenerFactory class="net.sf.ehcache.distribution.RMICacheManagerPeerListenerFactory" properties="port=40001,socketTimeoutMillis=2000"/> <!--缓存成员发现工厂,管理cacheManager对象 --> <cacheManagerPeerProviderFactory class="net.sf.ehcache.distribution.RMICacheManagerPeerProviderFactory" properties="peerDiscovery=automatic, multicastGroupAddress=230.0.0.1, multicastGroupPort=4446, timeToLive=32"/><cache name="allWindowsParticulars" maxElementsInMemory="3000" eternal="false" timeToIdleSeconds="7200" timeToLiveSeconds="7200" overflowToDisk="false" overflowToOffHeap="false" diskPersistent="false" memoryStoreEvictionPolicy="LRU"> <cacheEventListenerFactory class="net.sf.ehcache.distribution.RMICacheReplicatorFactory" properties="replicateAsynchronously=false" /> <!-- 服务器(Tomcat)启动就同步其他服务器(Tomcat)中的缓存--> <bootstrapCacheLoaderFactory class="net.sf.ehcache.distribution.RMIBootstrapCacheLoaderFactory" /> </cache>
如果cache节点是通过代码创建的,该怎么配置呐?解决办法如下:
CacheConfiguration config = cacheManager.getConfiguration().getDefaultCacheConfiguration(); CacheConfiguration.CacheEventListenerFactoryConfiguration cacheEventListenerFactoryConfiguration=new CacheConfiguration.CacheEventListenerFactoryConfiguration(); cacheEventListenerFactoryConfiguration.setClass("net.sf.ehcache.distribution.RMICacheReplicatorFactory"); cacheEventListenerFactoryConfiguration.setProperties("replicateAsynchronously=true,replicatePuts=true,replicateUpdates=true," + "replicateUpdatesViaCopy=false,replicateRemovals=true"); config.addCacheEventListenerFactory(cacheEventListenerFactoryConfiguration); CacheConfiguration.BootstrapCacheLoaderFactoryConfiguration bootstrapCacheLoaderFactoryConfiguration = new CacheConfiguration.BootstrapCacheLoaderFactoryConfiguration(); bootstrapCacheLoaderFactoryConfiguration.setClass("net.sf.ehcache.distribution.RMIBootstrapCacheLoaderFactory"); config.addBootstrapCacheLoaderFactory(bootstrapCacheLoaderFactoryConfiguration); new Cache(config);
阅读全文
0 0
- ehcache rmi 动态节点,代码创建,分布式配置。
- 分布式Ehcache缓存配置-RMI
- ehcache之RMI集群配置
- EhCache RMI方式分布式缓存解决方案
- EhCache RMI 分布式缓存/缓存集群
- ehcache jgroup 分布式配置
- RMI代码动态下载
- RMI方式缓存集群/配置分布式缓存
- Ehcache 分布式缓存 配置完全指北
- java ehcache 分布式缓存配置实例
- EHCache分布式缓存集群环境配置
- java ehcache 分布式缓存配置实例
- EHCache分布式缓存集群环境配置
- EHCache分布式缓存集群环境配置
- EHCache分布式缓存集群环境配置
- EHCache–分布式缓存集群环境配置
- EHCache分布式缓存集群环境配置
- EHCache分布式缓存集群环境配置
- 题目:给一个不多于5位的正整数,要求:一、求它是几位数,二、逆序打印出各位数字。(java)
- oracle——归档日志
- Win10小技巧:如何将在此处打开命令改为CMD或Powershell?
- Android Studio 中的调试技巧
- 打造自己的框架之使用注解制作IOC组件
- ehcache rmi 动态节点,代码创建,分布式配置。
- 新安装的mysql无法远程连接问题
- 深度学习实践操作—从小白到大白(九):Caffe依赖包解析
- 题目:有5个人坐在一起,问第五个人多少岁?他说比第4个人大2岁。问第4个人岁数,他说比第3个人大2岁。问第三个人,又说比第2人大两岁。 *问第2个人,说比第一个人大两岁...
- 老人机轮询紧急拨号功能
- 笔记:基于winform的应用程序,发生方通过sendmessage发送消息接收方无法成功接收消息
- 20171128
- 题目:有一分数序列:2/1,3/2,5/3,8/5,13/8,21/13...求出这个数列的前20项之和。(java)
- 排序之冒泡排序的C语言实现