lucenenet-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Digy (JIRA)" <j...@apache.org>
Subject [jira] Commented: (LUCENENET-181) Port of ThreadLocal is wrong?
Date Mon, 20 Apr 2009 07:42:47 GMT

    [ https://issues.apache.org/jira/browse/LUCENENET-181?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12700686#action_12700686
] 

Digy commented on LUCENENET-181:
--------------------------------

bq. If you'll make "enumerators" static in this case then all TermInfosReader will share the
same instance which is definitly not what we want and is defintly not how the java version
behaves (remember - The "enumerators" variable is also non-static in the java version).

Yes,making "enumerators" static  mean that all TermInfosReader will share the same instance.
But it can be thought as a pointer to a location which is created *per thread*  and where
Terms() are stored.  (*Thread.SetData(enumerators, termEnum);*).

One term-cache per thread is  what is intended in Java (or  I think so).

As I wanted to show in "TestCase", if you make "enumerators" static, cache is created only
once per thread, otherwise it is created with every new instance of TermInfosReader( A private
field would be enough for that type of cache). 


DIGY.









 

> Port of ThreadLocal is wrong?
> -----------------------------
>
>                 Key: LUCENENET-181
>                 URL: https://issues.apache.org/jira/browse/LUCENENET-181
>             Project: Lucene.Net
>          Issue Type: Improvement
>            Reporter: Digy
>            Priority: Minor
>         Attachments: TestCase.cs
>
>
> AFAIK, "ThreadLocal" in Java is there to hold objects which are intented to be used 
thread-wide. So, its port-equivalent "LocalDataStoreSlot" should contain objects related with
the executing thread. But, since they are not declared as "static" in Analyzer.cs, FieldsReader.cs,
SegmentReader.cs and TermInfosReader.cs, they are created with every class contruction, changing
the behaviour of "ThreadLocal" and possibly resulting in performance degradation.
> I will attach a test case for this issue.
> If I am wrong, then there is no problem. But If I am right we are in trouble;  Since
adding "static" to variables declared as LocalDataStoreSlot results in failing of almost all
test cases.
> DIGY

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


Mime
View raw message