Skip to content
This repository has been archived by the owner on Jan 5, 2022. It is now read-only.

Commit

Permalink
change to guice instance
Browse files Browse the repository at this point in the history
  • Loading branch information
Shawn Feldman committed Apr 8, 2015
1 parent 3c504f1 commit 7b229d4
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 1 deletion.
Expand Up @@ -23,6 +23,8 @@
import com.google.common.cache.CacheBuilder;
import com.google.common.cache.CacheLoader;
import com.google.common.cache.LoadingCache;
import com.google.inject.Inject;
import com.google.inject.Singleton;
import org.apache.usergrid.corepersistence.util.CpNamingUtils;
import org.apache.usergrid.persistence.EntityManager;
import org.apache.usergrid.persistence.EntityManagerFactory;
Expand All @@ -49,6 +51,7 @@
* Implements the org app cache for faster runtime lookups. These values are immutable, so this LRU cache can stay
* full for the duration of the execution
*/
@Singleton
public class ApplicationIdCacheImpl implements ApplicationIdCache {
private static final Logger logger = LoggerFactory.getLogger(ApplicationIdCacheImpl.class);

Expand All @@ -63,6 +66,7 @@ public class ApplicationIdCacheImpl implements ApplicationIdCache {



@Inject
public ApplicationIdCacheImpl(final EntityManagerFactory emf, ApplicationIdCacheFig fig) {
this.emf = (CpEntityManagerFactory)emf;
this.rootEm = emf.getEntityManager(emf.getManagementAppId());
Expand Down
Expand Up @@ -143,6 +143,7 @@ public void configureMigrationProvider() {
bind(AllApplicationsObservable.class).to(AllApplicationsObservableImpl.class);

install(new GuicyFigModule(ApplicationIdCacheFig.class));
bind(ApplicationIdCache.class).to(ApplicationIdCacheImpl.class);

}

Expand Down
Expand Up @@ -118,7 +118,7 @@ public CpEntityManagerFactory(
this.entityIndexFactory = injector.getInstance(EntityIndexFactory.class);
this.managerCache = injector.getInstance( ManagerCache.class );
this.metricsFactory = injector.getInstance( MetricsFactory.class );
this.applicationIdCache = new ApplicationIdCacheImpl( this );
this.applicationIdCache = injector.getInstance(ApplicationIdCache.class);
}


Expand Down

0 comments on commit 7b229d4

Please sign in to comment.