com.sleepycat.je.rep.impl.networkRestore
Class LogFileFeeder

java.lang.Object
  extended by java.lang.Thread
      extended by com.sleepycat.je.utilint.StoppableThread
          extended by com.sleepycat.je.rep.impl.networkRestore.LogFileFeeder
All Implemented Interfaces:
ExceptionListenerUser, Runnable

public class LogFileFeeder
extends StoppableThread

The LogFileFeeder supplies log files to a client. There is one instance of this class per client that's currently active. LogFileFeeders are created by the FeederManager and exist for the duration of the session with the client.


Nested Class Summary
 
Nested classes/interfaces inherited from class java.lang.Thread
Thread.State, Thread.UncaughtExceptionHandler
 
Field Summary
(package private)  MessageDigest messageDigest
           
(package private) static int TRANSFER_BYTES
           
 
Fields inherited from class com.sleepycat.je.utilint.StoppableThread
envImpl
 
Fields inherited from class java.lang.Thread
MAX_PRIORITY, MIN_PRIORITY, NORM_PRIORITY
 
Constructor Summary
LogFileFeeder(FeederManager feederManager, SocketChannel channel)
           
 
Method Summary
protected  Logger getLogger()
           
(package private) static MessageDigest getSHA1Digest(File file, long length)
          Returns the SHA1 has associated with the file.
protected  int initiateSoftShutdown()
          Threads that use shutdownThread() must define this method.
 void run()
          The main driver loop that enforces the protocol message sequence and implements it.
 void shutdown()
           
 
Methods inherited from class com.sleepycat.je.utilint.StoppableThread
cleanup, getSavedShutdownException, getTotalCpuTime, getTotalUserTime, isShutdown, saveShutdownException, setExceptionListener, shutdownDone, shutdownThread
 
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
 

Field Detail

TRANSFER_BYTES

static final int TRANSFER_BYTES
See Also:
Constant Field Values

messageDigest

final MessageDigest messageDigest
Constructor Detail

LogFileFeeder

public LogFileFeeder(FeederManager feederManager,
                     SocketChannel channel)
              throws DatabaseException
Throws:
DatabaseException
Method Detail

shutdown

public void shutdown()

initiateSoftShutdown

protected int initiateSoftShutdown()
Description copied from class: StoppableThread
Threads that use shutdownThread() must define this method. It's invoked by shutdownThread as an attempt at a soft shutdown. This method makes provisions for this thread to exit on its own. The technique used to make the thread exit can vary based upon the nature of the service being provided by the thread. For example, the thread may be known to poll some shutdown flag on a periodic basis, or it may detect that a channel that it waits on has been closed by this method.

Overrides:
initiateSoftShutdown in class StoppableThread
Returns:
the amount of time in ms that the shutdownThread method will wait for the thread to exit. A -ve value means that the method will not wait. A zero value means it will wait indefinitely.

run

public void run()
The main driver loop that enforces the protocol message sequence and implements it.

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

getSHA1Digest

static MessageDigest getSHA1Digest(File file,
                                   long length)
                            throws IOException,
                                   DatabaseException
Returns the SHA1 has associated with the file.

Parameters:
file -
length -
Returns:
Throws:
IOException
DatabaseException

getLogger

protected Logger getLogger()
Specified by:
getLogger in class StoppableThread
Returns:
a logger to use when logging uncaught exceptions.
See Also:
StoppableThread.getLogger()


Copyright (c) 2004-2010 Oracle. All rights reserved.