public final class QueryInProgressException extends JPLException
To prevent this kind of exception from being thrown, first make absolutely sure that all Queries are being closed properly, either by exhausting all solutions in a Query (i.e., hasMoreSolutions() returns false), or by explicitly calling rewind(). If your program involves multi-threading, make sure you obtain the lock from the Query object before entering a hasMoreSolutions()/nextSolution loop:
Query query = // get a query somehow
synchronized ( jpl.Query.lock() ){
while ( query.hasMoreElements() ){
Hashtable solution = query.nextSolution();
// process solution...
}
}
Note: In most situations such care is not necessary, since
the Query.query(), Query,oneSolution(), and Query.allSolutions()
methods are thread-safe. However, users may have reason
to use the hasMoreSolutions() and nextSolutions() methods, which,
while synchronized, do allow Queries to be opened between calls to
these methods.
If you catch this Exception, you can usese the query() accessor to obtain a reference to the Query that is in progress.
This library is free software; you can redistribute it and/or modify it under the terms of the GNU Library Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version.
This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library Public License for more details.
| Modifier | Constructor and Description |
|---|---|
protected |
QueryInProgressException(Query query) |
| Modifier and Type | Method and Description |
|---|---|
Query |
query() |
addSuppressed, fillInStackTrace, getCause, getLocalizedMessage, getMessage, getStackTrace, getSuppressed, initCause, printStackTrace, printStackTrace, printStackTrace, setStackTrace, toStringCopyright © 2015. All rights reserved.