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

MonitoringServerSocket

public class MonitoringServerSocket extends ServerSocket

Fields Summary
private static int
_numberOfOpenSockets
Constructors Summary
public MonitoringServerSocket(int port)

        super (port);
        _incrementNumberOfOpenSockets();
    
Methods Summary
private static void_incrementNumberOfOpenSockets()


        
        _numberOfOpenSockets++;
    
public java.net.Socketaccept()

        Socket returnValue = new MonitoringSocket();

        implAccept(returnValue);
        return returnValue;
    
private static voiddecrementNumberOfOpenSockets()

        _numberOfOpenSockets--;
    
public voidfinalize()

        decrementNumberOfOpenSockets();
    
private synchronized voidprintMonitoringServerSocketStatus()

        System.out.println("There are currently " + _numberOfOpenSockets + " open MonitoringServerSockets");
        try {
            System.out.println("\t getSoTimeout() returns " + getSoTimeout());
        } catch (IOException e) {
            System.out.println("\t getSoTimeout() is currently throwing an exception ");
        }
    
public voidsetSoTimeout(int timeout)

        super.setSoTimeout(timeout);
        printMonitoringServerSocketStatus();