use of org.apache.geode.cache.query.internal.cq.ClientCQ in project geode by apache.
the class QueueManagerImpl method recoverCqs.
private void recoverCqs(Connection recoveredConnection, boolean isDurable) {
Map cqs = this.getPool().getRITracker().getCqsMap();
Iterator i = cqs.entrySet().iterator();
while (i.hasNext()) {
Map.Entry e = (Map.Entry) i.next();
ClientCQ cqi = (ClientCQ) e.getKey();
String name = cqi.getName();
if (this.pool.getMultiuserAuthentication()) {
UserAttributes.userAttributes.set(((DefaultQueryService) this.pool.getQueryService()).getUserAttributes(name));
}
try {
if (((CqStateImpl) cqi.getState()).getState() != CqStateImpl.INIT) {
cqi.createOn(recoveredConnection, isDurable);
}
} finally {
UserAttributes.userAttributes.set(null);
}
}
}
use of org.apache.geode.cache.query.internal.cq.ClientCQ in project geode by apache.
the class ProxyQueryService method getCqs.
public ClientCQ[] getCqs(String regionName) throws CqException {
preOp();
Collection<? extends InternalCqQuery> cqs = null;
try {
ArrayList<CqQuery> cqList = new ArrayList<CqQuery>();
cqs = ((DefaultQueryService) realQueryService).getCqService().getAllCqs(regionName);
for (InternalCqQuery cq : cqs) {
if (this.cqNames.contains(cq.getName())) {
cqList.add((CqQuery) cq);
}
}
ClientCQ[] results = new ClientCQ[cqList.size()];
cqList.toArray(results);
return results;
} catch (CqException cqe) {
if (logger.isDebugEnabled()) {
logger.debug("Unable to get Cqs. Error: {}", cqe.getMessage(), cqe);
}
throw cqe;
}
}
use of org.apache.geode.cache.query.internal.cq.ClientCQ in project geode by apache.
the class ProxyQueryService method newCq.
public CqQuery newCq(String cqName, String queryString, CqAttributes cqAttributes) throws QueryInvalidException, CqExistsException, CqException {
preOp(true);
try {
if (cqName == null) {
throw new IllegalArgumentException(LocalizedStrings.DefaultQueryService_CQNAME_MUST_NOT_BE_NULL.toLocalizedString());
}
ClientCQ cq = ((DefaultQueryService) realQueryService).getCqService().newCq(cqName, queryString, cqAttributes, ((DefaultQueryService) realQueryService).getPool(), false);
cq.setProxyCache(proxyCache);
this.cqNames.add(cq.getName());
return cq;
} finally {
postOp();
}
}
use of org.apache.geode.cache.query.internal.cq.ClientCQ in project geode by apache.
the class ProxyQueryService method newCq.
public CqQuery newCq(String queryString, CqAttributes cqAttributes, boolean isDurable) throws QueryInvalidException, CqException {
preOp(true);
ClientCQ cq = null;
try {
cq = ((DefaultQueryService) realQueryService).getCqService().newCq(null, queryString, cqAttributes, ((DefaultQueryService) realQueryService).getPool(), isDurable);
cq.setProxyCache(this.proxyCache);
this.cqNames.add(cq.getName());
} catch (CqExistsException cqe) {
// Should not throw in here.
if (logger.isDebugEnabled()) {
logger.debug("Unable to createCq. Error: {}", cqe.getMessage(), cqe);
}
} finally {
postOp();
}
return cq;
}
Aggregations