Skip to content

Commit

Permalink
Some trivial optimizations in Config.java.
Browse files Browse the repository at this point in the history
git-svn-id: https://svn.apache.org/repos/asf/ofbiz/trunk@1674546 13f79535-47bb-0310-9956-ffa450edef68
  • Loading branch information
adrian-crum committed Apr 18, 2015
1 parent 752bdd3 commit 522cab1
Showing 1 changed file with 14 additions and 11 deletions.
25 changes: 14 additions & 11 deletions framework/start/src/org/ofbiz/base/start/Config.java
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@
import javax.xml.parsers.DocumentBuilder;
import javax.xml.parsers.DocumentBuilderFactory;
import javax.xml.parsers.ParserConfigurationException;

import java.io.File;
import java.io.FileFilter;
import java.io.FileInputStream;
Expand All @@ -46,6 +47,17 @@

public class Config {

private static final FileFilter componentLoadFilter = new FileFilter() {
public boolean accept(File pathname) {
return "component-load.xml".equals(pathname.getName());
}
};
private static final FileFilter folderFilter = new FileFilter() {
public boolean accept(File pathname) {
return pathname.isDirectory();
}
};

public final InetAddress adminAddress;
public final String adminKey;
public final int adminPort;
Expand Down Expand Up @@ -183,7 +195,7 @@ public class Config {
instrumenterFile = getProp(props, "ofbiz.instrumenterFile", null);

// loader classes
List<Map<String, String>> loadersTmp = new ArrayList<Map<String, String>>();
ArrayList<Map<String, String>> loadersTmp = new ArrayList<Map<String, String>>();
int currentPosition = 1;
Map<String, String> loader = null;
while (true) {
Expand All @@ -198,6 +210,7 @@ public class Config {
currentPosition++;
}
}
loadersTmp.trimToSize();
loaders = Collections.unmodifiableList(loadersTmp);

// set the port offset
Expand Down Expand Up @@ -302,16 +315,6 @@ private void collectClasspathEntries(File folder, Classpath classpath, Classpath
if (!folder.exists() && !folder.isDirectory()) {
return;
}
FileFilter componentLoadFilter = new FileFilter() {
public boolean accept(File pathname) {
return "component-load.xml".equals(pathname.getName());
}
};
FileFilter folderFilter = new FileFilter() {
public boolean accept(File pathname) {
return pathname.isDirectory();
}
};
DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance();
DocumentBuilder builder = factory.newDocumentBuilder();
File[] componentLoadFiles;
Expand Down

0 comments on commit 522cab1

Please sign in to comment.