Landon Fabbricino wrote:
1) When the application is running and the server I am connected to crashes, or
loses internet connection, I am not seeing any communication on my side that
the connection has been lost.
(I am just watching the log4j output.)
Would my handler be responsible to pick up this lost connection? If not, where would I identify a reconnect from.
Yes. Your handler should deal with lost connections somehow.
How you determine the connection is lost is another matter. In most
cases there be any event to tell you the other end of the connection is
no longer active. The best you can do, really, is to use the timeout
mechanism to detect that it hasn't been active in a long time, and close
the connection yourself. Whether you decide to reconnect or do something
else is outside the scope of MINA - you need to write your own code to
do that (ie. call establish a new session upon disconnection, or perhaps
some time after the disconnection).
2) Could someone help to better explain the following:
ConnectFuture cf connector.connect.....
cf.getSession().getCloseFuture().awaitUninterruptibly(); // What is this line
of code ?
It seems to wait until the connection established by the
connector.connect() call is closed. I'm not sure that code is correct,
however. I would expect getSession() to return null quite often if
called right after connect(), since the connection likely isn't
established that quickly.