使用EhCache的SpringMVC中出现死锁

时间:2019-10-30 09:27:12

标签: spring multithreading ehcache

在最近两三天内,在我们的tomcat服务上部署的网站发现了线程死锁问题。在对JVM线程转储进行故障排除和分析之后,我们在工作线程中发现了一个大的线程块,而该问题可能是由ehcache引起的。 但是,我相信ehcache的使用是正确的,有人可以帮助我分析原因吗?

我们的程序,日志和其他信息的代码和配置如下,谢谢:

版本:ehcache 2.10.3          ehcache-core 2.6.11          shiro-ehcache 1.2.4

src代码:

@Service

public class UserBuslinesService {
    @Resource
    UserBuslinesDao userbuslinesDao;

    public List<UserBuslines> find(Map paraMap) {
        return userbuslinesDao.find(paraMap);
    }
    @Cacheable(value={"UserBuslines"}, key = "#map")
    public List<UserBuslines> select(Map map) {
        List<UserBuslines> oList = userbuslinesDao.select(map);
        return oList;
    }



    public List<UserBuslines> selectAll(Map map) {
        List<UserBuslines> oList = userbuslinesDao.selectAll(map);
        return oList;
    }

    public UserBuslines get(Serializable id) {
        return userbuslinesDao.get(id);
    }

    @CacheEvict(value={"UserBuslines", "CarInfoTree"}, allEntries=true)
    public void insert(UserBuslines entity) {
        userbuslinesDao.insert(entity);
    }

    @CacheEvict(value={"UserBuslines", "CarInfoTree"}, allEntries=true)
    public void update(UserBuslines entity) {
        userbuslinesDao.update(entity);
    }

    @CacheEvict(value={"UserBuslines", "CarInfoTree"}, allEntries=true)
    public void deleteById(Serializable id) {
        userbuslinesDao.deleteById(id);
    }

    @CacheEvict(value={"UserBuslines", "CarInfoTree"}, allEntries=true)
    public void deleteByIds(Map paraMap) {
        userbuslinesDao.deleteByIds(paraMap);
    }
    @CacheEvict(value={"UserBuslines", "CarInfoTree"}, allEntries=true)
    public void delete(Serializable[] ids) {
        userbuslinesDao.delete(ids);
    }
}


-----------------------------------------------------------------------------------

    @ResponseBody
    @RequestMapping(value = "/SelectLastestGpsData", method = RequestMethod.POST)
    public Map<String, Object> SelectLastestGpsData(Integer[] firstCorp, Integer[] corpIdList, Integer[] buslineIdList, String[] simNoList, HttpSession session) {
        List<LastestGpsData> lastestGpsDataList;
        List<CarInfoTree> carInfoTreeList = new ArrayList<>();
        Map<String, Object> key = new HashMap<String, Object>() {
            {
                put("platforms", Arrays.asList(platform.replaceAll(" ", "").split(",")));
            }
        };

        Object cacheByCarTree = EhcacheUtil.getInstance().get("CarInfoTree", key);
        if (cacheByCarTree != null) {
            carInfoTreeList = (List<CarInfoTree>) cacheByCarTree;
        }
        Map<String, Object> queryUserBuslinesMap = new HashMap<>();
        queryUserBuslinesMap.put("userId", session.getAttribute("UserId"));
        List<UserBuslines> userBuslinesList = userBuslinesService.select(queryUserBuslinesMap);


        List<CarInfoTree> targetCarInfoList = carInfoTreeList
                .stream()
                .filter(
                        e -> (firstCorp != null && Arrays.asList(firstCorp).contains(e.getParentId())) ||
                                (corpIdList != null && Arrays.asList(corpIdList).contains(e.getCorpId())) ||
                                (buslineIdList != null && Arrays.asList(buslineIdList).contains(e.getBuslineId())) ||
                                (simNoList != null && Arrays.asList(simNoList).contains(e.getSimNo()))
                ).filter(car -> userBuslinesList.stream().anyMatch(ub -> ub.getBuslineId() == car.getBuslineId()))
                .collect(Collectors.toList());

        lastestGpsDataList = selectLastestGpsData(targetCarInfoList);


        Map<String, Object> result = new HashMap<>();
        result.put("rows", lastestGpsDataList);
        if(lastestGpsDataList.size()>0){
            //EhcacheUtil.getInstance().put("gnssData", session.getAttribute("UserId"), lastestGpsDataList);
            storageHashMap.put(session.getAttribute("UserId"), lastestGpsDataList);
        }

        return result;
    }
-------------------------------------------------------
public class EhcacheUtil {
    private static final String path = "/ehcache-config.xml";

    private URL url;

    private CacheManager manager;

    private static EhcacheUtil ehCache;

    private EhcacheUtil(String path) {
        url = getClass().getResource(path);
        manager = CacheManager.create(url);
    }

    public static EhcacheUtil getInstance() {
        if (ehCache== null) {
            ehCache= new EhcacheUtil(path);
        }
        return ehCache;
    }

    public void put(String cacheName, Object key, Object value) {
        Cache cache = manager.getCache(cacheName);
        Element element = new Element(key, value);
        cache.put(element);
        cache.flush();
    }

    public Object get(String cacheName, Object key) {
        Cache cache = manager.getCache(cacheName);
        Element element = cache.get(key);
        return element == null ? null : element.getObjectValue();
    }

    public Cache get(String cacheName) {
        return manager.getCache(cacheName);
    }

    public void remove(String cacheName, String key) {
        Cache cache = manager.getCache(cacheName);
        cache.remove(key);
    }
}

线程转储:

"http-nio-6600-exec-189" #25494 daemon prio=5 os_prio=0 tid=0x0000000020336000 nid=0x1f40 waiting for monitor entry [0x000000002eecd000]
   java.lang.Thread.State: BLOCKED (on object monitor)
    at net.sf.ehcache.store.cachingtier.OnHeapCachingTier$Fault.get(OnHeapCachingTier.java:331)
    - waiting to lock <0x000000008b5e3bc8> (a net.sf.ehcache.store.cachingtier.OnHeapCachingTier$Fault)
    at net.sf.ehcache.store.cachingtier.OnHeapCachingTier$Fault.access$200(OnHeapCachingTier.java:311)
    at net.sf.ehcache.store.cachingtier.OnHeapCachingTier.getValue(OnHeapCachingTier.java:299)
    at net.sf.ehcache.store.cachingtier.OnHeapCachingTier.get(OnHeapCachingTier.java:199)
    at net.sf.ehcache.store.CacheStore.get(CacheStore.java:192)
    at net.sf.ehcache.Cache.get(Cache.java:1751)
    at org.springframework.cache.ehcache.EhCacheCache.get(EhCacheCache.java:65)
    at org.springframework.cache.interceptor.AbstractCacheInvoker.doGet(AbstractCacheInvoker.java:68)
    at org.springframework.cache.interceptor.CacheAspectSupport.findInCaches(CacheAspectSupport.java:469)
    at org.springframework.cache.interceptor.CacheAspectSupport.findCachedItem(CacheAspectSupport.java:435)
    at org.springframework.cache.interceptor.CacheAspectSupport.execute(CacheAspectSupport.java:336)
    at org.springframework.cache.interceptor.CacheAspectSupport.execute(CacheAspectSupport.java:302)
    at org.springframework.cache.interceptor.CacheInterceptor.invoke(CacheInterceptor.java:61)
    at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:179)
    at org.springframework.aop.interceptor.ExposeInvocationInterceptor.invoke(ExposeInvocationInterceptor.java:92)
    at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:179)
    at org.springframework.aop.framework.CglibAopProxy$DynamicAdvisedInterceptor.intercept(CglibAopProxy.java:654)
    at com.xmgnss.service.UserBuslinesService$$EnhancerBySpringCGLIB$$d0f3eb42.select(<generated>)
    at com.xmgnss.controller.LastestGpsDataController.SelectLastestGpsData(LastestGpsDataController.java:294
    at sun.reflect.GeneratedMethodAccessor380.invoke(Unknown Source)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:498)
    at org.springframework.web.method.support.InvocableHandlerMethod.doInvoke(InvocableHandlerMethod.java:222)
    at org.springframework.web.method.support.InvocableHandlerMethod.invokeForRequest(InvocableHandlerMethod.java:137)
    at org.springframework.web.servlet.mvc.method.annotation.ServletInvocableHandlerMethod.invokeAndHandle(ServletInvocableHandlerMethod.java:110)
    at org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter.invokeHandlerMethod(RequestMappingHandlerAdapter.java:814)
    at org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter.handleInternal(RequestMappingHandlerAdapter.java:737)
    at org.springframework.web.servlet.mvc.method.AbstractHandlerMethodAdapter.handle(AbstractHandlerMethodAdapter.java:85)
    at org.springframework.web.servlet.DispatcherServlet.doDispatch(DispatcherServlet.java:959)
    at org.springframework.web.servlet.DispatcherServlet.doService(DispatcherServlet.java:893)
    at org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:970)
    at org.springframework.web.servlet.FrameworkServlet.doPost(FrameworkServlet.java:872)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:648)
    at org.springframework.web.servlet.FrameworkServlet.service(FrameworkServlet.java:846)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:729)
    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:230)
    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:165)
    at org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:52)
    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:192)
    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:165)
    at com.xmgnss.filter.XssFilter.doFilter(XssFilter.java:28)
    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:192)
    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:165)
    at org.apache.shiro.web.servlet.ProxiedFilterChain.doFilter(ProxiedFilterChain.java:61)
    at org.apache.shiro.web.servlet.AdviceFilter.executeChain(AdviceFilter.java:108)
    at org.apache.shiro.web.servlet.AdviceFilter.doFilterInternal(AdviceFilter.java:137)
    at org.apache.shiro.web.servlet.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:125)
    at org.apache.shiro.web.servlet.ProxiedFilterChain.doFilter(ProxiedFilterChain.java:66)
    at org.apache.shiro.web.servlet.AbstractShiroFilter.executeChain(AbstractShiroFilter.java:449)
    at org.apache.shiro.web.servlet.AbstractShiroFilter$1.call(AbstractShiroFilter.java:365)
    at org.apache.shiro.subject.support.SubjectCallable.doCall(SubjectCallable.java:90)
    at org.apache.shiro.subject.support.SubjectCallable.call(SubjectCallable.java:83)
    at org.apache.shiro.subject.support.DelegatingSubject.execute(DelegatingSubject.java:383)
    at org.apache.shiro.web.servlet.AbstractShiroFilter.doFilterInternal(AbstractShiroFilter.java:362)
    at org.apache.shiro.web.servlet.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:125)
    at org.springframework.web.filter.DelegatingFilterProxy.invokeDelegate(DelegatingFilterProxy.java:346)
    at org.springframework.web.filter.DelegatingFilterProxy.doFilter(DelegatingFilterProxy.java:262)
    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:192)
    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:165)
    at org.springframework.web.filter.CharacterEncodingFilter.doFilterInternal(CharacterEncodingFilter.java:121)
    at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107)
    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:192)
    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:165)
    at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:198)
    at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:96)
    at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:140)
    at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:79)
    at org.apache.catalina.valves.AbstractAccessLogValve.invoke(AbstractAccessLogValve.java:624)
    at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:87)
    at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:349)
    at org.apache.coyote.http11.Http11Processor.service(Http11Processor.java:783)
    at org.apache.coyote.AbstractProcessorLight.process(AbstractProcessorLight.java:66)
    at org.apache.coyote.AbstractProtocol$ConnectionHandler.process(AbstractProtocol.java:798)
    at org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.doRun(NioEndpoint.java:1434)
    at org.apache.tomcat.util.net.SocketProcessorBase.run(SocketProcessorBase.java:49)
    - locked <0x000000008c40c870> (a org.apache.tomcat.util.net.NioEndpoint$NioSocketWrapper)
    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
    at org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61)
    at java.lang.Thread.run(Thread.java:745)

   Locked ownable synchronizers:
    - <0x000000008b6443a0> (a java.util.concurrent.ThreadPoolExecutor$Worker)
    - waiting to lock <0x000000008b5e3bc8> (a net.sf.ehcache.store.cachingtier.OnHeapCachingTier$Fault)
    - waiting to lock <0x000000008b5e3bc8> (a net.sf.ehcache.store.cachingtier.OnHeapCachingTier$Fault)
    - waiting to lock <0x000000008b5e3bc8> (a net.sf.ehcache.store.cachingtier.OnHeapCachingTier$Fault)
    - waiting to lock <0x000000008b5e3bc8> (a net.sf.ehcache.store.cachingtier.OnHeapCachingTier$Fault)
    - waiting to lock <0x000000008b5e3bc8> (a net.sf.ehcache.store.cachingtier.OnHeapCachingTier$Fault)
    - waiting to lock <0x000000008b5e3bc8> (a net.sf.ehcache.store.cachingtier.OnHeapCachingTier$Fault)
    - waiting to lock <0x000000008b5e3bc8> (a net.sf.ehcache.store.cachingtier.OnHeapCachingTier$Fault)
    - locked <0x000000008b5e3bc8> (a net.sf.ehcache.store.cachingtier.OnHeapCachingTier$Fault)
    - waiting to lock <0x000000008b5e3bc8> (a net.sf.ehcache.store.cachingtier.OnHeapCachingTier$Fault)
    - waiting to lock <0x000000008b5e3bc8> (a net.sf.ehcache.store.cachingtier.OnHeapCachingTier$Fault)

    Line 3187:    java.lang.Thread.State: BLOCKED (on object monitor)
    Line 3274:    java.lang.Thread.State: BLOCKED (on object monitor)
    Line 3361:    java.lang.Thread.State: BLOCKED (on object monitor)
    Line 3448:    java.lang.Thread.State: BLOCKED (on object monitor)
    Line 6984:    java.lang.Thread.State: BLOCKED (on object monitor)
    Line 7091:    java.lang.Thread.State: BLOCKED (on object monitor)
    Line 7404:    java.lang.Thread.State: BLOCKED (on object monitor)
    Line 7602:    java.lang.Thread.State: BLOCKED (on object monitor)
    Line 7915:    java.lang.Thread.State: BLOCKED (on object monitor)
    Line 8002:    java.lang.Thread.State: BLOCKED (on object monitor)
    Line 8089:    java.lang.Thread.State: BLOCKED (on object monitor)
    Line 8176:    java.lang.Thread.State: BLOCKED (on object monitor)
    Line 8485:    java.lang.Thread.State: BLOCKED (on object monitor)
    Line 8572:    java.lang.Thread.State: BLOCKED (on object monitor)
    Line 8841:    java.lang.Thread.State: BLOCKED (on object monitor)
    Line 9023:    java.lang.Thread.State: BLOCKED (on object monitor)
    Line 9292:    java.lang.Thread.State: BLOCKED (on object monitor)
    Line 9379:    java.lang.Thread.State: BLOCKED (on object monitor)
    Line 9692:    java.lang.Thread.State: BLOCKED (on object monitor)
    Line 9779:    java.lang.Thread.State: BLOCKED (on object monitor)
    Line 9866:    java.lang.Thread.State: BLOCKED (on object monitor)
    Line 10250:    java.lang.Thread.State: BLOCKED (on object monitor)
    Line 10428:    java.lang.Thread.State: BLOCKED (on object monitor)
    Line 10515:    java.lang.Thread.State: BLOCKED (on object monitor)
    Line 10602:    java.lang.Thread.State: BLOCKED (on object monitor)
    Line 10689:    java.lang.Thread.State: BLOCKED (on object monitor)
    Line 11049:    java.lang.Thread.State: BLOCKED (on object monitor)
    Line 11136:    java.lang.Thread.State: BLOCKED (on object monitor)
    Line 11223:    java.lang.Thread.State: BLOCKED (on object monitor)
    Line 11310:    java.lang.Thread.State: BLOCKED (on object monitor)
    Line 11397:    java.lang.Thread.State: BLOCKED (on object monitor)
    Line 11484:    java.lang.Thread.State: BLOCKED (on object monitor)
    Line 11571:    java.lang.Thread.State: BLOCKED (on object monitor)
    Line 11749:    java.lang.Thread.State: BLOCKED (on object monitor)
    Line 11927:    java.lang.Thread.State: BLOCKED (on object monitor)
    Line 12105:    java.lang.Thread.State: BLOCKED (on object monitor)
    Line 12192:    java.lang.Thread.State: BLOCKED (on object monitor)
    Line 12279:    java.lang.Thread.State: BLOCKED (on object monitor)
    Line 12366:    java.lang.Thread.State: BLOCKED (on object monitor)
    Line 12453:    java.lang.Thread.State: BLOCKED (on object monitor)
    Line 12540:    java.lang.Thread.State: BLOCKED (on object monitor)
    Line 12627:    java.lang.Thread.State: BLOCKED (on object monitor)
    Line 12714:    java.lang.Thread.State: BLOCKED (on object monitor)
    Line 13074:    java.lang.Thread.State: BLOCKED (on object monitor)
    Line 13161:    java.lang.Thread.State: BLOCKED (on object monitor)
    Line 13248:    java.lang.Thread.State: BLOCKED (on object monitor)
    Line 13335:    java.lang.Thread.State: BLOCKED (on object monitor)
    Line 13422:    java.lang.Thread.State: BLOCKED (on object monitor)
    Line 13509:    java.lang.Thread.State: BLOCKED (on object monitor)
    Line 13596:    java.lang.Thread.State: BLOCKED (on object monitor)
    Line 13683:    java.lang.Thread.State: BLOCKED (on object monitor)
    Line 14043:    java.lang.Thread.State: BLOCKED (on object monitor)
    Line 14130:    java.lang.Thread.State: BLOCKED (on object monitor)
    Line 14217:    java.lang.Thread.State: BLOCKED (on object monitor)
    Line 14304:    java.lang.Thread.State: BLOCKED (on object monitor)
    Line 14482:    java.lang.Thread.State: BLOCKED (on object monitor)
    Line 14569:    java.lang.Thread.State: BLOCKED (on object monitor)
    Line 14656:    java.lang.Thread.State: BLOCKED (on object monitor)
    Line 14834:    java.lang.Thread.State: BLOCKED (on object monitor)
    Line 14921:    java.lang.Thread.State: BLOCKED (on object monitor)
    Line 15008:    java.lang.Thread.State: BLOCKED (on object monitor)
    Line 15186:    java.lang.Thread.State: BLOCKED (on object monitor)
    Line 15273:    java.lang.Thread.State: BLOCKED (on object monitor)
    Line 15360:    java.lang.Thread.State: BLOCKED (on object monitor)
    Line 15447:    java.lang.Thread.State: BLOCKED (on object monitor)
    Line 15534:    java.lang.Thread.State: BLOCKED (on object monitor)
    Line 15621:    java.lang.Thread.State: BLOCKED (on object monitor)
    Line 15708:    java.lang.Thread.State: BLOCKED (on object monitor)
    Line 15795:    java.lang.Thread.State: BLOCKED (on object monitor)
    Line 15882:    java.lang.Thread.State: BLOCKED (on object monitor)
    Line 15969:    java.lang.Thread.State: BLOCKED (on object monitor)
    Line 16056:    java.lang.Thread.State: BLOCKED (on object monitor)
    Line 16234:    java.lang.Thread.State: BLOCKED (on object monitor)
    Line 16321:    java.lang.Thread.State: BLOCKED (on object monitor)
    Line 16408:    java.lang.Thread.State: BLOCKED (on object monitor)
    Line 16495:    java.lang.Thread.State: BLOCKED (on object monitor)
    Line 16582:    java.lang.Thread.State: BLOCKED (on object monitor)
    Line 16760:    java.lang.Thread.State: BLOCKED (on object monitor)
    Line 16847:    java.lang.Thread.State: BLOCKED (on object monitor)
    Line 16934:    java.lang.Thread.State: BLOCKED (on object monitor)
    Line 17112:    java.lang.Thread.State: BLOCKED (on object monitor)
    Line 17199:    java.lang.Thread.State: BLOCKED (on object monitor)
    Line 17286:    java.lang.Thread.State: BLOCKED (on object monitor)
    Line 17373:    java.lang.Thread.State: BLOCKED (on object monitor)
    Line 17460:    java.lang.Thread.State: BLOCKED (on object monitor)
    Line 17547:    java.lang.Thread.State: BLOCKED (on object monitor)
    Line 17634:    java.lang.Thread.State: BLOCKED (on object monitor)
    Line 17721:    java.lang.Thread.State: BLOCKED (on object monitor)
    Line 17808:    java.lang.Thread.State: BLOCKED (on object monitor)
    Line 17895:    java.lang.Thread.State: BLOCKED (on object monitor)
    Line 17982:    java.lang.Thread.State: BLOCKED (on object monitor)
    Line 18069:    java.lang.Thread.State: BLOCKED (on object monitor)
    Line 18247:    java.lang.Thread.State: BLOCKED (on object monitor)
    Line 18334:    java.lang.Thread.State: BLOCKED (on object monitor)
    Line 18421:    java.lang.Thread.State: BLOCKED (on object monitor)
    Line 18508:    java.lang.Thread.State: BLOCKED (on object monitor)
    Line 18595:    java.lang.Thread.State: BLOCKED (on object monitor)
    Line 18864:    java.lang.Thread.State: BLOCKED (on object monitor)
    Line 18951:    java.lang.Thread.State: BLOCKED (on object monitor)
    Line 19038:    java.lang.Thread.State: BLOCKED (on object monitor)
    Line 19125:    java.lang.Thread.State: BLOCKED (on object monitor)
    Line 19212:    java.lang.Thread.State: BLOCKED (on object monitor)
    Line 19299:    java.lang.Thread.State: BLOCKED (on object monitor)
    Line 19386:    java.lang.Thread.State: BLOCKED (on object monitor)
    Line 19473:    java.lang.Thread.State: BLOCKED (on object monitor)
    Line 19560:    java.lang.Thread.State: BLOCKED (on object monitor)
    Line 19647:    java.lang.Thread.State: BLOCKED (on object monitor)
    Line 19734:    java.lang.Thread.State: BLOCKED (on object monitor)
    Line 19821:    java.lang.Thread.State: BLOCKED (on object monitor)
    Line 19908:    java.lang.Thread.State: BLOCKED (on object monitor)
    Line 19995:    java.lang.Thread.State: BLOCKED (on object monitor)
    Line 20082:    java.lang.Thread.State: BLOCKED (on object monitor)
    Line 20169:    java.lang.Thread.State: BLOCKED (on object monitor)
    Line 20256:    java.lang.Thread.State: BLOCKED (on object monitor)
    Line 20434:    java.lang.Thread.State: BLOCKED (on object monitor)
    Line 20521:    java.lang.Thread.State: BLOCKED (on object monitor)
    Line 20608:    java.lang.Thread.State: BLOCKED (on object monitor)
    Line 20695:    java.lang.Thread.State: BLOCKED (on object monitor)
    Line 20964:    java.lang.Thread.State: BLOCKED (on object monitor)
    Line 21051:    java.lang.Thread.State: BLOCKED (on object monitor)
    Line 21138:    java.lang.Thread.State: BLOCKED (on object monitor)
    Line 21225:    java.lang.Thread.State: BLOCKED (on object monitor)
    Line 21312:    java.lang.Thread.State: BLOCKED (on object monitor)
    Line 21399:    java.lang.Thread.State: BLOCKED (on object monitor)
    Line 21486:    java.lang.Thread.State: BLOCKED (on object monitor)
    Line 21573:    java.lang.Thread.State: BLOCKED (on object monitor)
    Line 21751:    java.lang.Thread.State: BLOCKED (on object monitor)
    Line 21838:    java.lang.Thread.State: BLOCKED (on object monitor)
    Line 21925:    java.lang.Thread.State: BLOCKED (on object monitor)
    Line 22107:    java.lang.Thread.State: BLOCKED (on object monitor)
    Line 22194:    java.lang.Thread.State: BLOCKED (on object monitor)
    Line 22281:    java.lang.Thread.State: BLOCKED (on object monitor)
    Line 22560:    java.lang.Thread.State: BLOCKED (on object monitor)
    Line 22647:    java.lang.Thread.State: BLOCKED (on object monitor)
    Line 22734:    java.lang.Thread.State: BLOCKED (on object monitor)
    Line 23012:    java.lang.Thread.State: BLOCKED (on object monitor)
    Line 23291:    java.lang.Thread.State: BLOCKED (on object monitor)
    Line 23378:    java.lang.Thread.State: BLOCKED (on object monitor)
    Line 23465:    java.lang.Thread.State: BLOCKED (on object monitor)
    Line 23738:    java.lang.Thread.State: BLOCKED (on object monitor)
    Line 24007:    java.lang.Thread.State: BLOCKED (on object monitor)
    Line 24190:    java.lang.Thread.State: BLOCKED (on object monitor)
    Line 24277:    java.lang.Thread.State: BLOCKED (on object monitor)
    Line 24364:    java.lang.Thread.State: BLOCKED (on object monitor)
    Line 24451:    java.lang.Thread.State: BLOCKED (on object monitor)
    Line 24538:    java.lang.Thread.State: BLOCKED (on object monitor)
    Line 24927:    java.lang.Thread.State: BLOCKED (on object monitor)
    Line 25014:    java.lang.Thread.State: BLOCKED (on object monitor)
    Line 25101:    java.lang.Thread.State: BLOCKED (on object monitor)
    Line 25188:    java.lang.Thread.State: BLOCKED (on object monitor)
    Line 25275:    java.lang.Thread.State: BLOCKED (on object monitor)
    Line 25457:    java.lang.Thread.State: BLOCKED (on object monitor)
    Line 25637:    java.lang.Thread.State: BLOCKED (on object monitor)
    Line 25910:    java.lang.Thread.State: BLOCKED (on object monitor)
    Line 25997:    java.lang.Thread.State: BLOCKED (on object monitor)
    Line 26084:    java.lang.Thread.State: BLOCKED (on object monitor)
    Line 26266:    java.lang.Thread.State: BLOCKED (on object monitor)
    Line 26353:    java.lang.Thread.State: BLOCKED (on object monitor)
    Line 26638:    java.lang.Thread.State: BLOCKED (on object monitor)
    Line 27048:    java.lang.Thread.State: BLOCKED (on object monitor)
    Line 27231:    java.lang.Thread.State: BLOCKED (on object monitor)
