博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
ehcache rmi 动态节点,代码创建,分布式配置。
阅读量:2022 次
发布时间:2019-04-28

本文共 1194 字,大约阅读时间需要 3 分钟。

通常配置ehcache分布式,都是在xml中配置的。例如:

如果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);

转载地址:http://jdgxf.baihongyu.com/

你可能感兴趣的文章
第十二讲、jmeter性能测试实战-mysql数据库
查看>>
liferay性能测试(LoadRunner)
查看>>
计算机网络
查看>>
DB2基础操作(Linux平台)
查看>>
Linux内核开发一:常识
查看>>
Linux内核开发二:GDB调试
查看>>
Linux内核开发三:多进程编程
查看>>
Linux内核开发四:进程间通信(6种方式)
查看>>
软件测试理论和APP测试案例
查看>>
UII自动化之MonkeyRunner
查看>>
fiddler抓包
查看>>
计算二元函数
查看>>
who is killer?
查看>>
Linux中的文件与目录管理
查看>>
C实现三子棋
查看>>
GDB的简单使用
查看>>
进度条
查看>>
注释转换器
查看>>
智能指针 AutoPtr ScopedPtr SharedPtr
查看>>
仿函数
查看>>