This implementation is optimised that timeout operations are not cancelled on every operation. Rather timeout are allowed to expire and a check is then made to see when the last operation took place. If the idle timeout has not expired, the timeout is rescheduled for the earliest possible time a timeout could occur.
| Modifier and Type | Field and Description |
|---|---|
| private volatile long | |
| private volatile long | |
| private final Scheduler | |
| private final AtomicReference | |
| private static final Logger |
| Access | Constructor and Description |
|---|---|
| public |
| Modifier and Type | Method and Description |
|---|---|
| private void | |
| protected long | |
| private void | |
| public long | Returns: the period of time, in milliseconds, that this object was idleGet the period of time, in milliseconds, that this object was idle. |
| public long | |
| public Scheduler | |
| private void | |
| public abstract boolean | Returns: True if the entity monitored should still be checked for idle timeoutsThis abstract method should be called to check if idle timeouts should still be checked. |
| public void | |
| public void | |
| protected abstract void | onIdleExpired(TimeoutException
a TimeoutException timeout)This abstract method is called when the idle timeout has expired. |
| public void | |
| private void | |
| public void | setIdleTimeout(long
the idle timeout in milliseconds idleTimeout)Sets the idle timeout in milliseconds. |
| _idleNanoTime | back to summary |
|---|---|
| private volatile long _idleNanoTime | |
| _idleTimeout | back to summary |
|---|---|
| private volatile long _idleTimeout | |
| _scheduler | back to summary |
|---|---|
| private final Scheduler _scheduler | |
| _timeout | back to summary |
|---|---|
| private final AtomicReference<Scheduler. | |
| LOG | back to summary |
|---|---|
| private static final Logger LOG | |
| IdleTimeout | back to summary |
|---|---|
public IdleTimeout(Scheduler scheduler)
| |
| activate | back to summary |
|---|---|
| private void activate() | |
| checkIdleTimeout | back to summary |
|---|---|
| protected long checkIdleTimeout() | |
| deactivate | back to summary |
|---|---|
| private void deactivate() | |
| getIdleFor | back to summary |
|---|---|
| public long getIdleFor() Get the period of time, in milliseconds, that this object was idle.
| |
| getIdleTimeout | back to summary |
|---|---|
public long getIdleTimeout()
| |
| getScheduler | back to summary |
|---|---|
| public Scheduler getScheduler() | |
| idleCheck | back to summary |
|---|---|
| private void idleCheck() | |
| isOpen | back to summary |
|---|---|
| public abstract boolean isOpen() This abstract method should be called to check if idle timeouts should still be checked.
| |
| notIdle | back to summary |
|---|---|
| public void notIdle() This method should be called when non-idle activity has taken place. | |
| onClose | back to summary |
|---|---|
| public void onClose() | |
| onIdleExpired | back to summary |
|---|---|
| protected abstract void onIdleExpired(TimeoutException timeout) This abstract method is called when the idle timeout has expired.
| |
| onOpen | back to summary |
|---|---|
| public void onOpen() | |
| scheduleIdleTimeout | back to summary |
|---|---|
| private void scheduleIdleTimeout(long delay) | |
| setIdleTimeout | back to summary |
|---|---|
| public void setIdleTimeout(long idleTimeout) Sets the idle timeout in milliseconds. A value that is less than or zero disables the idle timeout checks.
| |