0

Context: In a server-client setup (using ace-tao).

Problem Statement: The server might be down, while the client is up and attempting to make API calls. Now to make the client setup more robust, I want to make the client to be able to know about the server-down-state, and when server is up again, it can attempt the rebind and get the new ORB ready, for any further API calls.

Any suggestions?

Johnny Willemsen
  • 2,942
  • 1
  • 14
  • 16
parasrish
  • 3,864
  • 26
  • 32
  • Try to use a persistent object reference with the IORTable on the server side. That way the client only has to get the reference once and can just try to reconnect using that reference when the server is down. The newer TAO versions do have some automatic retry options. – Johnny Willemsen Nov 16 '15 at 15:00
  • do not want to alter server (persistence policy etc. related). – parasrish Nov 21 '15 at 15:52

1 Answers1

0

There is only one solution in case of TCP/IP. You must implement so-called heatbeat connection : simple echo connection and analyze the return code of read-write calls. There is no callback in TCP/IP for connection state : alive or dead.

Dmitry
  • 1,912
  • 2
  • 18
  • 29
  • 1
    You can call the implicitly available _validate_connection() as ping, that only pings the CORBA server functionality, not your business code. – Johnny Willemsen Nov 16 '15 at 15:42
  • i could get "true" value as return from the _validate_connection(), when remote server was up, but otherwise an exception, when the server is down. Is that an expected behaviour? As, I was expecting, "false" when server is down. Also, first exception that i get is "COM.failure.." and next attempt onwards I get "TRANSIENT error...". @Johnny comments please. – parasrish Nov 29 '15 at 11:27
  • @Dmitry, there is "heartbeat" implicit policy with tao. However, it is not recommended when system has lot of ORBs. However, I tried combination, wherein, I would poll (i.e. validate_connection) on a spawned thread and based on return value, and the exception raised, decide the server-up/down state, and hence attempt for "reconnect" – parasrish Nov 29 '15 at 11:31
  • Yes, when it fails there is an exception, that exception could tell you more about the reason it fails – Johnny Willemsen Nov 29 '15 at 14:44