Пример #1
0
  public void afterPropertiesSet() {
    CacheRegistryUtil.register(this);

    ServiceDependencyManager serviceDependencyManager = new ServiceDependencyManager();

    serviceDependencyManager.addServiceDependencyListener(
        new ServiceDependencyListener() {

          @Override
          public void dependenciesFulfilled() {
            Registry registry = RegistryUtil.getRegistry();

            _multiVMPool = registry.getService(MultiVMPool.class);

            PortalCacheManager<? extends Serializable, ? extends Serializable> portalCacheManager =
                _multiVMPool.getPortalCacheManager();

            portalCacheManager.registerPortalCacheManagerListener(EntityCacheImpl.this);
          }

          @Override
          public void destroy() {}
        });

    serviceDependencyManager.registerDependencies(MultiVMPool.class);
  }
Пример #2
0
  public void afterPropertiesSet() {
    ServiceDependencyManager serviceDependencyManager = new ServiceDependencyManager();

    serviceDependencyManager.addServiceDependencyListener(
        new ServiceDependencyListener() {

          @Override
          public void dependenciesFulfilled() {
            Registry registry = RegistryUtil.getRegistry();

            MultiVMPool multiVMPool = registry.getService(MultiVMPool.class);

            _portalCache =
                (PortalCache<Long, Serializable>)
                    multiVMPool.getPortalCache(LanguageImpl.class.getName());

            PortalCacheMapSynchronizeUtil.synchronize(
                _portalCache,
                _companyLocalesBags,
                new Synchronizer<Long, Serializable>() {

                  @Override
                  public void onSynchronize(
                      Map<? extends Long, ? extends Serializable> map,
                      Long key,
                      Serializable value,
                      int timeToLive) {

                    _companyLocalesBags.remove(key);
                  }
                });
          }

          @Override
          public void destroy() {}
        });

    serviceDependencyManager.registerDependencies(MultiVMPool.class);
  }