88package com.tangosol.coherence.component.util.daemon.queueProcessor.service.grid.partitionedService.partitionedCache;
99
1010import com.oracle.coherence.common.base.Blocking;
11+ import com.oracle.coherence.common.base.TimeHelper;
1112import com.oracle.coherence.persistence.PersistentStore;
1213import com.tangosol.coherence.component.net.Lease;
1314import com.tangosol.coherence.component.net.MemberSet;
@@ -736,6 +737,12 @@ public class Storage
736737
737738 private static final Object[] EMPTY_OBJECT_ARRAY = new Object[0];
738739
740+ /**
741+ * The maximum accepted value used in {#link {@link #scheduleEviction(long)}}.
742+ * This equals {@link Long#MAX_VALUE} minus millis in one day
743+ */
744+ private static final long MAX_EXPIRY = Long.MAX_VALUE - TimeUnit.DAYS.toMillis(1);
745+
739746 // Static initializer
740747 static
741748 {
@@ -9065,15 +9072,12 @@ protected static void rethrow(Throwable e)
90659072 * Schedule to run the eviction task at specified expiry delay
90669073 * (cExpiryMillis) if no task is currently scheduled. Cancel the
90679074 * existing task and create a new one if new expiry time is sooner than
9068- * previosely scheduled one.
9075+ * previously scheduled one.
90699076 *
90709077 * @param cExpiryMillis expiry delay in millis
90719078 */
90729079 public synchronized void scheduleEviction(long cExpiryMillis)
90739080 {
9074- // import Component.Util.DaemonPool as com.tangosol.coherence.component.util.DaemonPool;
9075- // import com.tangosol.util.Base;
9076-
90779081 com.tangosol.coherence.component.util.DaemonPool pool = getService().getDaemonPool();
90789082
90799083 if (!pool.isStarted())
@@ -9091,7 +9095,22 @@ public synchronized void scheduleEviction(long cExpiryMillis)
90919095 }
90929096
90939097 long ldtOldNext = task.getEvictionTime();
9094- long ldtNewNext = Base.getSafeTimeMillis() + cExpiryMillis;
9098+ long ldtNow = TimeHelper.getSafeTimeMillis();
9099+ long ldtMax = MAX_EXPIRY - ldtNow;
9100+
9101+ long ldtNewNext;
9102+ long ldtSchedule;
9103+
9104+ if (cExpiryMillis < ldtMax)
9105+ {
9106+ ldtNewNext = ldtNow + cExpiryMillis;
9107+ ldtSchedule = cExpiryMillis;
9108+ }
9109+ else
9110+ {
9111+ ldtNewNext = MAX_EXPIRY;
9112+ ldtSchedule = MAX_EXPIRY - ldtNow;
9113+ }
90959114
90969115 task.setPrune(cExpiryMillis == 0L);
90979116
0 commit comments