当前位置: 首页>>代码示例>>Java>>正文


Java RemovalNotification.getKey方法代码示例

本文整理汇总了Java中com.google.common.cache.RemovalNotification.getKey方法的典型用法代码示例。如果您正苦于以下问题:Java RemovalNotification.getKey方法的具体用法?Java RemovalNotification.getKey怎么用?Java RemovalNotification.getKey使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在com.google.common.cache.RemovalNotification的用法示例。


在下文中一共展示了RemovalNotification.getKey方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: onRemoval

import com.google.common.cache.RemovalNotification; //导入方法依赖的package包/类
@Override
public void onRemoval(RemovalNotification<Object, Cache<Query, Value>> notification) {
    Object key = notification.getKey();
    if (key == null) {
        return;
    }

    Cache<Query, Value> valueCache = notification.getValue();
    if (valueCache == null) {
        return;
    }

    for (Value value : valueCache.asMap().values()) {
        listener.onRemoval(value.shardId, value.bitset);
        // if null then this means the shard has already been removed and the stats are 0 anyway for the shard this key belongs to
    }
}
 
开发者ID:baidu,项目名称:Elasticsearch,代码行数:18,代码来源:BitsetFilterCache.java

示例2: onRemoval

import com.google.common.cache.RemovalNotification; //导入方法依赖的package包/类
public void onRemoval(RemovalNotification<Integer, StatementInfo> notification) {
  Integer stmtId = notification.getKey();
  StatementInfo doomed = notification.getValue();
  if (doomed == null) {
    // log/throw?
    return;
  }
  LOG.debug("Expiring statement {} because {}", stmtId, notification.getCause());
  try {
    if (doomed.getResultSet() != null) {
      doomed.getResultSet().close();
    }
    if (doomed.statement != null) {
      doomed.statement.close();
    }
  } catch (Throwable t) {
    LOG.info("Exception thrown while expiring statement {}", stmtId, t);
  }
}
 
开发者ID:apache,项目名称:calcite-avatica,代码行数:20,代码来源:JdbcMeta.java

示例3: onRemoval

import com.google.common.cache.RemovalNotification; //导入方法依赖的package包/类
public void onRemoval(RemovalNotification<Integer, StatementInfo> notification) {
  Integer stmtId = notification.getKey();
  StatementInfo doomed = notification.getValue();
  if (doomed == null) {
    // log/throw?
    return;
  }
  if (LOG.isDebugEnabled()) {
    LOG.debug("Expiring statement " + stmtId + " because "
        + notification.getCause());
  }
  try {
    if (doomed.resultSet != null) {
      doomed.resultSet.close();
    }
    if (doomed.statement != null) {
      doomed.statement.close();
    }
  } catch (Throwable t) {
    LOG.info("Exception thrown while expiring statement " + stmtId);
  }
}
 
开发者ID:qubole,项目名称:quark,代码行数:23,代码来源:QuarkMetaImpl.java

示例4: onRemoval

import com.google.common.cache.RemovalNotification; //导入方法依赖的package包/类
@Override
public void onRemoval(RemovalNotification<Key, Value> notification) {
    if (notification.getKey() == null) {
        return;
    }
    notification.getKey().shard.requestCache().onRemoval(notification);
}
 
开发者ID:baidu,项目名称:Elasticsearch,代码行数:8,代码来源:IndicesRequestCache.java

示例5: onRemoval

import com.google.common.cache.RemovalNotification; //导入方法依赖的package包/类
@Override
public void onRemoval(RemovalNotification<IndicesRequestCache.Key, IndicesRequestCache.Value> removalNotification) {
    if (removalNotification.wasEvicted()) {
        evictionsMetric.inc();
    }
    long dec = 0;
    if (removalNotification.getKey() != null) {
        dec += removalNotification.getKey().ramBytesUsed();
    }
    if (removalNotification.getValue() != null) {
        dec += removalNotification.getValue().ramBytesUsed();
    }
    totalMetric.dec(dec);
}
 
