Uploaded image for project: 'Apache Avro'
  1. Apache Avro
  2. AVRO-1425

Fallback to thread context class loader in SpecificData.getClass()

    XMLWordPrintableJSON

    Details

    • Type: Improvement
    • Status: Open
    • Priority: Minor
    • Resolution: Unresolved
    • Affects Version/s: 1.7.5
    • Fix Version/s: None
    • Component/s: java
    • Labels:
      None

      Description

      While trying to implement a simple Avro serializer that works in an OSGi environment I stumbled on the fact that SpecificData.getClass() only uses its own ClassLoader. Letting it fallback to the thread context class loader (TCCL) makes it more OSGi-friendly, as callers can then set the TCCL as needed.

      AVRO-987, which hasn't been applied and is now stale, is about making Avro fully OSGi compliant and would fix my issue as well, but I tried to aim for the minimal changes that work for me (patch follows).

      My use case is at https://github.com/bdelacretaz/avro-osgi-test - at commit e3b4c47839 there my test passes with the attached patch applied to avro trunk revision 1552851.

        Attachments

        1. AVRO-1425.patch
          4 kB
          Bertrand Delacretaz

          Issue Links

            Activity

              People

              • Assignee:
                Unassigned
                Reporter:
                bdelacretaz Bertrand Delacretaz
              • Votes:
                1 Vote for this issue
                Watchers:
                4 Start watching this issue

                Dates

                • Created:
                  Updated: