当前位置: 首页>>代码示例>>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;未经允许,请勿转载。