class EntryHolder.ContinuingQuery extends Object
EntryHolder.| Modifier and Type | Field and Description |
|---|---|
private Iterator<EntryHandle> |
contentsIterator
Current position in parent
EntryHolder's
contents |
private ThreadLocal<EntryHandleTmplDesc[]> |
descLocal
EntryHandleTmplDesc for the templates |
(package private) long |
now
Time used to weed out expired entries, ok if old
|
private boolean |
takeThem
true if entries yielded by the query should
removed. |
private EntryRep[] |
tmpls
Templates being used for the query
|
private TransactableMgr |
txn
Transaction (if any) being used for the query
|
| Modifier | Constructor and Description |
|---|---|
private |
ContinuingQuery(EntryRep[] tmpls,
TransactableMgr txn,
boolean takeThem,
long now)
Create a new
ContinuingQuery object. |
| Modifier and Type | Method and Description |
|---|---|
private boolean |
handleMatch(EntryHandle handle,
EntryHandleTmplDesc[] descs)
Returns
true if handle has not been removed
and matches one or more of the templates |
(package private) EntryHandle |
next(Set conflictSet,
Set<Uuid> lockedEntrySet,
Set<EntryHandle> provisionallyRemovedEntrySet)
Return the next matching entry.
|
(package private) void |
restart(long now)
EntryHolder queries have thread local state
that get clobbered if another query (on a different or same
EntryHolder, including hasMatch
calls) is started in the same thread. |
private final EntryRep[] tmpls
private final TransactableMgr txn
private final boolean takeThem
true if entries yielded by the query should
removed.private final ThreadLocal<EntryHandleTmplDesc[]> descLocal
EntryHandleTmplDesc for the templatesvolatile long now
private final Iterator<EntryHandle> contentsIterator
EntryHolder's
contentsprivate ContinuingQuery(EntryRep[] tmpls, TransactableMgr txn, boolean takeThem, long now)
ContinuingQuery object.tmpls - An array of templates. Query will yield any
entry that matches one or more of the templates.txn - Transaction that should be used with the query.
May be null. If
non-null any entries yielded by the
query will be locked under the transaction.takeThem - If true any entries yielded by
the query should be removed.now - Estimate of current time used to weed out
expired entries, ok if oldvoid restart(long now)
EntryHolder queries have thread local state
that get clobbered if another query (on a different or same
EntryHolder, including hasMatch
calls) is started in the same thread. The state also needs
to be restored if it the query is continued in another
thread. The restart method must be called to
restore the thread local state.now - Estimate of current time used to weed out
expired entries, ok if oldEntryHandle next(Set conflictSet, Set<Uuid> lockedEntrySet, Set<EntryHandle> provisionallyRemovedEntrySet) throws CannotJoinException
null
if there are no matches remaining. Call restart first if query is being used in a different thread
from the last next call and/or the current
thread has done any form of EntryHolder query
on any holder since the last next call.conflictSet - If non-null the TransactableMgr
objects of any transactions that prevent
a entry from being retured will
be added to conflictSet. May
be null in which case
conflicting transaction will not be recorded.
This method assumes that any concurrent access
is being arbitrated by the set or by the caller.lockedEntrySet - If non-null the ID of any entries that
can't be retured because of conflicting
transaction will be added to
lockedEntrySet. May be
null in which case unavailable
entries will not be recorded. This method
assumes that any concurrent access is being
arbitrated by the set or by the caller.provisionallyRemovedEntrySet - If the entry can not be
read/taken because it has been provisionally
removed then its handle will be placed in the
passed WeakHashMap as a key (with
null as the value). May be null in
which case provisionally removed entries will not
be recorded. This method assumes that any
concurrent access is being arbitrated by the set
or by the caller.null.CannotJoinException - if a match is found and
the operation is to be performed under a transaction,
but the transaction is no longer active.private boolean handleMatch(EntryHandle handle, EntryHandleTmplDesc[] descs)
true if handle has not been removed
and matches one or more of the templatesCopyright 2007-2013, multiple authors.
Licensed under the Apache License, Version 2.0, see the NOTICE file for attributions.