Java 类com.hazelcast.core.ManagedContext 实例源码

项目:concursus    文件:HazelcastCommandExecutorConfiguration.java   
/**
 * Add configuration to the supplied {@link Config} to support the use of a {@link HazelcastCommandExecutor}.
 * @param config The {@link Config} to configure.
 * @return The updated {@link Config}.
 */
public Config addCommandExecutorConfiguration(Config config) {
    SerializerConfig serializerConfig = new SerializerConfig()
            .setImplementation(RemoteCommandSerialiser.using(
                    objectMapper,
                    CommandTypeMatcher.matchingAgainst(typeInfoMap)))
            .setTypeClass(RemoteCommand.class);

    ManagedContext managedContext = CommandProcessingManagedContext
            .processingCommandsWith(dispatchingCommandProcessor);

    config.getSerializationConfig().addSerializerConfig(serializerConfig);

    config.setManagedContext(config.getManagedContext() == null
            ? managedContext
            : CompositeManagedContext.of(managedContext, config.getManagedContext()));

    config.addExecutorConfig(new ExecutorConfig(executorName, threadsPerNode));
    return config;
}
项目:concursus    文件:CompositeManagedContext.java   
@Override
public Object initialize(Object o) {
    Object result = o;
    for (ManagedContext context : managedContexts) {
        result = context.initialize(result);
    }
    return result;
}
项目:scheduled-executor    文件:ScheduledCallableTaskOperation.java   
@Override
public final void beforeRun() throws Exception {
    callable = getCallable();
    ManagedContext managedContext = getManagedContext();

    if (callable instanceof RunnableAdapter) {
        RunnableAdapter adapter = (RunnableAdapter) callable;
        Runnable runnable = (Runnable) managedContext.initialize(adapter.getRunnable());
        adapter.setRunnable(runnable);
    } else {
        callable = (Callable) managedContext.initialize(callable);
    }
}
项目:health-and-care-developer-network    文件:Serializer.java   
public Object readObject(final Data data) {
    if ((data == null) || (data.buffer == null) || (data.buffer.length == 0)) {
        return null;
    }
    byte[] byteArray = data.buffer;
    Object obj = toObject(byteArray);
    final ManagedContext managedContext = ThreadContext.get().getCurrentManagedContext();
    if (managedContext != null) {
        obj = managedContext.initialize(obj);
    }
    return obj;
}
项目:concursus    文件:CompositeManagedContext.java   
private CompositeManagedContext(List<ManagedContext> managedContexts) {
    this.managedContexts = managedContexts;
}
项目:hazelcast-jet    文件:TestOutbox.java   
@Override
public ManagedContext getManagedContext() {
    return o -> o; // initialize() will do nothing
}
项目:scheduled-executor    文件:ScheduledCallableTaskOperation.java   
private ManagedContext getManagedContext() {
    HazelcastInstanceImpl hazelcastInstance = (HazelcastInstanceImpl) getNodeEngine().getHazelcastInstance();
    SerializationServiceImpl serializationService =
            (SerializationServiceImpl) hazelcastInstance.getSerializationService();
    return serializationService.getManagedContext();
}
项目:health-and-care-developer-network    文件:Config.java   
public ManagedContext getManagedContext() {
    return managedContext;
}
项目:health-and-care-developer-network    文件:Config.java   
public Config setManagedContext(final ManagedContext managedContext) {
    this.managedContext = managedContext;
    return this;
}
项目:health-and-care-developer-network    文件:HazelcastManagedContext.java   
public HazelcastManagedContext(final FactoryImpl factory, final ManagedContext externalContext) {
    this.factory = factory;
    this.externalContext = externalContext;
    hasExternalContext = this.externalContext != null;
}
项目:health-and-care-developer-network    文件:ThreadContext.java   
public ManagedContext getCurrentManagedContext() {
    return currentFactory != null ? currentFactory.managedContext : null;
}
项目:concursus    文件:CommandProcessingManagedContext.java   
/**
 * Create a {@link ManagedContext} that passes the supplied {@link CommandProcessor} to any deserialised objects
 * that implement {@link CommandProcessorAware}.
 * @param commandProcessor The {@link CommandProcessor} to use to process {@link Command}s.
 * @return The constructed {@link ManagedContext}.
 */
public static ManagedContext processingCommandsWith(CommandProcessor commandProcessor) {
    return new CommandProcessingManagedContext(commandProcessor);
}
项目:concursus    文件:CompositeManagedContext.java   
/**
 * Construct a new {@link ManagedContext} that composes together all of the supplied {@link ManagedContext}s.
 * @param managedContexts The {@link ManagedContext}s to compose.
 * @return The compose {@link ManagedContext}.
 */
public static ManagedContext of(ManagedContext...managedContexts) {
    return of(Arrays.asList(managedContexts));
}
项目:concursus    文件:CompositeManagedContext.java   
/**
 * Construct a new {@link ManagedContext} that composes together all of the supplied {@link ManagedContext}s.
 * @param managedContexts The {@link ManagedContext}s to compose.
 * @return The compose {@link ManagedContext}.
 */
public static ManagedContext of(List<ManagedContext> managedContexts) {
    return new CompositeManagedContext(managedContexts);
}