File tree Expand file tree Collapse file tree 1 file changed +12
-0
lines changed
spring-context/src/main/java/org/springframework/context Expand file tree Collapse file tree 1 file changed +12
-0
lines changed Original file line number Diff line number Diff line change 16
16
17
17
package org .springframework .context ;
18
18
19
+ import java .time .Clock ;
19
20
import java .util .EventObject ;
20
21
21
22
/**
@@ -46,6 +47,17 @@ public ApplicationEvent(Object source) {
46
47
this .timestamp = System .currentTimeMillis ();
47
48
}
48
49
50
+ /**
51
+ * Create a new {@code ApplicationEvent} with a fixed timestamp.
52
+ * @param source the object on which the event initially occurred or with
53
+ * which the event is associated (never {@code null})
54
+ * @param clock a clock which will provide the timestamp
55
+ */
56
+ public ApplicationEvent (Object source , Clock clock ) {
57
+ super (source );
58
+ this .timestamp = clock .millis ();
59
+ }
60
+
49
61
50
62
/**
51
63
* Return the system time in milliseconds when the event occurred.
You can’t perform that action at this time.
0 commit comments