From a055401495bb9ef033c1263a8ff7269120ca1f4d Mon Sep 17 00:00:00 2001 From: Per Cederberg Date: Fri, 1 Sep 2023 14:37:08 +0200 Subject: [PATCH] core: Added Session.setDestroyTime(..) API to change session length --- src/java/org/rapidcontext/core/type/Session.java | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/src/java/org/rapidcontext/core/type/Session.java b/src/java/org/rapidcontext/core/type/Session.java index e9da7b47..b58bc2d3 100644 --- a/src/java/org/rapidcontext/core/type/Session.java +++ b/src/java/org/rapidcontext/core/type/Session.java @@ -375,6 +375,20 @@ public Date destroyTime() { return dict.getDate(KEY_DESTROY_TIME, new Date(Math.min(access, create))); } + /** + * Sets the scheduled session destruction timestamp. + * + * @param date the destruction timestamp, or null for default + */ + public void setDestroyTime(Date date) { + if (date == null) { + dict.remove(KEY_DESTROY_TIME); + } else { + dict.set(KEY_DESTROY_TIME, date); + } + modified = true; + } + /** * Returns the session last access timestamp. *