Small performance improvements
Modifications: - Added a static modifier for CompositeByteBuf.Component. This class is an inner class, but does not use its embedded reference to the object which created it. This reference makes the instances of the class larger, and may keep the reference to the creator object alive longer than necessary. A boxed primitive is created from a String, just to extract the unboxed primitive value. - Removed unnecessary checks if file exists before call mkdirs() in NativeLibraryLoader and PlatformDependent. Because the method mkdirs() has this check inside. Conflicts: codec-http/src/main/java/io/netty/handler/codec/http/multipart/DiskAttribute.java codec-stomp/src/main/java/io/netty/handler/codec/stomp/StompSubframeAggregator.java codec-stomp/src/main/java/io/netty/handler/codec/stomp/StompSubframeDecoder.java
This commit is contained in:
parent
f62777af11
commit
01b11ca2cb
@ -1319,7 +1319,7 @@ public class CompositeByteBuf extends AbstractReferenceCountedByteBuf {
|
||||
return result + ", components=" + components.size() + ')';
|
||||
}
|
||||
|
||||
private final class Component {
|
||||
private static final class Component {
|
||||
final ByteBuf buf;
|
||||
final int length;
|
||||
int offset;
|
||||
|
@ -110,7 +110,7 @@ public class HttpResponseDecoder extends HttpObjectDecoder {
|
||||
protected HttpMessage createMessage(String[] initialLine) {
|
||||
return new DefaultHttpResponse(
|
||||
HttpVersion.valueOf(initialLine[0]),
|
||||
new HttpResponseStatus(Integer.valueOf(initialLine[1]), initialLine[2]), validateHeaders);
|
||||
new HttpResponseStatus(Integer.parseInt(initialLine[1]), initialLine[2]), validateHeaders);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -78,7 +78,7 @@ public class RtspResponseDecoder extends RtspObjectDecoder {
|
||||
protected HttpMessage createMessage(String[] initialLine) throws Exception {
|
||||
return new DefaultHttpResponse(
|
||||
RtspVersions.valueOf(initialLine[0]),
|
||||
new HttpResponseStatus(Integer.valueOf(initialLine[1]), initialLine[2]), validateHeaders);
|
||||
new HttpResponseStatus(Integer.parseInt(initialLine[1]), initialLine[2]), validateHeaders);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -44,11 +44,7 @@ public final class NativeLibraryLoader {
|
||||
String workdir = SystemPropertyUtil.get("io.netty.native.workdir");
|
||||
if (workdir != null) {
|
||||
File f = new File(workdir);
|
||||
if (!f.exists()) {
|
||||
// ok to ignore as createTempFile will take care
|
||||
//noinspection ResultOfMethodCallIgnored
|
||||
f.mkdirs();
|
||||
}
|
||||
f.mkdirs();
|
||||
|
||||
try {
|
||||
f = f.getAbsoluteFile();
|
||||
@ -130,9 +126,7 @@ public final class NativeLibraryLoader {
|
||||
}
|
||||
|
||||
File f = new File(path);
|
||||
if (!f.exists()) {
|
||||
f.mkdirs();
|
||||
}
|
||||
f.mkdirs();
|
||||
|
||||
if (!f.isDirectory()) {
|
||||
return null;
|
||||
|
@ -759,9 +759,7 @@ public final class PlatformDependent {
|
||||
}
|
||||
|
||||
File f = new File(path);
|
||||
if (!f.exists()) {
|
||||
f.mkdirs();
|
||||
}
|
||||
f.mkdirs();
|
||||
|
||||
if (!f.isDirectory()) {
|
||||
return null;
|
||||
|
Loading…
Reference in New Issue
Block a user