|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object ca.uhn.cache.util.QueryProcessor
TODO: TESTS Ecapsulates the common caching algorithm of querying a cache, getting a remainder, querying the original data source, and combining the results. Objects of this class hold the state of a single query instance. It is left to the caller to provide results from the original data source.
Constructor Summary | |
QueryProcessor(IQuery theQuery,
ISemanticCache theCache,
int theMaxGroups,
EDU.oswego.cs.dl.util.concurrent.Executor theExecutor)
Constructor for STATIONARY DATA ONLY. |
Method Summary | |
void |
declareException(java.lang.String theMessage,
java.lang.Exception theException)
|
IQueryResult |
getCombinedResult()
Blocks until a result is available or an exception is encountered. |
IQuery[] |
getRemainderQueries()
|
protected void |
init()
Performs startup tasks (called by constructor). |
protected void |
setCombinedResult(IQueryResult theResult)
Provide an initial value for the combined result. |
void |
setSourceResult(IQuery theQuery,
IQueryResult theSourceResult)
|
protected void |
thread(java.lang.Runnable theTask)
Runs a task in its own thread. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
public QueryProcessor(IQuery theQuery, ISemanticCache theCache, int theMaxGroups, EDU.oswego.cs.dl.util.concurrent.Executor theExecutor) throws CacheException
theQuery
- the query to processtheCache
- the cache against which to process ittheMaxGroups
- maximum number of remainder queriestheExecutor
- handler of concurrent tasks (defaults to ThreadedExecutor if null)
CacheException
- if there is a problem finding the query remainderMethod Detail |
protected void init()
public IQuery[] getRemainderQueries()
protected void setCombinedResult(IQueryResult theResult)
theResult
- initial valuepublic void declareException(java.lang.String theMessage, java.lang.Exception theException)
theMessage
- descriptiontheException
- an exception that has been encountered that may render query
results incorrect (for example exception while querying cache or source data)public void setSourceResult(IQuery theQuery, IQueryResult theSourceResult)
theQuery
- scope of the results (from a remainder query)theSourceResult
- corresponding resultspublic IQueryResult getCombinedResult() throws CacheException
CacheException
- if a problem has been encountered getting data from the cacheprotected void thread(java.lang.Runnable theTask)
theTask
- the task to run
|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |