You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@directory.apache.org by Emir Rodriguez <em...@yahoo.com.mx> on 2005/10/20 20:55:28 UTC

[mina] How i can make a redundant connection

Hi,

I am making an app with mina, and i need that when the
connection from the server is broken, the client could
try to reconnect to the server since some time defined
in a config file.

I try to do this, with the events that fire mina,
sessionClosed(), with something like this:

if (agent instanceof ClientAgent) {
int timeOut = agent.getTimeOut();
			agent.stop();

			if (timeOut >= 0) {
				if (timeOut == 0)
					timeOut = 60;
				while (!agent.isRunning()) {
					try {
						// Thread.sleep(timeOut*1000);
						agent.start();
						// } catch (InterruptedException e) {
						// Ignore
					} catch (DigiCOMMException e) {
						// Ignore
					}
				}
			} else
				commonProtocol.sessionClosed(session);
		} else
			commonProtocol.sessionClosed(session); 


	
	
		
___________________________________________________________ 
Do You Yahoo!? 
La mejor conexión a Internet y <b >2GB</b> extra a tu correo por $100 al mes. http://net.yahoo.com.mx