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

Quick Search    Search Deep

com.fetish.directory
Class Search  view Search download Search.java

java.lang.Object
  extended bycom.fetish.directory.Search

public class Search
extends java.lang.Object

Class with information about a search process.
It holds the responses from all asked FADA nodes.


Field Summary
private  long expiryDate
           
private  java.lang.Object lock
           
private  java.lang.Object lockpending
           
static long MAX_WAIT_TIME
           
(package private)  int maxResponses
          Maximum number of responses
private  long maxWaitTime
           
(package private)  long pending
          Number of pending searches
private  java.util.Vector pendingThreads
           
private  java.util.Vector results
          Vector of ServiceItem elements with services found for this search
(package private)  SearchID searchID
          This search identifier
 
Constructor Summary
Search(SearchID id, int maxResponses)
          Constructs a new Search object with the specified SearchID and default maximum wait time.
Search(SearchID id, long maxWaitTime, int maxResponses)
          Constructs a new Search object with the specified SearchID and maximum wait time.
 
Method Summary
 void addResult(ServiceID sid, ServiceMatches sm)
          Puts obtained results in this Search object for the FADA node identified by sid ServiceID.
 void addResult(ServiceMatches sm)
          Puts obtained results in this Search object.
This method decreases the count of started searches to allow early return of the getResults method.
 void finishedSearch()
          Announces that a search process for this Search has finished.
 long getExpiryDate()
          Obtains the expiry date for this Search object
 ServiceMatches getResults()
          Obtains the results of the search process.
 SearchID getSearchID()
          Obtains the SearchID for this Search object
 void setExpiryDate(long date)
          Sets the expiry date for this Search object
 void startedSearches(int started)
          Adds started to the amount of started searches to wait results from.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

lock

private java.lang.Object lock

lockpending

private java.lang.Object lockpending

maxWaitTime

private long maxWaitTime

pendingThreads

private java.util.Vector pendingThreads

expiryDate

private long expiryDate

MAX_WAIT_TIME

public static final long MAX_WAIT_TIME
See Also:
Constant Field Values

searchID

SearchID searchID
This search identifier


pending

long pending
Number of pending searches


results

private java.util.Vector results
Vector of ServiceItem elements with services found for this search


maxResponses

int maxResponses
Maximum number of responses

Constructor Detail

Search

public Search(SearchID id,
              int maxResponses)
Constructs a new Search object with the specified SearchID and default maximum wait time.


Search

public Search(SearchID id,
              long maxWaitTime,
              int maxResponses)
Constructs a new Search object with the specified SearchID and maximum wait time.

Method Detail

startedSearches

public void startedSearches(int started)
Adds started to the amount of started searches to wait results from.


getSearchID

public SearchID getSearchID()
Obtains the SearchID for this Search object


getExpiryDate

public long getExpiryDate()
Obtains the expiry date for this Search object


setExpiryDate

public void setExpiryDate(long date)
Sets the expiry date for this Search object


addResult

public void addResult(ServiceMatches sm)
Puts obtained results in this Search object.
This method decreases the count of started searches to allow early return of the getResults method.


addResult

public void addResult(ServiceID sid,
                      ServiceMatches sm)
Puts obtained results in this Search object for the FADA node identified by sid ServiceID. This method decreases the count of started searches to allow early return of the getResults method.


finishedSearch

public void finishedSearch()
Announces that a search process for this Search has finished. This method decreases the count of started searches for this Search object.


getResults

public ServiceMatches getResults()
Obtains the results of the search process. This method blocks the calling thread until the search process has finished, which happens when:

  • The amount of responses reaches maxResponses OR
  • maxWaitTime milliseconds have passed since call to this method OR
  • All started search threads have finished