[ 
https://issues.apache.org/jira/browse/KAFKA-385?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13435689#comment-13435689
 ] 

Joel Koshy commented on KAFKA-385:
----------------------------------

Jun had brought up one more problem - the factory method to getAndMaybePut 
doesn't really
fix the problem of avoiding instantiation of objects if they are already 
present in the Pool since the
anonymous function that I use needs to instantiate the object. I tweaked the 
code to use lazy vals
and used logging to verify that each object in the Pool is instantiated only 
once.

>From what I understand, it seems lazy val's implementation effectively uses a 
>synchronized bitmap
to keep track of whether a particular val has been created or not. However, I'm 
not so sure how it works
if the val involves a parameter. e.g., lazy val factory = new MyClass(param) as 
opposed to
lazy val factory = new MyClass The concern is that scala may need to create 
some internal wrapper
classes (at runtime). I tried disassembling the bytecode but did not want to 
spend too much time on
it - so I thought I'd ask if anyone know details of how lazy vals work when the 
actual instance is only
known at runtime?

                
> RequestPurgatory enhancements - expire/checkSatisfy issue; add jmx beans
> ------------------------------------------------------------------------
>
>                 Key: KAFKA-385
>                 URL: https://issues.apache.org/jira/browse/KAFKA-385
>             Project: Kafka
>          Issue Type: Bug
>            Reporter: Joel Koshy
>            Assignee: Joel Koshy
>              Labels: bugs
>             Fix For: 0.8
>
>         Attachments: example_dashboard.jpg, graphite_explorer.jpg, 
> KAFKA-385-v1.patch, KAFKA-385-v2.patch, KAFKA-385-v3.patch, KAFKA-385-v3.patch
>
>
> As discussed in KAFKA-353:
> 1 - There is potential for a client-side race condition in the 
> implementations of expire and checkSatisfied. We can just synchronize on the 
> DelayedItem.
> 2 - Would be good to add jmx beans to facilitate monitoring RequestPurgatory 
> stats.

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: 
https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

Reply via email to