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


Java HazelcastInstanceAware类代码示例

本文整理汇总了Java中com.hazelcast.core.HazelcastInstanceAware的典型用法代码示例。如果您正苦于以下问题:Java HazelcastInstanceAware类的具体用法?Java HazelcastInstanceAware怎么用?Java HazelcastInstanceAware使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


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

示例1: readObject

import com.hazelcast.core.HazelcastInstanceAware; //导入依赖的package包/类
public Object readObject(final Data data) {
    if ((data == null) || (data.buffer == null) || (data.buffer.length == 0)) {
        return null;
    }
    byte[] byteArray = data.buffer;
    final Object obj = toObject(byteArray);
    if (obj instanceof HazelcastInstanceAware) {
        ((HazelcastInstanceAware) obj).setHazelcastInstance(ThreadContext.get().getCurrentFactory());
    }
    return obj;
}
 
开发者ID:mdogan,项目名称:hazelcast-archive,代码行数:12,代码来源:Serializer.java

示例2: initialize

import com.hazelcast.core.HazelcastInstanceAware; //导入依赖的package包/类
public final Object initialize(Object obj) {
    if (obj instanceof HazelcastInstanceAware) {
        ((HazelcastInstanceAware) obj).setHazelcastInstance(factory);
    }

    if (hasExternalContext) {
        obj = externalContext.initialize(obj);
    }
    return obj;
}
 
开发者ID:health-and-care-developer-network,项目名称:health-and-care-developer-network,代码行数:11,代码来源:HazelcastManagedContext.java

示例3: finalReduceStep

import com.hazelcast.core.HazelcastInstanceAware; //导入依赖的package包/类
protected Map<KeyOut, ValueOut> finalReduceStep( Map<KeyOut, List<ValueOut>> groupedResponses )
{
    Map<KeyOut, ValueOut> reducedResults = new HashMap<KeyOut, ValueOut>();

    if ( reducer instanceof HazelcastInstanceAware )
    {
        ( (HazelcastInstanceAware) reducer ).setHazelcastInstance( hazelcastInstance );
    }

    // Final local reduce step
    for ( Entry<KeyOut, List<ValueOut>> entry : groupedResponses.entrySet() )
    {
        if ( isDistributableReducer() )
        {
            reducedResults.put( entry.getKey(), reducer.reduce( entry.getKey(), entry.getValue().iterator() ) );
        }
        else
        {
            List results = new ArrayList( groupedResponses.size() );
            for ( Object value : prepareIntermediateResults( entry.getValue() ) )
            {
                // Eventually aggregate subresults to one big result list
                if ( value instanceof List )
                {
                    for ( Object innerValue : ( (List) value ) )
                    {
                        results.add( innerValue );
                    }
                }
                else
                {
                    results.add( value );
                }
            }
            if ( reducer != null )
            {
                reducedResults.put( entry.getKey(), reducer.reduce( entry.getKey(), results.iterator() ) );
            }
            else
            {
                reducedResults.put( entry.getKey(), (ValueOut) results );
            }
        }
    }
    return reducedResults;
}
 
开发者ID:noctarius,项目名称:castmapr,代码行数:47,代码来源:AbstractMapReduceTask.java


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