You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@plc4x.apache.org by Łukasz Dywicki <lu...@code-house.org> on 2020/10/14 16:19:07 UTC

[DISCUSS] Enriched driver context for plc4j

Hey all,
I have a need and also proposal to extend driver context a bit.
Currently we miss a bit of information which is available to
DriverManager (caller class loader) which results in inconsistent
results for ServiceLoader.load and Class.forName calls.
These two are mainly dependent on class loading, however I would like to
make one step further and cover ServiceLoader with plc4j specific SPI,
ie. ServiceResolver which could be changed depending on needs.

My needs are coming purely from osgi landscape where class loaders are
managed and every call to ServiceLoader or Class.forName causes
troubles. For that reason I'd really love to find most obvious ones and
fix them.

What's currently unclear to me is what DriverContext is really for,
cause base type is empty and brings very little to the table. It seems
to be a perfect candidate to propagate class loader set in
PlcDriverManager to drivers, but if we bring it there we have N contexts
to update..

Cheers,
Łukasz

Re: [DISCUSS] Enriched driver context for plc4j

Posted by Christofer Dutz <ch...@c-ware.de>.
Hi Lukasz,

could you possibly whip up a proposal in a branch ... I have to admit I don't quite understand the problem you're trying to solve.
Perhaps being able to see what changes you propose makes this easier?

Chris



Am 14.10.20, 18:19 schrieb "Łukasz Dywicki" <lu...@code-house.org>:

    Hey all,
    I have a need and also proposal to extend driver context a bit.
    Currently we miss a bit of information which is available to
    DriverManager (caller class loader) which results in inconsistent
    results for ServiceLoader.load and Class.forName calls.
    These two are mainly dependent on class loading, however I would like to
    make one step further and cover ServiceLoader with plc4j specific SPI,
    ie. ServiceResolver which could be changed depending on needs.

    My needs are coming purely from osgi landscape where class loaders are
    managed and every call to ServiceLoader or Class.forName causes
    troubles. For that reason I'd really love to find most obvious ones and
    fix them.

    What's currently unclear to me is what DriverContext is really for,
    cause base type is empty and brings very little to the table. It seems
    to be a perfect candidate to propagate class loader set in
    PlcDriverManager to drivers, but if we bring it there we have N contexts
    to update..

    Cheers,
    Łukasz