Coder Social home page Coder Social logo

Comments (3)

turingking avatar turingking commented on May 24, 2024

我把断点打在 AppJoint.class 的101行,发现会执行多次。

    public BinaryKeyMap<Class, String, Object> getRouterInstanceMap() {
        if (softRouterInstanceMap.get() == null) {
            softRouterInstanceMap = new SoftReference<>(new BinaryKeyMap<>());  //这里在初始化的时候会走三次
        }
        return softRouterInstanceMap.get();
    }

from appjoint.

turingking avatar turingking commented on May 24, 2024

初步判断是 SoftReference 被回收的问题
这导致我A页面使用的是一个ServiceImpl对象,B页面使用的是一个新的ServiceImpl对象。

from appjoint.

ZhangHowie avatar ZhangHowie commented on May 24, 2024

我也发现了这个问题,就是软引用导致的,系统内存不足会导致软引用被内存回收掉。可能作者没想用到单例模式。但是如果按照单例模式使用就会出现生命周期问题。

from appjoint.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.