TrueZIP
  1. TrueZIP
  2. TRUEZIP-312

ServiceLocator duplicate services in multithreading case.

    Details

    • Type: Bug Bug
    • Status: Closed
    • Priority: Major Major
    • Resolution: Works as designed
    • Affects Version/s: TrueZIP 7.6.6
    • Fix Version/s: None
    • Component/s: TrueZIP Kernel
    • Labels:
      None
    • Environment:

      win7 jdk1.6 eclipse3.7

      Description

      when I use TrueZip in my eclipse plugin project, first new a TFile in a separate thread by org.eclipse.jface.dialogs.ProgressMonitorDialog.ProgressMonitorDialog, get a warnning:

      警告: Found two services with the same priority 0
      First: de.schlichtherle.truezip.fs.file.TempFilePoolService[priority=0]
      Second: de.schlichtherle.truezip.fs.file.TempFilePoolService[priority=0]

      by debug code, find in de.schlichtherle.truezip.util.ServiceLocator.getServices(Class<S>), l1 and l2 are not same not find the same class de.schlichtherle.truezip.fs.file.TempFilePoolService

        Activity

        Hide
        Christian Schlichtherle added a comment -

        This can't be a multithreading issue because this code is properly isolated by the JVM when accessing the IOPoolLocator.Boot class. The effect you see is the result if your current thread's context class loader is not the same as the class loader which defined the IOPoolLocator class, yet both class loaders can locate an implementation class. You can try to set up the current thread's context class loader to be identical the class loader which defined the IOPoolLocator class. Otherwise, it's just a warning and should work anyway.

        Note that in TrueVFS, the successor of TrueZIP, a more sophisticated class loading framework is used which can resort this issue if one class loader is a parent of the other.

        Show
        Christian Schlichtherle added a comment - This can't be a multithreading issue because this code is properly isolated by the JVM when accessing the IOPoolLocator.Boot class. The effect you see is the result if your current thread's context class loader is not the same as the class loader which defined the IOPoolLocator class, yet both class loaders can locate an implementation class. You can try to set up the current thread's context class loader to be identical the class loader which defined the IOPoolLocator class. Otherwise, it's just a warning and should work anyway. Note that in TrueVFS, the successor of TrueZIP, a more sophisticated class loading framework is used which can resort this issue if one class loader is a parent of the other.
        Hide
        darknesstm added a comment -

        Thanks for the feedback.The problem is really not a multithreading issue.Actually the two class loaders load the same class by a same class loader.

        Show
        darknesstm added a comment - Thanks for the feedback.The problem is really not a multithreading issue.Actually the two class loaders load the same class by a same class loader.

          People

          • Assignee:
            Christian Schlichtherle
            Reporter:
            darknesstm
          • Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved: