directory-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Julien Vermillard (JIRA)" <j...@apache.org>
Subject [jira] Closed: (DIRMINA-13) SocketConnector connection timeout not respected
Date Fri, 29 Apr 2005 07:22:11 GMT
     [ http://issues.apache.org/jira/browse/DIRMINA-13?page=all ]
     
Julien Vermillard closed DIRMINA-13:
------------------------------------


> SocketConnector connection timeout not respected
> ------------------------------------------------
>
>          Key: DIRMINA-13
>          URL: http://issues.apache.org/jira/browse/DIRMINA-13
>      Project: Directory MINA
>         Type: Bug
>  Environment: In a client code using MINA SocketConnector.
> After a connection closed due to IDLEing ( I have unplugged the network cable of the
server), my client try to reconnect every 5 seconds to the server with this intruction :
> session = connector.connect(new InetSocketAddress( hostname, port), 5, protocolProvider);
> the connection try take more than 5 secondes for fail, something like 1 minute for throw
an IOException.
>     Reporter: Julien Vermillard
>     Assignee: Trustin Lee

>
> System : AMD64 Linux Debian, Sun JRE 1.5.0_01
> MINA from CVS (today checkout)
> code SNIPET
> 	private final class PollingThread extends Thread {
> 		private final ProtocolProvider protocolProvider;
> 		private final IoProtocolConnector connector;
> 		private final int TIMEOUT;
> 		private PollingThread(ProtocolProvider protocolProvider, IoProtocolConnector connector,
int TIMEOUT) {
> 			super();
> 			this.protocolProvider = protocolProvider;
> 			this.connector = connector;
> 			this.TIMEOUT = TIMEOUT;
> 		}
> 		public void run() {
> 			while (run) {
> 				if ((session == null || !session.isConnected()) && run) {
> 					// try to reconnect
> 					logger.info("Try reconnection");
> 					// session.close();
> 					try {
> 						session = connector.connect(new InetSocketAddress(
> 								hostname, port), TIMEOUT, protocolProvider);
> 						logger.info("Reconnection sucess");
> 					} catch (IOException e) {
> 						// it's not reconnecting
> 						logger.info("Reconnection failed");
> 						try {
> 							// sleep 5 seconds
> 							Thread.sleep(5000);
> 						} catch (InterruptedException e1) {
> 							logger.error("Sleep interrupted", e);
> 						}
> 					}
> 				}
> 				if(session!=null)
> 					session.write(new ModbusMessage(0, 0, 1, 1, new byte[] { 0,
> 							0, 0, (byte) getInputsCount() }));
> 				try {
> 					Thread.sleep(getPollingSpeed());
> 				} catch (InterruptedException e) {
> 					logger.error("Sleep interrupted", e);
> 				}
> 			}
> 		}
> 	}

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
   http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see:
   http://www.atlassian.com/software/jira


Mime
View raw message