class ToolkitInstanceFactoryImpl implements ToolkitInstanceFactory {

  @Override
  public void linkClusteredCacheManager(String cacheManagerName, net.sf.ehcache.config.Configuration configuration) {
    if (clusteredCacheManagerEntity == null) {
      logCacheManagerConfigInTerracottaClientLogs(cacheManagerName, configuration);

      ClusteredCacheManager clusteredCacheManager = clusteredEntityManager.getRootEntity(cacheManagerName,
          ClusteredCacheManager.class);
      ToolkitReadWriteLock cmRWLock = clusteredEntityManager.getEntityLock(EhcacheEntitiesNaming
          .getCacheManagerLockNameFor(cacheManagerName));
      ToolkitLock cmWriteLock = cmRWLock.writeLock();
      while (clusteredCacheManager == null) {
        if (cmWriteLock.tryLock()) {
          try {
            clusteredCacheManager = createClusteredCacheManagerEntity(cacheManagerName, configuration);
          } finally {
            cmWriteLock.unlock();
          }
        } else {
          clusteredCacheManager = clusteredEntityManager.getRootEntity(cacheManagerName, ClusteredCacheManager.class);
        }
      }
      clusteredCacheManagerEntity = clusteredCacheManager;
      entityNames.setCacheManagerName(cacheManagerName);
    }
  }

  public  ToolkitInstanceFactoryImpl(final TerracottaClientConfiguration terracottaClientConfiguration, final String productId);
  public  ToolkitInstanceFactoryImpl(final TerracottaClientConfiguration terracottaClientConfiguration);
    ToolkitInstanceFactoryImpl(final Toolkit toolkit, final ClusteredEntityManager clusteredEntityManager);
    ToolkitInstanceFactoryImpl(final Toolkit toolkit, final ClusteredEntityManager clusteredEntityManager,
                             final WANUtil util, final Watchdog wanWatchdog);

}