Interface SocketMonitor
-
- All Superinterfaces:
ResourceMonitor<java.lang.Long>
public interface SocketMonitor extends ResourceMonitor<java.lang.Long>
AResourceMonitor
for theResourceMonitoringService.RES_TYPE_SOCKET
resource type.SocketMonitor
instance are used to monitor and limit the number of in-use sockets perResourceContext
instance.SocketMonitor
instance handle all types of sockets (TCP, UDP, ...).A TCP socket is considered to be in-use when it is bound (
Socket.bind(java.net.SocketAddress)
) or when it is connected (Socket.connect(java.net.SocketAddress)
). It leaves the in-use state when the socket is closed (Socket.close()
). *A UDP socket is in-use when it is bound (
DatagramSocket.bind(java.net.SocketAddress)
) or connected (DatagramSocket.connect(java.net.SocketAddress)
). A UDP Socket leaves the in-use state when it is closed (DatagramSocket.close()
).- Version:
- 1.0
- Author:
- $Id: 8fec9cff490b0b56ac7afd8e8507a0b911e65758 $
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description long
getSocketUsage()
Returns the number of existing socket created by aResourceContext
.-
Methods inherited from interface org.osgi.service.resourcemonitoring.ResourceMonitor
delete, disable, enable, equals, getContext, getMonitoredPeriod, getResourceType, getSamplingPeriod, getUsage, hashCode, isDeleted, isEnabled
-
-
-
-
Method Detail
-
getSocketUsage
long getSocketUsage()
Returns the number of existing socket created by aResourceContext
.The
ResourceMonitor.getUsage()
method returns the same value, wrapped in a long.- Returns:
- the number of existing socket.
-
-