lucene-java-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Uwe Schindler" <>
Subject RE: A codec moment or pickle
Date Thu, 12 Feb 2015 08:20:18 GMT

How about Codec.getDefault()? It does indeed not necessarily return the newest one (if somebody
changes the default using Codec.setDefault()), but for your use case "wrapping the current
default one", it should be fine?

I have not tried this yet, but there might be a chicken-egg problem:
- Your codec will have a separate name and be listed in META-INF as service (I assume this).
So it gets discovered by the Codec discovery process and is instantiated by that.
- On loading the Codec framework the call to codec.getDefault() might get in at a time where
the codecs are not yet fully initialized (because it will instantiate your codec while loading
the META-INF). This happens before the Codec class is itself fully statically initialized,
so the default codec might be null...
So relying on Codec.getDefault() in constructors of filter codecs may not work as expected!

Maybe try it out, was just an idea :-)


Uwe Schindler
H.-H.-Meier-Allee 63, D-28213 Bremen

> -----Original Message-----
> From: Benson Margulies []
> Sent: Thursday, February 12, 2015 2:11 AM
> To:
> Subject: A codec moment or pickle
> I have a class that extends FilterCodec. Written against Lucene 4.9, it uses the
> Lucene49Codec.
> Dropped into a copy of Solr with Lucene 4.10, it discovers that this codec is
> read-only in 4.10. Is there some way to code one of these to get 'the default
> codec' and not have to chase versions?
> ---------------------------------------------------------------------
> To unsubscribe, e-mail:
> For additional commands, e-mail:

To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message