ants.gnutant
Class GnutantResponseMonitor

java.lang.Object
  |
  +--ants.gnutant.GnutantResponseMonitor
All Implemented Interfaces:
Clearable, ResponseListener, ResponseMonitor

public class GnutantResponseMonitor
extends Object
implements Clearable, ResponseMonitor, ResponseListener

Listens for responses from ReplyGnutant and log the statistics. It also initiates a download phase of a certain percentage of the found documents.

Version:
$Revision: 1.7 $
Author:
Hein Meling

Field Summary
static String PAR_DOWNLOADPROB
          Parameter name used to read the percentage of documents to download upon receiving a set of documents references.
 
Fields inherited from interface antsim.ResponseMonitor
NAME
 
Constructor Summary
GnutantResponseMonitor(Factory factory, String name)
          Creates a new custom Gnutant response monitor.
 
Method Summary
 void clear()
          Restores the object to its initial state.
 void complete()
          Upcall method used to notify this listener that the given request has finished to return resources.
 void returnResources(RequestId rid, Resource[] resources)
          Upcall method used to notify this listener that the given request has returned the specified set of resources.
 void setStatistics(Stats stats)
           
 void startRequest(RequestId rid)
          Must be invoked prior to invoking a request on a nest, to ensure that the given request is stored to enable lookup on responses.
 void tick()
           
 void tick(int v)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

PAR_DOWNLOADPROB

public static final String PAR_DOWNLOADPROB
Parameter name used to read the percentage of documents to download upon receiving a set of documents references.

See Also:
Constant Field Values
Constructor Detail

GnutantResponseMonitor

public GnutantResponseMonitor(Factory factory,
                              String name)
Creates a new custom Gnutant response monitor.

Method Detail

clear

public void clear()
Restores the object to its initial state.

Specified by:
clear in interface Clearable

setStatistics

public void setStatistics(Stats stats)
Specified by:
setStatistics in interface ResponseMonitor

tick

public void tick()
Specified by:
tick in interface ResponseMonitor

tick

public void tick(int v)
Specified by:
tick in interface ResponseMonitor

startRequest

public void startRequest(RequestId rid)
Must be invoked prior to invoking a request on a nest, to ensure that the given request is stored to enable lookup on responses.

Specified by:
startRequest in interface ResponseMonitor

returnResources

public void returnResources(RequestId rid,
                            Resource[] resources)
Upcall method used to notify this listener that the given request has returned the specified set of resources.

Specified by:
returnResources in interface ResponseListener
Parameters:
rid - the request identifier for the returned resources.
resources - the resources found.

complete

public void complete()
Upcall method used to notify this listener that the given request has finished to return resources.

Specified by:
complete in interface ResponseListener