use of com.hazelcast.spi.impl.NodeEngine in project hazelcast by hazelcast.
the class PlanExecutor method execute.
SqlResult execute(ShowStatementPlan plan) {
Stream<String> rows;
switch(plan.getShowTarget()) {
case MAPPINGS:
rows = catalog.getMappingNames().stream();
break;
case VIEWS:
rows = catalog.getViewNames().stream();
break;
case JOBS:
assert plan.getShowTarget() == ShowStatementTarget.JOBS;
NodeEngine nodeEngine = getNodeEngine(hazelcastInstance);
JetServiceBackend jetServiceBackend = nodeEngine.getService(JetServiceBackend.SERVICE_NAME);
rows = jetServiceBackend.getJobRepository().getJobRecords().stream().map(record -> record.getConfig().getName()).filter(Objects::nonNull);
break;
default:
throw new AssertionError("Unsupported SHOW statement target.");
}
SqlRowMetadata metadata = new SqlRowMetadata(singletonList(new SqlColumnMetadata("name", VARCHAR, false)));
InternalSerializationService serializationService = Util.getSerializationService(hazelcastInstance);
return new SqlResultImpl(QueryId.create(hazelcastInstance.getLocalEndpoint().getUuid()), new StaticQueryResultProducerImpl(rows.sorted().map(name -> new JetSqlRow(serializationService, new Object[] { name })).iterator()), metadata, false);
}
use of com.hazelcast.spi.impl.NodeEngine in project hazelcast by hazelcast.
the class CacheDestroyOperation method destroyCacheOnAllMembers.
private void destroyCacheOnAllMembers(String name, UUID callerUuid) {
NodeEngine nodeEngine = getNodeEngine();
OperationService operationService = nodeEngine.getOperationService();
Collection<Member> members = nodeEngine.getClusterService().getMembers();
for (Member member : members) {
if (!member.localMember() && !member.getUuid().equals(callerUuid)) {
CacheDestroyOperation op = new CacheDestroyOperation(name, true);
operationService.invokeOnTarget(ICacheService.SERVICE_NAME, op, member.getAddress());
}
}
}
use of com.hazelcast.spi.impl.NodeEngine in project hazelcast by hazelcast.
the class MapFlushMessageTask method call.
@Override
protected Object call() throws Exception {
MapService mapService = getService(SERVICE_NAME);
MapServiceContext mapServiceContext = mapService.getMapServiceContext();
NodeEngine nodeEngine = mapServiceContext.getNodeEngine();
ProxyService proxyService = nodeEngine.getProxyService();
UUID source = endpoint.getUuid();
DistributedObject distributedObject = proxyService.getDistributedObject(SERVICE_NAME, parameters, source);
MapProxyImpl mapProxy = (MapProxyImpl) distributedObject;
mapProxy.flush();
return null;
}
use of com.hazelcast.spi.impl.NodeEngine in project hazelcast by hazelcast.
the class AbstractCollectionProxyImpl method compareAndRemove.
private boolean compareAndRemove(boolean retain, @Nonnull Collection<?> c) {
checkNotNull(c, "Null collection is not allowed");
Set<Data> valueSet = createHashSet(c.size());
final NodeEngine nodeEngine = getNodeEngine();
for (Object o : c) {
checkNotNull(o, "Null collection element is not allowed");
valueSet.add(nodeEngine.toData(o));
}
final CollectionCompareAndRemoveOperation operation = new CollectionCompareAndRemoveOperation(name, retain, valueSet);
final Boolean result = invoke(operation);
return result;
}
use of com.hazelcast.spi.impl.NodeEngine in project hazelcast by hazelcast.
the class AbstractCollectionProxyImpl method containsAll.
public boolean containsAll(@Nonnull Collection<?> c) {
checkNotNull(c, "Null collection is not allowed");
Set<Data> valueSet = createHashSet(c.size());
final NodeEngine nodeEngine = getNodeEngine();
for (Object o : c) {
checkNotNull(o, "Null collection element is not allowed");
valueSet.add(nodeEngine.toData(o));
}
final CollectionContainsOperation operation = new CollectionContainsOperation(name, valueSet);
final Boolean result = invoke(operation);
return result;
}
Aggregations