当前位置: 首页 > 知识库问答 >
问题:

EhCache Jgroups复制

边健
2023-03-14

在我的基于sping的项目(spring Version4.1.5.Final)中,我使用了ehcache-core Version2.6.10、ehcache-jgroupsreplication Versione1.7和jGroups3.1.0.Final

这是我的XML ehcache配置:

<?xml version="1.0" encoding="UTF-8"?>
<ehcache xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="http://ehcache.org/ehcache.xsd" name="webCache" >
<diskStore path="java.io.tmpdir/webCache"/>
<cacheManagerPeerProviderFactory class="net.sf.ehcache.distribution.jgroups.JGroupsCacheManagerPeerProviderFactory" properties="udp.xml"/>
<cache name="it.test.cache.CustomCache"
            maxElementsInMemory="1000"
            eternal="false"
            timeToIdleSeconds="600"
            timeToLiveSeconds="6000"
            overflowToDisk="true">
<cacheEventListenerFactory class="net.sf.ehcache.distribution.jgroups.JGroupsCacheReplicatorFactory" properties="replicateAsynchronously=true,replicatePuts=true,replicateUpdates=true,replicateUpdatesViaCopy=false,replicateRemovals=true" />
</cache>  
</ehcache>
<config xmlns="urn:org:jgroups"
        xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
        xsi:schemaLocation="urn:org:jgroups http://www.jgroups.org/schema/jgroups.xsd">
    <UDP
         mcast_port="${jgroups.udp.mcast_port:45588}"
         tos="8"
         ucast_recv_buf_size="200K"
         ucast_send_buf_size="200K"
         mcast_recv_buf_size="200K"
         mcast_send_buf_size="200K"
         max_bundle_size="64K"
         max_bundle_timeout="30"
         ip_ttl="${jgroups.udp.ip_ttl:2}"
         enable_diagnostics="true"
         thread_naming_pattern="cl"
         timer_type="new"
         timer.min_threads="4"
         timer.max_threads="10"
         timer.keep_alive_time="3000"
         timer.queue_max_size="500"
         thread_pool.enabled="true"
         thread_pool.min_threads="2"
         thread_pool.max_threads="8"
         thread_pool.keep_alive_time="5000"
         thread_pool.queue_enabled="true"
         thread_pool.queue_max_size="10000"
         thread_pool.rejection_policy="discard"
         oob_thread_pool.enabled="true"
         oob_thread_pool.min_threads="1"
         oob_thread_pool.max_threads="8"
         oob_thread_pool.keep_alive_time="5000"
         oob_thread_pool.queue_enabled="false"
         oob_thread_pool.queue_max_size="100"
         oob_thread_pool.rejection_policy="Run"/>
    <PING />
    <MERGE3 max_interval="30000"
            min_interval="10000"/>
    <FD_SOCK/>
    <FD_ALL/>
    <VERIFY_SUSPECT timeout="1500"  />
    <BARRIER />
    <pbcast.NAKACK use_mcast_xmit="true"
                   retransmit_timeout="300,600,1200"
                   discard_delivered_msgs="true"/>
    <UNICAST/>
    <pbcast.STABLE stability_delay="1000" desired_avg_gossip="50000"
                   max_bytes="4M"/>
    <pbcast.GMS print_local_addr="true" join_timeout="3000"
                view_bundling="true"/>
    <UFC max_credits="2M"
         min_threshold="0.4"/>
    <MFC max_credits="2M"
         min_threshold="0.4"/>
    <FRAG2 frag_size="60K"  />
    <pbcast.STATE_TRANSFER />
</config>
<bean id="settaSystemProps" name="settaSystemProps" class="org.springframework.beans.factory.config.MethodInvokingFactoryBean">
    <property name="targetObject">
        <bean class="org.springframework.beans.factory.config.MethodInvokingFactoryBean">
            <property name="targetClass" value="java.lang.System" />
            <property name="targetMethod" value="getProperties" />
        </bean>
    </property>
    <property
        name="targetMethod" value="putAll" />
    <property
        name="arguments">
        <util:properties>
            <prop key="jgroups.logging.log_factory_class">it.test.cache.replication.jgroups.log.logback.impl.LogbackLogImpl</prop>
            <prop key="java.net.preferIPv4Stack">true</prop>
        </util:properties>
    </property>
</bean> 
<bean id="webCacheManager" class="org.springframework.cache.ehcache.EhCacheManagerFactoryBean" depends-on="settaSystemProps">
    <property name="configLocation" value="classpath:webCoMiEhCacheCfg.xml"/>
</bean>

谢谢。

安杰洛

共有1个答案

田普松
2023-03-14

启动实例时的输出是什么?我想你可能还在使用IPv6。可以使用-djava.net.preferipv4stack=true而不是在XML中定义它吗?

 类似资料:
  • 下面是Gradle Build的stacktrace: Build.Gradle看起来是这样的: 编辑1:从META-INF目录中的httpmime库的本地副本中删除我有问题的文件,成功解决了此问题

  • cp(copy),可以复制指定的文件与目录。 cp 要复制的源 复制到的目标 练习:复制文件 复制一份 ninghao-project 下面的 README.md ,放到 ninghao-project/app 这个目录的下面。 cp ninghao-project/README.md ninghao-project/app/ 练习:复制目录 要复制一个目录连同它里面包含的所有文件与子目录,需

  •  说明 调用方法: $.f2e.util.clip(text,message) 插件说明: 复制文字,现只支持IE 参数说明: 参数名 类型 说明 备注 text string 复制的文本内容 无 message string 复制成功后的提示文案 可不传 默认文案 复制成功 类绑定 <html> //复制 <a class="f2e-util-clip" data-text="

  • NowCoder 题目描述 输入一个复杂链表(每个节点中有节点值,以及两个指针,一个指向下一个节点,另一个特殊指针指向任意一个节点),返回结果为复制后复杂链表的 head。 // java public class RandomListNode { int label; RandomListNode next = null; RandomListNode random =

  • 我有一个这样的数据帧。 现在,我想将第1列中的dict扩展到如下所示的各个列。 有没有捷径可以实现这一点?

  • 我想在POI中使用OPCPackage和XSSFWorkbook打开一个excel文件。由于这个文件将在不同的线程中使用,我想避免重新打开该文件以节省时间(POI在打开一个xlsx文件时速度较慢)。所以我所做的是将工作簿保存在一个全局变量中,然后线程将访问这个全局变量并重用对象。 我遇到的问题是当我尝试重用对象时,它影响/修改了excel文件的原始数据。

  • 一、题目 请实现函数ComplexListNode clone(ComplexListNode head),复制一个复杂链表。在复杂链表中,每个结点除了有一个next 域指向下一个结点外,还有一个sibling 指向链表中的任意结点或者null。 二、解题思路 在不用辅助空间的情况下实现O(n)的时间效率。 第一步:仍然是根据原始链表的每个结点N 创建对应的N’。把N’链接在N的后面。 第二步:设

  • 我需要创建一个按钮,当我点击它时,我复制一个我正在使用的特定链接。js 这是我的按钮 当我点击这个按钮时,我需要剪贴板上有类似“https::/google.com”的内容