public UserAttributes getUserAttributes(String cqName) { try { return getCqService().getUserAttributes(cqName); } catch (CqException ce) { return null; } }
/** * Close all CQs executing in this VM, and release resources associated with executing CQs. * CqQuerys created by other VMs are unaffected. * */ @Override public void closeCqs() { try { getCqService().closeAllCqs(true); } catch (CqException cqe) { if (logger.isDebugEnabled()) { logger.debug("Unable to closeAll Cqs. Error :{}", cqe.getMessage(), cqe); } } }
@Override public List<String> getAllDurableCqsFromServer() throws CqException { if (!isServer()) { if (pool != null) { return getCqService().getAllDurableCqsFromServer(pool); } else { throw new UnsupportedOperationException( "GetAllDurableCQsFromServer requires a pool to be configured."); } } else { // we are a server return Collections.EMPTY_LIST; } }
/** * Get statistics information for this query. * * @return CQ statistics null if the continuous query object not found for the given cqName. */ @Override public CqServiceStatistics getCqStatistics() { CqServiceStatistics stats = null; try { stats = getCqService().getCqStatistics(); } catch (CqException cqe) { if (logger.isDebugEnabled()) { logger.debug("Unable get CQ Statistics. Error :{}", cqe.getMessage(), cqe); } } return stats; }
public void closeCqs(boolean keepAlive) { preOp(); try { ((DefaultQueryService) realQueryService).getCqService().closeAllCqs(!keepAlive, Arrays.asList(this.getCqs()), keepAlive); this.cqNames.clear(); } catch (CqException cqe) { if (logger.isDebugEnabled()) { logger.debug("Unable to closeAll Cqs. Error: {}", cqe.getMessage(), cqe); } } }
/** * Stops execution of all the continuous queries for this client to become inactive. This is * useful when client needs to control the incoming cq messages during bulk region operations. * * @see QueryService#executeCqs() * * @throws CqException if failure to execute CQ. */ @Override public void stopCqs() throws CqException { try { getCqService().stopAllClientCqs(); } catch (CqException cqe) { if (logger.isDebugEnabled()) { logger.debug("Unable to stop all CQs. Error :{}", cqe.getMessage(), cqe); } } }
@Override public ClientCQ[] getCqs() { preOp(); ClientCQ[] cqs = null; try { ArrayList<InternalCqQuery> cqList = new ArrayList<InternalCqQuery>(); for (String name : this.cqNames) { cqList.add(((DefaultQueryService) realQueryService).getCqService().getCq(name)); } cqs = new ClientCQ[cqList.size()]; cqList.toArray(cqs); } catch (CqException cqe) { if (logger.isDebugEnabled()) { logger.debug("Unable to get Cqs. Error: {}", cqe.getMessage(), cqe); } } return cqs; }
/** * Retrieve a CqQuery by name. * * @return the CqQuery or null if not found */ @Override public CqQuery getCq(String cqName) { CqQuery cq = null; try { cq = (CqQuery) getCqService().getCq(cqName); } catch (CqException cqe) { if (logger.isDebugEnabled()) { logger.debug("Unable to getCq. Error :{}", cqe.getMessage(), cqe); } } return cq; }
/** * Starts execution of all the registered continuous queries for this client. This is * complementary to stopCqs. * * @see QueryService#stopCqs() * * @throws CqException if failure to execute CQ. */ @Override public void executeCqs() throws CqException { try { getCqService().executeAllClientCqs(); } catch (CqException cqe) { if (logger.isDebugEnabled()) { logger.debug("Unable to execute all cqs. Error :{}", cqe.getMessage(), cqe); } } }
/** * Returns all the cq on a given region. */ @Override public CqQuery[] getCqs(final String regionName) throws CqException { return toArray(getCqService().getAllCqs(regionName)); }
/** * Starts execution of all the continuous queries registered on the specified region for this * client. This is complementary method to stopCQs(). * * @see QueryService#stopCqs() * * @throws CqException if failure to stop CQs. */ @Override public void executeCqs(String regionName) throws CqException { try { getCqService().executeAllRegionCqs(regionName); } catch (CqException cqe) { if (logger.isDebugEnabled()) { logger.debug("Unable to execute cqs on the specified region. Error :{}", cqe.getMessage(), cqe); } } }
@Override public void executeCqs() throws CqException { preOp(); try { ((DefaultQueryService) realQueryService).getCqService() .executeCqs(Arrays.asList(this.getCqs())); } catch (CqException cqe) { if (logger.isDebugEnabled()) { logger.debug("Unable to execute cqs. Error: {}", cqe.getMessage(), cqe); } } }
@Override public void stopCqs() throws CqException { preOp(); try { ((DefaultQueryService) realQueryService).getCqService().stopCqs(Arrays.asList(this.getCqs())); } catch (CqException cqe) { if (logger.isDebugEnabled()) { logger.debug("Unable to stop all CQs. Error: {}", cqe.getMessage(), cqe); } } }
@Override public void executeCqs(String regionName) throws CqException { preOp(); try { ((DefaultQueryService) realQueryService).getCqService() .executeCqs(Arrays.asList(this.getCqs(regionName))); } catch (CqException cqe) { if (logger.isDebugEnabled()) { logger.debug("Unable to execute cqs on the specified region. Error: {}", cqe.getMessage(), cqe); } } }
@Override public void stopCqs(String regionName) throws CqException { preOp(); try { ((DefaultQueryService) realQueryService).getCqService() .stopCqs(Arrays.asList(this.getCqs(regionName))); } catch (CqException cqe) { if (logger.isDebugEnabled()) { logger.debug("Unable to stop cqs on the specified region. Error: {}", cqe.getMessage(), cqe); } } }
/** * Retrieve all CqQuerys created by this VM. * * @return null if there are no cqs. */ @Override public CqQuery[] getCqs() { CqQuery[] cqs = null; try { return toArray(getCqService().getAllCqs()); } catch (CqException cqe) { if (logger.isDebugEnabled()) { logger.debug("Unable to getAllCqs. Error :{}", cqe.getMessage(), cqe); } } return cqs; }
@Override public CqQuery newCq(String cqName, String queryString, CqAttributes cqAttributes) throws QueryInvalidException, CqExistsException, CqException { preOp(true); try { if (cqName == null) { throw new IllegalArgumentException( "cqName must not be null"); } 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(); } }
@Override public CqQuery newCq(String cqName, String queryString, CqAttributes cqAttributes, boolean isDurable) throws QueryInvalidException, CqExistsException, CqException { preOp(true); try { if (cqName == null) { throw new IllegalArgumentException( "cqName must not be null"); } ClientCQ cq = ((DefaultQueryService) realQueryService).getCqService().newCq(cqName, queryString, cqAttributes, ((DefaultQueryService) realQueryService).getPool(), isDurable); cq.setProxyCache(proxyCache); this.cqNames.add(cq.getName()); return cq; } finally { postOp(); } }
@Override 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; }
@Override public CqQuery newCq(String queryString, CqAttributes cqAttributes) throws QueryInvalidException, CqException { preOp(true); ClientCQ cq = null; try { cq = ((DefaultQueryService) realQueryService).getCqService().newCq(null, queryString, cqAttributes, ((DefaultQueryService) realQueryService).getPool(), false); 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; }