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());
|
||||
}
|
||||
}
|
||||
return destinations.toArray(new String[0]);
|
||||
return destinations.toArray(new String[destinations.size()]);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -143,7 +143,7 @@ public class OsgiBroker {
|
|||
protocols.add(protoName);
|
||||
}
|
||||
}
|
||||
return protocols.toArray(new String[]{});
|
||||
return protocols.toArray(new String[protocols.size()]);
|
||||
}
|
||||
|
||||
@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.server.cluster.Bridge;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public class BridgeControlImpl extends AbstractControl implements BridgeControl {
|
||||
|
||||
// Constants -----------------------------------------------------
|
||||
|
@ -51,7 +53,8 @@ public class BridgeControlImpl extends AbstractControl implements BridgeControl
|
|||
public String[] getStaticConnectors() throws Exception {
|
||||
clearIO();
|
||||
try {
|
||||
return configuration.getStaticConnectors().toArray(new String[0]);
|
||||
List<String> staticConnectors = configuration.getStaticConnectors();
|
||||
return staticConnectors.toArray(new String[staticConnectors.size()]);
|
||||
}
|
||||
finally {
|
||||
blockOnIO();
|
||||
|
|
|
@ -125,11 +125,12 @@ public class ClusterConnectionControlImpl extends AbstractControl implements Clu
|
|||
public String[] getStaticConnectors() {
|
||||
clearIO();
|
||||
try {
|
||||
if (configuration.getStaticConnectors() == null) {
|
||||
List<String> staticConnectors = configuration.getStaticConnectors();
|
||||
if (staticConnectors == null) {
|
||||
return null;
|
||||
}
|
||||
else {
|
||||
return configuration.getStaticConnectors().toArray(new String[0]);
|
||||
return staticConnectors.toArray(new String[staticConnectors.size()]);
|
||||
}
|
||||
}
|
||||
finally {
|
||||
|
|
|
@ -48,7 +48,7 @@ public class MBeanInfoHelper {
|
|||
}
|
||||
}
|
||||
|
||||
return operations.toArray(new MBeanOperationInfo[0]);
|
||||
return operations.toArray(new MBeanOperationInfo[operations.size()]);
|
||||
}
|
||||
|
||||
// Package protected ---------------------------------------------
|
||||
|
|
|
@ -358,7 +358,7 @@ public class NettyAcceptor extends AbstractAcceptor {
|
|||
set.add(s);
|
||||
}
|
||||
warningPrinted.set(true);
|
||||
engine.setEnabledProtocols(set.toArray(new String[0]));
|
||||
engine.setEnabledProtocols(set.toArray(new String[set.size()]));
|
||||
|
||||
SslHandler handler = new SslHandler(engine);
|
||||
|
||||
|
|
Loading…
Reference in New Issue