Avoid unnecessary empty array creation
This commit is contained in:
parent
bb739be92d
commit
11acf2180f
|
@ -777,7 +777,7 @@ public class JMSServerControlImpl extends AbstractControl implements JMSServerCo
|
||||||
destinations.add(control.getAddress());
|
destinations.add(control.getAddress());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return destinations.toArray(new String[0]);
|
return destinations.toArray(new String[destinations.size()]);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
@ -143,7 +143,7 @@ public class OsgiBroker {
|
||||||
protocols.add(protoName);
|
protocols.add(protoName);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return protocols.toArray(new String[]{});
|
return protocols.toArray(new String[protocols.size()]);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Deactivate
|
@Deactivate
|
||||||
|
|
|
@ -23,6 +23,8 @@ import org.apache.activemq.artemis.core.config.BridgeConfiguration;
|
||||||
import org.apache.activemq.artemis.core.persistence.StorageManager;
|
import org.apache.activemq.artemis.core.persistence.StorageManager;
|
||||||
import org.apache.activemq.artemis.core.server.cluster.Bridge;
|
import org.apache.activemq.artemis.core.server.cluster.Bridge;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
public class BridgeControlImpl extends AbstractControl implements BridgeControl {
|
public class BridgeControlImpl extends AbstractControl implements BridgeControl {
|
||||||
|
|
||||||
// Constants -----------------------------------------------------
|
// Constants -----------------------------------------------------
|
||||||
|
@ -51,7 +53,8 @@ public class BridgeControlImpl extends AbstractControl implements BridgeControl
|
||||||
public String[] getStaticConnectors() throws Exception {
|
public String[] getStaticConnectors() throws Exception {
|
||||||
clearIO();
|
clearIO();
|
||||||
try {
|
try {
|
||||||
return configuration.getStaticConnectors().toArray(new String[0]);
|
List<String> staticConnectors = configuration.getStaticConnectors();
|
||||||
|
return staticConnectors.toArray(new String[staticConnectors.size()]);
|
||||||
}
|
}
|
||||||
finally {
|
finally {
|
||||||
blockOnIO();
|
blockOnIO();
|
||||||
|
|
|
@ -125,11 +125,12 @@ public class ClusterConnectionControlImpl extends AbstractControl implements Clu
|
||||||
public String[] getStaticConnectors() {
|
public String[] getStaticConnectors() {
|
||||||
clearIO();
|
clearIO();
|
||||||
try {
|
try {
|
||||||
if (configuration.getStaticConnectors() == null) {
|
List<String> staticConnectors = configuration.getStaticConnectors();
|
||||||
|
if (staticConnectors == null) {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
return configuration.getStaticConnectors().toArray(new String[0]);
|
return staticConnectors.toArray(new String[staticConnectors.size()]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
finally {
|
finally {
|
||||||
|
|
|
@ -48,7 +48,7 @@ public class MBeanInfoHelper {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return operations.toArray(new MBeanOperationInfo[0]);
|
return operations.toArray(new MBeanOperationInfo[operations.size()]);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Package protected ---------------------------------------------
|
// Package protected ---------------------------------------------
|
||||||
|
|
|
@ -358,7 +358,7 @@ public class NettyAcceptor extends AbstractAcceptor {
|
||||||
set.add(s);
|
set.add(s);
|
||||||
}
|
}
|
||||||
warningPrinted.set(true);
|
warningPrinted.set(true);
|
||||||
engine.setEnabledProtocols(set.toArray(new String[0]));
|
engine.setEnabledProtocols(set.toArray(new String[set.size()]));
|
||||||
|
|
||||||
SslHandler handler = new SslHandler(engine);
|
SslHandler handler = new SslHandler(engine);
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue