NO-JIRA Inline some variables to simplify the code flow

This commit is contained in:
Otavio R. Piske 2019-02-20 21:09:45 +01:00 committed by Clebert Suconic
parent d2bf02082f
commit 69582ef642
8 changed files with 12 additions and 24 deletions

View File

@ -1496,8 +1496,7 @@ public final class ClientSessionImpl implements ClientSessionInternal, FailureLi
@Override
public ClientProducerCredits getCredits(final SimpleString address, final boolean anon) {
synchronized (producerCreditManager) {
ClientProducerCredits credits = producerCreditManager.getCredits(address, anon, sessionContext);
return credits;
return producerCreditManager.getCredits(address, anon, sessionContext);
}
}
@ -2020,8 +2019,7 @@ public final class ClientSessionImpl implements ClientSessionInternal, FailureLi
private ClientConsumerInternal getConsumer(final ConsumerContext consumerContext) {
synchronized (consumers) {
ClientConsumerInternal consumer = consumers.get(consumerContext);
return consumer;
return consumers.get(consumerContext);
}
}

View File

@ -741,8 +741,7 @@ public class LargeMessageControllerImpl implements LargeMessageController {
}
public int readInt(final int pos) {
int v = getInt(pos);
return v;
return getInt(pos);
}
@Override

View File

@ -317,8 +317,7 @@ public final class ServerLocatorImpl implements ServerLocatorInternal, Discovery
private static DiscoveryGroup createDiscoveryGroup(String nodeID,
DiscoveryGroupConfiguration config) throws Exception {
DiscoveryGroup group = new DiscoveryGroup(nodeID, config.getName(), config.getRefreshTimeout(), config.getBroadcastEndpointFactory(), null);
return group;
return new DiscoveryGroup(nodeID, config.getName(), config.getRefreshTimeout(), config.getBroadcastEndpointFactory(), null);
}
private ServerLocatorImpl(final Topology topology,
@ -672,8 +671,7 @@ public final class ServerLocatorImpl implements ServerLocatorInternal, Discovery
}
if (topologyMember.getLive() == null && topologyMember.getBackup() != null) {
// This shouldn't happen, however I wanted this to consider all possible cases
ClientSessionFactoryInternal factory = (ClientSessionFactoryInternal) createSessionFactory(topologyMember.getBackup());
return factory;
return (ClientSessionFactoryInternal) createSessionFactory(topologyMember.getBackup());
}
// it shouldn't happen
return null;
@ -1854,8 +1852,7 @@ public final class ServerLocatorImpl implements ServerLocatorInternal, Discovery
}
private Object writeReplace() throws ObjectStreamException {
ServerLocatorImpl clone = new ServerLocatorImpl(this);
return clone;
return new ServerLocatorImpl(this);
}
public boolean isReceivedTopology() {

View File

@ -190,9 +190,7 @@ public final class DiscoveryGroup implements ActiveMQComponent {
}
public synchronized List<DiscoveryEntry> getDiscoveryEntries() {
List<DiscoveryEntry> list = new ArrayList<>(connectors.values());
return list;
return new ArrayList<>(connectors.values());
}
public boolean waitForBroadcast(final long timeout) {

View File

@ -571,11 +571,9 @@ public final class ChannelImpl implements Channel {
// And switch it
final CoreRemotingConnection rnewConnection = newConnection;
newConnection.putChannel(id, this);
rnewConnection.putChannel(id, this);
connection = rnewConnection;
connection = newConnection;
transferring = true;
}

View File

@ -288,7 +288,7 @@ public class SSLSupport {
return new URL(storePath);
} catch (MalformedURLException e) {
File file = new File(storePath);
if (file.exists() == true && file.isFile()) {
if (file.exists() && file.isFile()) {
return file.toURI().toURL();
} else {
URL url = findResource(storePath);

View File

@ -316,8 +316,7 @@ public class SoftValueHashMap<K, V extends SoftValueHashMap.ValueCache> implemen
}
private AggregatedSoftReference createReference(final K key, final V value) {
AggregatedSoftReference ref = new AggregatedSoftReference(key, value);
return ref;
return new AggregatedSoftReference(key, value);
}
// Inner classes -------------------------------------------------

View File

@ -43,8 +43,7 @@ public class XidCodecSupport {
in.readBytes(bq);
byte[] gtxid = new byte[in.readInt()];
in.readBytes(gtxid);
Xid xid = new XidImpl(bq, formatID, gtxid);
return xid;
return new XidImpl(bq, formatID, gtxid);
}
public static int getXidEncodeLength(final Xid xid) {