Source:
<code>protected Object handleRequestMessage(Message<?> requestMessage) { Assert.notNull(this.connectionFactory, this.getClass().getName() + " requires a client connection factory"); boolean haveSemaphore = false; TcpConnection connection = null; String connectionId = null; try { if (!this.isSingleUse) { logger.debug("trying semaphore"); if (!this.semaphore.tryAcquire(this.requestTimeout, TimeUnit.MILLISECONDS)) { throw new MessageTimeoutException(requestMessage, "Timed out waiting for connection"); } haveSemaphore = true; if (logger.isDebugEnabled()) { logger.debug("got semaphore"); } } connection = this.connectionFactory.getConnection(); Long remoteTimeout = this.remoteTimeoutExpression.getValue(this.evaluationContext, requestMessage, Long.class); if (remoteTimeout == null) { remoteTimeout = DEFAULT_REMOTE_TIMEOUT; <START> if (logger.isWarnEnabled()) { <END> logger.warn("remoteTimeoutExpression evaluated to null; falling back to default"); } } AsyncReply reply = new AsyncReply(remoteTimeout); connectionId = connection.getConnectionId(); this.pendingReplies.put(connectionId, reply); if (logger.isDebugEnabled()) { logger.debug("Added pending reply " + connectionId); } connection.send(requestMessage); Message<?> replyMessage = reply.getReply(); if (replyMessage == null) { if (logger.isDebugEnabled()) { logger.debug("Remote Timeout on " + connectionId); } this.connectionFactory.forceClose(connection); throw new MessageTimeoutException(requestMessage, "Timed out waiting for response"); } if (logger.isDebugEnabled()) { logger.debug("Response " + replyMessage); } return replyMessage; } catch (Exception e) { logger.error("Tcp Gateway exception", e); if (e instanceof MessagingException) { throw (MessagingException) e; } throw new MessagingException("Failed to send or receive", e); } finally { if (connectionId != null) { this.pendingReplies.remove(connectionId); if (logger.isDebugEnabled()) { logger.debug("Removed pending reply " + connectionId); } if (this.isSingleUse) { connection.close(); } } if (haveSemaphore) { this.semaphore.release(); if (logger.isDebugEnabled()) { logger.debug("released semaphore"); } } } }</code><technical_language>reason wrap if log message is static</technical_language>

Target:
protected Object handleRequestMessage(Message<?> requestMessage) { Assert.notNull(this.connectionFactory, this.getClass().getName() + " requires a client connection factory"); boolean haveSemaphore = false; TcpConnection connection = null; String connectionId = null; try { if (!this.isSingleUse) { logger.debug("trying semaphore"); if (!this.semaphore.tryAcquire(this.requestTimeout, TimeUnit.MILLISECONDS)) { throw new MessageTimeoutException(requestMessage, "Timed out waiting for connection"); } haveSemaphore = true; if (logger.isDebugEnabled()) { logger.debug("got semaphore"); } } connection = this.connectionFactory.getConnection(); Long remoteTimeout = this.remoteTimeoutExpression.getValue(this.evaluationContext, requestMessage, Long.class); if (remoteTimeout == null) { remoteTimeout = DEFAULT_REMOTE_TIMEOUT; if (logger.isWarnEnabled()) { logger.warn("remoteTimeoutExpression evaluated to null; falling back to default for message " + requestMessage); } } AsyncReply reply = new AsyncReply(remoteTimeout); connectionId = connection.getConnectionId(); this.pendingReplies.put(connectionId, reply); if (logger.isDebugEnabled()) { logger.debug("Added pending reply " + connectionId); } connection.send(requestMessage); Message<?> replyMessage = reply.getReply(); if (replyMessage == null) { if (logger.isDebugEnabled()) { logger.debug("Remote Timeout on " + connectionId); } this.connectionFactory.forceClose(connection); throw new MessageTimeoutException(requestMessage, "Timed out waiting for response"); } if (logger.isDebugEnabled()) { logger.debug("Response " + replyMessage); } return replyMessage; } catch (Exception e) { logger.error("Tcp Gateway exception", e); if (e instanceof MessagingException) { throw (MessagingException) e; } throw new MessagingException("Failed to send or receive", e); } finally { if (connectionId != null) { this.pendingReplies.remove(connectionId); if (logger.isDebugEnabled()) { logger.debug("Removed pending reply " + connectionId); } if (this.isSingleUse) { connection.close(); } } if (haveSemaphore) { this.semaphore.release(); if (logger.isDebugEnabled()) { logger.debug("released semaphore"); } } } }