本文整理汇总了Java中org.openspaces.core.GigaSpace.readMultiple方法的典型用法代码示例。如果您正苦于以下问题:Java GigaSpace.readMultiple方法的具体用法?Java GigaSpace.readMultiple怎么用?Java GigaSpace.readMultiple使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.openspaces.core.GigaSpace
的用法示例。
在下文中一共展示了GigaSpace.readMultiple方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: doReceiveBlocking
import org.openspaces.core.GigaSpace; //导入方法依赖的package包/类
/**
* First tries and perform a {@link org.openspaces.core.GigaSpace#readMultiple(Object,int,int)} using
* the provided template, configured maxEntries (defaults to <code>50</code>) and the configured fifoGroups (default to <code>false</code>).
* If no values are returned, will perform a blocking read operation using
* {@link org.openspaces.core.GigaSpace#read(Object,long,int)}.
*
* <p>Read operations are performed under an exclusive read lock which mimics the similar behavior
* as take without actually taking the entry from the space.
*/
@Override
protected Object doReceiveBlocking(Object template, GigaSpace gigaSpace, long receiveTimeout) throws DataAccessException {
ReadModifiers modifiers = gigaSpace.getDefaultReadModifiers().add(ReadModifiers.EXCLUSIVE_READ_LOCK);
if(useFifoGrouping)
modifiers = modifiers.add(ReadModifiers.FIFO_GROUPING_POLL);
if (useMemoryOnlySearch)
modifiers = modifiers.add(ReadModifiers.MEMORY_ONLY_SEARCH);
Object[] results = gigaSpace.readMultiple(template, maxEntries, modifiers);
if (results != null && results.length > 0) {
return results;
}
return gigaSpace.read(template, receiveTimeout, modifiers);
}
示例2: doReceiveNonBlocking
import org.openspaces.core.GigaSpace; //导入方法依赖的package包/类
/**
* Perform a {@link org.openspaces.core.GigaSpace#readMultiple(Object,int,int)}
* using the provided template, configured maxEntries (defaults to <code>50</code>) and the configured fifoGroups (default to <code>false</code>).
*
* <p>Read operations are performed under an exclusive read lock which mimics the similar behavior
* as take without actually taking the entry from the space.
*/
@Override
protected Object doReceiveNonBlocking(Object template, GigaSpace gigaSpace) throws DataAccessException {
ReadModifiers modifiers = gigaSpace.getDefaultReadModifiers().add(ReadModifiers.EXCLUSIVE_READ_LOCK);
if(useFifoGrouping)
modifiers = modifiers.add(ReadModifiers.FIFO_GROUPING_POLL);
if (useMemoryOnlySearch)
modifiers = modifiers.add(ReadModifiers.MEMORY_ONLY_SEARCH);
Object[] results = gigaSpace.readMultiple(template, maxEntries, modifiers);
if (results != null && results.length > 0) {
return results;
}
return null;
}
示例3: doReceiveBlocking
import org.openspaces.core.GigaSpace; //导入方法依赖的package包/类
/**
* First tries and perform a {@link org.openspaces.core.GigaSpace#readMultiple(Object,int)}
* using the provided template and configured maxEntries (defaults to <code>50</code>). If no
* values are returned, will perform a blocking read operation using
* {@link org.openspaces.core.GigaSpace#read(Object,long)}.
*/
@Override
protected Object doReceiveBlocking(Object template, GigaSpace gigaSpace, long receiveTimeout) throws DataAccessException {
int modifiers = gigaSpace.getSpace().getReadModifiers();
if (useMemoryOnlySearch)
modifiers |= ReadModifiers.MEMORY_ONLY_SEARCH;
Object[] results = gigaSpace.readMultiple(template, maxEntries, modifiers);
if (results != null && results.length > 0) {
return results;
}
return gigaSpace.read(template, receiveTimeout, modifiers);
}
示例4: doReceiveNonBlocking
import org.openspaces.core.GigaSpace; //导入方法依赖的package包/类
/**
* Perform a {@link org.openspaces.core.GigaSpace#readMultiple(Object,int)}
* using the provided template and configured maxEntries (defaults to <code>50</code>). This is a non
* blocking operation.
*/
@Override
protected Object doReceiveNonBlocking(Object template, GigaSpace gigaSpace) throws DataAccessException {
int modifiers = gigaSpace.getSpace().getReadModifiers();
if (useMemoryOnlySearch)
modifiers |= ReadModifiers.MEMORY_ONLY_SEARCH;
Object[] results = gigaSpace.readMultiple(template, maxEntries, modifiers);
if (results != null && results.length > 0) {
return results;
}
return null;
}