예제 #1
0
  @Override
  public void init(CacheLoaderConfig config, Cache<?, ?> cache, StreamingMarshaller m)
      throws CacheLoaderException {
    super.init(config, cache, m);
    Configuration cacheCfg = cache != null ? cache.getConfiguration() : null;
    concurrencyLevel = cacheCfg != null ? cacheCfg.getConcurrencyLevel() : 16;
    int cacheStopTimeout = cacheCfg != null ? cacheCfg.getCacheStopTimeout() : 30000;
    Long configuredAsyncStopTimeout = asyncStoreConfig.getShutdownTimeout();
    cacheName = cacheCfg != null ? cacheCfg.getName() : null;

    // Async store shutdown timeout cannot be bigger than
    // the overall cache stop timeout, so limit it accordingly.
    if (configuredAsyncStopTimeout >= cacheStopTimeout) {
      shutdownTimeout = Math.round(cacheStopTimeout * 0.90);
      log.asyncStoreShutdownTimeoutTooHigh(
          configuredAsyncStopTimeout, cacheStopTimeout, shutdownTimeout);
    } else {
      shutdownTimeout = configuredAsyncStopTimeout;
    }

    lockContainer = new ReleaseAllLockContainer(concurrencyLevel);
    transactions =
        new ConcurrentHashMap<GlobalTransaction, List<? extends Modification>>(
            64, 0.75f, concurrencyLevel);
  }