use of com.hazelcast.nio.Address in project hazelcast by hazelcast.
the class JobSupervisor method asyncCancelRemoteOperations.
private void asyncCancelRemoteOperations(final Set<Address> addresses) {
final NodeEngine nodeEngine = mapReduceService.getNodeEngine();
TaskScheduler taskScheduler = nodeEngine.getExecutionService().getGlobalTaskScheduler();
taskScheduler.execute(new Runnable() {
@Override
public void run() {
String name = getConfiguration().getName();
String jobId = getConfiguration().getJobId();
for (Address address : addresses) {
try {
CancelJobSupervisorOperation operation = new CancelJobSupervisorOperation(name, jobId);
mapReduceService.processRequest(address, operation);
} catch (Exception ignore) {
// We can ignore this exception since we just want to cancel the job
// and the member may be crashed or unreachable in some way
ILogger logger = nodeEngine.getLogger(JobSupervisor.class);
logger.finest("Remote node may already be down", ignore);
}
}
}
});
}
use of com.hazelcast.nio.Address in project hazelcast by hazelcast.
the class KeyValueJobOperation method run.
@Override
public void run() throws Exception {
MapReduceService mapReduceService = getService();
Address jobOwner = getCallerAddress();
if (jobOwner == null) {
jobOwner = getNodeEngine().getThisAddress();
}
// Inject managed context
injectManagedContext(mapper, combinerFactory, reducerFactory, keyValueSource);
// Build immutable configuration
JobTaskConfiguration config = new JobTaskConfiguration(jobOwner, getNodeEngine(), chunkSize, name, jobId, mapper, combinerFactory, reducerFactory, keyValueSource, communicateStats, topologyChangedStrategy);
JobSupervisor supervisor = mapReduceService.createJobSupervisor(config);
if (supervisor == null) {
// Supervisor was cancelled prior to creation
AbstractJobTracker jobTracker = (AbstractJobTracker) mapReduceService.getJobTracker(name);
TrackableJobFuture future = jobTracker.unregisterTrackableJob(jobId);
if (future != null) {
Exception exception = new CancellationException("Operation was cancelled by the user");
future.setResult(exception);
}
}
}
use of com.hazelcast.nio.Address in project hazelcast by hazelcast.
the class MapKeyValueSource method open.
@Override
public boolean open(NodeEngine nodeEngine) {
NodeEngineImpl nei = (NodeEngineImpl) nodeEngine;
IPartitionService ps = nei.getPartitionService();
MapService mapService = nei.getService(MapService.SERVICE_NAME);
ss = nei.getSerializationService();
Address partitionOwner = ps.getPartitionOwner(partitionId);
if (partitionOwner == null) {
return false;
}
RecordStore recordStore = mapService.getMapServiceContext().getRecordStore(partitionId, mapName);
iterator = recordStore.iterator();
return true;
}
use of com.hazelcast.nio.Address in project hazelcast by hazelcast.
the class MultiMapKeyValueSource method open.
@Override
public boolean open(NodeEngine nodeEngine) {
NodeEngineImpl nei = (NodeEngineImpl) nodeEngine;
IPartitionService ps = nei.getPartitionService();
MultiMapService multiMapService = nei.getService(MultiMapService.SERVICE_NAME);
ss = nei.getSerializationService();
Address partitionOwner = ps.getPartitionOwner(partitionId);
if (partitionOwner == null) {
return false;
}
multiMapContainer = multiMapService.getOrCreateCollectionContainer(partitionId, multiMapName);
isBinary = multiMapContainer.getConfig().isBinary();
keyIterator = multiMapContainer.keySet().iterator();
return true;
}
use of com.hazelcast.nio.Address in project hazelcast by hazelcast.
the class MemberAwareMapReduceNotification method readData.
@Override
public void readData(ObjectDataInput in) throws IOException {
super.readData(in);
address = new Address();
address.readData(in);
}
Aggregations