verinec.importer.analysis
Class StartLookUpHost

java.lang.Object
  extended by verinec.importer.analysis.StartLookUpHost
All Implemented Interfaces:
IOperation

public class StartLookUpHost
extends Object
implements IOperation

This class manages the lookup of the host names. To do this, a threadpool form java 1.5 is used.

Author:
martial.seifriz at unifr.ch

Nested Class Summary
 class StartLookUpHost.HostNameLookUpThread
          A thread that populates a host name in a host renderer.
 
Field Summary
private  boolean abort
           
private  AnalysisThread analyser
          The AnalysisThread, which owns the StartLookUpHost object
private  java.util.concurrent.ScheduledThreadPoolExecutor my_executor
          The executor of the threadpool
 
Constructor Summary
StartLookUpHost(int paralleLoockUps, AnalysisThread analyser)
          This constuructor just initializes the executor for the threadpool.
 
Method Summary
 void abortOperation()
          Abort the lookups as soon as possible.
 int getFinishedTasks()
          Get the number of looked up hosts.
 int getQueuedTasks()
          Get the number of the queued host to look up.
 boolean isFinished()
          Find out whether the lookup is finished.
 void lookUpHostName(HostCommRenderer host)
          Look up the name of a host.
private  void updateState()
          Update the actual state of the queued and finished lookups.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

my_executor

private java.util.concurrent.ScheduledThreadPoolExecutor my_executor
The executor of the threadpool


analyser

private AnalysisThread analyser
The AnalysisThread, which owns the StartLookUpHost object


abort

private boolean abort
Constructor Detail

StartLookUpHost

public StartLookUpHost(int paralleLoockUps,
                       AnalysisThread analyser)
This constuructor just initializes the executor for the threadpool.

Parameters:
paralleLoockUps - The number of parallel Lookups
analyser - The AnalysisThread, which owns the StartLookUpHost object
Method Detail

abortOperation

public void abortOperation()
Abort the lookups as soon as possible.

Specified by:
abortOperation in interface IOperation

lookUpHostName

public void lookUpHostName(HostCommRenderer host)
Look up the name of a host.

Parameters:
host - The host to look up.

getFinishedTasks

public int getFinishedTasks()
Get the number of looked up hosts.

Returns:
Only the number of hosts, which were looked up.

getQueuedTasks

public int getQueuedTasks()
Get the number of the queued host to look up.

Returns:
Only the number of the hosts, which are queued.

isFinished

public boolean isFinished()
Find out whether the lookup is finished.

Returns:
True if aborted or no more queued tasks.

updateState

private void updateState()
Update the actual state of the queued and finished lookups.


Copyright © 2005 Verinec, DIUF