This content has been marked as final.
Show 2 replies
-
1. Re: Problem getting correct IP for CallbackServer
ovidiu.feodorov Aug 29, 2006 11:55 AM (in response to coyotesqrl)Thanks.
I've opened this: http://jira.jboss.com/jira/browse/JBMESSAGING-536
Scheduled it for CR5. -
2. Re: Problem getting correct IP for CallbackServer
clebert.suconic Sep 5, 2006 12:32 PM (in response to coyotesqrl)I will fix this by getting the IP from serverLocator.
This way, we will get the same IP configured.protected Connector startCallbackServer(InvokerLocator serverLocator) throws Exception { if (log.isTraceEnabled()) { log.trace(this + " setting up connection to " + serverLocator); } final int MAX_RETRIES = 50; boolean completed = false; Connector server = null; String serializationType = null; int count = 0; String thisAddress = serverLocator.getHost(); boolean isSSL = serverLocator.getProtocol().equals("sslsocket"); Map params = serverLocator.getParameters(); if (params != null) { serializationType = (String)params.get("serializationtype"); } while (!completed && count < MAX_RETRIES) { try { int bindPort = PortUtil.findFreePort(thisAddress); String callbackServerURI; if (isSSL) { // See http://jira.jboss.com/jira/browse/JBREM-470 callbackServerURI = "sslsocket://" + thisAddress + ":" + bindPort + CALLBACK_SERVER_PARAMS + "&" + SSLSocketBuilder.REMOTING_SERVER_SOCKET_USE_CLIENT_MODE + "=true"; } else { callbackServerURI = serverLocator.getProtocol() + "://" + thisAddress + ":" + bindPort + CALLBACK_SERVER_PARAMS; } if (serializationType != null) { callbackServerURI += "&serializationType=" + serializationType; } InvokerLocator callbackServerLocator = new InvokerLocator(callbackServerURI); log.debug(this + " starting callback server " + callbackServerLocator.getLocatorURI()); server = new Connector(); server.setInvokerLocator(callbackServerLocator.getLocatorURI()); server.create(); server.addInvocationHandler(JMS_CALLBACK_SUBSYSTEM, new CallbackManager()); server.start(); if (log.isTraceEnabled()) { log.trace("callback server started"); } completed = true; } catch (Exception e) { log.warn("Failed to start connection. Will retry", e); // Intermittently we can fail to open a socket on the address since it's already in use // This is despite remoting having checked the port is free. This is probably because // of the small window between remoting checking the port is free and getting the // port number and actually opening the connection during which some one else can use // that port. Therefore we catch this and retry. count++; if (count == MAX_RETRIES) { final String msg = "Cannot start callbackserver after " + MAX_RETRIES + " retries"; log.error(msg, e); throw new MessagingJMSException(msg, e); } } } return server; }