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


Java GigaSpace.read方法代码示例

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


在下文中一共展示了GigaSpace.read方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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);
}
 
开发者ID:Gigaspaces,项目名称:xap-openspaces,代码行数:24,代码来源:MultiExclusiveReadReceiveOperationHandler.java

示例2: doReceiveBlocking

import org.openspaces.core.GigaSpace; //导入方法依赖的package包/类
/**
 * Performs single read operation using {@link org.openspaces.core.GigaSpace#read(Object,long,int)}
 * under an exclusive read lock. This receive operation handler allows to lock entries so other
 * receive operations won't be able to obtain it (mimics the take operation) but without actually
 * performing a take from the Space.
 *
 * Note, this receive operation handler must be performed under a transaction.
 */
@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);
    return gigaSpace.read(template, receiveTimeout, modifiers);
}
 
开发者ID:Gigaspaces,项目名称:xap-openspaces,代码行数:18,代码来源:ExclusiveReadReceiveOperationHandler.java

示例3: doReceiveNonBlocking

import org.openspaces.core.GigaSpace; //导入方法依赖的package包/类
/**
 * Performs single read operation using {@link org.openspaces.core.GigaSpace#read(Object,long,int)}
 * under an exclusive read lock with no timeout. This receive operation handler allows to lock entries so other
 * receive operations won't be able to obtain it (mimics the take operation) but without actually
 * performing a take from the Space.
 *
 * Note, this receive operation handler must be performed under a transaction.
 */
@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);
    return gigaSpace.read(template, 0, modifiers);
}
 
开发者ID:Gigaspaces,项目名称:xap-openspaces,代码行数:18,代码来源:ExclusiveReadReceiveOperationHandler.java

示例4: doReceiveBlocking

import org.openspaces.core.GigaSpace; //导入方法依赖的package包/类
/**
 * Performs single read operation using {@link org.openspaces.core.GigaSpace#read(Object,long)} with the
 * given timeout.
 */
@Override
protected Object doReceiveBlocking(Object template, GigaSpace gigaSpace, long receiveTimeout) throws DataAccessException {
    int modifiers = gigaSpace.getSpace().getReadModifiers();
    if (useMemoryOnlySearch)
        modifiers |= ReadModifiers.MEMORY_ONLY_SEARCH;
    
    return gigaSpace.read(template, receiveTimeout, modifiers);
}
 
开发者ID:Gigaspaces,项目名称:xap-openspaces,代码行数:13,代码来源:SingleReadReceiveOperationHandler.java

示例5: doReceiveNonBlocking

import org.openspaces.core.GigaSpace; //导入方法依赖的package包/类
/**
 * Performs single read operation using {@link org.openspaces.core.GigaSpace#read(Object,long)} with no
 * timeout.
 */
@Override
protected Object doReceiveNonBlocking(Object template, GigaSpace gigaSpace) throws DataAccessException {
    int modifiers = gigaSpace.getSpace().getReadModifiers();
    if (useMemoryOnlySearch)
        modifiers |= ReadModifiers.MEMORY_ONLY_SEARCH;
    
    return gigaSpace.read(template, 0, modifiers);
}
 
开发者ID:Gigaspaces,项目名称:xap-openspaces,代码行数:13,代码来源:SingleReadReceiveOperationHandler.java

示例6: 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);
}
 
开发者ID:Gigaspaces,项目名称:xap-openspaces,代码行数:18,代码来源:MultiReadReceiveOperationHandler.java

示例7: triggerReceive

import org.openspaces.core.GigaSpace; //导入方法依赖的package包/类
/**
 * Uses {@link org.openspaces.core.GigaSpace#read(Object,long)} and returns its result.
 */
public Object triggerReceive(Object template, GigaSpace gigaSpace, long receiveTimeout) throws DataAccessException {
    return gigaSpace.read(template, receiveTimeout);
}
 
开发者ID:Gigaspaces,项目名称:xap-openspaces,代码行数:7,代码来源:ReadTriggerOperationHandler.java


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