Docjar: A Java Source and Docuemnt Enginecom.*    java.*    javax.*    org.*    all    new    plug-in

Quick Search    Search Deep

com.k_int.hss
Class AggregateFragmentSource  view AggregateFragmentSource download AggregateFragmentSource.java

java.lang.Object
  extended byjava.util.Observable
      extended bycom.k_int.hss.AggregateFragmentSource
All Implemented Interfaces:
com.k_int.IR.InformationFragmentSource

public class AggregateFragmentSource
extends java.util.Observable
implements com.k_int.IR.InformationFragmentSource

AggregateFragmentSource. Object used in conunction with HeterogeneousSetOfSearchable object to track the progress of a specific HSS query and provide access to it's results (And component searches)

Version:
$Id: AggregateFragmentSource.java,v 1.41 2003/05/09 12:54:47 rob_tice Exp $

Field Summary
private  boolean active_collate_thread
           
private  int available_records
           
private static LoggingContext cat
           
private  java.lang.Object collate_thread_lock
           
static int dbg_count
           
private  com.k_int.IR.RecordFormatSpecification default_record_spec
           
private  java.lang.Object new_records_lock
           
private  java.util.Vector pending_async_gets
           
private  int rec_counter
           
private  JDBMRecordManager recman
           
private  int record_hwm_target
           
private  java.util.Hashtable record_sources
           
private  JDBMHashtable result_set
           
private  java.lang.String results_file_name
           
private  boolean running
           
 java.util.Observer subset_observer
           
private  java.lang.Thread the_active_collate_thread
           
private  ThreadPool thread_pool
           
private  int timeout
           
private  int total_records_available
           
 
Fields inherited from class java.util.Observable
 
Fields inherited from interface com.k_int.IR.InformationFragmentSource
default_spec
 
Constructor Summary
AggregateFragmentSource(ThreadPool thread_pool)
           
 
Method Summary
 void addFragmentSourceObserver(java.util.Observer o)
           
 void addSource(com.k_int.IR.InformationFragmentSource s)
           
 void asyncGetFragment(int starting_fragment, int count, com.k_int.IR.RecordFormatSpecification spec, com.k_int.IR.IFSNotificationTarget target)
           
private  void checkPendingAsyncGets()
           
private  void collateRecordsFromAllSources()
          Spin around all record sources and try to interleave the records.
 void destroy()
          Release all resources and shut down the object
 com.k_int.IR.AsynchronousEnumeration elements()
          Enumerate all the items availabe from this fragment source
private  void ensureResultAvailable(int index)
          Evaluate cache status and spawn any needed threads to request records from the sub search tasks.
private  com.k_int.IR.InformationFragment[] extractProxyFragments(int start, int count, com.k_int.IR.RecordFormatSpecification spec)
           
protected  void finalize()
          Called on an object by the Virtual Machine at most once, at some point after the Object is determined unreachable but before it is destroyed.
 com.k_int.IR.InformationFragment[] getFragment(int starting_fragment, int count, com.k_int.IR.RecordFormatSpecification spec)
          Position based range access to the result set.
 com.k_int.IR.InformationFragment getFragmentAs(int source_id, com.k_int.IR.RecordFormatSpecification spec, int position)
          A bit of glue that sits between a ProxyFragment and the original source of the record when we want that record is some format other than the original.
 int getFragmentCount()
          Current number of fragments available
private  int getResultSetSize()
           
 com.k_int.IR.IRStatusReport getStatusReport()
          If this source aggregates other sources, there status reports can be found here, return null if this is an original source of data.
private  java.lang.Runnable makeGetRecordsTask()
           
 void newRecordsAvailable(com.k_int.IR.InformationFragmentSource ifs, int i)
           
private  ProxyFragment retrieve(int index)
           
private  void storeFragment(ProxyFragment f)
           
private  boolean waitForResult(int index, int wait_timeout)
          Wait for one of the sub tasks to make a record available that will be presented at position "index" in the result set.
 
Methods inherited from class java.util.Observable
addObserver, clearChanged, countObservers, deleteObserver, deleteObservers, hasChanged, notifyObservers, notifyObservers, setChanged
 
Methods inherited from class java.lang.Object
clone, equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

record_sources

private java.util.Hashtable record_sources

new_records_lock

private java.lang.Object new_records_lock

dbg_count

public static int dbg_count

timeout

private int timeout

cat

private static LoggingContext cat

total_records_available

private int total_records_available

thread_pool

private ThreadPool thread_pool

record_hwm_target

private int record_hwm_target

active_collate_thread

private boolean active_collate_thread

the_active_collate_thread

private java.lang.Thread the_active_collate_thread

collate_thread_lock

private java.lang.Object collate_thread_lock

results_file_name

private java.lang.String results_file_name

recman

private JDBMRecordManager recman

result_set

private JDBMHashtable result_set

rec_counter

private int rec_counter

available_records

private int available_records

pending_async_gets

private java.util.Vector pending_async_gets

running

private boolean running

default_record_spec

