本文整理汇总了Java中javax.cache.event.EventType.ordinal方法的典型用法代码示例。如果您正苦于以下问题:Java EventType.ordinal方法的具体用法?Java EventType.ordinal怎么用?Java EventType.ordinal使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类javax.cache.event.EventType
的用法示例。
在下文中一共展示了EventType.ordinal方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: rebuildListenerPresent
import javax.cache.event.EventType; //导入方法依赖的package包/类
/**
* Rebuild the listenerPresent lookup array
*/
private void rebuildListenerPresent()
{
short listenerPresentXnew = 0;
for (ListenerEntry<K, V> listener : listeners)
{
for (EventType eventType : EventType.values())
{
if (listener.isListeningFor(eventType))
{
listenerPresentXnew |= (1 << eventType.ordinal());
}
}
}
listenerPresentMask = listenerPresentXnew;
}
示例2: enableCacheEntryListener
import javax.cache.event.EventType; //导入方法依赖的package包/类
/**
* Enables a listener, without adding it to the Configuration. An enabled listener can send events after this method returns.
* The caller must make sure that the
* corresponding Configuration object reflects the change.
*
* @param listenerConfiguration
* @return
*/
private synchronized boolean enableCacheEntryListener(CacheEntryListenerConfiguration<K, V> listenerConfiguration)
{
DispatchMode dispatchMode = listenerConfiguration.isSynchronous() ? DispatchMode.SYNC : DispatchMode.ASYNC_TIMED;
ListenerEntry<K, V> newListener = new ListenerEntry<K, V>(listenerConfiguration, tcache, dispatchMode);
boolean added = listeners.add(newListener);
for (EventType eventType : EventType.values())
{
if (newListener.isListeningFor(eventType))
{
listenerPresentMask |= (1 << eventType.ordinal());
}
}
return added;
}
示例3: hasListenerFor
import javax.cache.event.EventType; //导入方法依赖的package包/类
/**
* Checks whether this ListenerCollection includes at least one Listener for the given EventType.
*
* @param eventType The EventType to check
* @return true if at least one Listener is interested in the EventType
*/
public boolean hasListenerFor(EventType eventType)
{
int present = listenerPresentMask & (1 << eventType.ordinal());
return present != 0;
}