As far as I remember, the 1.2 code was guaranteeing that only one instance of the core would be created even if 2 threads were trying to access/create it at the same time. The static method getSolrCore accesses the static SolrCore member 'instance' which is set by the SolrCore ctor; the CoreContainer getCore synchronization can not make the same guarantee. Since the singleton has been deprecated in 1.3, I guess it could be removed in 1.4 and that synchronization mechanism could thus go away.
Noble Paul നോബിള് नोब्ळ् wrote: > > we do not have that synchronization anymore . The CoreContainer is > already synchronizing in the getCore() method > > On Wed, Apr 8, 2009 at 4:50 PM, Henrib <[email protected]> wrote: >> >> It is synchronized due to 1.2 singleton core compatibility: >> public static SolrCore getSolrCore() { >> synchronized( SolrCore.class ) { >> ... >> >> It would require a lot of simultaneous core creations (and/or deprecated >> getSolrCore calls) to have a noticeable performance effect. >> >> >> Noble Paul നോബിള് नोब्ळ् wrote: >>> >>> Why does it have to be synchronized . will it notlead to poor >>> multicore performance? >>> >>> /** >>> * Creates a new core and register it in the list of cores. >>> * If a core with the same name already exists, it will be stopped >>> and replaced by this one. >>> �...@param dataDir the index directory >>> �...@param config a solr config instance >>> �...@param schema a solr schema instance >>> * >>> �...@since solr 1.3 >>> */ >>> public SolrCore(String name, String dataDir, SolrConfig config, >>> IndexSchema schema, CoreDescriptor cd) { >>> synchronized (SolrCore.class) { >>> >>> .... >>> } >>> -- >>> --Noble Paul >>> >>> >> >> -- >> View this message in context: >> http://www.nabble.com/Why-is-SolrCore-creation-synchronized--tp22943290p22948229.html >> Sent from the Solr - Dev mailing list archive at Nabble.com. >> >> > > > > -- > --Noble Paul > > -- View this message in context: http://www.nabble.com/Why-is-SolrCore-creation-synchronized--tp22943290p22948519.html Sent from the Solr - Dev mailing list archive at Nabble.com.
