java.lang.Runnable
public class SocketTimeout<A extends Address>
extends java.util.TimerTask
SocketTimeout
is a TimerTask
that provides means to detect when a socket is not used for
predefined time and then close the socket and free its resources.Constructor | Description |
---|---|
SocketTimeout(ConnectionOrientedTransportMapping<A> transportMapping,
AbstractServerSocket<A> entry) |
Create a socket timeout handler for the provided
TransportMapping and server socket entry. |
Modifier and Type | Method | Description |
---|---|---|
boolean |
cancel() |
|
void |
run() |
Runs a timeout check and if the socket has timed out, it removes the socket from the associated
TransportMapping . |
public SocketTimeout(ConnectionOrientedTransportMapping<A> transportMapping, AbstractServerSocket<A> entry)
TransportMapping
and server socket entry.transportMapping
- a ConnectionOrientedTransportMapping
that acts as a server.entry
- a AbstractSocketEntry
representing a server socket for a client connection associated with the above
transport mapping.public void run()
TransportMapping
.run
in interface java.lang.Runnable
run
in class java.util.TimerTask
public boolean cancel()
cancel
in class java.util.TimerTask
Copyright © 2018 SNMP4J.org. All rights reserved.