Coherence EP中调用其他CACHE问题deadlock告警问题

 如果把COHERENCE的LOG级别为DEBUG,那么在EP执行时,会有下面的WARING和EXCEPTION。虽然查询结果是正确的。在压力比较大的情况下,不清楚会不会真的死锁

 

该WARING和EXCEPTION只在第一次调用EP的时候会抛,以后就不会。

 

2013-12-17 15:09:01 Coherence [WARN]2013-12-17 15:09:01.565/18.179 Oracle Coher

ence GE 3.7.1.0 <Warning>(thread=boss-distributed-serviceWorker:49, member=1):

Application code runningon "boss-distributed-service" service thread(s) should

not call ensureCache asthis may result in deadlock. The most common case is a C

acheFactory call from acustom CacheStore implementation.

2013-12-17 15:09:01 Coherence [DEBUG]2013-12-17 15:09:01.569/18.183 Oracle Cohe

rence GE 3.7.1.0 <D7>(thread=boss-distributed-serviceWorker:49, member=1): Stac

k trace:

       at com.tangosol.coherence.component.util.SafeService.checkClientThread(S

afeService.CDB:38)

       at com.tangosol.coherence.component.util.safeService.SafeCacheService.en

sureCache(SafeCacheService.CDB:8)

        atcom.tangosol.net.DefaultConfigurableCacheFactory.ensureCache(DefaultC

onfigurableCacheFactory.java:920)

       at com.tangosol.net.DefaultConfigurableCacheFactory.configureCache(Defau

ltConfigurableCacheFactory.java:1296)

       at com.tangosol.net.DefaultConfigurableCacheFactory.ensureCache(DefaultC

onfigurableCacheFactory.java:297)

       at com.tangosol.net.CacheFactory.getCache(CacheFactory.java:204)

       at com.tangosol.net.CacheFactory.getCache(CacheFactory.java:181)

        atcom.newland.poc.boss.test.Case1EP.process(Case1EP.java:49)

       at com.tangosol.coherence.component.util.daemon.queueProcessor.service.g

rid.partitionedService.PartitionedCache$Storage.invoke(PartitionedCache.CDB:10)

       at com.tangosol.coherence.component.util.daemon.queueProcessor.service.g

rid.partitionedService.PartitionedCache.onInvokeRequest(PartitionedCache.CDB:52)

 

       at com.tangosol.coherence.component.util.daemon.queueProcessor.service.g

rid.partitionedService.PartitionedCache$InvokeRequest.run(PartitionedCache.CDB:1

)

       at com.tangosol.coherence.component.util.DaemonPool$WrapperTask.run(Daem

onPool.CDB:1)

       at com.tangosol.coherence.component.util.DaemonPool$WrapperTask.run(Daem

onPool.CDB:32)

       at com.tangosol.coherence.component.util.DaemonPool$Daemon.onNotify(Daem

onPool.CDB:63)

       at com.tangosol.coherence.component.util.Daemon.run(Daemon.CDB:42)

       at java.lang.Thread.run(Thread.java:662)

 

user=User [user_id=591305000000181,imsi=460005008377002, msisdn=13805002028, ho

me_city=591, home_county=104,inure_time=2005/1/5 10:09:53, expire_time=2030/7/1

, affinityKey=591305000000181]

解决方法:

给调用EP的CACHE和在EP中要操作的CACHE配置不同的SERVICE,这样就不会有上面的告警. 但这样如果在实际项目中CACHE很多话,配置管理比较麻烦。

<caching-scheme-mapping>

   <cache-mapping>

     <cache-name>xcj-*</cache-name>

     <scheme-name>ExamplesPartitionedPofScheme</scheme-name>

   </cache-mapping>  

    <cache-mapping>

     <cache-name>dist-*</cache-name>

     <scheme-name>boss-distributed</scheme-name>

   </cache-mapping>

     

 </caching-scheme-mapping>

 

 <caching-schemes>

   <!--

   Distributed caching scheme.

   -->

   <distributed-scheme>

     <scheme-name>ExamplesPartitionedPofScheme</scheme-name>

     <service-name>PartitionedPofCache</service-name>

     <serializer> 

       <instance>

        <class-name>com.tangosol.io.pof.ConfigurablePofContext</class-name>

          <init-params>

            <init-param>

              <param-type>String</param-type> 

              <param-value>boss-pof-config.xml</param-value>

            </init-param>

          </init-params>

       </instance>

     </serializer>

       <thread-count>10</thread-count> 

       <backing-map-scheme>

        <local-scheme>

          <unit-calculator>binary</unit-calculator>

        </local-scheme>

     </backing-map-scheme>

     <autostart>true</autostart>

   </distributed-scheme>

    

   <distributed-scheme>

     <scheme-name>boss-distributed</scheme-name>

     <service-name>boss-distributed-service</service-name>

     <thread-count>64</thread-count>

      <key-associator>

        <class-name>com.newland.poc.boss.domain.affinity.MyKeyAssociator</class-name>

      </key-associator>

      <backing-map-scheme>

        <partitioned>true</partitioned>

                <local-scheme>

                    <unit-calculator>BINARY</unit-calculator>

                </local-scheme>

        <!--

        <local-scheme>

          <scheme-ref>example-binary-backing-map</scheme-ref>

        </local-scheme>

         -->

     </backing-map-scheme>

 

     <autostart>true</autostart>

    </distributed-scheme>

 

imsiToUseridIndex=CacheFactory.getCache(xcj-cache)

Map result =imsiToUseridIndex.invokeAll(keys, new Case1EP());

 

EP代码:

public Map processAll(Set setEntries) {

        //System.out.println("enter processall**********");      

        Useruser=null;

        UserSelectedBranduserSBresult = null;

        UserStatus userStatus = null;

       

        for (Iterator iter =setEntries.iterator(); iter.hasNext(); )

           {

             Entryentry = (Entry) iter.next();

             Stringimsi = entry.getKey().toString();

                //System.out.println("imsi=" + imsi);

                Stringuserid=entry.getValue().toString();

                //System.out.println("userid=" + userid);

                NamedCache userCache= CacheFactory.getCache(“dist-cache”);

                user= (User) userCache.get(userid);

 

 

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值