Giter Site home page Giter Site logo

Comments (4)

olaf-otto avatar olaf-otto commented on June 5, 2024

Ii would be interesting to know how the bundle context became invalid in the first place... However, the consistency checker must be hardened regardless.

from neba.

olaf-otto avatar olaf-otto commented on June 5, 2024

I've taken a look at the felix bundle context implementation to better understand how this happens. First of, this only happens on very old version of Felix (e.g. those shipped with CQ 5.3). It seems to me that this is a felix-internal issue, perhaps because the NEBA bundle is a fragment. Here is the code excerpt from [1]:

353    private void More ...checkValidity()
354    {
355        if (m_valid)
356        {
357            switch (m_bundle.getState())
358            {
359                case Bundle.ACTIVE:
360                case Bundle.STARTING:
361                case Bundle.STOPPING:
362                    return;
363            }
364        }
365
366        throw new IllegalStateException("Invalid BundleContext.");
367    }

Unfortunately, the exception does not tell what the unexpected state is.

[1] http://grepcode.com/file/repo1.maven.org/maven2/org.apache.felix/org.apache.felix.framework/2.0.5/org/apache/felix/framework/BundleContextImpl.java#BundleContextImpl.checkValidity%28%29

from neba.

olaf-otto avatar olaf-otto commented on June 5, 2024

After some analysis, I have come to the conclusion that the reference checker itself may be discarded due to an earlier architecture change.

When a bundle is stopped or fails, the ContextShutdownHandler removes all data related to the bundle from all registries. Consequently, it is safe to store a reference to the source bundle in the OsgiBeanSource. This makes it possible to simply check the validity there - which is also much better from an OO point of view:

Before:

consistencyChecker.isValid(source)

After:

source.isValid();

I'll put this on a feature branch.

from neba.

olaf-otto avatar olaf-otto commented on June 5, 2024

Done - merged pull request.

from neba.

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.