de.root1.simon
Class PublicationSearcher

java.lang.Object
  extended by java.lang.Thread
      extended by de.root1.simon.PublicationSearcher
All Implemented Interfaces:
java.lang.Runnable

public class PublicationSearcher
extends java.lang.Thread

TODO document me

Author:
achr

Nested Class Summary
 
Nested classes/interfaces inherited from class java.lang.Thread
java.lang.Thread.State, java.lang.Thread.UncaughtExceptionHandler
 
Field Summary
 
Fields inherited from class java.lang.Thread
MAX_PRIORITY, MIN_PRIORITY, NORM_PRIORITY
 
Constructor Summary
protected PublicationSearcher(SearchProgressListener listener, int searchTime)
          Creates a searcher instance that searches for published remote objects on the local network
 
Method Summary
 java.util.List<SimonPublication> getNewPublications()
          Returns new found publications
 int getSearchProgress()
          Returns a value from 0..100 indicating the search progress. 0 is at beginning, 100 at end.
 boolean isSearching()
          Returns if thread is still busy with searching
 void run()
           
 void shutdown()
          Signals a shutdown to the search thread and waits until the shutdown is processed completely.
 void signalShutdown()
          Signals a shutdown request to the search thread.
 
Methods inherited from class java.lang.Thread
activeCount, checkAccess, countStackFrames, currentThread, destroy, dumpStack, enumerate, getAllStackTraces, getContextClassLoader, getDefaultUncaughtExceptionHandler, getId, getName, getPriority, getStackTrace, getState, getThreadGroup, getUncaughtExceptionHandler, holdsLock, interrupt, interrupted, isAlive, isDaemon, isInterrupted, join, join, join, resume, setContextClassLoader, setDaemon, setDefaultUncaughtExceptionHandler, setName, setPriority, setUncaughtExceptionHandler, sleep, sleep, start, stop, stop, suspend, toString, yield
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

PublicationSearcher

protected PublicationSearcher(SearchProgressListener listener,
                              int searchTime)
                       throws java.io.IOException
Creates a searcher instance that searches for published remote objects on the local network

Parameters:
listener - a SearchProgressListener implementation which is informed about the current search progress
searchTime - the time the background search thread spends for searching published remote objects
Throws:
java.io.IOException
Method Detail

run

public void run()
Specified by:
run in interface java.lang.Runnable
Overrides:
run in class java.lang.Thread

signalShutdown

public void signalShutdown()
Signals a shutdown request to the search thread.
Note:This method does not block until shutdown is finished. It returns immediately.


shutdown

public void shutdown()
Signals a shutdown to the search thread and waits until the shutdown is processed completely. Note:This method blocks until shutdown is finished!


getNewPublications

public java.util.List<SimonPublication> getNewPublications()
Returns new found publications

Returns:
found publications since the last call of getNewPublications()

getSearchProgress

public int getSearchProgress()
Returns a value from 0..100 indicating the search progress. 0 is at beginning, 100 at end.

Returns:
value 0..100

isSearching

public boolean isSearching()
Returns if thread is still busy with searching

Returns:
true if search is in progress, false if search has finished.


Copyright © 2011. All Rights Reserved.