Felix
  1. Felix
  2. FELIX-2646

[Framework] Locking could be used to prevent concurrent access to a single bundle cache

    Details

    • Type: New Feature New Feature
    • Status: Closed
    • Priority: Minor Minor
    • Resolution: Fixed
    • Affects Version/s: framework-3.0.4
    • Fix Version/s: framework-3.0.6
    • Component/s: Framework
    • Labels:
      None

      Description

      Currently, the framework completely ignores concurrent access to the same bundle cache and leaves it as a configuration issue. The downside of this approach is that a mistaken configuration could corrupt your bundle cache. We could avoid this by introducing some sort of bundle cache locking protocol using java.nio.channels.FileLock. I think it would be sufficient to simply implement a fail-fast locking protocol.

      1. FELIX-2646.txt
        7 kB
        Richard S. Hall

        Activity

        Hide
        Richard S. Hall added a comment -

        Committed patch.

        Show
        Richard S. Hall added a comment - Committed patch.
        Hide
        Richard S. Hall added a comment -

        I suppose if it ends up posing such an issue, we could always make it configurable so that portion of code need not be executed in a 1.3 environment. But I'd rather not make it configurable in advance to avoid unnecessary configuration options.

        Show
        Richard S. Hall added a comment - I suppose if it ends up posing such an issue, we could always make it configurable so that portion of code need not be executed in a 1.3 environment. But I'd rather not make it configurable in advance to avoid unnecessary configuration options.
        Hide
        Karl Pauls added a comment -

        It should be no problem for android as that is 1.5 and has support for the nio packages. However, I agree that it might be a problem for embedded users running on 1.3 but that is getting pretty rare plus I don't think we really support 1.3 anymore anyways.

        Show
        Karl Pauls added a comment - It should be no problem for android as that is 1.5 and has support for the nio packages. However, I agree that it might be a problem for embedded users running on 1.3 but that is getting pretty rare plus I don't think we really support 1.3 anymore anyways.
        Hide
        Felix Meschberger added a comment -

        Makes sense and looks good.

        The only drawback is, that it requires Java 1.4 or better – but to me this presents absolutely no problem. But cannot tell about embedded uses (Android comes to mind).

        Show
        Felix Meschberger added a comment - Makes sense and looks good. The only drawback is, that it requires Java 1.4 or better – but to me this presents absolutely no problem. But cannot tell about embedded uses (Android comes to mind).
        Hide
        Sahoo added a comment -

        Thanks for making this enhancement.

        Show
        Sahoo added a comment - Thanks for making this enhancement.
        Hide
        Karl Pauls added a comment -

        I think this makes sense and the patch looks good.

        Show
        Karl Pauls added a comment - I think this makes sense and the patch looks good.
        Hide
        Richard S. Hall added a comment -

        Here is a proposed patch for bundle cache locking. I did a simple test by starting the framework twice from the same directory and it appears to work. The main downside of adding locking is it adds one more open file per framework instance. What do people think, is this a worthy addition?

        Show
        Richard S. Hall added a comment - Here is a proposed patch for bundle cache locking. I did a simple test by starting the framework twice from the same directory and it appears to work. The main downside of adding locking is it adds one more open file per framework instance. What do people think, is this a worthy addition?

          People

          • Assignee:
            Richard S. Hall
            Reporter:
            Richard S. Hall
          • Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved:

              Development