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;
@@ -737,6 +738,12 @@ public class Storage
737738
738739 private static final Object[] EMPTY_OBJECT_ARRAY = new Object[0];
739740
741+ /**
742+ * The maximum accepted value used in {#link {@link #scheduleEviction(long)}}.
743+ * This equals {@link Long#MAX_VALUE} minus millis in one day
744+ */
745+ private static final long MAX_EXPIRY = Long.MAX_VALUE - TimeUnit.DAYS.toMillis(1);
746+
740747 // Static initializer
741748 static
742749 {
@@ -9100,15 +9107,12 @@ protected static void rethrow(Throwable e)
91009107 * Schedule to run the eviction task at specified expiry delay
91019108 * (cExpiryMillis) if no task is currently scheduled. Cancel the
91029109 * existing task and create a new one if new expiry time is sooner than
9103- * previosely scheduled one.
9110+ * previously scheduled one.
91049111 *
91059112 * @param cExpiryMillis expiry delay in millis
91069113 */
91079114 public synchronized void scheduleEviction(long cExpiryMillis)
91089115 {
9109- // import Component.Util.DaemonPool as com.tangosol.coherence.component.util.DaemonPool;
9110- // import com.tangosol.util.Base;
9111-
91129116 com.tangosol.coherence.component.util.DaemonPool pool = getService().getDaemonPool();
91139117
91149118 if (!pool.isStarted())
@@ -9126,7 +9130,22 @@ public synchronized void scheduleEviction(long cExpiryMillis)
91269130 }
91279131
91289132 long ldtOldNext = task.getEvictionTime();
9129- long ldtNewNext = Base.getSafeTimeMillis() + cExpiryMillis;
9133+ long ldtNow = TimeHelper.getSafeTimeMillis();
9134+ long ldtMax = MAX_EXPIRY - ldtNow;
9135+
9136+ long ldtNewNext;
9137+ long ldtSchedule;
9138+
9139+ if (cExpiryMillis < ldtMax)
9140+ {
9141+ ldtNewNext = ldtNow + cExpiryMillis;
9142+ ldtSchedule = cExpiryMillis;
9143+ }
9144+ else
9145+ {
9146+ ldtNewNext = MAX_EXPIRY;
9147+ ldtSchedule = MAX_EXPIRY - ldtNow;
9148+ }
91309149
91319150 task.setPrune(cExpiryMillis == 0L);
91329151
0 commit comments