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

View File

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

View File

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

View File

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

View File

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

View File

@ -288,7 +288,7 @@ public class SSLSupport {
return new URL(storePath); return new URL(storePath);
} catch (MalformedURLException e) { } catch (MalformedURLException e) {
File file = new File(storePath); File file = new File(storePath);
if (file.exists() == true && file.isFile()) { if (file.exists() && file.isFile()) {
return file.toURI().toURL(); return file.toURI().toURL();
} else { } else {
URL url = findResource(storePath); 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) { private AggregatedSoftReference createReference(final K key, final V value) {
AggregatedSoftReference ref = new AggregatedSoftReference(key, value); return new AggregatedSoftReference(key, value);
return ref;
} }
// Inner classes ------------------------------------------------- // Inner classes -------------------------------------------------

View File

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