net.sf.ehcache.Cache.dispose()方法的使用及代码示例

x33g5p2x  于2022-01-18 转载在 其他  
字(3.2k)|赞(0)|评价(0)|浏览(139)

本文整理了Java中net.sf.ehcache.Cache.dispose()方法的一些代码示例,展示了Cache.dispose()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Cache.dispose()方法的具体详情如下:
包路径:net.sf.ehcache.Cache
类名称:Cache
方法名:dispose

Cache.dispose介绍

[英]Starts an orderly shutdown of the Cache. Steps are:

  1. Completes any outstanding CacheLoader loads.
  2. Completes any outstanding CacheWriter operations.
  3. Disposes any cache extensions.
  4. Disposes any cache event listeners. The listeners normally complete, so for example distributed caching operations will complete.
  5. Flushes all cache items from memory to the disk store, if any
  6. changes status to shutdown, so that any cache operations after this point throw IllegalStateException
    This method should be invoked only by CacheManager, as a cache's lifecycle is bound into that of it's cache manager.
    [中]启动缓存的有序关闭。步骤如下:
    1.完成所有未完成的缓存加载程序加载。
    1.完成所有未完成的CacheWriter操作。
    1.处置任何缓存扩展。
    1.处置任何缓存事件侦听器。侦听器通常会完成,例如,分布式缓存操作将完成。
    1.将所有缓存项从内存刷新到磁盘存储(如果有)
    1.将状态更改为shutdown,以便在此点之后的任何缓存操作都会引发IllegalStateException
    此方法只能由CacheManager调用,因为缓存的生命周期绑定到其缓存管理器的生命周期中。

代码示例

代码示例来源:origin: gravitee-io/gravitee-gateway

@Override
protected void doStop() throws Exception {
  if (enabled) {
    super.doStop();
    if (executorService != null) {
      executorService.shutdown();
    }
    LOGGER.info("Clear API keys from in-memory cache before stopping service");
    cache.removeAll();
    cache.dispose();
  }
}

代码示例来源:origin: gravitee-io/gravitee-gateway

@Override
protected void doStop() throws Exception {
  if (enabled) {
    super.doStop();
    if (executorService != null) {
      executorService.shutdown();
    }
    LOGGER.info("Clear subscriptions from cache before stopping service");
    cache.removeAll();
    cache.dispose();
  }
}

代码示例来源:origin: io.gravitee.gateway.services/gravitee-gateway-services-subscriptions-cache

@Override
protected void doStop() throws Exception {
  if (enabled) {
    super.doStop();
    if (executorService != null) {
      executorService.shutdown();
    }
    LOGGER.info("Clear subscriptions from cache before stopping service");
    cache.removeAll();
    cache.dispose();
  }
}

代码示例来源:origin: io.gravitee.gateway.services/gravitee-gateway-services-apikeyscache

@Override
protected void doStop() throws Exception {
  if (enabled) {
    super.doStop();
    if (executorService != null) {
      executorService.shutdown();
    }
    LOGGER.info("Clear API keys from in-memory cache before stopping service");
    cache.removeAll();
    cache.dispose();
  }
}

代码示例来源:origin: uk.ac.ebi.enfin.mi.cluster/micluster

private void shutdownIfActive( Cache cache ) {
     if( Status.STATUS_ALIVE.equals( cache.getStatus() ) ) {
       System.out.println( "Attempting to dispose of: " + cache.getName() + "..." );
       cache.dispose();
     } else {
       System.out.println( "Cache('"+ cache.getName() +"') was not alive. Skipping dispose()..." );
     }
  }
}

代码示例来源:origin: datasalt/splout-db

/**
 * Properly dispose this DNode.
 */
public void stop() throws Exception {
 dbCache.dispose();
 deployExecutor.shutdownNow();
 factory.close();
 httpExchanger.close();
 hz.getLifecycleService().shutdown();
}

代码示例来源:origin: uk.ac.ebi.intact.bridges/intact-uniprot

@Override
public void close() {
  if (this.cache != null){
    if( Status.STATUS_ALIVE.equals( cache.getStatus() ) ) {
      System.out.println( "Attempting to dispose of: " + cache.getName() + "..." );
      cache.dispose();
    }
  }
  if (cacheManager != null){
    cacheManager.clearAll();
  }
  service.close();
}

代码示例来源:origin: apache/oozie

missingCache.dispose(); //discard

代码示例来源:origin: org.apache.oozie/oozie-core

missingCache.dispose(); //discard

相关文章

Cache类方法