use of org.apache.geode.cache.query.internal.cq.CqService in project geode by apache.
the class MonitorCQ method cmdExecute.
@Override
public void cmdExecute(Message clientMessage, ServerConnection serverConnection, long start) throws IOException {
CachedRegionHelper crHelper = serverConnection.getCachedRegionHelper();
serverConnection.setAsTrue(REQUIRES_RESPONSE);
serverConnection.setAsTrue(REQUIRES_CHUNKED_RESPONSE);
int op = clientMessage.getPart(0).getInt();
if (op < 1) {
// This should have been taken care at the client - remove?
String err = LocalizedStrings.MonitorCQ__0_THE_MONITORCQ_OPERATION_IS_INVALID.toLocalizedString(serverConnection.getName());
sendCqResponse(MessageType.CQDATAERROR_MSG_TYPE, err, clientMessage.getTransactionId(), null, serverConnection);
return;
}
String regionName = null;
if (clientMessage.getNumberOfParts() == 2) {
// This will be enable/disable on region.
regionName = clientMessage.getPart(1).getString();
if (regionName == null) {
// This should have been taken care at the client - remove?
String err = LocalizedStrings.MonitorCQ__0_A_NULL_REGION_NAME_WAS_PASSED_FOR_MONITORCQ_OPERATION.toLocalizedString(serverConnection.getName());
sendCqResponse(MessageType.CQDATAERROR_MSG_TYPE, err, clientMessage.getTransactionId(), null, serverConnection);
return;
}
}
if (logger.isDebugEnabled()) {
logger.debug("{}: Received MonitorCq request from {} op: {}{}", serverConnection.getName(), serverConnection.getSocketString(), op, (regionName != null) ? " RegionName: " + regionName : "");
}
this.securityService.authorizeClusterRead();
try {
CqService cqService = crHelper.getCache().getCqService();
cqService.start();
// Should never come.
throw new CqException(LocalizedStrings.CqService_INVALID_CQ_MONITOR_REQUEST_RECEIVED.toLocalizedString());
} catch (CqException cqe) {
sendCqResponse(MessageType.CQ_EXCEPTION_TYPE, "", clientMessage.getTransactionId(), cqe, serverConnection);
return;
} catch (Exception e) {
String err = LocalizedStrings.MonitorCQ_EXCEPTION_WHILE_HANDLING_THE_MONITOR_REQUEST_OP_IS_0.toLocalizedString(Integer.valueOf(op));
sendCqResponse(MessageType.CQ_EXCEPTION_TYPE, err, clientMessage.getTransactionId(), e, serverConnection);
return;
}
}
Aggregations