FileDocCategorySizeDatePackage
MonitoringSocket.javaAPI DocExample1275Thu Nov 08 00:23:22 GMT 2001com.ora.rmibook.chapter18.sockets

MonitoringSocket

public class MonitoringSocket extends Socket

Fields Summary
private static int
_numberOfOpenSockets
Constructors Summary
public MonitoringSocket()

        incrementNumberOfOpenSockets();
        printMonitoringSocketStatus();
    
public MonitoringSocket(String host, int port)

        super (host, port);
        incrementNumberOfOpenSockets();
        printMonitoringSocketStatus();
    
Methods Summary
public voidclose()

        super.close();
        decrementNumberOfOpenSockets();
        printMonitoringSocketStatus();
    
private static synchronized voiddecrementNumberOfOpenSockets()

        _numberOfOpenSockets--;
    
private static synchronized voidincrementNumberOfOpenSockets()

 
         
        _numberOfOpenSockets++;
    
private static synchronized voidprintMonitoringSocketStatus()

        System.out.println("There are currently " + _numberOfOpenSockets + " open MonitoringSockets");
    
public synchronized voidsetSoTimeout(int timeout)

        System.out.println("Set timeout called");
        super.setSoTimeout(timeout);