com.sun.jini.outrigger
Class OutriggerServerImpl.ContentsQuery

java.lang.Object
  extended by com.sun.jini.outrigger.OutriggerServerImpl.ContentsQuery
All Implemented Interfaces:
LeasedResource
Enclosing class:
OutriggerServerImpl

private class OutriggerServerImpl.ContentsQuery
extends Object
implements LeasedResource

Object that keeps the current state of contents queries. Holds the expiration time as well as the current state of the iteration.


Field Summary
private  Set classes
          The Set of classes we need to search
private  Iterator classesIterator
          An iteration into classes
private  EntryHolder.ContinuingQuery currentQuery
          The current ContinuingQuery
private  long expiration
          The current expiration time
private  EntryRep[] lastBatch
          Last batch of entries returned
private  Uuid lastEntry
          Uuid of the last entry returned
private  Object lock
          Lock to prevent concurrent calls to nextBatch
private  WeakHashMap provisionallyRemovedEntrySet
          Set of entries that we have encountered that have been provisionally removed
private  long remaining
          Number of elements left to return before reaching the the client specified limit
private  EntryRep[] tmpls
          The complete set of templates
private  Txn txn
          The transaction the query is being performed under
private  Uuid uuid
          Uuid associated with this query and its lease
 
Constructor Summary
private OutriggerServerImpl.ContentsQuery(Uuid uuid, EntryRep[] tmpls, Txn txn, long limit)
           
 
Method Summary
private  boolean advanceCurrentQuery(long now)
           
private  boolean cancel()
          Remove this query, assumes caller holds lock on this object.
 Uuid getCookie()
          Returns the universally unique identifier associated with this lease.
 long getExpiration()
          Returns the expiration time of the lease.
private  EntryRep[] nextBatch(Uuid lastReceived, long now)
           
 void setExpiration(long newExpiration)
          Changes the expiration time of the lease.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

uuid

private final Uuid uuid
Uuid associated with this query and its lease


classes

private final Set classes
The Set of classes we need to search


classesIterator

private final Iterator classesIterator
An iteration into classes


tmpls

private final EntryRep[] tmpls
The complete set of templates


txn

private final Txn txn
The transaction the query is being performed under


lock

private final Object lock
Lock to prevent concurrent calls to nextBatch


expiration

private long expiration
The current expiration time


currentQuery

private EntryHolder.ContinuingQuery currentQuery
The current ContinuingQuery


remaining

private long remaining
Number of elements left to return before reaching the the client specified limit


lastEntry

private Uuid lastEntry
Uuid of the last entry returned


lastBatch

private EntryRep[] lastBatch
Last batch of entries returned


provisionallyRemovedEntrySet

private final WeakHashMap provisionallyRemovedEntrySet
Set of entries that we have encountered that have been provisionally removed

Constructor Detail

OutriggerServerImpl.ContentsQuery

private OutriggerServerImpl.ContentsQuery(Uuid uuid,
                                          EntryRep[] tmpls,
                                          Txn txn,
                                          long limit)
Method Detail

advanceCurrentQuery

private boolean advanceCurrentQuery(long now)

nextBatch

private EntryRep[] nextBatch(Uuid lastReceived,
                             long now)
                      throws TransactionException
Throws:
TransactionException

cancel

private boolean cancel()
Remove this query, assumes caller holds lock on this object. Returns true if query has not been already removed.


setExpiration

public void setExpiration(long newExpiration)
Description copied from interface: LeasedResource
Changes the expiration time of the lease.

Specified by:
setExpiration in interface LeasedResource
Parameters:
newExpiration - The new expiration time in milliseconds since the beginning of the epoch

getExpiration

public long getExpiration()
Description copied from interface: LeasedResource
Returns the expiration time of the lease.

Specified by:
getExpiration in interface LeasedResource
Returns:
The expiration time in milliseconds since the beginning of the epoch

getCookie

public Uuid getCookie()
Description copied from interface: LeasedResource
Returns the universally unique identifier associated with this lease. Any proxies for this lease that implement ReferentUuid should return this object from their getReferentUuid method and should base their implementation of equals on this object.

Specified by:
getCookie in interface LeasedResource


Copyright 2007-2010, multiple authors.
Licensed under the Apache License, Version 2.0, see the NOTICE file for attributions.