0

I connect to external host successfully

 void createConnection() 
{
    logger.info("Connecting to " + host_ + ":" + port_);
    Socket sock_ = new Socket(host_, port_);
}

Connection is executed successfully, however I need to implement a reconnection mechanism, that is triggered when host is down/killed, and subsequently reconnect to A new host and port. Is there such mechanism in JDK? Something like trigger event or Observer?

Szanownego
  • 239
  • 1
  • 11

0 Answers0