}
}
}
private PackageRegistry newPackage(final PackageDescr packageDescr) {
Package pkg;
if ( this.ruleBase == null || (pkg = this.ruleBase.getPackage( packageDescr.getName() )) == null ) {
// there is no rulebase or it does not define this package so define it
pkg = new Package( packageDescr.getName() );
pkg.setClassFieldAccessorCache( new ClassFieldAccessorCache( this.rootClassLoader ) );
// if there is a rulebase then add the package.
if ( this.ruleBase != null ) {
// Must lock here, otherwise the assumption about addPackage/getPackage behavior below might be violated
this.ruleBase.lock();
try {
this.ruleBase.addPackage( pkg );
pkg = this.ruleBase.getPackage( packageDescr.getName() );
} finally {
this.ruleBase.unlock();
}
} else {
// the RuleBase will also initialise the
pkg.getDialectRuntimeRegistry().onAdd( this.rootClassLoader );
}
}
PackageRegistry pkgRegistry = new PackageRegistry( this,
pkg );