[jboss-user] [JBoss Cache: Core Edition] - Re: TcpDelegatingCacheLoader

lovelyliatroim do-not-reply at jboss.com
Mon Jan 5 07:38:04 EST 2009


Just a comment on the TcpCacheServer as well.

I dont like this


  | Thread serverThread = new Thread("TcpCacheServer")
  |       {
  |          @Override
  |          public void run()
  |          {
  |             try
  |             {
  |                while (running)
  |                {
  |                   Socket client_sock = srv_sock.accept();
  |                   Connection conn = new Connection(client_sock, cache);
  |                   conns.add(conn);
  |                   conn.start();
  |                }
  |             }
  |             catch (SocketException se)
  |             {
  |                if (!running)
  |                {
  |                   // this is because of the stop() lifecycle method being called.
  |                   // ignore.
  |                   log.info("Shutting down TcpCacheServer");
  |                }
  |                else
  |                {
  |                   log.error("Caught exception! Shutting down server thread.", se);
  |                }
  |             }
  |             catch (IOException e)
  |             {
  |                log.error("Caught exception! Shutting down server thread.", e);
  |             }
  |          }
  |       };
  | 

The reason i dont like it, is that as soon as there is a problem or an exception thrown the TcpCacheServer listening thread shutsdown, so that means no other nodes are no longer able to connect and thus a restart of this node is needed in order to recover.

Any reason why this is this way?? Should be catching inside the loop and trying to recover, not just stop listening completely.

Cheers,
LL


View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4199528#4199528

Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4199528



More information about the jboss-user mailing list