當前位置: 首頁>>代碼示例>>Java>>正文


Java RemovalNotification.getValue方法代碼示例

本文整理匯總了Java中com.google.common.cache.RemovalNotification.getValue方法的典型用法代碼示例。如果您正苦於以下問題:Java RemovalNotification.getValue方法的具體用法?Java RemovalNotification.getValue怎麽用?Java RemovalNotification.getValue使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在com.google.common.cache.RemovalNotification的用法示例。


在下文中一共展示了RemovalNotification.getValue方法的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: clientRemovalListener

import com.google.common.cache.RemovalNotification; //導入方法依賴的package包/類
private RemovalListener<String, DFSClient> clientRemovalListener() {
  return new RemovalListener<String, DFSClient>() {
    @Override
    public void onRemoval(
        RemovalNotification<String, DFSClient> notification) {
      DFSClient client = notification.getValue();
      try {
        client.close();
      } catch (IOException e) {
        LOG.warn(String
            .format("IOException when closing the DFSClient(%s), cause: %s",
                client, e));
      }
    }
  };
}
 
開發者ID:hopshadoop,項目名稱:hops,代碼行數:17,代碼來源:DFSClientCache.java

示例5: onRemoval

import com.google.common.cache.RemovalNotification; //導入方法依賴的package包/類
@Override
public void onRemoval(RemovalNotification<CacheValue, NodeDocument> n) {
    //If removed explicitly then we clear from L2
    if (n.getCause() == RemovalCause.EXPLICIT
            || n.getCause() == RemovalCause.REPLACED) {
        offHeapCache.invalidate(n.getKey());
    }

    //If removed because of size then we move it to
    //L2
    if (n.getCause() == RemovalCause.SIZE) {
        NodeDocument doc = n.getValue();
        if (doc != NodeDocument.NULL) {
            offHeapCache.put(n.getKey(),
                    new NodeDocReference(n.getKey(), doc));
        }
    }
}
 
開發者ID:denismo,項目名稱:jackrabbit-dynamodb-store,代碼行數:19,代碼來源:NodeDocOffHeapCache.java

示例6: onRemoval

import com.google.common.cache.RemovalNotification; //導入方法依賴的package包/類
public void onRemoval(RemovalNotification<String, Object> notification) {
	Class<?> handlerClass = null;
	
	try {
		handlerClass = Class.forName(notification.getKey());
	} catch (ClassNotFoundException e) {
		logger.error("Unexpected exception", e);
	}
	
	if (handlerClass != null) {
		String[] beanNames = beanFactory.getBeanNamesForType(handlerClass);

		if (beanNames != null && beanNames.length > 0) {
			if (beanFactory.isPrototype(beanNames[0])) {
				if (notification.getValue() instanceof WebSocketSessionAware) {
					WebSocketSessionAware webSocketSessionAwareHandler = (WebSocketSessionAware)notification.getValue();
					
					webSocketSessionAwareHandler.onWebSocketSessionRemoved(webSocketSession);
				}
				
				beanFactory.destroyBean(notification.getValue());
			} // else this is a singleton and we don't do anything with singletons
		} // this shouldn't happen
	} // this shouldn't happen either
}
 
開發者ID:Kixeye,項目名稱:chassis,代碼行數:26,代碼來源:ActionInvokingWebSocket.java

示例7: onRemoval

import com.google.common.cache.RemovalNotification; //導入方法依賴的package包/類
@Override
public void onRemoval(RemovalNotification<String, CachedOffer> notification) {
  if (notification.getCause() == RemovalCause.EXPLICIT) {
    return;
  }

  LOG.debug("Cache removal for {} due to {}", notification.getKey(), notification.getCause());

  synchronized (offerCache) {
    if (notification.getValue().offerState == OfferState.AVAILABLE) {
      declineOffer(notification.getValue());
    } else {
      notification.getValue().expire();
    }
  }
}
 
開發者ID:HubSpot,項目名稱:Singularity,代碼行數:17,代碼來源:SingularityOfferCache.java

示例8: onRemoval

import com.google.common.cache.RemovalNotification; //導入方法依賴的package包/類
public void onRemoval(RemovalNotification<String, List<Tuple>> removal) {
    if (!removal.wasEvicted())
        return;
    LOG.error("Purged from waitAck {} with {} values", removal.getKey(),
            removal.getValue().size());
    for (Tuple t : removal.getValue()) {
        _collector.fail(t);
    }
}
 
開發者ID:eorliac,項目名稱:patent-crawler,代碼行數:10,代碼來源:StatusUpdaterBolt.java

