本文整理汇总了Java中com.gemstone.gemfire.cache.EntryEvent类的典型用法代码示例。如果您正苦于以下问题:Java EntryEvent类的具体用法?Java EntryEvent怎么用?Java EntryEvent使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
EntryEvent类属于com.gemstone.gemfire.cache包,在下文中一共展示了EntryEvent类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。
示例1: doEvict
import com.gemstone.gemfire.cache.EntryEvent; //导入依赖的package包/类
@Override
public boolean doEvict(EntryEvent<Object, Object> event) {
final EntryEventImpl ev = (EntryEventImpl)event;
final RegionEntry re = ev.getRegionEntry();
LocalRegion region = ev.getRegion();
if (region.getLogWriterI18n().fineEnabled()) {
region.getLogWriterI18n().fine(
" The entry is " + re + " and the event is " + event
+ " re marked for eviction " + re.isMarkedForEviction());
}
if (re != null) {
if (re.hasAnyLock()) {
return false;
}
if (re.isMarkedForEviction()) {
return true;
}
}
return false;
}
开发者ID:gemxd,项目名称:gemfirexd-oss,代码行数:22,代码来源:GlobalHashIndex.java
示例2: afterCreate
import com.gemstone.gemfire.cache.EntryEvent; //导入依赖的package包/类
public void afterCreate(EntryEvent event)
{
Cache cache = event.getRegion().getCache();
HARegion regionForQueue = (HARegion)cache.getRegion(Region.SEPARATOR
+ HARegionQueue.createRegionName(HAGIIBugDUnitTest.regionQueueName));
HARegionQueue regionqueue = regionForQueue.getOwner();
try {
regionqueue.put(new ConflatableObject(event.getKey(),
event.getNewValue(), ((EntryEventImpl)event).getEventId(),
false, "region1"));
}
catch (Exception e) {
e.printStackTrace();
}
}
开发者ID:gemxd,项目名称:gemfirexd-oss,代码行数:18,代码来源:HAGIIBugDUnitTest.java
示例3: afterUpdate
import com.gemstone.gemfire.cache.EntryEvent; //导入依赖的package包/类
/**
* This method performs the following tasks:<br>
* 1)Increment the count of afterUpdate in Validator<br>
* 2)Verify that value received in the event is not null as Feeder always
* generates update on a key with a Long value one more than the previous one
* on this key.<br>
* 3)If the oldValue received in the event is null,it implies that Feeder
* invalidated this key in previous operation. In this case, validate that the
* newValue received in the event is more than that stored in the local
* <code>latestValues</code> map<br>
* 4)If the oldValue received in the event is not null, validate that the
* newValue received in the event is more than the oldValue received in the
* event.<br>
* 4)Update the latest value map for the event key with the new value
* received.
*
* @param event -
* the entry event received in callback
*/
public void afterUpdate(EntryEvent event)
{
Validator.updateCount++;
String key = (String)event.getKey();
Long newValue = (Long)event.getNewValue();
Long oldValue = (Long)event.getOldValue();
if (newValue == null) {
throwException("newValue in afterUpdate cannot be null: key = " + key);
return;
}
if (oldValue == null) {
validateIncrementedNewValue(key, newValue);
}
else {
if (newValue.longValue() <= oldValue.longValue()) {
throwException("newValue must be greater than oldValue , but was not for key = "
+ key + " & newVal = " + newValue + " oldValue = " + oldValue);
return;
}
}
latestValues.put(key, newValue);
}
开发者ID:gemxd,项目名称:gemfirexd-oss,代码行数:45,代码来源:HANoFailoverConflationEnabledClientListener.java
示例4: afterCreate
import com.gemstone.gemfire.cache.EntryEvent; //导入依赖的package包/类
@Override
public void afterCreate(EntryEvent<String, Object> event) {
if (!readyForEvents) {
return;
}
ObjectName objectName = null;
try {
objectName = ObjectName.getInstance(event.getKey());
Object newObject = event.getNewValue();
proxyHelper.createProxy(event.getDistributedMember(), objectName, event
.getRegion(), newObject);
} catch (Exception e) {
if (logger.fineEnabled()) {
logger.fine(THIS_COMPONENT + ": Proxy Create failed for " + objectName
+ "With Exception " + e);
}
}
}
开发者ID:gemxd,项目名称:gemfirexd-oss,代码行数:21,代码来源:ManagementCacheListener.java
示例5: processVersionTag
import com.gemstone.gemfire.cache.EntryEvent; //导入依赖的package包/类
/**
* Process a version tag. This overrides AbtractRegionEntry so
* we can check to see if the old value was recovered from disk.
* If so, we don't check for conflicts.
*/
@Override
public void processVersionTag(EntryEvent cacheEvent) {
DiskId did = getDiskId();
boolean checkConflicts = true;
if(did != null) {
LocalRegion lr = (LocalRegion)cacheEvent.getRegion();
if (lr != null && lr.getDiskRegion().isReadyForRecovery()) {
synchronized(did) {
checkConflicts = !EntryBits.isRecoveredFromDisk(did.getUserBits());
}
}
}
processVersionTag(cacheEvent, checkConflicts);
}
开发者ID:gemxd,项目名称:gemfirexd-oss,代码行数:21,代码来源:AbstractOplogDiskRegionEntry.java
示例6: afterCreate
import com.gemstone.gemfire.cache.EntryEvent; //导入依赖的package包/类
public void afterCreate(EntryEvent event) {
logCall("afterCreate", event);
ParRegExpirationBB.getBB().getSharedCounters().increment(
ParRegExpirationBB.numAfterCreateEvents_CustomIdleTOInvalidate);
if (event.getKey().toString().startsWith("Expire_")) {
ParRegExpirationBB.getBB().getSharedCounters().increment(
ParRegExpirationBB.numAfterCreateEvents_CustomExpiryIdleTOInvalidate);
}
else {
ParRegExpirationBB
.getBB()
.getSharedCounters()
.increment(
ParRegExpirationBB.numAfterCreateEvents_CustomNoExpiryIdleTOInvalidate);
}
}
开发者ID:gemxd,项目名称:gemfirexd-oss,代码行数:17,代码来源:ParRegCustomIdleTOInvalListener.java
示例7: afterDestroy
import com.gemstone.gemfire.cache.EntryEvent; //导入依赖的package包/类
/**
* This method performs the following tasks:<br>
* 1)Increment the count of afterDestroy in Validator<br>
* 2)If the oldValue in the event is not null, update the latest value map for
* the event key with the oldValue received. If the value is null, it implies
* that Feeder did a invalidate() in its previous operation on this key and
* hence no need to update the local <code>latestValues</code> map.
*
* @param event -
* the entry event received in callback
*/
public void afterDestroy(EntryEvent event) {
synchronized (latestValues) {
Validator.destroyCount++;
if(event.getOldValue() instanceof Long) // for mix feed mode
return;
String key = (String)event.getKey();
DeltaTestObj value = (DeltaTestObj)event.getOldValue();
if (value != null) {
latestValues.put(key, value.getIntVar());
Log.getLogWriter().info(
"key " + key + " received at client old value : " + value);
}
Log.getLogWriter().fine("destroy entry in Map key " + key);
Validator.keyToMap.remove(key);
}
}
开发者ID:gemxd,项目名称:gemfirexd-oss,代码行数:31,代码来源:DeltaClientValidationListener.java
示例8: afterCreate
import com.gemstone.gemfire.cache.EntryEvent; //导入依赖的package包/类
/**
* This method performs the following tasks:<br>
* 1)Increment the count of afterCreate in Validator<br>
* 2)Verify that value received in the event is not null as Feeder always does
* create() on a key with a Long value. <br>
* 3)If the value is not zero( meaning the first create() call on this key),
* validate that the new value is exactly one more than the previous value.<br>
* 4)Update the latest value map for the event key with the new value
* received.
*
* @param event -
* the entry event received in callback
*/
public void afterCreate(EntryEvent event)
{
Validator.createCount++;
String key = (String)event.getKey();
if (key.equals(Feeder.LAST_KEY)) {
HAClientQueue.lastKeyReceived = true;
Log.getLogWriter().info("'last_key' received at client");
}
Long value = (Long)event.getNewValue();
if (value == null) {
throwException("value in afterCreate cannot be null: key = " + key);
return;
}
if (value.longValue() != 0) {
validateIncrementByOne(key, value);
}
latestValues.put(key, value);
}
开发者ID:gemxd,项目名称:gemfirexd-oss,代码行数:35,代码来源:HANoFailoverClientListener.java
示例9: setValueWithTombstoneCheck
import com.gemstone.gemfire.cache.EntryEvent; //导入依赖的package包/类
@Override
public void setValueWithTombstoneCheck(@Unretained Object v, EntryEvent e) throws RegionClearedException {
if (v == Token.TOMBSTONE) {
makeTombstone((LocalRegion)e.getRegion(), ((EntryEventImpl)e).getVersionTag());
} else {
setValue((LocalRegion)e.getRegion(), v);
}
}
开发者ID:gemxd,项目名称:gemfirexd-oss,代码行数:9,代码来源:AbstractRegionEntry.java
示例10: afterDestroy
import com.gemstone.gemfire.cache.EntryEvent; //导入依赖的package包/类
/**
* This method performs the following tasks:<br>
* 1)Increment the count of afterDestroy in Validator<br>
* 2)If the oldValue in the event is not null, update the latest value map for
* the event key with the oldValue received. If the value is null, it implies
* that Feeder did a invalidate() in its previous operation on this key and
* hence no need to update the local <code>latestValues</code> map.
*
* @param event -
* the entry event received in callback
*/
public void afterDestroy(EntryEvent event) {
synchronized (latestValues) {
Validator.destroyCount++;
String key = (String)event.getKey();
Long value = (Long)event.getOldValue();
if (value != null) {
latestValues.put(key, value.intValue());
Log.getLogWriter().info(
"key " + key + " received at client old value : " + value);
}
Log.getLogWriter().fine("destroy entry in Map key " + key);
}
}
开发者ID:gemxd,项目名称:gemfirexd-oss,代码行数:26,代码来源:DeltaClientOldValidationListener.java
示例11: beforeCreate
import com.gemstone.gemfire.cache.EntryEvent; //导入依赖的package包/类
public void beforeCreate(EntryEvent event){
// try{
// Thread.sleep(20000);
// }catch(InterruptedException ex) {
// //
// }
beforeCreateputAllcounter++;
getLogWriter().fine("*******BeforeCreate*****");
beforeCreate = true;
}
开发者ID:gemxd,项目名称:gemfirexd-oss,代码行数:12,代码来源:PutAllDAckDUnitTest.java
示例12: main1
import com.gemstone.gemfire.cache.EntryEvent; //导入依赖的package包/类
public static void main1(String[] args) throws Exception {
DistributedSystem system =
DistributedSystem.connect(new java.util.Properties());
Cache cache = CacheFactory.create(system);
AttributesFactory factory = new AttributesFactory();
factory.setEvictionAttributes(EvictionAttributes
.createLRUMemoryAttributes(2, (ObjectSizer) null, EvictionAction.OVERFLOW_TO_DISK));
factory.setCacheListener(new CacheListenerAdapter() {
public void afterUpdate(EntryEvent event) {
System.out.println("UPDATE: " + event.getKey() + " -> (" +
event.getOldValue() + " -> " +
event.getNewValue() + ")");
}
});
LocalRegion region = (LocalRegion)
cache.createRegion("TestDiskRegion",
factory.create());
DiskRegion dr = region.getDiskRegion();
DiskRegionStats diskStats = dr.getStats();
LRUStatistics lruStats = getLRUStats(region);
BufferedReader br =
new BufferedReader(new InputStreamReader(System.in));
System.out.println("Hit enter to perform action");
for (int i = 0; true; i++) {
br.readLine();
// Thread.sleep(500);
Object key = new Integer(i);
Object value = new byte[200000];
region.put(key, value);
System.out.println(key + " -> " + value + " evictions = " +
lruStats.getEvictions() + ", writes = " +
diskStats.getWrites());
}
}
开发者ID:gemxd,项目名称:gemfirexd-oss,代码行数:37,代码来源:TestDiskRegion.java
示例13: afterUpdate
import com.gemstone.gemfire.cache.EntryEvent; //导入依赖的package包/类
public void afterUpdate( EntryEvent event ) {
// If we're not processing local events, simply return
if (processRemoteEventsOnly) {
if (!event.isOriginRemote()) {
return;
}
}
Object value = event.getNewValue();
recordLatency(value);
}
开发者ID:gemxd,项目名称:gemfirexd-oss,代码行数:11,代码来源:LatencyListener.java
示例14: afterCreate
import com.gemstone.gemfire.cache.EntryEvent; //导入依赖的package包/类
/**
* Counts the number of puts done by create events.
*/
@Override
public void afterCreate(EntryEvent event) {
super.afterCreate(event);
synchronized (this) {
this.puts++;
notifyAll();
}
}
开发者ID:gemxd,项目名称:gemfirexd-oss,代码行数:12,代码来源:Client.java
示例15: afterDestroy
import com.gemstone.gemfire.cache.EntryEvent; //导入依赖的package包/类
@Override
public void afterDestroy(EntryEvent event) {
final String regionName = event.getRegion().getName();
final Object key = event.getKey();
final Object newValue = event.getNewValue();
System.out.println("In region " + regionName + " destroyed key " + key
+ " value " + newValue);
}
开发者ID:gemxd,项目名称:gemfirexd-oss,代码行数:9,代码来源:LoggingCacheListener.java
示例16: afterUpdate
import com.gemstone.gemfire.cache.EntryEvent; //导入依赖的package包/类
/**
* This method performs the following tasks:<br>
* 1)Increment the count of afterUpdate in Validator<br>
* 2)Verify that value received in the event is not null as Feeder always
* generates update on a key with a value's integer attribute is one more than the previous one
* on this key.<br>
* 3)If the oldValue received in the event is null,it implies that Feeder
* invalidated this key in previous operation. In this case, validate that the
* newValue received in the event is one more than that stored in the local
* <code>latestValues</code> map<br>
* 4)If the oldValue received in the event is not null, validate that the
* newValue's integer attribute received in the event is one more than the oldValue's integer attribute received in
* the event.<br>
* 4)Update the latest value map for the event key with the new value
* received.
*
* @param event -
* the entry event received in callback
*/
public void afterUpdate(EntryEvent event) {
synchronized (latestValues) {
Validator.updateNonDeltaCount++;
String key = (String)event.getKey();
Long newValue = (Long)event.getNewValue();
Long oldValue = (Long)event.getOldValue();
if (newValue == null) {
throwException("newValue in afterUpdate cannot be null: key = " + key);
return;
}
if (oldValue == null) {
validateIncrementByOne(key, newValue);
}
else {
long diff = newValue.intValue()
- ((Integer)latestValues.get(key)).intValue();
if (diff != 1) {
throwException("difference expected in newValue and oldValue is less than 1, but was not for key = "
+ key
+ " & newVal = "
+ newValue
+ " oldValue = "
+ ((Integer)latestValues.get(key)).intValue());
return;
}
}
Log.getLogWriter().fine(
"update entry in Map key " + key + " : value : " + newValue
+ " : puting into map : " + newValue.intValue());
latestValues.put(key, newValue.intValue());
}
}
开发者ID:gemxd,项目名称:gemfirexd-oss,代码行数:53,代码来源:DeltaClientOldValidationListener.java
示例17: afterDestroy
import com.gemstone.gemfire.cache.EntryEvent; //导入依赖的package包/类
@Override
public void afterDestroy(EntryEvent entryEvent) {
removeMeter.mark();
try {
Action action = new Action(entryEvent.getKey(), entryEvent.getNewValue());
action.setPut(false);
send(action);
} catch (Exception e) {
e.printStackTrace();
}
}
开发者ID:charliemblack,项目名称:gemfire-copy,代码行数:12,代码来源:SocketSenderCacheListener.java
示例18: isWanRemoteEvent
import com.gemstone.gemfire.cache.EntryEvent; //导入依赖的package包/类
private boolean isWanRemoteEvent(EntryEvent event){
int dsid = TestConfig.getInstance().getGemFireDescription(
System.getProperty(GemFirePrms.GEMFIRE_NAME_PROPERTY))
.getDistributedSystemId();
Object callback = ((EntryEventImpl)event).getRawCallbackArgument();
if (callback == null || !(callback instanceof GatewaySenderEventCallbackArgument)){
//not a gateway sender event
return false;
}
GatewaySenderEventCallbackArgument senderCallback = (GatewaySenderEventCallbackArgument)callback;
if(senderCallback.getOriginatingDSId() < 0){
//event is originated from edge client
return false;
}else if(senderCallback.getOriginatingDSId() == dsid){
//event from same ds
return false;
} else {
//check if event from remote ds, but routing from peer of same ds.
String tName = Thread.currentThread().getName();
if(!tName.contains("ServerConnection on port") && !tName.contains("PartitionedRegion Message Processor")){
//event is not from sender
return false;
}
}
//all criteria passed
return true;
}
开发者ID:gemxd,项目名称:gemfirexd-oss,代码行数:32,代码来源:WanLatencyListener.java
示例19: afterCreate
import com.gemstone.gemfire.cache.EntryEvent; //导入依赖的package包/类
@Override
public void afterCreate(EntryEvent<String, Object> event) {
ObjectName objectName = null;
try {
if (!service.isStartedAndOpen() || !service.isManager()) {
// NO OP return; No work for Non Manager Nodes
return;
}
objectName = ObjectName.getInstance(event.getKey());
FederationComponent newObject = (FederationComponent) event.getNewValue();
String className = newObject.getMBeanInterfaceClass();
Class interfaceClass;
if (classRef.get(className) != null) {
interfaceClass = classRef.get(className);
} else {
interfaceClass = ClassLoadUtil.classFromName(className);
classRef.put(className, interfaceClass);
}
service.afterPseudoCreateProxy(objectName, interfaceClass, null, newObject);
} catch (Exception e) {
if (logger.fineEnabled()) {
logger.fine(THIS_COMPONENT + ": Aggregation Failed failed for "
+ objectName + "With Exception " + e);
}
}
}
开发者ID:gemxd,项目名称:gemfirexd-oss,代码行数:31,代码来源:MonitoringRegionCacheListener.java
示例20: createServerCache
import com.gemstone.gemfire.cache.EntryEvent; //导入依赖的package包/类
public static Integer createServerCache(Boolean flag, DataPolicy policy,
Scope scope, Boolean listener) throws Exception {
ConnectionTable.threadWantsSharedResources();
DeltaPropagationStatsDUnitTest test = new DeltaPropagationStatsDUnitTest(
"temp");
Properties props = new Properties();
if (!flag) {
props
.setProperty(DistributionConfig.DELTA_PROPAGATION_PROP_NAME, "false");
}
cache = test.createCache(props);
AttributesFactory factory = new AttributesFactory();
factory.setScope(scope);
factory.setDataPolicy(policy);
if (listener) {
factory.addCacheListener(new CacheListenerAdapter() {
public void afterCreate(EntryEvent event) {
if (event.getKey().equals(LAST_KEY)) {
lastKeyReceived = true;
}
}
});
}
Region region = cache.createRegion(REGION_NAME, factory.create());
if (!policy.isReplicate()) {
region.create("KEY", "KEY");
}
region.getAttributesMutator().setCloningEnabled(false);
CacheServer server = cache.addCacheServer();
int port = AvailablePort.getRandomAvailablePort(AvailablePort.SOCKET);
server.setPort(port);
server.setNotifyBySubscription(true);
server.start();
return server.getPort();
}
开发者ID:gemxd,项目名称:gemfirexd-oss,代码行数:38,代码来源:DeltaPropagationStatsDUnitTest.java
注:本文中的com.gemstone.gemfire.cache.EntryEvent类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论