> On April 19, 2016, 6:35 p.m., David Kantor wrote: > > typesystem/src/main/java/org/apache/atlas/typesystem/types/TypeSystemProvider.java, > > lines 44-46 > > <https://reviews.apache.org/r/46330/diff/1/?file=1348468#file1348468line44> > > > > So the type system is being re-initialized every time get() is called? > > Could be a performance issue.
Hi Dave, The TypeSystem is bound to be created by Guice in singleton scope. See the following line... bind(TypeSystem.class).toProvider(TypeSystemProvider.class).asEagerSingleton(); So the 'get' on typesystem provider is only called once for the duration of the Atlas server. Guice allows custom construction/initialization of objects through the provider interface (default is to look for @Inject annotated constructors). Currently in the Atlas code, the TypeSystem object ideally should have been injected wherever it is needed (or others depend on), but that is not the case. Instead all of the code is referring to TypeSystem object through the static TypeSystem.getInstance method which is diluting the GUICE's way of DI pattern. - venkata ----------------------------------------------------------- This is an automatically generated e-mail. To reply, visit: https://reviews.apache.org/r/46330/#review129588 ----------------------------------------------------------- On April 21, 2016, 11:44 a.m., venkata madugundu wrote: > > ----------------------------------------------------------- > This is an automatically generated e-mail. To reply, visit: > https://reviews.apache.org/r/46330/ > ----------------------------------------------------------- > > (Updated April 21, 2016, 11:44 a.m.) > > > Review request for atlas and David Kantor. > > > Bugs: ATLAS-683 > https://issues.apache.org/jira/browse/ATLAS-683 > > > Repository: atlas > > > Description > ------- > > The local type-cache has been carved out as an interface ITypeCacheProvider > and the TypeSystem code has been refactored to use an instance of > ITypeCacheProvider injected through Guice. An instance of ITypeCacheProvider > is created by looking up the implementation class specified in > atlas-application.properties (property - atlas.typesystem.cache.provider). > The default implementation is a local cache implemented by > DefaultTypeCacheProvider. > > > Diffs > ----- > > common/src/main/java/org/apache/atlas/AtlasRuntimeException.java > PRE-CREATION > distro/src/conf/atlas-application.properties > 41312402d339448db7547b1508b5a55a3f1e3cd7 > repository/src/main/java/org/apache/atlas/RepositoryMetadataModule.java > 75d14f0f8603f81cd52f758b9954764d74c89c14 > repository/src/test/java/org/apache/atlas/repository/BaseTest.java > 7e1df676c1502d14df2af4fc90513009fdafc632 > repository/src/test/scala/org/apache/atlas/query/GremlinTest.scala > 0289b1abcacfce7294e64518d0f79dc4c4826b2c > repository/src/test/scala/org/apache/atlas/query/LineageQueryTest.scala > cd1c424879008b9fafa77f3e969c6a116a8e98a5 > typesystem/src/main/java/org/apache/atlas/typesystem/types/TypeSystem.java > 7763ebc39593d2ba747bd53e861f1d35657c8ea1 > > typesystem/src/main/java/org/apache/atlas/typesystem/types/TypeSystemProvider.java > 4e1cd36bc1ccf6e770bca3d649b9203dbbc179a8 > > typesystem/src/main/java/org/apache/atlas/typesystem/types/cache/DefaultTypeCacheProvider.java > PRE-CREATION > > typesystem/src/main/java/org/apache/atlas/typesystem/types/cache/ITypeCacheProvider.java > PRE-CREATION > typesystem/src/test/java/org/apache/atlas/typesystem/types/BaseTest.java > 64dc7511a756f8f68519b48a38228696a866a7f8 > > typesystem/src/test/java/org/apache/atlas/typesystem/types/TypeInheritanceTest.java > c13ef3a10d7efa2c6a8fa6c261a3402d633f08d4 > > typesystem/src/test/java/org/apache/atlas/typesystem/types/cache/DefaultTypeCacheProviderTest.java > PRE-CREATION > > typesystem/src/test/scala/org/apache/atlas/typesystem/builders/BuilderTest.scala > 9d1d00f1dc649101119a3eebfca72e9bb3378a3d > > typesystem/src/test/scala/org/apache/atlas/typesystem/builders/MultiplicityTest.scala > 91e72c7d78e44d65f8fe8e2516d38c0da00ddd00 > > Diff: https://reviews.apache.org/r/46330/diff/ > > > Testing > ------- > > Unit tests for the local cache DefaultTypeCacheProvider have been authored > and all other affected unit tests of TypeSystem interface are modified to > function in the presence of a type cache provider. Ran all tests of Atlas. > > > Thanks, > > venkata madugundu > >
