Search in sources :

Example 1 with ClientCQ

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);
        }
    }
}
Also used : RegionInterestEntry(org.apache.geode.cache.client.internal.RegisterInterestTracker.RegionInterestEntry) ClientCQ(org.apache.geode.cache.query.internal.cq.ClientCQ) Iterator(java.util.Iterator) Map(java.util.Map) SortedMap(java.util.SortedMap) HashMap(java.util.HashMap) TreeMap(java.util.TreeMap)

Example 2 with ClientCQ

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;
    }
}
Also used : ClientCQ(org.apache.geode.cache.query.internal.cq.ClientCQ) CqException(org.apache.geode.cache.query.CqException) ArrayList(java.util.ArrayList) InternalCqQuery(org.apache.geode.cache.query.internal.cq.InternalCqQuery) InternalCqQuery(org.apache.geode.cache.query.internal.cq.InternalCqQuery) CqQuery(org.apache.geode.cache.query.CqQuery)

Example 3 with ClientCQ

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();
    }
}
Also used : ClientCQ(org.apache.geode.cache.query.internal.cq.ClientCQ)

Example 4 with ClientCQ

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;
}
Also used : ClientCQ(org.apache.geode.cache.query.internal.cq.ClientCQ) CqExistsException(org.apache.geode.cache.query.CqExistsException)

Aggregations

ClientCQ (org.apache.geode.cache.query.internal.cq.ClientCQ)4 ArrayList (java.util.ArrayList)1 HashMap (java.util.HashMap)1 Iterator (java.util.Iterator)1 Map (java.util.Map)1 SortedMap (java.util.SortedMap)1 TreeMap (java.util.TreeMap)1 RegionInterestEntry (org.apache.geode.cache.client.internal.RegisterInterestTracker.RegionInterestEntry)1 CqException (org.apache.geode.cache.query.CqException)1 CqExistsException (org.apache.geode.cache.query.CqExistsException)1 CqQuery (org.apache.geode.cache.query.CqQuery)1 InternalCqQuery (org.apache.geode.cache.query.internal.cq.InternalCqQuery)1