[ 
https://issues.apache.org/jira/browse/LUCENE-2154?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Uwe Schindler updated LUCENE-2154:
----------------------------------

    Attachment: LUCENE-2154-javassist.patch
                LUCENE-2154-cglib.patch

Here the last CGLIB patch for reference.

Now the real cool class created using JAVASSIST [http://www.javassist.org/]:
You have to place the latest javassist.jar (Mozilla/LGPL licensed) in the lib/ 
folder and apply the patch. What it does is the fastest proxy we can think of:
It creates a subclass of ProxyAttributeImpl that implements all methods of the 
interface natively in bytecode using JAVASSIST's bytecode generation tools (a 
subset of the Java language spec).

The micro-benchmark shows, no difference between proxied and native method - as 
hotspot removes the extra method call.

With Javassist it would even be possible to create classes that implement our 
interfaces around simple fields that are set by get/setters. Just like 
Eclipse's create get/set around a private field. That would be really cool. Or 
we could create combining attributes on the fly, Michael Busch would be 
excited. All *Impl classes we currently have would be almost obsolete (except 
TermAttributeImpl, which is rather complex). We could also create dynamic State 
classes for capturing state...

Nice, but a little bit hackish. Maybe we put this first into contrib and supply 
a ConcenatingTokenStream as demo impl and also other Solr TokenStreams that are 
no longer easy with the Attributes without proxies (Robert listed some).

> Need a clean way for Dir/MultiReader to "merge" the AttributeSources of the 
> sub-readers
> ---------------------------------------------------------------------------------------
>
>                 Key: LUCENE-2154
>                 URL: https://issues.apache.org/jira/browse/LUCENE-2154
>             Project: Lucene - Java
>          Issue Type: Bug
>          Components: Index
>    Affects Versions: Flex Branch
>            Reporter: Michael McCandless
>             Fix For: Flex Branch
>
>         Attachments: LUCENE-2154-cglib.patch, LUCENE-2154-javassist.patch, 
> LUCENE-2154.patch, LUCENE-2154.patch
>
>
> The flex API allows extensibility at the Fields/Terms/Docs/PositionsEnum 
> levels, for a codec to set custom attrs.
> But, it's currently broken for Dir/MultiReader, which must somehow share 
> attrs across all the sub-readers.  Somehow we must make a single attr source, 
> and tell each sub-reader's enum to use that instead of creating its own.  
> Hopefully Uwe can work some magic here :)

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


---------------------------------------------------------------------
To unsubscribe, e-mail: java-dev-unsubscr...@lucene.apache.org
For additional commands, e-mail: java-dev-h...@lucene.apache.org

Reply via email to