Skip to content

Commit

Permalink
NO-JIRA Inline some variables to simplify the code flow
Browse files Browse the repository at this point in the history
  • Loading branch information
orpiske authored and clebertsuconic committed Feb 20, 2019
1 parent d2bf020 commit 69582ef
Show file tree
Hide file tree
Showing 8 changed files with 12 additions and 24 deletions.
Expand Up @@ -1496,8 +1496,7 @@ public void sendProducerCreditsMessage(final int credits, final SimpleString add
@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);
}
}

Expand Down Expand Up @@ -2020,8 +2019,7 @@ private void checkClosed() throws ActiveMQException {

private ClientConsumerInternal getConsumer(final ConsumerContext consumerContext) {
synchronized (consumers) {
ClientConsumerInternal consumer = consumers.get(consumerContext);
return consumer;
return consumers.get(consumerContext);
}
}

Expand Down
Expand Up @@ -741,8 +741,7 @@ public int readInt() {
}

public int readInt(final int pos) {
int v = getInt(pos);
return v;
return getInt(pos);
}

@Override
Expand Down
Expand Up @@ -317,8 +317,7 @@ public synchronized void initialize() throws ActiveMQException {

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,
Expand Down Expand Up @@ -672,8 +671,7 @@ public ClientSessionFactory createSessionFactory(String nodeID) throws Exception
}
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;
Expand Down Expand Up @@ -1854,8 +1852,7 @@ public boolean isClosed() {
}

private Object writeReplace() throws ObjectStreamException {
ServerLocatorImpl clone = new ServerLocatorImpl(this);
return clone;
return new ServerLocatorImpl(this);
}

public boolean isReceivedTopology() {
Expand Down
Expand Up @@ -190,9 +190,7 @@ public String getName() {
}

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) {
Expand Down
Expand Up @@ -571,11 +571,9 @@ public void transferConnection(final CoreRemotingConnection newConnection) {

// And switch it

final CoreRemotingConnection rnewConnection = newConnection;
newConnection.putChannel(id, this);

rnewConnection.putChannel(id, this);

connection = rnewConnection;
connection = newConnection;

transferring = true;
}
Expand Down
Expand Up @@ -288,7 +288,7 @@ private static URL validateStoreURL(final String storePath) throws Exception {
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);
Expand Down
Expand Up @@ -316,8 +316,7 @@ private void processQueue() {
}

private AggregatedSoftReference createReference(final K key, final V value) {
AggregatedSoftReference ref = new AggregatedSoftReference(key, value);
return ref;
return new AggregatedSoftReference(key, value);
}

// Inner classes -------------------------------------------------
Expand Down
Expand Up @@ -43,8 +43,7 @@ public static Xid decodeXid(final ActiveMQBuffer in) {
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) {
Expand Down

0 comments on commit 69582ef

Please sign in to comment.