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


Java RemovalCause.EXPLICIT属性代码示例

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


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

示例1: onRemoval

@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,代码行数:18,代码来源:NodeDocOffHeapCache.java

示例2: onRemoval

@Override
	public void onRemoval(RemovalNotification<Writable, T> note) {
//		System.err.println("S0 Cache: " + activeKey + " " + note.getKey() + " " + note.getCause() + " " + cache.size());
		if (!(note.wasEvicted() || note.getCause() == RemovalCause.EXPLICIT)) {
			return;
		}
		if (activeKey != null && activeKey.equals(note.getKey())) {
			return;
		}

		try {
//			System.err.println("  s0emit: " + note.getCause() + " " + note.getKey() + " " + note.getValue());
			// Emit the record.
			collector.emit(new FValues(note.getKey(), note.getValue()));
		} catch (Throwable e) {
			lastThrown = e;
		}
	}
 
开发者ID:JamesLampton,项目名称:piggybank-squeal,代码行数:18,代码来源:Stage0Executor.java

示例3: onRemoval

@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,代码行数:16,代码来源:SingularityOfferCache.java

示例4: onRemoval

@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,代码行数:13,代码来源:MuxFs.java

示例5: onRemoval

@Override
public void onRemoval(final RemovalNotification<ChunkCoordIntPair, NBTTagCompound> notification) {
	try {
		// Only flush the entry if it was invalidated. Any entry could
		// be updated prior to it being written by an IO thread so we
		// want to avoid unnecessary writes.
		if (notification.getCause() == RemovalCause.EXPLICIT)
			AnvilChunkLoader.this.writeChunkNBTTags(notification.getKey(), notification.getValue());
	} catch (final Exception e) {
		e.printStackTrace();
	}
}
 
开发者ID:OreCruncher,项目名称:Jiffy,代码行数:12,代码来源:AnvilChunkLoader.java

示例6: onRemoval

@Override
	public void onRemoval(RemovalNotification<Writable, T> note) {
//		System.err.println("S1 Cache: " + activeKey + " " + note.getKey() + " " + note.getCause() + " " + cache.size());
		if (!(note.wasEvicted() || note.getCause() == RemovalCause.EXPLICIT)) {
			return;
		}
		
		if (activeKey != null && activeKey.equals(note.getKey())) {
			return;
		}

		try {
			// Determine if the current value is in the backlog or the prefetch.
			T cur;
			if (!stateBacklog.containsKey(note.getKey())) {
				// Pull the values in from the prefetch.
				runPrefetch();
			}
			cur = stateBacklog.remove(note.getKey());
//			System.err.println("stateBacklogged: k=<" + note.getKey() + "> v=" + cur);

			// Apply the update.
			cur = storeAgg.combine(cur, note.getValue());

			// Move things to the writeAhead.
			writeAhead.put(note.getKey(), cur);

			// Emit the result.
			collector.emit(new FValues(note.getKey(), cur));
		} catch (Throwable e) {
			lastThrown = e;
		}
	}
 
开发者ID:JamesLampton,项目名称:piggybank-squeal,代码行数:33,代码来源:Stage1Executor.java


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