Search in sources :

Example 1 with RunnableAdapter

use of com.hazelcast.executor.impl.RunnableAdapter in project hazelcast by hazelcast.

the class SpringManagedContext method initialize.

@Override
public Object initialize(Object obj) {
    Object resultObject = obj;
    if (obj != null) {
        if (obj instanceof RunnableAdapter) {
            RunnableAdapter adapter = (RunnableAdapter) obj;
            Object runnable = adapter.getRunnable();
            runnable = initializeIfSpringAwareIsPresent(runnable);
            adapter.setRunnable((Runnable) runnable);
        } else {
            resultObject = initializeIfSpringAwareIsPresent(obj);
        }
    }
    return resultObject;
}
Also used : RunnableAdapter(com.hazelcast.executor.impl.RunnableAdapter)

Example 2 with RunnableAdapter

use of com.hazelcast.executor.impl.RunnableAdapter in project hazelcast by hazelcast.

the class DurableExecutorServiceProxy method execute.

@Override
public void execute(Runnable task) {
    RunnableAdapter runnableAdapter = createRunnableAdapter(task);
    int partitionId = getTaskPartitionId(runnableAdapter);
    submitToPartition(runnableAdapter, partitionId, null);
}
Also used : RunnableAdapter(com.hazelcast.executor.impl.RunnableAdapter)

Example 3 with RunnableAdapter

use of com.hazelcast.executor.impl.RunnableAdapter in project hazelcast by hazelcast.

the class DurableExecutorServiceProxy method executeOnKeyOwner.

@Override
public void executeOnKeyOwner(Runnable task, Object key) {
    RunnableAdapter runnableAdapter = createRunnableAdapter(task);
    int partitionId = getPartitionId(key);
    submitToPartition(runnableAdapter, partitionId, null);
}
Also used : RunnableAdapter(com.hazelcast.executor.impl.RunnableAdapter)

Example 4 with RunnableAdapter

use of com.hazelcast.executor.impl.RunnableAdapter in project hazelcast by hazelcast.

the class AbstractCallableTaskOperation method beforeRun.

@Override
public final void beforeRun() throws Exception {
    returnsResponse = false;
    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);
    }
}
Also used : RunnableAdapter(com.hazelcast.executor.impl.RunnableAdapter) ManagedContext(com.hazelcast.core.ManagedContext)

Aggregations

RunnableAdapter (com.hazelcast.executor.impl.RunnableAdapter)4 ManagedContext (com.hazelcast.core.ManagedContext)1