private com.k_int.IR.RecordFormatSpecification default_record_spec

subset_observer

public java.util.Observer subset_observer
Constructor Detail

AggregateFragmentSource

public AggregateFragmentSource(ThreadPool thread_pool)
Method Detail

finalize

protected void finalize()
Description copied from class: java.lang.Object
Called on an object by the Virtual Machine at most once, at some point after the Object is determined unreachable but before it is destroyed. You would think that this means it eventually is called on every Object, but this is not necessarily the case. If execution terminates abnormally, garbage collection does not always happen. Thus you cannot rely on this method to always work. For finer control over garbage collection, use references from the java.lang.ref package.

Virtual Machines are free to not call this method if they can determine that it does nothing important; for example, if your class extends Object and overrides finalize to do simply super.finalize().

finalize() will be called by a java.lang.Thread that has no locks on any Objects, and may be called concurrently. There are no guarantees on the order in which multiple objects are finalized. This means that finalize() is usually unsuited for performing actions that must be thread-safe, and that your implementation must be use defensive programming if it is to always work.

If an Exception is thrown from finalize() during garbage collection, it will be patently ignored and the Object will still be destroyed.

It is allowed, although not typical, for user code to call finalize() directly. User invocation does not affect whether automatic invocation will occur. It is also permitted, although not recommended, for a finalize() method to "revive" an object by making it reachable from normal code again.

Unlike constructors, finalize() does not get called for an object's superclass unless the implementation specifically calls super.finalize().

The default implementation does nothing.


addSource

public void addSource(com.k_int.IR.InformationFragmentSource s)

getFragment

public com.k_int.IR.InformationFragment[] getFragment(int starting_fragment,
                                                      int count,
                                                      com.k_int.IR.RecordFormatSpecification spec)
                                               throws com.k_int.IR.PresentException
Description copied from interface: com.k_int.IR.InformationFragmentSource
Position based range access to the result set. Implementation must be 1 based: IE, First record in result set is 1 not 0. Local mappings (e.g to vector) must account for this!

Specified by:
getFragment in interface com.k_int.IR.InformationFragmentSource

asyncGetFragment

public void asyncGetFragment(int starting_fragment,
                             int count,
                             com.k_int.IR.RecordFormatSpecification spec,
                             com.k_int.IR.IFSNotificationTarget target)
Specified by:
asyncGetFragment in interface com.k_int.IR.InformationFragmentSource

getFragmentCount

public int getFragmentCount()
Description copied from interface: com.k_int.IR.InformationFragmentSource
Current number of fragments available

Specified by:
getFragmentCount in interface com.k_int.IR.InformationFragmentSource

ensureResultAvailable

private void ensureResultAvailable(int index)
Evaluate cache status and spawn any needed threads to request records from the sub search tasks. This function **SHOULD NOT BLOCK**. Instead it should create fetch threads that are able to wait for the sub queries to return results. Remember that the first item in a result set (via this API) is at 1 and not 0.


collateRecordsFromAllSources

private void collateRecordsFromAllSources()
Spin around all record sources and try to interleave the records.


checkPendingAsyncGets

private void checkPendingAsyncGets()

waitForResult

private boolean waitForResult(int index,
                              int wait_timeout)
                       throws com.k_int.IR.TimeoutExceededException
Wait for one of the sub tasks to make a record available that will be presented at position "index" in the result set.


newRecordsAvailable

public void newRecordsAvailable(com.k_int.IR.InformationFragmentSource ifs,
                                int i)

addFragmentSourceObserver

public void addFragmentSourceObserver(java.util.Observer o)

destroy

public void destroy()
Description copied from interface: com.k_int.IR.InformationFragmentSource
Release all resources and shut down the object

Specified by:
destroy in interface com.k_int.IR.InformationFragmentSource

elements

public com.k_int.IR.AsynchronousEnumeration elements()
Description copied from interface: com.k_int.IR.InformationFragmentSource
Enumerate all the items availabe from this fragment source

Specified by:
elements in interface com.k_int.IR.InformationFragmentSource

getStatusReport

public com.k_int.IR.IRStatusReport getStatusReport()
Description copied from interface: com.k_int.IR.InformationFragmentSource
If this source aggregates other sources, there status reports can be found here, return null if this is an original source of data.

Specified by:
getStatusReport in interface com.k_int.IR.InformationFragmentSource

makeGetRecordsTask

private java.lang.Runnable makeGetRecordsTask()

getFragmentAs

public com.k_int.IR.InformationFragment getFragmentAs(int source_id,
                                                      com.k_int.IR.RecordFormatSpecification spec,
                                                      int position)
A bit of glue that sits between a ProxyFragment and the original source of the record when we want that record is some format other than the original.


storeFragment

private void storeFragment(ProxyFragment f)

retrieve

private ProxyFragment retrieve(int index)

getResultSetSize

private int getResultSetSize()

extractProxyFragments

private com.k_int.IR.InformationFragment[] extractProxyFragments(int start,
                                                                 int count,
                                                                 com.k_int.IR.RecordFormatSpecification spec)