aboutsummaryrefslogtreecommitdiffstats
path: root/jdisc_core/src
diff options
context:
space:
mode:
authorHåkon Hallingstad <hakon@oath.com>2018-01-22 15:44:14 +0100
committerHåkon Hallingstad <hakon@oath.com>2018-01-22 15:44:14 +0100
commitfa9b1942bf51a3301398be5fdc8f18bf3d9485ff (patch)
tree0fed27e3b5047bc781096fd1834c9678cdad9b2a /jdisc_core/src
parentb54f86da25e5183fc45d1d5f1620eb6394d7aca0 (diff)
Redefine task and its context
After discussions with bratseth, we'll not organize tasks in a tree structure, and instead have tasks mostly 1:1 with components. Tasks are put in chains, and may have ordering constraints between them that the chain resolves. The FileSystem API has been removed and instead use the raw java NIO FileSystem, and use Jimfs to mock FileSystem in tests. NodeAdminStateUpdater has been made an interface, since the HTTP request handler needs to delegate to it when getting requests. Much of the public HTTP API will get internalized with standalone NodeAdmin.
Diffstat (limited to 'jdisc_core/src')
-rw-r--r--jdisc_core/src/main/java/com/yahoo/jdisc/Timer.java8
1 files changed, 8 insertions, 0 deletions
diff --git a/jdisc_core/src/main/java/com/yahoo/jdisc/Timer.java b/jdisc_core/src/main/java/com/yahoo/jdisc/Timer.java
index c94ebc1ab93..f0dc26844e7 100644
--- a/jdisc_core/src/main/java/com/yahoo/jdisc/Timer.java
+++ b/jdisc_core/src/main/java/com/yahoo/jdisc/Timer.java
@@ -4,6 +4,8 @@ package com.yahoo.jdisc;
import com.google.inject.ImplementedBy;
import com.yahoo.jdisc.core.SystemTimer;
+import java.time.Instant;
+
/**
* <p>This class provides access to the current time in milliseconds, as viewed by the {@link Container}. Inject an
* instance of this class into any component that needs to access time, instead of using
@@ -27,4 +29,10 @@ public interface Timer {
*/
long currentTimeMillis();
+ /**
+ * Convenience method for getting an java.util.Instance from currentTimeMillis().
+ */
+ default Instant currentTime() {
+ return Instant.ofEpochMilli(currentTimeMillis());
+ }
}