示例9: createRemovalListener

import com.google.common.cache.RemovalNotification; //導入方法依賴的package包/類
private RemovalListener<String, DataContext> createRemovalListener() {
    return new RemovalListener<String, DataContext>() {
        @Override
        public void onRemoval(final RemovalNotification<String, DataContext> notification) {
            final DataContext dataContext = notification.getValue();
            // some DataContexts are closeable - attempt closing it here
            FileHelper.safeClose(dataContext);
        }
    };
}
 
開發者ID:apache,項目名稱:metamodel-membrane,代碼行數:11,代碼來源:CachedDataSourceRegistryWrapper.java

示例10: createRemovalListener

import com.google.common.cache.RemovalNotification; //導入方法依賴的package包/類
private RemovalListener<String, TenantContext> createRemovalListener() {
    return new RemovalListener<String, TenantContext>() {
        @Override
        public void onRemoval(final RemovalNotification<String, TenantContext> notification) {
            final TenantContext tenantContext = notification.getValue();
            // TenantContexts could be closeable - attempt closing it here
            FileHelper.safeClose(tenantContext);
        }
    };
}
 
開發者ID:apache,項目名稱:metamodel-membrane,代碼行數:11,代碼來源:CachedTenantRegistryWrapper.java

示例11: onRemoval

import com.google.common.cache.RemovalNotification; //導入方法依賴的package包/類
@Override
public void onRemoval(RemovalNotification<FileInfo, MuxedFile> notification) {
	if (notification.getCause() != RemovalCause.EXPLICIT) {
		MuxedFile muxedFile = notification.getValue();
		// This is racy, at worst we will re-trigger muxing for unlucky files being re-opened
		if (!openMuxFiles.containsValue(muxedFile)) {
			muxFiles.remove(muxedFile.getInfo(), muxedFile.getMuxer());
			logger.info("Expired {}: {} deleted = {}", notification.getCause(), muxedFile, safeDelete(muxedFile));
		} else {
			logger.warn("BUG: Expired {}: {}, but is still open!", notification.getCause(), muxedFile);
		}
	}
}
 
開發者ID:tfiskgul,項目名稱:mux2fs,代碼行數:14,代碼來源:MuxFs.java

示例12: 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

示例13: clientRemovalListener

import com.google.common.cache.RemovalNotification; //導入方法依賴的package包/類
private RemovalListener<String, DFSClient> clientRemovalListener() {
  return new RemovalListener<String, DFSClient>() {
    @Override
    public void onRemoval(RemovalNotification<String, DFSClient> notification) {
      DFSClient client = notification.getValue();
      try {
        client.close();
      } catch (IOException e) {
        LOG.warn(String.format(
            "IOException when closing the DFSClient(%s), cause: %s", client,
            e));
      }
    }
  };
}
 
開發者ID:naver,項目名稱:hadoop,代碼行數:16,代碼來源:DFSClientCache.java

示例14: onRemoval

import com.google.common.cache.RemovalNotification; //導入方法依賴的package包/類
@Override
public void onRemoval(RemovalNotification<HBaseConnectionKey, Connection> notification) {
  try {
    Connection conn = notification.getValue();
    if (isValid(conn)) {
      conn.close();
    }
    logger.info("HBase connection '{}' closed.", conn);
  } catch (Throwable t) {
    logger.warn("Error while closing HBase connection.", t);
  }
}
 
開發者ID:dremio,項目名稱:dremio-oss,代碼行數:13,代碼來源:HBaseConnectionManager.java

示例15: stateRemoved

import com.google.common.cache.RemovalNotification; //導入方法依賴的package包/類
private void stateRemoved(final RemovalNotification<Identifier, SlicedMessageState<ActorRef>> notification) {
    final SlicedMessageState<ActorRef> state = notification.getValue();
    state.close();
    if (notification.wasEvicted()) {
        LOG.warn("{}: SlicedMessageState for {} was expired from the cache", logContext, notification.getKey());
        state.getOnFailureCallback().accept(new RuntimeException(String.format(
                "The slicing state for message identifier %s was expired due to inactivity from the assembling "
                 + "component on the other end", state.getIdentifier())));
    } else {
        LOG.debug("{}: SlicedMessageState for {} was removed from the cache due to {}", logContext,
                notification.getKey(), notification.getCause());
    }
}
 
開發者ID:hashsdn,項目名稱:hashsdn-controller,代碼行數:14,代碼來源:MessageSlicer.java


注:本文中的com.google.common.cache.RemovalNotification.getValue方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。