<ehcache>
    <diskStore path="D:/xiaoyuchuan/cache" />
    <defaultCache
            maxElementsInMemory="1000"
            eternal="false"
            timeToIdleSeconds="120"
            timeToLiveSeconds="120"
            overflowToDisk="false"/>
    <cache name="CarInfoTree"
           maxElementsOnDisk="0"
           maxElementsInMemory="20000"
           eternal="true"
           overflowToDisk="true"
           diskPersistent="true"/>
    <cache name="UserBuslines"
           maxElementsOnDisk="20000"
           maxElementsInMemory="2000"
           eternal="true"
           overflowToDisk="true"
           diskPersistent="true"/>
    <cache name="gnssData"
           maxElementsOnDisk="0"
           maxElementsInMemory="2000"
           eternal="true"
           overflowToDisk="true"
           diskPersistent="true"/>
</ehcache>

The VisualVM Thread View

1 个答案:

答案 0 :(得分:0)

我们解决了这个问题,Ehcache很正常,这是我们的业务代码错误。 我们同时使用EhcacheUtil和Spring Ehcache批注,当EhcacheUtil返回null时,我们将循环调用out方法,然后服务器上的负载会突然增加,从而导致问题的描述。

我们仅通过使用Spring Ehcache注释解决了这个问题。