Impala
Impalaistheopensource,nativeanalyticdatabaseforApacheHadoop.
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros
com.cloudera.impala.util.FileWatchService Class Reference
Collaboration diagram for com.cloudera.impala.util.FileWatchService:

Classes

interface  FileChangeListener
 

Public Member Functions

 FileWatchService (File file, FileChangeListener listener)
 
void setCheckIntervalMs (long checkIntervalMs)
 
synchronized void start ()
 
synchronized void stop ()
 

Static Package Attributes

static final Logger LOG = LoggerFactory.getLogger(FileWatchService.class)
 
static final long DEFAULT_CHECK_INTERVAL_MS = 10 * 1000
 

Private Member Functions

void checkFile ()
 

Private Attributes

long checkIntervalMs_ = DEFAULT_CHECK_INTERVAL_MS
 
ScheduledFuture<?> fileCheckFuture_
 
final AtomicBoolean running_
 
final FileChangeListener changeListener_
 
final File file_
 
boolean alreadyWarned_
 
long prevChange_
 

Detailed Description

Service to watch a file for changes. A thread periodically checks the file modification time and uses the provided FileChangeListener to notify a consumer.

Definition at line 36 of file FileWatchService.java.

Constructor & Destructor Documentation

Member Function Documentation

void com.cloudera.impala.util.FileWatchService.checkFile ( )
inlineprivate

Checks if the file has changed since the last observed change and if so, notifies the listener.

Definition at line 89 of file FileWatchService.java.

References com.cloudera.impala.util.FileWatchService.alreadyWarned_, com.cloudera.impala.util.FileWatchService.file_, and com.cloudera.impala.util.FileWatchService.prevChange_.

Referenced by com.cloudera.impala.util.FileWatchService.start().

void com.cloudera.impala.util.FileWatchService.setCheckIntervalMs ( long  checkIntervalMs)
inline

Set the time (in milliseconds) to wait between checking the file for changes. Only used in tests.

Definition at line 81 of file FileWatchService.java.

References com.cloudera.impala.util.FileWatchService.checkIntervalMs_.

synchronized void com.cloudera.impala.util.FileWatchService.start ( )
inline

Starts the thread to check for file changes. Continues checking for file changes every 'checkIntervalMs_' milliseconds until stop() is called.

Definition at line 109 of file FileWatchService.java.

References com.cloudera.impala.util.FileWatchService.checkFile(), com.cloudera.impala.util.FileWatchService.checkIntervalMs_, com.cloudera.impala.util.FileWatchService.file_, and com.cloudera.impala.util.FileWatchService.fileCheckFuture_.

synchronized void com.cloudera.impala.util.FileWatchService.stop ( )
inline

Stops the file watching thread.

Definition at line 132 of file FileWatchService.java.

Member Data Documentation

boolean com.cloudera.impala.util.FileWatchService.alreadyWarned_
private
final FileChangeListener com.cloudera.impala.util.FileWatchService.changeListener_
private
long com.cloudera.impala.util.FileWatchService.checkIntervalMs_ = DEFAULT_CHECK_INTERVAL_MS
private
final long com.cloudera.impala.util.FileWatchService.DEFAULT_CHECK_INTERVAL_MS = 10 * 1000
staticpackage

Definition at line 40 of file FileWatchService.java.

ScheduledFuture<?> com.cloudera.impala.util.FileWatchService.fileCheckFuture_
private
final Logger com.cloudera.impala.util.FileWatchService.LOG = LoggerFactory.getLogger(FileWatchService.class)
staticpackage

Definition at line 37 of file FileWatchService.java.

long com.cloudera.impala.util.FileWatchService.prevChange_
private
final AtomicBoolean com.cloudera.impala.util.FileWatchService.running_
private

The documentation for this class was generated from the following file: