use of org.apache.ignite.client.ClientFeatureNotSupportedByServerException in project ignite by apache.
the class ClientClusterImpl method state.
/**
* {@inheritDoc}
*/
@Override
public void state(ClusterState newState) throws ClientException {
try {
ch.service(ClientOperation.CLUSTER_CHANGE_STATE, req -> {
ProtocolContext protocolCtx = req.clientChannel().protocolCtx();
checkClusterApiSupported(protocolCtx);
if (newState.ordinal() > 1 && !protocolCtx.isFeatureSupported(ProtocolBitmaskFeature.CLUSTER_STATES)) {
throw new ClientFeatureNotSupportedByServerException("State " + newState.name() + " is not " + "supported by the server");
}
req.out().writeByte((byte) newState.ordinal());
}, null);
} catch (ClientError e) {
throw new ClientException(e);
}
}
use of org.apache.ignite.client.ClientFeatureNotSupportedByServerException in project ignite by apache.
the class ClientClusterGroupImpl method requestNodeIds.
/**
* Requests node IDs from the server.
*/
private synchronized Collection<UUID> requestNodeIds() {
try {
return ch.service(ClientOperation.CLUSTER_GROUP_GET_NODE_IDS, req -> {
if (!req.clientChannel().protocolCtx().isFeatureSupported(ProtocolBitmaskFeature.CLUSTER_GROUPS))
throw new ClientFeatureNotSupportedByServerException(ProtocolBitmaskFeature.CLUSTER_GROUPS);
try (BinaryRawWriterEx writer = utils.createBinaryWriter(req.out())) {
writer.writeLong(cachedTopVer);
projectionFilters.write(writer);
}
}, res -> {
if (!res.in().readBoolean())
// There were no changes since last request.
return new ArrayList<>(cachedNodeIds);
// Topology version.
long topVer = res.in().readLong();
int nodesCnt = res.in().readInt();
Collection<UUID> nodeIds = new ArrayList<>(nodesCnt);
for (int i = 0; i < nodesCnt; i++) nodeIds.add(new UUID(res.in().readLong(), res.in().readLong()));
cachedNodes.keySet().retainAll(nodeIds);
cachedTopVer = topVer;
cachedNodeIds = nodeIds;
return new ArrayList<>(nodeIds);
});
} catch (ClientError e) {
throw new ClientException(e);
}
}
use of org.apache.ignite.client.ClientFeatureNotSupportedByServerException in project ignite by apache.
the class ClientClusterGroupImpl method requestNodesByIds.
/**
* Requests nodes from the server.
*
* @param nodeIds Node ids.
*/
private Collection<ClusterNode> requestNodesByIds(Collection<UUID> nodeIds) {
try {
return ch.service(ClientOperation.CLUSTER_GROUP_GET_NODE_INFO, req -> {
if (!req.clientChannel().protocolCtx().isFeatureSupported(ProtocolBitmaskFeature.CLUSTER_GROUPS))
throw new ClientFeatureNotSupportedByServerException(ProtocolBitmaskFeature.CLUSTER_GROUPS);
req.out().writeInt(nodeIds.size());
for (UUID nodeId : nodeIds) {
req.out().writeLong(nodeId.getMostSignificantBits());
req.out().writeLong(nodeId.getLeastSignificantBits());
}
}, res -> {
try (BinaryReaderExImpl reader = utils.createBinaryReader(res.in())) {
int nodesCnt = reader.readInt();
Collection<ClusterNode> nodes = new ArrayList<>();
for (int i = 0; i < nodesCnt; i++) {
ClusterNode node = readClusterNode(reader);
cachedNodes.put(node.id(), node);
if (projectionFilters.testClientSidePredicates(node))
nodes.add(node);
}
return nodes;
} catch (IOException e) {
throw new ClientError(e);
}
});
} catch (ClientError e) {
throw new ClientException(e);
}
}
use of org.apache.ignite.client.ClientFeatureNotSupportedByServerException in project ignite by apache.
the class ClientComputeImpl method writeExecuteTaskRequest.
/**
*/
private <T> void writeExecuteTaskRequest(PayloadOutputChannel ch, String taskName, @Nullable T arg, Collection<UUID> nodeIds, byte flags, long timeout) throws ClientException {
if (!ch.clientChannel().protocolCtx().isFeatureSupported(ProtocolBitmaskFeature.EXECUTE_TASK_BY_NAME)) {
throw new ClientFeatureNotSupportedByServerException("Compute grid functionality for thin " + "client not supported by server node (" + ch.clientChannel().serverNodeId() + ')');
}
try (BinaryRawWriterEx w = utils.createBinaryWriter(ch.out())) {
if (// Include all nodes.
nodeIds == null)
w.writeInt(0);
else {
w.writeInt(nodeIds.size());
for (UUID nodeId : nodeIds) {
w.writeLong(nodeId.getMostSignificantBits());
w.writeLong(nodeId.getLeastSignificantBits());
}
}
w.writeByte(flags);
w.writeLong(timeout);
w.writeString(taskName);
w.writeObject(arg);
}
}
Aggregations