/** * Creates a server CQ proxy given using the same pool as that of the given server proxy. * * @param sp server proxy whose pool we are to use */ public ServerCQProxyImpl(ServerProxy sp) { this(sp.getPool()); }
/** * Release use of this pool */ public void detach(boolean keepalive) { this.pool.getRITracker().unregisterRegion(this, keepalive); super.detach(); }
private Object executeOnServer(Object[] parameters) { long startTime = CachePerfStats.getStatTime(); Object result = null; try { if (this.proxyCache != null) { if (this.proxyCache.isClosed()) { throw proxyCache.getCacheClosedException("Cache is closed for this user."); } UserAttributes.userAttributes.set(this.proxyCache.getUserAttributes()); } result = this.serverProxy.query(this.queryString, parameters); } finally { UserAttributes.userAttributes.set(null); long endTime = CachePerfStats.getStatTime(); updateStatistics(endTime - startTime); } return result; }
/** * Constructs a new <code>Query</code> object. Uses the default namespace, which is the Objects * Context of the current application. * * @return The new <code>Query</code> object. * @throws IllegalArgumentException if the query syntax is invalid. * @see org.apache.geode.cache.query.Query */ @Override public Query newQuery(String queryString) { if (QueryMonitor.isLowMemory()) { String reason = String.format( "Query execution canceled due to memory threshold crossed in system, memory used: %s bytes.", QueryMonitor.getMemoryUsedBytes()); throw new QueryExecutionLowMemoryException(reason); } if (queryString == null) throw new QueryInvalidException( "The query string must not be null"); if (queryString.length() == 0) throw new QueryInvalidException( "The query string must not be empty"); ServerProxy serverProxy = pool == null ? null : new ServerProxy(pool); DefaultQuery query = new DefaultQuery(queryString, this.cache, serverProxy != null); query.setServerProxy(serverProxy); return query; }