run()
{
while ( true ){
Socket socket = null;
ObjectInputStream ois = null;
try{
socket = server_socket.accept();
String address = socket.getInetAddress().getHostAddress();
if ( !( address.equals("localhost") || address.equals("127.0.0.1"))){
socket.close();
continue;
}
ois = new ObjectInputStream( socket.getInputStream());
ois.readInt(); // version
String header = (String)ois.readObject();
if ( !header.equals( getHeader())){
log.messageLogged(
LoggerChannel.LT_ERROR,
"SingleInstanceHandler: invalid header - " + header );
continue;
}
String[] args = (String[])ois.readObject();
handler.processArguments( args );
}catch( Throwable e ){
log.messageLogged( "SingleInstanceHandler: receive error", e );
}finally{
if ( ois != null ){
try{
ois.close();
}catch( Throwable e ){
}
}