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

Enis Soztutar updated NUTCH-471:
--------------------------------

    Attachment: NutchBeanCreationSync_v2.patch

>From http://www-128.ibm.com/developerworks/java/library/j-dcl.html

The bottom line is that double-checked locking, in whatever form, should not be 
used because you cannot guarantee that it will work on any JVM implementation. 
JSR-133 is addressing issues regarding the memory model, however, 
double-checked locking will not be supported by the new memory model. 
Therefore, you have two options:
    * Accept the synchronization of a getInstance() method as shown in Listing 
2.
    * Forgo synchronization and use a static field.

We don't want to remise performance in NutchBean.get(), synchronization is not 
a solution. Thus as Sami has suggested, i have written a ServetContextListener 
and added NutchBean construction code there. And modified web.xml to register 
the event listener class. Also In the servlet initialization, the Configuration 
object is initialized and cached by NutchConfiguration, so we avoid the same 
problem in NutchConfiguration.get(). 

 i have tested the implementation and it seems OK. 


> Fix synchronization in NutchBean creation
> -----------------------------------------
>
>                 Key: NUTCH-471
>                 URL: https://issues.apache.org/jira/browse/NUTCH-471
>             Project: Nutch
>          Issue Type: Bug
>          Components: searcher
>    Affects Versions: 1.0.0
>            Reporter: Enis Soztutar
>             Fix For: 1.0.0
>
>         Attachments: NutchBeanCreationSync_v1.patch, 
> NutchBeanCreationSync_v2.patch
>
>
> NutchBean is created and then cached in servlet context. But 
> NutchBean.get(ServletContext app, Configuration conf) is not syncronized, 
> which causes more than one instance of the bean (and 
> DistributedSearch$Client) if servlet container is accessed rapidly during 
> startup. 

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


-------------------------------------------------------------------------
This SF.net email is sponsored by DB2 Express
Download DB2 Express C - the FREE version of DB2 express and take
control of your XML. No limits. Just data. Click to get it now.
http://sourceforge.net/powerbar/db2/
_______________________________________________
Nutch-developers mailing list
Nutch-developers@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/nutch-developers

Reply via email to