net.sf.uadetector.datastore
Class AbstractUpdateOperation

java.lang.Object
  extended by net.sf.uadetector.datastore.AbstractUpdateOperation
All Implemented Interfaces:
java.lang.Runnable, UpdateOperation

public abstract class AbstractUpdateOperation
extends java.lang.Object
implements UpdateOperation

Provides a basic implementation to update UAS data in the background when calling run().

Author:
André Rouél

Field Summary
 
Fields inherited from interface net.sf.uadetector.datastore.UpdateOperation
DEFAULT_UPDATE_INTERVAL
 
Constructor Summary
AbstractUpdateOperation(RefreshableDataStore dataStore)
           
 
Method Summary
 long getLastUpdateCheck()
          Gets the time of the last update check in milliseconds.
protected  boolean isUpdateAvailable()
          Fetches the current version information over HTTP and compares it with the last version of the most recently imported data.
 void run()
          Executes the update at some time in the future (as soon as possible) within a new thread.
 void shutdown()
          Shuts down the corresponding background executor as soon as possible, but at the latest specified default time.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface net.sf.uadetector.datastore.UpdateOperation
call
 

Constructor Detail

AbstractUpdateOperation

public AbstractUpdateOperation(@Nonnull
                               RefreshableDataStore dataStore)
Method Detail

getLastUpdateCheck

public long getLastUpdateCheck()
Gets the time of the last update check in milliseconds.

Specified by:
getLastUpdateCheck in interface UpdateOperation
Returns:
time of the last update check in milliseconds

isUpdateAvailable

protected boolean isUpdateAvailable()
Fetches the current version information over HTTP and compares it with the last version of the most recently imported data.

Returns:
true if an update exists, otherwise false

run

public void run()
Executes the update at some time in the future (as soon as possible) within a new thread.

Specified by:
run in interface java.lang.Runnable

shutdown

public void shutdown()
Shuts down the corresponding background executor as soon as possible, but at the latest specified default time.

Specified by:
shutdown in interface UpdateOperation
See Also:
ExecutorServices.shutdown(ExecutorService)


Copyright © 2011-2014. All Rights Reserved.