private boolean isExceptionDueToLowMemory(QueryException e, int HEAP_USED) { String message = e.getMessage(); return (message.contains( LocalizedStrings.QueryMonitor_LOW_MEMORY_CANCELED_QUERY.toLocalizedString(HEAP_USED)) || message.contains( LocalizedStrings.QueryMonitor_LOW_MEMORY_WHILE_GATHERING_RESULTS_FROM_PARTITION_REGION .toLocalizedString())); }
/** * 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 com.gemstone.gemfire.cache.query.Query */ public Query newQuery(String queryString) { if (QueryMonitor.isLowMemory()) { String reason = LocalizedStrings.QueryMonitor_LOW_MEMORY_CANCELED_QUERY.toLocalizedString( QueryMonitor.getMemoryUsedDuringLowMemory()); throw new QueryExecutionLowMemoryException(reason); } if (queryString == null) throw new QueryInvalidException( LocalizedStrings.DefaultQueryService_THE_QUERY_STRING_MUST_NOT_BE_NULL .toLocalizedString()); if (queryString.length() == 0) throw new QueryInvalidException( LocalizedStrings.DefaultQueryService_THE_QUERY_STRING_MUST_NOT_BE_EMPTY .toLocalizedString()); DefaultQuery query = new DefaultQuery(queryString, this.cache); ServerProxy serverProxy = pool == null ? null : new ServerProxy(pool); query.setServerProxy(serverProxy); return query; }