本文整理汇总了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;
}
示例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;
}