开发者ID:baidu,项目名称:Elasticsearch,代码行数:15,代码来源:ShardRequestCache.java

示例6: onRemoval

import com.google.common.cache.RemovalNotification; //导入方法依赖的package包/类
@Override
public void onRemoval(final RemovalNotification<String, List<MemberDescriptor>> notification) {
  final RemovalCause cause = notification.getCause();
  if (cause.equals(RemovalCause.EXPLICIT)) {
    final String key = notification.getKey();
    ProjectDatabaseHelper.deleteMemberDescriptors(key);
  }
}
 
开发者ID:mopemope,项目名称:meghanada-server,代码行数:9,代码来源:MemberCacheLoader.java

示例7: createCacheRemoveListener

import com.google.common.cache.RemovalNotification; //导入方法依赖的package包/类
/**
 * Creates the removal listener which is attached to the cache.
 *
 * @return cache entry removal listener.
 */
private RemovalListener<String, FSFilterStreamContext> createCacheRemoveListener()
{
  //When an entry is removed from the cache, removal listener is notified and it closes the output stream.
  return new RemovalListener<String, FSFilterStreamContext>()
  {
    @Override
    public void onRemoval(@Nonnull RemovalNotification<String, FSFilterStreamContext> notification)
    {
      FSFilterStreamContext streamContext = notification.getValue();
      if (streamContext != null) {
        try {
          String filename = notification.getKey();
          String partFileName = getPartFileNamePri(filename);

          LOG.info("closing {}", partFileName);
          long start = System.currentTimeMillis();

          closeStream(streamContext);
          filesWithOpenStreams.remove(filename);

          totalWritingTime += System.currentTimeMillis() - start;
        } catch (IOException e) {
          LOG.error("removing {}", notification.getValue(), e);
          throw new RuntimeException(e);
        }
      }
    }
  };
}
 
开发者ID:apache,项目名称:apex-malhar,代码行数:35,代码来源:AbstractFileOutputOperator.java

示例8: onRemoval

import com.google.common.cache.RemovalNotification; //导入方法依赖的package包/类
@Override
public void onRemoval(RemovalNotification<ArtifactIdentifier, File> notification) {
	ArtifactIdentifier artifactIdentifier = notification.getKey();
	File file = notification.getValue();
	if (file.exists()) {
              if (file.delete()) {
                  LOG.debug("Removed downloaded jar '{}' for '{}'", file, artifactIdentifier);
              }else{
                  LOG.warn("Could not remove downloaded jar '{}' for '{}'", file, artifactIdentifier);
              }
          }else{
              LOG.warn("Downloaded jar does not exists, so it cannot be cleaned up '{}' for '{}'", file, artifactIdentifier);
          }
}
 
开发者ID:RBMHTechnology,项目名称:apidoc-server,代码行数:15,代码来源:RepositoryService.java

示例9: onRemoval

import com.google.common.cache.RemovalNotification; //导入方法依赖的package包/类
@Override
public void onRemoval(RemovalNotification<Class<? extends IService>, Object> removal)
{
	final Class<? extends IService> serviceInterfaceClass = removal.getKey();
	final Object serviceImpl = removal.getValue();
	unloadService(serviceInterfaceClass, serviceImpl);
}
 
开发者ID:metasfresh,项目名称:metasfresh,代码行数:8,代码来源:Services.java

示例10: onRemoval

import com.google.common.cache.RemovalNotification; //导入方法依赖的package包/类
@Override
public void onRemoval(@NotNull final RemovalNotification<UUID, CPlayer> notification) {
    final UUID uuid = notification.getKey();
    if (uuid == null) return;
    // Invalidate the titles being kept with this player
    DefaultPlayerAPI.this.chatterbox.getAPI().getTitleAPI().invalidate(uuid);
}
 
开发者ID:Chatterbox,项目名称:Chatterbox,代码行数:8,代码来源:DefaultPlayerAPI.java

