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


Java EventType.UPDATED属性代码示例

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


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

示例1: getAndReplace

@Override
public V getAndReplace(K key, V value)
{
	throwISEwhenClosed();

	Action<K, V, Object> action = new ReplaceAction<K, V, Object>(key, value, EventType.UPDATED);
	V oldValue = null;
	if (actionRunnerWriteBehind.preMutate(action))
	{
		oldValue = tcache.getAndReplace(key, value);
		boolean replaced = oldValue != null;
		ChangeStatus changeStatus = replaced ? ChangeStatus.CHANGED : ChangeStatus.UNCHANGED;
		actionRunnerWriteBehind.postMutate(action, changeStatus);
	}
	action.close();
	return oldValue;				
}
 
开发者ID:trivago,项目名称:triava,代码行数:17,代码来源:TCacheJSR107.java

示例2: put0

void put0(K key, V value, boolean writeThrough)
{
	throwISEwhenClosed();
	kvUtil.verifyKeyAndValueNotNull(key, value);

	Action<K,V,Object> action = new PutAction<>(key, value, EventType.CREATED, false, writeThrough);

	if (actionRunner.preMutate(action))
	{
		Holders<V> holders = tcache.putToMapI(key, value, tcache.cacheTimeSpread(), false);
		final EventType eventType;
		if (holders == null)
			eventType = null;
		else
		{
			if (holders.newHolder == null || holders.newHolder.isInvalid())
				eventType = null; // new is invalid
			else
				eventType = holders.oldHolder == null ? EventType.CREATED : EventType.UPDATED;
		}
		action.setEventType(eventType);
		actionRunner.postMutate(action);	
	}
	action.close();
}
 
开发者ID:trivago,项目名称:triava,代码行数:25,代码来源:TCacheJSR107.java

示例3: replace

@Override
public boolean replace(K key, V oldValue, V newValue)
{
	throwISEwhenClosed();
	kvUtil.verifyKeyAndValueNotNull(key, newValue);
	kvUtil.verifyValueNotNull(oldValue);
	
	boolean replaced = false;
	Action<K, V, Object> action = new ReplaceAction<K, V, Object>(key, newValue, EventType.UPDATED);
	if (actionRunnerWriteBehind.preMutate(action))
	{
		ChangeStatus changeStatus = tcache.replace(key, oldValue, newValue);
		actionRunnerWriteBehind.postMutate(action, changeStatus);
		replaced = changeStatus == ChangeStatus.CHANGED;
	}

	return replaced;
}
 
开发者ID:trivago,项目名称:triava,代码行数:18,代码来源:TCacheJSR107.java

示例4: onEntryUpdated

void onEntryUpdated(K key, V oldValue, V value) {
    if (onUpdate) {
        BlazingCacheCacheEntryEvent event = new BlazingCacheCacheEntryEvent(key, oldValue, value, parent, EventType.UPDATED, true);
        if (filter != null && !filter.evaluate(event)) {
            return;
        }
        ((CacheEntryUpdatedListener) listener).onUpdated(Arrays.asList(event));
    }
}
 
开发者ID:diennea,项目名称:blazingcache,代码行数:9,代码来源:BlazingCacheCacheEntryListenerWrapper.java

示例5: testCacheContinuousQueryEntrySerialization

/**
 *
 */
public void testCacheContinuousQueryEntrySerialization() {
    CacheContinuousQueryEntry e0 = new CacheContinuousQueryEntry(
        1,
        EventType.UPDATED,
        new KeyCacheObjectImpl(1, new byte[] {0, 0, 0, 1}, 1),
        new CacheObjectImpl(2, new byte[] {0, 0, 0, 2}),
        new CacheObjectImpl(2, new byte[] {0, 0, 0, 3}),
        true,
        1,
        1L,
        new AffinityTopologyVersion(1L),
        (byte)0);

    e0.markFiltered();

    ByteBuffer buf = ByteBuffer.allocate(4096);
    DirectMessageWriter writer = new DirectMessageWriter((byte)1);

    // Skip write class header.
    writer.onHeaderWritten();
    e0.writeTo(buf, writer);

    CacheContinuousQueryEntry e1 = new CacheContinuousQueryEntry();
    e1.readFrom(ByteBuffer.wrap(buf.array()), new DirectMessageReader(new GridIoMessageFactory(null), (byte)1));

    assertEquals(e0.cacheId(), e1.cacheId());
    assertEquals(e0.eventType(), e1.eventType());
    assertEquals(e0.isFiltered(), e1.isFiltered());
    assertEquals(e0.isBackup(), e1.isBackup());
    assertEquals(e0.isKeepBinary(), e1.isKeepBinary());
    assertEquals(e0.partition(), e1.partition());
    assertEquals(e0.updateCounter(), e1.updateCounter());

    // Key and value shouldn't be serialized in case an event is filtered.
    assertNull(e1.key());
    assertNotNull(e0.key());
    assertNull(e1.oldValue());
    assertNotNull(e0.oldValue());
    assertNull(e1.value());
    assertNotNull(e0.value());
}
 
开发者ID:apache,项目名称:ignite,代码行数:44,代码来源:IgniteCacheContinuousQueryImmutableEntryTest.java

示例6: AbstractJCacheTest

protected AbstractJCacheTest(String cacheName) {
	this(cacheName, EventType.CREATED, EventType.UPDATED, EventType.REMOVED, EventType.EXPIRED);
}
 
开发者ID:pnemes,项目名称:jcache-cdi-example,代码行数:3,代码来源:AbstractJCacheTest.java

示例7: shouldHandleCacheEntryEventFromServerWithClient

/**
 * Ensure that values can be loaded from the {@link org.jsr107.tck.event.CacheEntryListenerClient} via
 * the {@link org.jsr107.tck.event.CacheEntryListenerServer}.
 */
@Test
public void shouldHandleCacheEntryEventFromServerWithClient() {

  CacheTestSupport.MyCacheEntryListener<String, String> listener = new CacheTestSupport.MyCacheEntryListener<>();


  CacheEntryListenerServer<String, String> serverListener =
    new CacheEntryListenerServer<>(10011, String.class, String.class);
  serverListener.addCacheEventListener(listener);

  try {
    serverListener.open();

    CacheEntryListenerClient<String, String> clientListener =
      new CacheEntryListenerClient<>(serverListener.getInetAddress(), serverListener.getPort());

    TestCacheEntryEvent<String, String> event = new TestCacheEntryEvent(null, EventType.CREATED);
    event.setKey("key");
    event.setValue("value");
    event.setOldValueAvailable(false);
    ArrayList events = new ArrayList();
    events.add(event);

    clientListener.onCreated(events);
    Assert.assertThat(listener.getCreated(), is(1));

    clientListener.onRemoved(events);
    Assert.assertThat(listener.getRemoved(), is(0));

    event = new TestCacheEntryEvent(null, EventType.UPDATED);
    event.setKey("key");
    event.setValue("value");
    event.setOldValue("oldValue");
    event.setOldValueAvailable(true);

    events.clear();
    events.add(event);
    clientListener.onUpdated(events);
    Assert.assertThat(listener.getUpdated(), is(1));
    Assert.assertThat(listener.getCreated(), is(1));

  } catch (Exception e) {

  } finally {
    serverListener.close();
  }
}
 
开发者ID:cache2k,项目名称:cache2k,代码行数:51,代码来源:CacheEntryListenerClientServerTest.java

示例8: getEventType

@Override
public EventType getEventType() {
  return EventType.UPDATED;
}
 
开发者ID:cache2k,项目名称:cache2k,代码行数:4,代码来源:Listener.java


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