de.unikassel.android.sdcframework.util
Class TimeProvider.UpdateThread

Package class diagram package TimeProvider.UpdateThread
java.lang.Object
  extended by java.lang.Thread
      extended by de.unikassel.android.sdcframework.util.AbstractWorkerThread
          extended by de.unikassel.android.sdcframework.util.TimeProvider.UpdateThread
All Implemented Interfaces:
EventObserver<NetworkStateChangeEvent>, WorkerThread, Runnable
Enclosing class:
TimeProvider

 class TimeProvider.UpdateThread
extends AbstractWorkerThread
implements EventObserver<NetworkStateChangeEvent>

Thread for asynchronous time updates


Nested Class Summary
 
Nested classes/interfaces inherited from class java.lang.Thread
Thread.State, Thread.UncaughtExceptionHandler
 
Field Summary
private  int attemptCounter
          The counter for sync attempts
private  NetworkConnectionObserver connectionObserver
          the network connection observer
private  Object connectionWaitLock
          The Connection wait lock
private  Context context
          The context
private  WakeLockHolder lockHolder
          The wake lock holder instance
 
Fields inherited from class java.lang.Thread
MAX_PRIORITY, MIN_PRIORITY, NORM_PRIORITY
 
Constructor Summary
TimeProvider.UpdateThread(Context context)
          Constructor
 
Method Summary
private  boolean asynchhronousUpdateTime(Context context)
          Method to update the time provider time offset
protected  void doCleanUp()
          The clean up method executed on termination
protected  void doWork()
          The working method executed in the running loop if started
 void onEvent(ObservableEventSource<? extends NetworkStateChangeEvent> eventSource, NetworkStateChangeEvent observedEvent)
          This method is called whenever the observed object does create an observed event
 
Methods inherited from class de.unikassel.android.sdcframework.util.AbstractWorkerThread
doTerminate, hasTerminated, isLogging, isWorking, logMessage, run, setLogging, start, startWork, stopWork
 
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, stop, stop, suspend, toString, yield
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

connectionObserver

private final NetworkConnectionObserver connectionObserver
the network connection observer


lockHolder

private final WakeLockHolder lockHolder
The wake lock holder instance


context

private final Context context
The context


attemptCounter

private int attemptCounter
The counter for sync attempts


connectionWaitLock

private final Object connectionWaitLock
The Connection wait lock

Constructor Detail

TimeProvider.UpdateThread

public TimeProvider.UpdateThread(Context context)
Constructor

Parameters:
context - the context
Method Detail

doCleanUp

protected void doCleanUp()
Description copied from class: AbstractWorkerThread
The clean up method executed on termination

Specified by:
doCleanUp in class AbstractWorkerThread

doWork

protected void doWork()
Description copied from class: AbstractWorkerThread
The working method executed in the running loop if started

Specified by:
doWork in class AbstractWorkerThread

asynchhronousUpdateTime

private final boolean asynchhronousUpdateTime(Context context)
Method to update the time provider time offset

Parameters:
context - the context

onEvent

public void onEvent(ObservableEventSource<? extends NetworkStateChangeEvent> eventSource,
                    NetworkStateChangeEvent observedEvent)
Description copied from interface: EventObserver
This method is called whenever the observed object does create an observed event

Specified by:
onEvent in interface EventObserver<NetworkStateChangeEvent>
Parameters:
eventSource - the event generator
observedEvent - the event created by the observed object