Class ClockFactoryImpl
- java.lang.Object
-
- java.util.TimerTask
-
- net.officefloor.frame.impl.execute.clock.ClockFactoryImpl
-
- All Implemented Interfaces:
java.lang.Runnable,OfficeFloorListener,ClockFactory
public class ClockFactoryImpl extends java.util.TimerTask implements ClockFactory, OfficeFloorListener
ClockFactoryimplementation.- Author:
- Daniel Sagenschneider
-
-
Constructor Summary
Constructors Constructor Description ClockFactoryImpl()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description <T> Clock<T>createClock(java.util.function.Function<java.lang.Long,T> translator)Creates aClock.protected longcurrentTimeSeconds()Obtains the current time in seconds since Epoch.voidofficeFloorClosed(OfficeFloorEvent event)Notifies that theOfficeFloorhas been closed.voidofficeFloorOpened(OfficeFloorEvent event)Notifies that theOfficeFloorhas been opened.voidrun()
-
-
-
Method Detail
-
currentTimeSeconds
protected long currentTimeSeconds()
Obtains the current time in seconds since Epoch.- Returns:
- Current time in seconds since Epoch.
-
createClock
public <T> Clock<T> createClock(java.util.function.Function<java.lang.Long,T> translator)
Description copied from interface:ClockFactoryCreates aClock.- Specified by:
createClockin interfaceClockFactory- Parameters:
translator- Translate the seconds since Epoch toClocktime.- Returns:
Clock.
-
officeFloorOpened
public void officeFloorOpened(OfficeFloorEvent event) throws java.lang.Exception
Description copied from interface:OfficeFloorListenerNotifies that theOfficeFloorhas been opened.- Specified by:
officeFloorOpenedin interfaceOfficeFloorListener- Parameters:
event-OfficeFloorEvent.- Throws:
java.lang.Exception- If fails to handle open listen logic.
-
officeFloorClosed
public void officeFloorClosed(OfficeFloorEvent event) throws java.lang.Exception
Description copied from interface:OfficeFloorListenerNotifies that theOfficeFloorhas been closed.- Specified by:
officeFloorClosedin interfaceOfficeFloorListener- Parameters:
event-OfficeFloorEvent.- Throws:
java.lang.Exception- If fails to handle close listen logic.
-
run
public void run()
- Specified by:
runin interfacejava.lang.Runnable- Specified by:
runin classjava.util.TimerTask
-
-