當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。