示例11: onRemoval

import com.google.common.cache.RemovalNotification; //导入方法依赖的package包/类
@Override
public void onRemoval(RemovalNotification<ByteBuf, String> notification) {
  ByteBuf key = notification.getKey();
  if (key == null) {
    throw new IllegalStateException("Unexpected null key");
  }
  boolean release = key.release();
  if (!release) {
    LOGGER.warn("The cached string ByteBuf with value {} was "
        + "removed but it had more references than expected", notification.getValue());
  }
}
 
开发者ID:torodb,项目名称:mongowp,代码行数:13,代码来源:GuavaStringPool.java

示例12: onRemoval

import com.google.common.cache.RemovalNotification; //导入方法依赖的package包/类
@Override
public void onRemoval(RemovalNotification<IpmiReceiverKey, IpmiReceiver> notification) {
    IpmiReceiverKey key = notification.getKey();
    IpmiReceiver receiver = notification.getValue();
    if (key != null && receiver != null && notification.wasEvicted())
        receiver.timeout(key);
}
 
开发者ID:shevek,项目名称:ipmi4j,代码行数:8,代码来源:IpmiPayloadReceiveDispatcher.java

示例13: onRemoval

import com.google.common.cache.RemovalNotification; //导入方法依赖的package包/类
@Override
public void onRemoval(
		RemovalNotification<SchemaCacheKey<?>, Object> paramRemovalNotification) {
	SchemaCacheKey<?> sck = paramRemovalNotification.getKey();
	if (sck.getCacheSegment() != CacheSegment.UNCATEGORIZED) {
		HashSet<PlanCacheKey> current = new HashSet<PlanCacheKey>(planCache.getROMap().keySet());
		for(PlanCacheKey pck : current) {
			CachedPlan cp = planCache.get(null,pck);
			if (cp == null) continue;
			if (cp.invalidate(sck))
				planCache.invalidate(pck);
		}
		pstmtCache.invalidate(sck);
	}
}
 
开发者ID:Tesora,项目名称:tesora-dve-pub,代码行数:16,代码来源:SchemaCache.java

示例14: onRemoval

import com.google.common.cache.RemovalNotification; //导入方法依赖的package包/类
/**
 * Atomically transitions the resource to a state where it can no longer be used. If the
 * resource is idle or retired then it is immediately discarded. If the resource is
 * currently in use then it is marked to be discarded when it has been released.
 */
@Override
public void onRemoval(RemovalNotification<ResourceKey<K>, R> notification) {
  ResourceKey<K> resourceKey = notification.getKey();
  for (;;) {
    Status status = resourceKey.getStatus();
    switch (status) {
      case IDLE:
        // The resource is not being used and may be immediately discarded
        if (resourceKey.goFromIdleToDead()) {
          discardFromIdle(resourceKey, notification.getValue());
          return;
        }
        break;
      case IN_FLIGHT:
        // The resource is currently being used and should be discarded when released
        if (resourceKey.goFromInFlightToRetired()) {
          return;
        }
        break;
      case RETIRED:
        // A resource is already retired when it has been expired by the idle cache
        if (resourceKey.goFromRetiredToDead()) {
          discardFromRetired(resourceKey, notification.getValue());
          return;
        }
        break;
      default:
        throw new IllegalStateException("Unnexpected state: " + status);
    }
  }
}
 
开发者ID:ben-manes,项目名称:multiway-pool,代码行数:37,代码来源:TransferPool.java

示例15: onRemoval

import com.google.common.cache.RemovalNotification; //导入方法依赖的package包/类
public void onRemoval(RemovalNotification<String, TradeAccount> notification) {
    this.removalCause = notification.getCause();
    this.removedKey = notification.getKey();
    this.removedValue = notification.getValue();
}
 
开发者ID:wsldl123292,项目名称:testeverything,代码行数:6,代码来源:TradeAccountRemovalListener.java


注:本文中的com.google.common.cache.RemovalNotification.getKey方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。