RE: [Simpleweb-Support] How to get noticed when Simple Servergoesdown ...
Brought to you by:
niallg
|
From: Niall G. <nia...@an...> - 2004-05-11 11:08:27
|
Hi,
> Server.connection.connect(socketFactory.createServerSocket(sslPort));
>
> If I want to use interface Monitor (like you advice earlier for
> ServerSocket), how can I do that?
Mabye try and wrap the socketFactory.createServerSocket(sslPort) within
the ServerSocket implementation and delegate to the created SSLServerSocket
like this.
Server.connection.connect(new MonitoredServerSocket(monitor, socketFactory.createServerSocket(sslPort)));
public class MonitoredServerSocket extends ServerSocket {
private Monitor monitor;
private ServerSocket sock;
public MonitoredServerSocket(Monitor monitor, ServerSocket sock){
this.monitor = monitor;
this.sock = sock;
}
public boolean isClosed() {
return sock.isClosed();
}
public Socket accept() throws IOException {
try {
return sock.accept();
}catch(IOException e){
// as before ...
}
}
}
This should work....
Niall
|