RequireThis rule and fixThis Gradle task
* `gradlew clean check -x test --parallel --continue` - to collect reports * `gradlew fixThis --parallel` - to fix all possible vulnerabilities. With `-Dfile.encoding=UTF-8` on Windows Since the `RequireThisCheck` doesn't see parents for anonymous classes (e.g. `Runnable` callback), its report doesn't contains the outer class name with `this.`, therefore we still have to fix those cases manually. Thanks to the wrong `replacer` just with `this.` we have uncompilable code enough easy to find problems. Not so easy to fix for good readability though... * Upgrade to Grade 2.12 * Upgrade to SonarQube native plugin The fix contains at about 300 files. So, will be done on merge. Fix `fixThis.gradle` according PR comments Apply `fixThis` and also `fixModifiers` for test classes. Fix some `this.` inner issues manually. Make code polishing for long lines after `fixThis` Fix conflicts and vulnerabilities after the rebase
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2002-2015 the original author or authors.
|
||||
* Copyright 2002-2016 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -65,7 +65,7 @@ public abstract class AbstractInternetProtocolReceivingChannelAdapter
|
||||
* @return The port on which this receiver is listening.
|
||||
*/
|
||||
public int getPort() {
|
||||
return port;
|
||||
return this.port;
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -77,7 +77,7 @@ public abstract class AbstractInternetProtocolReceivingChannelAdapter
|
||||
* @return the soTimeout
|
||||
*/
|
||||
public int getSoTimeout() {
|
||||
return soTimeout;
|
||||
return this.soTimeout;
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -89,7 +89,7 @@ public abstract class AbstractInternetProtocolReceivingChannelAdapter
|
||||
* @return the soReceiveBufferSize
|
||||
*/
|
||||
public int getSoReceiveBufferSize() {
|
||||
return soReceiveBufferSize;
|
||||
return this.soReceiveBufferSize;
|
||||
}
|
||||
|
||||
public void setReceiveBufferSize(int receiveBufferSize) {
|
||||
@@ -100,7 +100,7 @@ public abstract class AbstractInternetProtocolReceivingChannelAdapter
|
||||
* @return the receiveBufferSize
|
||||
*/
|
||||
public int getReceiveBufferSize() {
|
||||
return receiveBufferSize;
|
||||
return this.receiveBufferSize;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -146,7 +146,7 @@ public abstract class AbstractInternetProtocolReceivingChannelAdapter
|
||||
}
|
||||
|
||||
public boolean isListening() {
|
||||
return listening;
|
||||
return this.listening;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -157,7 +157,7 @@ public abstract class AbstractInternetProtocolReceivingChannelAdapter
|
||||
}
|
||||
|
||||
public String getLocalAddress() {
|
||||
return localAddress;
|
||||
return this.localAddress;
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -179,14 +179,14 @@ public abstract class AbstractInternetProtocolReceivingChannelAdapter
|
||||
* @return the taskExecutor
|
||||
*/
|
||||
public Executor getTaskExecutor() {
|
||||
return taskExecutor;
|
||||
return this.taskExecutor;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the active
|
||||
*/
|
||||
public boolean isActive() {
|
||||
return active;
|
||||
return this.active;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2002-2014 the original author or authors.
|
||||
* Copyright 2002-2016 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -87,7 +87,7 @@ public abstract class AbstractInternetProtocolSendingMessageHandler extends Abst
|
||||
* @return the host
|
||||
*/
|
||||
public String getHost() {
|
||||
return host;
|
||||
return this.host;
|
||||
}
|
||||
|
||||
|
||||
@@ -95,7 +95,7 @@ public abstract class AbstractInternetProtocolSendingMessageHandler extends Abst
|
||||
* @return the port
|
||||
*/
|
||||
public int getPort() {
|
||||
return port;
|
||||
return this.port;
|
||||
}
|
||||
|
||||
|
||||
@@ -103,7 +103,7 @@ public abstract class AbstractInternetProtocolSendingMessageHandler extends Abst
|
||||
* @return the destinationAddress
|
||||
*/
|
||||
public SocketAddress getDestinationAddress() {
|
||||
return destinationAddress;
|
||||
return this.destinationAddress;
|
||||
}
|
||||
|
||||
|
||||
@@ -111,7 +111,7 @@ public abstract class AbstractInternetProtocolSendingMessageHandler extends Abst
|
||||
* @return the soTimeout
|
||||
*/
|
||||
public int getSoTimeout() {
|
||||
return soTimeout;
|
||||
return this.soTimeout;
|
||||
}
|
||||
|
||||
|
||||
@@ -119,7 +119,7 @@ public abstract class AbstractInternetProtocolSendingMessageHandler extends Abst
|
||||
* @return the soSendBufferSize
|
||||
*/
|
||||
public int getSoSendBufferSize() {
|
||||
return soSendBufferSize;
|
||||
return this.soSendBufferSize;
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2002-2014 the original author or authors.
|
||||
* Copyright 2002-2016 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -135,7 +135,7 @@ public class TcpConnectionFactoryFactoryBean extends AbstractFactoryBean<Abstrac
|
||||
@Override
|
||||
protected AbstractConnectionFactory createInstance() throws Exception {
|
||||
if (!this.mapperSet) {
|
||||
mapper.setBeanFactory(this.beanFactory);
|
||||
this.mapper.setBeanFactory(this.beanFactory);
|
||||
}
|
||||
if (this.usingNio) {
|
||||
if ("server".equals(this.type)) {
|
||||
|
||||
@@ -127,7 +127,7 @@ public class TcpInboundGateway extends MessagingGatewaySupport implements
|
||||
String connectionId = (String) message.getHeaders().get(IpHeaders.CONNECTION_ID);
|
||||
TcpConnection connection = null;
|
||||
if (connectionId != null) {
|
||||
connection = connections.get(connectionId);
|
||||
connection = this.connections.get(connectionId);
|
||||
}
|
||||
if (connection == null) {
|
||||
publishNoConnectionEvent(message, connectionId);
|
||||
@@ -185,12 +185,12 @@ public class TcpInboundGateway extends MessagingGatewaySupport implements
|
||||
|
||||
@Override
|
||||
public void addNewConnection(TcpConnection connection) {
|
||||
connections.put(connection.getConnectionId(), connection);
|
||||
this.connections.put(connection.getConnectionId(), connection);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void removeDeadConnection(TcpConnection connection) {
|
||||
connections.remove(connection.getConnectionId());
|
||||
this.connections.remove(connection.getConnectionId());
|
||||
}
|
||||
@Override
|
||||
public String getComponentType(){
|
||||
@@ -253,7 +253,7 @@ public class TcpInboundGateway extends MessagingGatewaySupport implements
|
||||
*/
|
||||
@Override
|
||||
public boolean isClientMode() {
|
||||
return isClientMode;
|
||||
return this.isClientMode;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -268,7 +268,7 @@ public class TcpInboundGateway extends MessagingGatewaySupport implements
|
||||
* @return the retryInterval
|
||||
*/
|
||||
public long getRetryInterval() {
|
||||
return retryInterval;
|
||||
return this.retryInterval;
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2001-2015 the original author or authors.
|
||||
* Copyright 2001-2016 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -111,7 +111,7 @@ public class TcpOutboundGateway extends AbstractReplyProducingMessageHandler
|
||||
|
||||
@Override
|
||||
protected Object handleRequestMessage(Message<?> requestMessage) {
|
||||
Assert.notNull(connectionFactory, this.getClass().getName() +
|
||||
Assert.notNull(this.connectionFactory, this.getClass().getName() +
|
||||
" requires a client connection factory");
|
||||
boolean haveSemaphore = false;
|
||||
TcpConnection connection = null;
|
||||
@@ -131,7 +131,7 @@ public class TcpOutboundGateway extends AbstractReplyProducingMessageHandler
|
||||
AsyncReply reply = new AsyncReply(this.remoteTimeoutExpression.getValue(this.evaluationContext,
|
||||
requestMessage, Long.class));
|
||||
connectionId = connection.getConnectionId();
|
||||
pendingReplies.put(connectionId, reply);
|
||||
this.pendingReplies.put(connectionId, reply);
|
||||
if (logger.isDebugEnabled()) {
|
||||
logger.debug("Added pending reply " + connectionId);
|
||||
}
|
||||
@@ -159,7 +159,7 @@ public class TcpOutboundGateway extends AbstractReplyProducingMessageHandler
|
||||
}
|
||||
finally {
|
||||
if (connectionId != null) {
|
||||
pendingReplies.remove(connectionId);
|
||||
this.pendingReplies.remove(connectionId);
|
||||
if (logger.isDebugEnabled()) {
|
||||
logger.debug("Removed pending reply " + connectionId);
|
||||
}
|
||||
@@ -187,7 +187,7 @@ public class TcpOutboundGateway extends AbstractReplyProducingMessageHandler
|
||||
if (logger.isTraceEnabled()) {
|
||||
logger.trace("onMessage: " + connectionId + "(" + message + ")");
|
||||
}
|
||||
AsyncReply reply = pendingReplies.get(connectionId);
|
||||
AsyncReply reply = this.pendingReplies.get(connectionId);
|
||||
if (reply == null) {
|
||||
if (message instanceof ErrorMessage) {
|
||||
/*
|
||||
@@ -265,7 +265,7 @@ public class TcpOutboundGateway extends AbstractReplyProducingMessageHandler
|
||||
* @return the connectionFactory
|
||||
*/
|
||||
protected AbstractConnectionFactory getConnectionFactory() {
|
||||
return connectionFactory;
|
||||
return this.connectionFactory;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -305,7 +305,7 @@ public class TcpOutboundGateway extends AbstractReplyProducingMessageHandler
|
||||
Thread.currentThread().interrupt();
|
||||
}
|
||||
boolean waitForMessageAfterError = true;
|
||||
while (reply instanceof ErrorMessage) {
|
||||
while (this.reply instanceof ErrorMessage) {
|
||||
if (waitForMessageAfterError) {
|
||||
/*
|
||||
* Possible race condition with NIO; we might have received the close
|
||||
@@ -315,11 +315,11 @@ public class TcpOutboundGateway extends AbstractReplyProducingMessageHandler
|
||||
this.secondChanceLatch.await(2, TimeUnit.SECONDS);
|
||||
waitForMessageAfterError = false;
|
||||
}
|
||||
else if (reply.getPayload() instanceof MessagingException) {
|
||||
throw (MessagingException) reply.getPayload();
|
||||
else if (this.reply.getPayload() instanceof MessagingException) {
|
||||
throw (MessagingException) this.reply.getPayload();
|
||||
}
|
||||
else {
|
||||
throw new MessagingException("Exception while awaiting reply", (Throwable) reply.getPayload());
|
||||
throw new MessagingException("Exception while awaiting reply", (Throwable) this.reply.getPayload());
|
||||
}
|
||||
}
|
||||
return this.reply;
|
||||
|
||||
@@ -198,14 +198,14 @@ public class TcpReceivingChannelAdapter
|
||||
* @return the clientConnectionFactory
|
||||
*/
|
||||
protected ConnectionFactory getClientConnectionFactory() {
|
||||
return clientConnectionFactory;
|
||||
return this.clientConnectionFactory;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the serverConnectionFactory
|
||||
*/
|
||||
protected ConnectionFactory getServerConnectionFactory() {
|
||||
return serverConnectionFactory;
|
||||
return this.serverConnectionFactory;
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -96,7 +96,7 @@ public class TcpSendingMessageHandler extends AbstractMessageHandler implements
|
||||
Object connectionId = message.getHeaders().get(IpHeaders.CONNECTION_ID);
|
||||
TcpConnection connection = null;
|
||||
if (connectionId != null) {
|
||||
connection = connections.get(connectionId);
|
||||
connection = this.connections.get(connectionId);
|
||||
}
|
||||
if (connection != null) {
|
||||
try {
|
||||
@@ -213,12 +213,12 @@ public class TcpSendingMessageHandler extends AbstractMessageHandler implements
|
||||
|
||||
@Override
|
||||
public void addNewConnection(TcpConnection connection) {
|
||||
connections.put(connection.getConnectionId(), connection);
|
||||
this.connections.put(connection.getConnectionId(), connection);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void removeDeadConnection(TcpConnection connection) {
|
||||
connections.remove(connection.getConnectionId());
|
||||
this.connections.remove(connection.getConnectionId());
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -304,21 +304,21 @@ public class TcpSendingMessageHandler extends AbstractMessageHandler implements
|
||||
* @return the clientConnectionFactory
|
||||
*/
|
||||
protected ConnectionFactory getClientConnectionFactory() {
|
||||
return clientConnectionFactory;
|
||||
return this.clientConnectionFactory;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the serverConnectionFactory
|
||||
*/
|
||||
protected ConnectionFactory getServerConnectionFactory() {
|
||||
return serverConnectionFactory;
|
||||
return this.serverConnectionFactory;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the connections
|
||||
*/
|
||||
protected Map<String, TcpConnection> getConnections() {
|
||||
return connections;
|
||||
return this.connections;
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2002-2015 the original author or authors.
|
||||
* Copyright 2002-2016 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -168,7 +168,7 @@ public abstract class AbstractClientConnectionFactory extends AbstractConnection
|
||||
* @return the theConnection
|
||||
*/
|
||||
protected TcpConnectionSupport getTheConnection() {
|
||||
return theConnection;
|
||||
return this.theConnection;
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2002-2015 the original author or authors.
|
||||
* Copyright 2002-2016 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -148,7 +148,7 @@ public abstract class AbstractConnectionFactory extends IntegrationObjectSupport
|
||||
}
|
||||
|
||||
public ApplicationEventPublisher getApplicationEventPublisher() {
|
||||
return applicationEventPublisher;
|
||||
return this.applicationEventPublisher;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -181,7 +181,7 @@ public abstract class AbstractConnectionFactory extends IntegrationObjectSupport
|
||||
* @return the soTimeout
|
||||
*/
|
||||
public int getSoTimeout() {
|
||||
return soTimeout;
|
||||
return this.soTimeout;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -195,7 +195,7 @@ public abstract class AbstractConnectionFactory extends IntegrationObjectSupport
|
||||
* @return the soReceiveBufferSize
|
||||
*/
|
||||
public int getSoReceiveBufferSize() {
|
||||
return soReceiveBufferSize;
|
||||
return this.soReceiveBufferSize;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -209,7 +209,7 @@ public abstract class AbstractConnectionFactory extends IntegrationObjectSupport
|
||||
* @return the soSendBufferSize
|
||||
*/
|
||||
public int getSoSendBufferSize() {
|
||||
return soSendBufferSize;
|
||||
return this.soSendBufferSize;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -223,7 +223,7 @@ public abstract class AbstractConnectionFactory extends IntegrationObjectSupport
|
||||
* @return the soTcpNoDelay
|
||||
*/
|
||||
public boolean isSoTcpNoDelay() {
|
||||
return soTcpNoDelay;
|
||||
return this.soTcpNoDelay;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -237,7 +237,7 @@ public abstract class AbstractConnectionFactory extends IntegrationObjectSupport
|
||||
* @return the soLinger
|
||||
*/
|
||||
public int getSoLinger() {
|
||||
return soLinger;
|
||||
return this.soLinger;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -251,7 +251,7 @@ public abstract class AbstractConnectionFactory extends IntegrationObjectSupport
|
||||
* @return the soKeepAlive
|
||||
*/
|
||||
public boolean isSoKeepAlive() {
|
||||
return soKeepAlive;
|
||||
return this.soKeepAlive;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -265,7 +265,7 @@ public abstract class AbstractConnectionFactory extends IntegrationObjectSupport
|
||||
* @return the soTrafficClass
|
||||
*/
|
||||
public int getSoTrafficClass() {
|
||||
return soTrafficClass;
|
||||
return this.soTrafficClass;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -279,49 +279,49 @@ public abstract class AbstractConnectionFactory extends IntegrationObjectSupport
|
||||
* @return the host
|
||||
*/
|
||||
public String getHost() {
|
||||
return host;
|
||||
return this.host;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the port
|
||||
*/
|
||||
public int getPort() {
|
||||
return port;
|
||||
return this.port;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the listener
|
||||
*/
|
||||
public TcpListener getListener() {
|
||||
return listener;
|
||||
return this.listener;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the sender
|
||||
*/
|
||||
public TcpSender getSender() {
|
||||
return sender;
|
||||
return this.sender;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the serializer
|
||||
*/
|
||||
public Serializer<?> getSerializer() {
|
||||
return serializer;
|
||||
return this.serializer;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the deserializer
|
||||
*/
|
||||
public Deserializer<?> getDeserializer() {
|
||||
return deserializer;
|
||||
return this.deserializer;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the mapper
|
||||
*/
|
||||
public TcpMessageMapper getMapper() {
|
||||
return mapper;
|
||||
return this.mapper;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -384,7 +384,7 @@ public abstract class AbstractConnectionFactory extends IntegrationObjectSupport
|
||||
* @return the singleUse
|
||||
*/
|
||||
public boolean isSingleUse() {
|
||||
return singleUse;
|
||||
return this.singleUse;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -413,7 +413,7 @@ public abstract class AbstractConnectionFactory extends IntegrationObjectSupport
|
||||
* @return the lookupHost
|
||||
*/
|
||||
public boolean isLookupHost() {
|
||||
return lookupHost;
|
||||
return this.lookupHost;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -429,11 +429,11 @@ public abstract class AbstractConnectionFactory extends IntegrationObjectSupport
|
||||
}
|
||||
|
||||
protected BlockingQueue<PendingIO> getDelayedReads() {
|
||||
return delayedReads;
|
||||
return this.delayedReads;
|
||||
}
|
||||
|
||||
protected long getReadDelay() {
|
||||
return readDelay;
|
||||
return this.readDelay;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -574,7 +574,7 @@ public abstract class AbstractConnectionFactory extends IntegrationObjectSupport
|
||||
logger.debug("Removing closed channel");
|
||||
it.remove();
|
||||
}
|
||||
else if (soTimeout > 0) {
|
||||
else if (this.soTimeout > 0) {
|
||||
TcpNioConnection connection = connections.get(channel);
|
||||
if (now - connection.getLastRead() >= this.soTimeout) {
|
||||
/*
|
||||
@@ -606,7 +606,7 @@ public abstract class AbstractConnectionFactory extends IntegrationObjectSupport
|
||||
}
|
||||
this.harvestClosedConnections();
|
||||
if (logger.isTraceEnabled()) {
|
||||
if (host == null) {
|
||||
if (this.host == null) {
|
||||
logger.trace("Port " + this.port + " SelectionCount: " + selectionCount);
|
||||
} else {
|
||||
logger.trace("Host " + this.host + " port " + this.port + " SelectionCount: " + selectionCount);
|
||||
@@ -829,7 +829,7 @@ public abstract class AbstractConnectionFactory extends IntegrationObjectSupport
|
||||
* @return the active
|
||||
*/
|
||||
protected boolean isActive() {
|
||||
return active;
|
||||
return this.active;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -846,7 +846,7 @@ public abstract class AbstractConnectionFactory extends IntegrationObjectSupport
|
||||
}
|
||||
|
||||
protected TcpSocketSupport getTcpSocketSupport() {
|
||||
return tcpSocketSupport;
|
||||
return this.tcpSocketSupport;
|
||||
}
|
||||
|
||||
public void setTcpSocketSupport(TcpSocketSupport tcpSocketSupport) {
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2001-2015 the original author or authors.
|
||||
* Copyright 2001-2016 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -104,11 +104,11 @@ public abstract class AbstractServerConnectionFactory extends AbstractConnection
|
||||
* @return true if the server is listening on the port.
|
||||
*/
|
||||
public boolean isListening() {
|
||||
return listening;
|
||||
return this.listening;
|
||||
}
|
||||
|
||||
protected boolean isShuttingDown() {
|
||||
return shuttingDown;
|
||||
return this.shuttingDown;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -153,7 +153,7 @@ public abstract class AbstractServerConnectionFactory extends AbstractConnection
|
||||
* @return the localAddress
|
||||
*/
|
||||
public String getLocalAddress() {
|
||||
return localAddress;
|
||||
return this.localAddress;
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -63,7 +63,7 @@ public class CachingClientConnectionFactory extends AbstractClientConnectionFact
|
||||
@Override
|
||||
public TcpConnectionSupport createForPool() {
|
||||
try {
|
||||
return targetConnectionFactory.getConnection();
|
||||
return CachingClientConnectionFactory.this.targetConnectionFactory.getConnection();
|
||||
}
|
||||
catch (Exception e) {
|
||||
throw new MessagingException("Failed to obtain connection", e);
|
||||
@@ -163,7 +163,7 @@ public class CachingClientConnectionFactory extends AbstractClientConnectionFact
|
||||
}
|
||||
super.close();
|
||||
}
|
||||
pool.releaseItem(getTheConnection());
|
||||
CachingClientConnectionFactory.this.pool.releaseItem(getTheConnection());
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -53,18 +53,18 @@ public class ClientModeConnectionManager implements Runnable {
|
||||
synchronized (this.clientConnectionFactory) {
|
||||
try {
|
||||
TcpConnection connection = this.clientConnectionFactory.getConnection();
|
||||
if (connection != lastConnection) {
|
||||
if (logger.isDebugEnabled()) {
|
||||
logger.debug("Connection " + connection.getConnectionId() + " established");
|
||||
if (connection != this.lastConnection) {
|
||||
if (this.logger.isDebugEnabled()) {
|
||||
this.logger.debug("Connection " + connection.getConnectionId() + " established");
|
||||
}
|
||||
lastConnection = connection;
|
||||
this.lastConnection = connection;
|
||||
} else {
|
||||
if (logger.isTraceEnabled()) {
|
||||
logger.trace("Connection " + connection.getConnectionId() + " still OK");
|
||||
if (this.logger.isTraceEnabled()) {
|
||||
this.logger.trace("Connection " + connection.getConnectionId() + " still OK");
|
||||
}
|
||||
}
|
||||
} catch (Exception e) {
|
||||
logger.error("Could not establish connection using " + this.clientConnectionFactory, e);
|
||||
this.logger.error("Could not establish connection using " + this.clientConnectionFactory, e);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -73,16 +73,16 @@ public class DefaultTcpSSLContextSupport implements TcpSSLContextSupport {
|
||||
KeyStore ks = KeyStore.getInstance("JKS");
|
||||
KeyStore ts = KeyStore.getInstance("JKS");
|
||||
|
||||
ks.load(keyStore.getInputStream(), keyStorePassword);
|
||||
ts.load(trustStore.getInputStream(), trustStorePassword);
|
||||
ks.load(this.keyStore.getInputStream(), this.keyStorePassword);
|
||||
ts.load(this.trustStore.getInputStream(), this.trustStorePassword);
|
||||
|
||||
KeyManagerFactory kmf = KeyManagerFactory.getInstance("SunX509");
|
||||
kmf.init(ks, keyStorePassword);
|
||||
kmf.init(ks, this.keyStorePassword);
|
||||
|
||||
TrustManagerFactory tmf = TrustManagerFactory.getInstance("SunX509");
|
||||
tmf.init(ts);
|
||||
|
||||
SSLContext sslContext = SSLContext.getInstance(protocol);
|
||||
SSLContext sslContext = SSLContext.getInstance(this.protocol);
|
||||
|
||||
sslContext.init(kmf.getKeyManagers(), tmf.getTrustManagers(), null);
|
||||
|
||||
|
||||
@@ -51,7 +51,7 @@ public class FailoverClientConnectionFactory extends AbstractClientConnectionFac
|
||||
@Override
|
||||
protected void onInit() throws Exception {
|
||||
super.onInit();
|
||||
for (AbstractClientConnectionFactory factory : factories) {
|
||||
for (AbstractClientConnectionFactory factory : this.factories) {
|
||||
Assert.state(!(this.isSingleUse() ^ factory.isSingleUse()),
|
||||
"Inconsistent singleUse - delegate factories must match this one");
|
||||
factory.enableManualListenerRegistration();
|
||||
@@ -304,7 +304,7 @@ public class FailoverClientConnectionFactory extends AbstractClientConnectionFac
|
||||
|
||||
@Override
|
||||
public String getConnectionId() {
|
||||
return this.connectionId + ":" + epoch;
|
||||
return this.connectionId + ":" + this.epoch;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -41,7 +41,7 @@ public class TcpConnectionFailedCorrelationEvent extends IpIntegrationEvent {
|
||||
}
|
||||
|
||||
public String getConnectionId() {
|
||||
return connectionId;
|
||||
return this.connectionId;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -28,7 +28,7 @@ public class TcpConnectionInterceptorFactoryChain {
|
||||
private TcpConnectionInterceptorFactory[] interceptorFactories;
|
||||
|
||||
public TcpConnectionInterceptorFactory[] getInterceptorFactories() {
|
||||
return interceptorFactories;//NOSONAR
|
||||
return this.interceptorFactories;//NOSONAR
|
||||
}
|
||||
|
||||
public void setInterceptors(TcpConnectionInterceptorFactory[] interceptorFactories) {
|
||||
|
||||
@@ -185,7 +185,7 @@ public abstract class TcpConnectionInterceptorSupport extends TcpConnectionSuppo
|
||||
*/
|
||||
@Override
|
||||
public TcpListener getListener() {
|
||||
return tcpListener;
|
||||
return this.tcpListener;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2015 the original author or authors.
|
||||
* Copyright 2015-2016 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -40,7 +40,7 @@ public class TcpConnectionServerListeningEvent extends IpIntegrationEvent {
|
||||
}
|
||||
|
||||
public int getPort() {
|
||||
return port;
|
||||
return this.port;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -134,8 +134,8 @@ public abstract class TcpConnectionSupport implements TcpConnection {
|
||||
if (connectionFactoryName != null) {
|
||||
this.connectionFactoryName = connectionFactoryName;
|
||||
}
|
||||
if (logger.isDebugEnabled()) {
|
||||
logger.debug("New connection " + this.getConnectionId());
|
||||
if (this.logger.isDebugEnabled()) {
|
||||
this.logger.debug("New connection " + this.getConnectionId());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -181,7 +181,7 @@ public abstract class TcpConnectionSupport implements TcpConnection {
|
||||
* @return the mapper
|
||||
*/
|
||||
public TcpMessageMapper getMapper() {
|
||||
return mapper;
|
||||
return this.mapper;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -277,8 +277,8 @@ public abstract class TcpConnectionSupport implements TcpConnection {
|
||||
@Override
|
||||
public TcpListener getListener() {
|
||||
if (this.manualListenerRegistration) {
|
||||
if (logger.isDebugEnabled()) {
|
||||
logger.debug(getConnectionId() + " Waiting for listener registration");
|
||||
if (this.logger.isDebugEnabled()) {
|
||||
this.logger.debug(getConnectionId() + " Waiting for listener registration");
|
||||
}
|
||||
waitForListenerRegistration();
|
||||
}
|
||||
@@ -287,8 +287,8 @@ public abstract class TcpConnectionSupport implements TcpConnection {
|
||||
|
||||
private void waitForListenerRegistration() {
|
||||
try {
|
||||
Assert.state(listenerRegisteredLatch.await(1, TimeUnit.MINUTES), "TcpListener not registered");
|
||||
manualListenerRegistration = false;
|
||||
Assert.state(this.listenerRegisteredLatch.await(1, TimeUnit.MINUTES), "TcpListener not registered");
|
||||
this.manualListenerRegistration = false;
|
||||
}
|
||||
catch (InterruptedException e) {
|
||||
Thread.currentThread().interrupt();
|
||||
@@ -300,12 +300,12 @@ public abstract class TcpConnectionSupport implements TcpConnection {
|
||||
* @return the sender
|
||||
*/
|
||||
public TcpSender getSender() {
|
||||
return sender;
|
||||
return this.sender;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isServer() {
|
||||
return server;
|
||||
return this.server;
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -337,7 +337,7 @@ public abstract class TcpConnectionSupport implements TcpConnection {
|
||||
}
|
||||
|
||||
protected boolean isNoReadErrorOnClose() {
|
||||
return noReadErrorOnClose;
|
||||
return this.noReadErrorOnClose;
|
||||
}
|
||||
|
||||
protected void setNoReadErrorOnClose(boolean noReadErrorOnClose) {
|
||||
@@ -384,21 +384,21 @@ public abstract class TcpConnectionSupport implements TcpConnection {
|
||||
private void doPublish(TcpConnectionEvent event) {
|
||||
try {
|
||||
if (this.applicationEventPublisher == null) {
|
||||
logger.warn("No publisher available to publish " + event);
|
||||
this.logger.warn("No publisher available to publish " + event);
|
||||
}
|
||||
else {
|
||||
this.applicationEventPublisher.publishEvent(event);
|
||||
if (logger.isTraceEnabled()) {
|
||||
logger.trace("Published: " + event);
|
||||
if (this.logger.isTraceEnabled()) {
|
||||
this.logger.trace("Published: " + event);
|
||||
}
|
||||
}
|
||||
}
|
||||
catch (Exception e) {
|
||||
if (logger.isDebugEnabled()) {
|
||||
logger.debug("Failed to publish " + event, e);
|
||||
if (this.logger.isDebugEnabled()) {
|
||||
this.logger.debug("Failed to publish " + event, e);
|
||||
}
|
||||
else if (logger.isWarnEnabled()) {
|
||||
logger.warn("Failed to publish " + event + ":" + e.getMessage());
|
||||
else if (this.logger.isWarnEnabled()) {
|
||||
this.logger.warn("Failed to publish " + event + ":" + e.getMessage());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -119,8 +119,8 @@ public class TcpMessageMapper implements
|
||||
message = messageBuilder.build();
|
||||
}
|
||||
else {
|
||||
if (logger.isWarnEnabled()) {
|
||||
logger.warn("Null payload from connection " + connection.getConnectionId());
|
||||
if (this.logger.isWarnEnabled()) {
|
||||
this.logger.warn("Null payload from connection " + connection.getConnectionId());
|
||||
}
|
||||
}
|
||||
return message;
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2002-2014 the original author or authors.
|
||||
* Copyright 2002-2016 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -77,7 +77,7 @@ public class TcpNetClientConnectionFactory extends
|
||||
}
|
||||
|
||||
protected TcpSocketFactorySupport getTcpSocketFactorySupport() {
|
||||
return tcpSocketFactorySupport;
|
||||
return this.tcpSocketFactorySupport;
|
||||
}
|
||||
|
||||
public void setTcpSocketFactorySupport(
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2001-2015 the original author or authors.
|
||||
* Copyright 2001-2016 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -96,7 +96,7 @@ public class TcpNetConnection extends TcpConnectionSupport implements Scheduling
|
||||
public synchronized void send(Message<?> message) throws Exception {
|
||||
if (this.socketOutputStream == null) {
|
||||
int writeBufferSize = this.socket.getSendBufferSize();
|
||||
this.socketOutputStream = new BufferedOutputStream(socket.getOutputStream(),
|
||||
this.socketOutputStream = new BufferedOutputStream(this.socket.getOutputStream(),
|
||||
writeBufferSize > 0 ? writeBufferSize : 8192);
|
||||
}
|
||||
Object object = this.getMapper().fromMessage(message);
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2002-2015 the original author or authors.
|
||||
* Copyright 2002-2016 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -200,11 +200,11 @@ public class TcpNetServerConnectionFactory extends AbstractServerConnectionFacto
|
||||
* @return the serverSocket
|
||||
*/
|
||||
protected ServerSocket getServerSocket() {
|
||||
return serverSocket;
|
||||
return this.serverSocket;
|
||||
}
|
||||
|
||||
protected TcpSocketFactorySupport getTcpSocketFactorySupport() {
|
||||
return tcpSocketFactorySupport;
|
||||
return this.tcpSocketFactorySupport;
|
||||
}
|
||||
|
||||
public void setTcpSocketFactorySupport(TcpSocketFactorySupport tcpSocketFactorySupport) {
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2002-2015 the original author or authors.
|
||||
* Copyright 2002-2016 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -94,8 +94,8 @@ public class TcpNioClientConnectionFactory extends
|
||||
connection.setLastRead(System.currentTimeMillis());
|
||||
}
|
||||
this.channelMap.put(socketChannel, connection);
|
||||
newChannels.add(socketChannel);
|
||||
selector.wakeup();
|
||||
this.newChannels.add(socketChannel);
|
||||
this.selector.wakeup();
|
||||
return wrappedConnection;
|
||||
}
|
||||
|
||||
@@ -159,16 +159,16 @@ public class TcpNioClientConnectionFactory extends
|
||||
if (getDelayedReads().size() > 0 && (timeout == 0 || getReadDelay() < timeout)) {
|
||||
timeout = getReadDelay();
|
||||
}
|
||||
selectionCount = selector.select(timeout);
|
||||
selectionCount = this.selector.select(timeout);
|
||||
}
|
||||
catch (CancelledKeyException cke) {
|
||||
if (logger.isDebugEnabled()) {
|
||||
logger.debug("CancelledKeyException during Selector.select()");
|
||||
}
|
||||
}
|
||||
while ((newChannel = newChannels.poll()) != null) {
|
||||
while ((newChannel = this.newChannels.poll()) != null) {
|
||||
try {
|
||||
newChannel.register(this.selector, SelectionKey.OP_READ, channelMap.get(newChannel));
|
||||
newChannel.register(this.selector, SelectionKey.OP_READ, this.channelMap.get(newChannel));
|
||||
}
|
||||
catch (ClosedChannelException cce) {
|
||||
if (logger.isDebugEnabled()) {
|
||||
@@ -176,7 +176,7 @@ public class TcpNioClientConnectionFactory extends
|
||||
}
|
||||
}
|
||||
}
|
||||
this.processNioSelections(selectionCount, selector, null, this.channelMap);
|
||||
this.processNioSelections(selectionCount, this.selector, null, this.channelMap);
|
||||
}
|
||||
}
|
||||
catch (ClosedSelectorException cse) {
|
||||
@@ -197,21 +197,21 @@ public class TcpNioClientConnectionFactory extends
|
||||
* @return the usingDirectBuffers
|
||||
*/
|
||||
protected boolean isUsingDirectBuffers() {
|
||||
return usingDirectBuffers;
|
||||
return this.usingDirectBuffers;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the connections
|
||||
*/
|
||||
protected Map<SocketChannel, TcpNioConnection> getConnections() {
|
||||
return channelMap;
|
||||
return this.channelMap;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the newChannels
|
||||
*/
|
||||
protected BlockingQueue<SocketChannel> getNewChannels() {
|
||||
return newChannels;
|
||||
return this.newChannels;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2002-2015 the original author or authors.
|
||||
* Copyright 2002-2016 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -122,7 +122,7 @@ public class TcpNioConnection extends TcpConnectionSupport {
|
||||
|
||||
private void doClose() {
|
||||
try {
|
||||
channelInputStream.close();
|
||||
this.channelInputStream.close();
|
||||
}
|
||||
catch (IOException e) {}
|
||||
try {
|
||||
@@ -309,7 +309,7 @@ public class TcpNioConnection extends TcpConnectionSupport {
|
||||
logger.trace(getConnectionId() + " checking data avail: " + this.channelInputStream.available() +
|
||||
" pending: " + (this.writingToPipe));
|
||||
}
|
||||
return writingToPipe || this.channelInputStream.available() > 0;
|
||||
return this.writingToPipe || this.channelInputStream.available() > 0;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -387,7 +387,7 @@ public class TcpNioConnection extends TcpConnectionSupport {
|
||||
|
||||
private void doRead() throws Exception {
|
||||
if (this.rawBuffer == null) {
|
||||
this.rawBuffer = allocate(maxMessageSize);
|
||||
this.rawBuffer = allocate(this.maxMessageSize);
|
||||
}
|
||||
|
||||
this.writingLatch = new CountDownLatch(1);
|
||||
@@ -416,9 +416,9 @@ public class TcpNioConnection extends TcpConnectionSupport {
|
||||
logger.trace("After flip:" + this.rawBuffer.position() + "/" + this.rawBuffer.limit());
|
||||
}
|
||||
if (logger.isDebugEnabled()) {
|
||||
logger.debug("Read " + rawBuffer.limit() + " into raw buffer");
|
||||
logger.debug("Read " + this.rawBuffer.limit() + " into raw buffer");
|
||||
}
|
||||
this.sendToPipe(rawBuffer);
|
||||
this.sendToPipe(this.rawBuffer);
|
||||
}
|
||||
catch (RejectedExecutionException e) {
|
||||
throw e;
|
||||
@@ -526,11 +526,11 @@ public class TcpNioConnection extends TcpConnectionSupport {
|
||||
}
|
||||
|
||||
protected boolean isUsingDirectBuffers() {
|
||||
return usingDirectBuffers;
|
||||
return this.usingDirectBuffers;
|
||||
}
|
||||
|
||||
protected ChannelOutputStream getChannelOutputStream() {
|
||||
return channelOutputStream;
|
||||
return this.channelOutputStream;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -538,7 +538,7 @@ public class TcpNioConnection extends TcpConnectionSupport {
|
||||
* @return Time of last read.
|
||||
*/
|
||||
public long getLastRead() {
|
||||
return lastRead;
|
||||
return this.lastRead;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -553,7 +553,7 @@ public class TcpNioConnection extends TcpConnectionSupport {
|
||||
* @return the time of the last send
|
||||
*/
|
||||
public long getLastSend() {
|
||||
return lastSend;
|
||||
return this.lastSend;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -599,23 +599,23 @@ public class TcpNioConnection extends TcpConnectionSupport {
|
||||
if (logger.isDebugEnabled()) {
|
||||
logger.debug(getConnectionId() + " writing " + buffer.remaining());
|
||||
}
|
||||
socketChannel.write(buffer);
|
||||
TcpNioConnection.this.socketChannel.write(buffer);
|
||||
int remaining = buffer.remaining();
|
||||
if (remaining == 0) {
|
||||
return;
|
||||
}
|
||||
if (this.selector == null) {
|
||||
this.selector = Selector.open();
|
||||
this.soTimeout = socketChannel.socket().getSoTimeout();
|
||||
this.soTimeout = TcpNioConnection.this.socketChannel.socket().getSoTimeout();
|
||||
}
|
||||
socketChannel.register(selector, SelectionKey.OP_WRITE);
|
||||
TcpNioConnection.this.socketChannel.register(this.selector, SelectionKey.OP_WRITE);
|
||||
while (remaining > 0) {
|
||||
int selectionCount = this.selector.select(this.soTimeout);
|
||||
if (selectionCount == 0) {
|
||||
throw new SocketTimeoutException("Timeout on write");
|
||||
}
|
||||
selector.selectedKeys().clear();
|
||||
socketChannel.write(buffer);
|
||||
this.selector.selectedKeys().clear();
|
||||
TcpNioConnection.this.socketChannel.write(buffer);
|
||||
remaining = buffer.remaining();
|
||||
}
|
||||
}
|
||||
@@ -672,7 +672,7 @@ public class TcpNioConnection extends TcpConnectionSupport {
|
||||
|
||||
@Override
|
||||
public synchronized int read() throws IOException {
|
||||
if (this.isClosed && available.get() == 0) {
|
||||
if (this.isClosed && this.available.get() == 0) {
|
||||
if (TcpNioConnection.this.timedOut) {
|
||||
throw new SocketTimeoutException("Connection has timed out");
|
||||
}
|
||||
@@ -701,7 +701,7 @@ public class TcpNioConnection extends TcpConnectionSupport {
|
||||
byte[] buffer = null;
|
||||
while (buffer == null) {
|
||||
try {
|
||||
buffer = buffers.poll(1, TimeUnit.SECONDS);
|
||||
buffer = this.buffers.poll(1, TimeUnit.SECONDS);
|
||||
if (buffer == null && this.isClosed) {
|
||||
return null;
|
||||
}
|
||||
@@ -729,7 +729,7 @@ public class TcpNioConnection extends TcpConnectionSupport {
|
||||
TcpNioConnection.this.writingLatch.countDown();
|
||||
}
|
||||
try {
|
||||
if (!this.buffers.offer(buffer, pipeTimeout, TimeUnit.MILLISECONDS)) {
|
||||
if (!this.buffers.offer(buffer, TcpNioConnection.this.pipeTimeout, TimeUnit.MILLISECONDS)) {
|
||||
throw new IOException("Timed out waiting for buffer space");
|
||||
}
|
||||
}
|
||||
|
||||
@@ -93,7 +93,7 @@ public class TcpNioSSLConnection extends TcpNioConnection {
|
||||
protected void sendToPipe(final ByteBuffer networkBuffer) throws IOException {
|
||||
Assert.notNull(networkBuffer, "rawBuffer cannot be null");
|
||||
if (logger.isDebugEnabled()) {
|
||||
logger.debug("sendToPipe " + sslEngine.getHandshakeStatus() + ", remaining:" + networkBuffer.remaining());
|
||||
logger.debug("sendToPipe " + this.sslEngine.getHandshakeStatus() + ", remaining:" + networkBuffer.remaining());
|
||||
}
|
||||
SSLEngineResult result = null;
|
||||
while (!this.needMoreNetworkData) {
|
||||
@@ -215,7 +215,7 @@ public class TcpNioSSLConnection extends TcpNioConnection {
|
||||
runTasks();
|
||||
}
|
||||
}
|
||||
HandshakeStatus handshakeStatus = sslEngine.getHandshakeStatus();
|
||||
HandshakeStatus handshakeStatus = this.sslEngine.getHandshakeStatus();
|
||||
if (logger.isDebugEnabled()) {
|
||||
logger.debug("New handshake status " + handshakeStatus);
|
||||
}
|
||||
@@ -367,7 +367,7 @@ public class TcpNioSSLConnection extends TcpNioConnection {
|
||||
if (logger.isTraceEnabled()) {
|
||||
logger.trace("Writer waiting for handshake");
|
||||
}
|
||||
if (!semaphore.tryAcquire(30, TimeUnit.SECONDS)) {
|
||||
if (!TcpNioSSLConnection.this.semaphore.tryAcquire(30, TimeUnit.SECONDS)) {
|
||||
throw new MessagingException("SSL Handshaking taking too long");
|
||||
}
|
||||
if (logger.isTraceEnabled()) {
|
||||
@@ -392,7 +392,7 @@ public class TcpNioSSLConnection extends TcpNioConnection {
|
||||
logger.debug("After wrap:" + resultToString(result) + " Plaintext buffer @" + plainText.position() + "/" + plainText.limit());
|
||||
}
|
||||
if (result.getStatus() == SSLEngineResult.Status.BUFFER_OVERFLOW) {
|
||||
TcpNioSSLConnection.this.encoded = allocateEncryptionBuffer(sslEngine.getSession().getPacketBufferSize());
|
||||
TcpNioSSLConnection.this.encoded = allocateEncryptionBuffer(TcpNioSSLConnection.this.sslEngine.getSession().getPacketBufferSize());
|
||||
result = TcpNioSSLConnection.this.sslEngine.wrap(plainText, TcpNioSSLConnection.this.encoded);
|
||||
}
|
||||
return result;
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2002-2015 the original author or authors.
|
||||
* Copyright 2002-2016 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -284,21 +284,21 @@ public class TcpNioServerConnectionFactory extends AbstractServerConnectionFacto
|
||||
* @return the serverChannel
|
||||
*/
|
||||
protected ServerSocketChannel getServerChannel() {
|
||||
return serverChannel;
|
||||
return this.serverChannel;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the usingDirectBuffers
|
||||
*/
|
||||
protected boolean isUsingDirectBuffers() {
|
||||
return usingDirectBuffers;
|
||||
return this.usingDirectBuffers;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the connections
|
||||
*/
|
||||
protected Map<SocketChannel, TcpNioConnection> getConnections() {
|
||||
return channelMap;
|
||||
return this.channelMap;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2002-2014 the original author or authors.
|
||||
* Copyright 2002-2016 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -51,7 +51,7 @@ public abstract class AbstractByteArraySerializer implements
|
||||
* @return The max message size.
|
||||
*/
|
||||
public int getMaxMessageSize() {
|
||||
return maxMessageSize;
|
||||
return this.maxMessageSize;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -70,7 +70,7 @@ public abstract class AbstractByteArraySerializer implements
|
||||
|
||||
protected void checkClosure(int bite) throws IOException {
|
||||
if (bite < 0) {
|
||||
logger.debug("Socket closed during message assembly");
|
||||
this.logger.debug("Socket closed during message assembly");
|
||||
throw new IOException("Socket closed during message assembly");
|
||||
}
|
||||
}
|
||||
@@ -96,8 +96,8 @@ public abstract class AbstractByteArraySerializer implements
|
||||
if (this.applicationEventPublisher != null) {
|
||||
this.applicationEventPublisher.publishEvent(event);
|
||||
}
|
||||
else if (logger.isTraceEnabled()) {
|
||||
logger.trace("No event publisher for " + event);
|
||||
else if (this.logger.isTraceEnabled()) {
|
||||
this.logger.trace("No event publisher for " + event);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2002-2015 the original author or authors.
|
||||
* Copyright 2002-2016 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -99,8 +99,8 @@ public class ByteArrayLengthHeaderSerializer extends AbstractByteArraySerializer
|
||||
@Override
|
||||
public byte[] deserialize(InputStream inputStream) throws IOException {
|
||||
int messageLength = this.readHeader(inputStream);
|
||||
if (logger.isDebugEnabled()) {
|
||||
logger.debug("Message length is " + messageLength);
|
||||
if (this.logger.isDebugEnabled()) {
|
||||
this.logger.debug("Message length is " + messageLength);
|
||||
}
|
||||
byte[] messagePart = null;
|
||||
try {
|
||||
@@ -160,8 +160,8 @@ public class ByteArrayLengthHeaderSerializer extends AbstractByteArraySerializer
|
||||
throw new IOException("Stream closed after " + lengthRead + " of " + needed);
|
||||
}
|
||||
lengthRead += len;
|
||||
if (logger.isDebugEnabled()) {
|
||||
logger.debug("Read " + len + " bytes, buffer is now at " +
|
||||
if (this.logger.isDebugEnabled()) {
|
||||
this.logger.debug("Read " + len + " bytes, buffer is now at " +
|
||||
lengthRead + " of " +
|
||||
needed);
|
||||
}
|
||||
@@ -184,7 +184,7 @@ public class ByteArrayLengthHeaderSerializer extends AbstractByteArraySerializer
|
||||
case HEADER_SIZE_UNSIGNED_BYTE:
|
||||
if (length > 0xff) {
|
||||
throw new IllegalArgumentException("Length header:"
|
||||
+ headerSize
|
||||
+ this.headerSize
|
||||
+ " too short to accommodate message length:" + length);
|
||||
}
|
||||
lengthPart.put((byte) length);
|
||||
@@ -192,13 +192,13 @@ public class ByteArrayLengthHeaderSerializer extends AbstractByteArraySerializer
|
||||
case HEADER_SIZE_UNSIGNED_SHORT:
|
||||
if (length > 0xffff) {
|
||||
throw new IllegalArgumentException("Length header:"
|
||||
+ headerSize
|
||||
+ this.headerSize
|
||||
+ " too short to accommodate message length:" + length);
|
||||
}
|
||||
lengthPart.putShort((short) length);
|
||||
break;
|
||||
default:
|
||||
throw new IllegalArgumentException("Bad header size:" + headerSize);
|
||||
throw new IllegalArgumentException("Bad header size:" + this.headerSize);
|
||||
}
|
||||
outputStream.write(lengthPart.array());
|
||||
}
|
||||
@@ -236,7 +236,7 @@ public class ByteArrayLengthHeaderSerializer extends AbstractByteArraySerializer
|
||||
messageLength = ByteBuffer.wrap(lengthPart).getShort() & 0xffff;
|
||||
break;
|
||||
default:
|
||||
throw new IllegalArgumentException("Bad header size:" + headerSize);
|
||||
throw new IllegalArgumentException("Bad header size:" + this.headerSize);
|
||||
}
|
||||
return messageLength;
|
||||
}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2002-2015 the original author or authors.
|
||||
* Copyright 2002-2016 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -57,12 +57,12 @@ public class ByteArraySingleTerminatorSerializer extends AbstractByteArraySerial
|
||||
throw new SoftEndOfStreamException("Stream closed between payloads");
|
||||
}
|
||||
checkClosure(bite);
|
||||
if (bite == terminator) {
|
||||
if (bite == this.terminator) {
|
||||
break;
|
||||
}
|
||||
buffer[n++] = (byte) bite;
|
||||
if (n >= this.maxMessageSize) {
|
||||
throw new IOException("Terminator '0x" + Integer.toHexString(terminator & 0xff)
|
||||
throw new IOException("Terminator '0x" + Integer.toHexString(this.terminator & 0xff)
|
||||
+ "' not found before max message length: "
|
||||
+ this.maxMessageSize);
|
||||
}
|
||||
@@ -90,7 +90,7 @@ public class ByteArraySingleTerminatorSerializer extends AbstractByteArraySerial
|
||||
@Override
|
||||
public void serialize(byte[] bytes, OutputStream outputStream) throws IOException {
|
||||
outputStream.write(bytes);
|
||||
outputStream.write(terminator);
|
||||
outputStream.write(this.terminator);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -43,11 +43,11 @@ public class TcpDeserializationExceptionEvent extends IpIntegrationEvent {
|
||||
}
|
||||
|
||||
public byte[] getBuffer() {
|
||||
return buffer;//NOSONAR - direct access
|
||||
return this.buffer;//NOSONAR - direct access
|
||||
}
|
||||
|
||||
public int getOffset() {
|
||||
return offset;
|
||||
return this.offset;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -114,7 +114,7 @@ public class MulticastSendingMessageHandler extends UnicastSendingMessageHandler
|
||||
MulticastSocket socket;
|
||||
if (this.isAcknowledge()) {
|
||||
int ackPort = this.getAckPort();
|
||||
if (localAddress == null) {
|
||||
if (this.localAddress == null) {
|
||||
socket = ackPort == 0 ? new MulticastSocket() : new MulticastSocket(ackPort);
|
||||
}
|
||||
else {
|
||||
|
||||
@@ -183,7 +183,7 @@ public class UnicastReceivingChannelAdapter extends AbstractInternetProtocolRece
|
||||
protected void doSend(final DatagramPacket packet) {
|
||||
Message<byte[]> message = null;
|
||||
try {
|
||||
message = mapper.toMessage(packet);
|
||||
message = this.mapper.toMessage(packet);
|
||||
if (logger.isDebugEnabled()) {
|
||||
logger.debug("Received:" + message);
|
||||
}
|
||||
|
||||
@@ -261,7 +261,7 @@ public class UnicastSendingMessageHandler extends
|
||||
try {
|
||||
boolean waitForAck = this.waitForAck;
|
||||
if (waitForAck) {
|
||||
countdownLatch = new CountDownLatch(ackCounter);
|
||||
countdownLatch = new CountDownLatch(this.ackCounter);
|
||||
this.ackControl.put(messageId, countdownLatch);
|
||||
}
|
||||
convertAndSend(message);
|
||||
@@ -282,10 +282,10 @@ public class UnicastSendingMessageHandler extends
|
||||
}
|
||||
catch (Exception e) {
|
||||
try{
|
||||
socket.close();
|
||||
this.socket.close();
|
||||
}
|
||||
catch (Exception e1) { }
|
||||
socket = null;
|
||||
this.socket = null;
|
||||
throw new MessageHandlingException(message, "failed to send UDP packet", e);
|
||||
}
|
||||
finally {
|
||||
@@ -305,10 +305,10 @@ public class UnicastSendingMessageHandler extends
|
||||
catch (IOException e) {
|
||||
logger.error("Error creating socket", e);
|
||||
}
|
||||
ackLatch = new CountDownLatch(1);
|
||||
this.ackLatch = new CountDownLatch(1);
|
||||
this.taskExecutor.execute(this);
|
||||
try {
|
||||
ackLatch.await(10000, TimeUnit.MILLISECONDS);
|
||||
this.ackLatch.await(10000, TimeUnit.MILLISECONDS);
|
||||
}
|
||||
catch (InterruptedException e) {
|
||||
Thread.currentThread().interrupt();
|
||||
@@ -365,8 +365,8 @@ public class UnicastSendingMessageHandler extends
|
||||
|
||||
protected synchronized DatagramSocket getSocket() throws IOException {
|
||||
if (this.socket == null) {
|
||||
if (acknowledge) {
|
||||
if (localAddress == null) {
|
||||
if (this.acknowledge) {
|
||||
if (this.localAddress == null) {
|
||||
this.socket = this.ackPort == 0 ? new DatagramSocket() : new DatagramSocket(this.ackPort);
|
||||
}
|
||||
else {
|
||||
@@ -374,7 +374,7 @@ public class UnicastSendingMessageHandler extends
|
||||
this.socket = new DatagramSocket(new InetSocketAddress(whichNic, this.ackPort));
|
||||
}
|
||||
if (this.soReceiveBufferSize > 0) {
|
||||
socket.setReceiveBufferSize(this.soReceiveBufferSize);
|
||||
this.socket.setReceiveBufferSize(this.soReceiveBufferSize);
|
||||
}
|
||||
if (logger.isDebugEnabled()) {
|
||||
logger.debug("Listening for acks on port: " + getAckPort());
|
||||
@@ -445,7 +445,7 @@ public class UnicastSendingMessageHandler extends
|
||||
* @return the acknowledge
|
||||
*/
|
||||
public boolean isAcknowledge() {
|
||||
return acknowledge;
|
||||
return this.acknowledge;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -465,7 +465,7 @@ public class UnicastSendingMessageHandler extends
|
||||
* @return the soReceiveBufferSize
|
||||
*/
|
||||
public int getSoReceiveBufferSize() {
|
||||
return soReceiveBufferSize;
|
||||
return this.soReceiveBufferSize;
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -494,7 +494,7 @@ public class UnicastSendingMessageHandler extends
|
||||
public void run() {
|
||||
try {
|
||||
this.ackThreadRunning = true;
|
||||
ackLatch.countDown();
|
||||
this.ackLatch.countDown();
|
||||
DatagramPacket ackPack = new DatagramPacket(new byte[100], 100);
|
||||
while(true) {
|
||||
this.getSocket().receive(ackPack);
|
||||
@@ -527,9 +527,9 @@ public class UnicastSendingMessageHandler extends
|
||||
}
|
||||
|
||||
private void closeSocketIfNeeded() {
|
||||
if (socket != null) {
|
||||
socket.close();
|
||||
socket = null;
|
||||
if (this.socket != null) {
|
||||
this.socket.close();
|
||||
this.socket = null;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -261,7 +261,7 @@ public class ConnectionFactoryTests extends LogAdjustingTestSupport {
|
||||
@SuppressWarnings("serial")
|
||||
private class FooEvent extends TcpConnectionOpenEvent {
|
||||
|
||||
public FooEvent(TcpConnectionSupport connection, String connectionFactoryName) {
|
||||
FooEvent(TcpConnectionSupport connection, String connectionFactoryName) {
|
||||
super(connection, connectionFactoryName);
|
||||
}
|
||||
|
||||
|
||||
@@ -95,7 +95,7 @@ public class TcpConnectionEventListenerTests {
|
||||
@SuppressWarnings("serial")
|
||||
private class FooEvent extends TcpConnectionOpenEvent {
|
||||
|
||||
public FooEvent(TcpConnectionSupport connection, String connectionFactoryName) {
|
||||
FooEvent(TcpConnectionSupport connection, String connectionFactoryName) {
|
||||
super(connection, connectionFactoryName);
|
||||
}
|
||||
|
||||
@@ -104,7 +104,7 @@ public class TcpConnectionEventListenerTests {
|
||||
@SuppressWarnings("serial")
|
||||
private class BarEvent extends TcpConnectionOpenEvent {
|
||||
|
||||
public BarEvent(TcpConnectionSupport connection, String connectionFactoryName) {
|
||||
BarEvent(TcpConnectionSupport connection, String connectionFactoryName) {
|
||||
super(connection, connectionFactoryName);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user