01: // Prevayler(TM) - The Open-Source Prevalence Layer.
02: // Copyright (C) 2001 Klaus Wuestefeld.
03: // This library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License version 2.1 as published by the Free Software Foundation. This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with this library; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA.
04:
05: package org.prevayler;
06:
07: import java.io.Serializable;
08: import java.util.Date;
09:
10: /** The clock used by every business object in a PrevalentSystem for ALL its date/time related functions.
11: * If any business object were to access the system clock directly, with methods like new Date() and System.currentTimeMillis(), its behaviour would NOT be deterministic.
12: * A future version of AlarmClock will be able to wake up other objects in a way similar to javax.swing.Timer and java.util.Timer.
13: */
14: public interface AlarmClock extends Serializable {
15:
16: /** Returns the "current" time. The same value will be returned for every call, throughout the execution of a command, ensuring that each command is executed in a single moment in time. Without this, the commands could not be deterministically re-executed during crash-recovery.
17: * @return A Date greater or equal to the one returned by the last call to this method. If the time is the same as the last call, the SAME Date object is guaranteed to be returned and not a new, equal one.
18: */
19: public Date time();
20: }
|