kr.co.hit.live.util
Class FileWatchdog

java.lang.Object
  extended by java.lang.Thread
      extended by kr.co.hit.live.util.FileWatchdog
All Implemented Interfaces:
Runnable

public class FileWatchdog
extends Thread

File Watch Dog 클래스

Since:
3.0
Author:
김형도

Nested Class Summary
 
Nested classes/interfaces inherited from class java.lang.Thread
Thread.State, Thread.UncaughtExceptionHandler
 
Field Summary
static long DEFAULT_DELAY
           해당 파일의 변경 유무를 체크하기 위한 Default 초의 static final 변수, 기본 적용은 값은 30초
static String WATCHDOG_THREAD_NAME
          감시 쓰레드 명
 
Fields inherited from class java.lang.Thread
MAX_PRIORITY, MIN_PRIORITY, NORM_PRIORITY
 
Constructor Summary
FileWatchdog(File file)
          감시하고자 하는 파일을 파라메타로 받는 기본 생성자.
 
Method Summary
protected  void checkAndConfigure()
           파일의 변경 유무를 체크하는 메소드
 void quit()
          감시를 중단한다.
 void run()
           파일의 변경 유무의 체크를 주기적으로 실행시키는 메소드
 void setDelay(long delay)
          감시 주기를 설정한다.
 FileWatchdogListener setListener(FileWatchdogListener lstnr)
          파일 변경시 이벤트를 전달할 리스너 객체를 설정한다.
 void setLockFile(File file)
          Lock 파일 객체를 지정한다.
 
Methods inherited from class java.lang.Thread
activeCount, checkAccess, clone, 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
equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

DEFAULT_DELAY

public static final long DEFAULT_DELAY

해당 파일의 변경 유무를 체크하기 위한 Default 초의 static final 변수, 기본 적용은 값은 30초

See Also:
Constant Field Values

WATCHDOG_THREAD_NAME

public static final String WATCHDOG_THREAD_NAME
감시 쓰레드 명

See Also:
Constant Field Values
Constructor Detail

FileWatchdog

public FileWatchdog(File file)
감시하고자 하는 파일을 파라메타로 받는 기본 생성자.

Parameters:
filename -
Method Detail

quit

public void quit()
감시를 중단한다.


setDelay

public void setDelay(long delay)
감시 주기를 설정한다.

Parameters:
delay - 감시주기 (초)

setLockFile

public void setLockFile(File file)
Lock 파일 객체를 지정한다.

Parameters:
file -

setListener

public FileWatchdogListener setListener(FileWatchdogListener lstnr)
파일 변경시 이벤트를 전달할 리스너 객체를 설정한다. 이전에 설정된 리스너가 있을 경우에는 이를 리턴한다.

Parameters:
lstnr - 설정할 리스너 객체
Returns:
이전에 설정된 리스너가 있을 경우 리턴한다.

checkAndConfigure

protected void checkAndConfigure()

파일의 변경 유무를 체크하는 메소드


run

public void run()

파일의 변경 유무의 체크를 주기적으로 실행시키는 메소드

Specified by:
run in interface Runnable
Overrides:
run in class Thread


Copyright © 2014. All Rights Reserved.