Small performance improvements
Motivation: Found performance issues via FindBugs and PMD. Modifications: - Removed unnecessary boxing/unboxing operations in DefaultTextHeaders.convertToInt(CharSequence) and DefaultTextHeaders.convertToLong(CharSequence). A boxed primitive is created from a string, just to extract the unboxed primitive value. - Added a static modifier for DefaultHttp2Connection.ParentChangedEvent class. 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. - Added a static compiled Pattern to avoid compile it each time it is used when we need to replace some part of authority. - Improved using of StringBuilders. Result: Performance improvements.
This commit is contained in:
parent
3843ca55a2
commit
3d200085a4
@ -1104,23 +1104,18 @@ public abstract class AbstractByteBuf extends ByteBuf {
|
|||||||
return StringUtil.simpleClassName(this) + "(freed)";
|
return StringUtil.simpleClassName(this) + "(freed)";
|
||||||
}
|
}
|
||||||
|
|
||||||
StringBuilder buf = new StringBuilder();
|
StringBuilder buf = new StringBuilder()
|
||||||
buf.append(StringUtil.simpleClassName(this));
|
.append(StringUtil.simpleClassName(this))
|
||||||
buf.append("(ridx: ");
|
.append("(ridx: ").append(readerIndex)
|
||||||
buf.append(readerIndex);
|
.append(", widx: ").append(writerIndex)
|
||||||
buf.append(", widx: ");
|
.append(", cap: ").append(capacity());
|
||||||
buf.append(writerIndex);
|
|
||||||
buf.append(", cap: ");
|
|
||||||
buf.append(capacity());
|
|
||||||
if (maxCapacity != Integer.MAX_VALUE) {
|
if (maxCapacity != Integer.MAX_VALUE) {
|
||||||
buf.append('/');
|
buf.append('/').append(maxCapacity);
|
||||||
buf.append(maxCapacity);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
ByteBuf unwrapped = unwrap();
|
ByteBuf unwrapped = unwrap();
|
||||||
if (unwrapped != null) {
|
if (unwrapped != null) {
|
||||||
buf.append(", unwrapped: ");
|
buf.append(", unwrapped: ").append(unwrapped);
|
||||||
buf.append(unwrapped);
|
|
||||||
}
|
}
|
||||||
buf.append(')');
|
buf.append(')');
|
||||||
return buf.toString();
|
return buf.toString();
|
||||||
|
@ -309,41 +309,41 @@ abstract class PoolArena<T> {
|
|||||||
protected abstract void destroyChunk(PoolChunk<T> chunk);
|
protected abstract void destroyChunk(PoolChunk<T> chunk);
|
||||||
|
|
||||||
public synchronized String toString() {
|
public synchronized String toString() {
|
||||||
StringBuilder buf = new StringBuilder();
|
StringBuilder buf = new StringBuilder()
|
||||||
buf.append("Chunk(s) at 0~25%:");
|
.append("Chunk(s) at 0~25%:")
|
||||||
buf.append(StringUtil.NEWLINE);
|
.append(StringUtil.NEWLINE)
|
||||||
buf.append(qInit);
|
.append(qInit)
|
||||||
buf.append(StringUtil.NEWLINE);
|
.append(StringUtil.NEWLINE)
|
||||||
buf.append("Chunk(s) at 0~50%:");
|
.append("Chunk(s) at 0~50%:")
|
||||||
buf.append(StringUtil.NEWLINE);
|
.append(StringUtil.NEWLINE)
|
||||||
buf.append(q000);
|
.append(q000)
|
||||||
buf.append(StringUtil.NEWLINE);
|
.append(StringUtil.NEWLINE)
|
||||||
buf.append("Chunk(s) at 25~75%:");
|
.append("Chunk(s) at 25~75%:")
|
||||||
buf.append(StringUtil.NEWLINE);
|
.append(StringUtil.NEWLINE)
|
||||||
buf.append(q025);
|
.append(q025)
|
||||||
buf.append(StringUtil.NEWLINE);
|
.append(StringUtil.NEWLINE)
|
||||||
buf.append("Chunk(s) at 50~100%:");
|
.append("Chunk(s) at 50~100%:")
|
||||||
buf.append(StringUtil.NEWLINE);
|
.append(StringUtil.NEWLINE)
|
||||||
buf.append(q050);
|
.append(q050)
|
||||||
buf.append(StringUtil.NEWLINE);
|
.append(StringUtil.NEWLINE)
|
||||||
buf.append("Chunk(s) at 75~100%:");
|
.append("Chunk(s) at 75~100%:")
|
||||||
buf.append(StringUtil.NEWLINE);
|
.append(StringUtil.NEWLINE)
|
||||||
buf.append(q075);
|
.append(q075)
|
||||||
buf.append(StringUtil.NEWLINE);
|
.append(StringUtil.NEWLINE)
|
||||||
buf.append("Chunk(s) at 100%:");
|
.append("Chunk(s) at 100%:")
|
||||||
buf.append(StringUtil.NEWLINE);
|
.append(StringUtil.NEWLINE)
|
||||||
buf.append(q100);
|
.append(q100)
|
||||||
buf.append(StringUtil.NEWLINE);
|
.append(StringUtil.NEWLINE)
|
||||||
buf.append("tiny subpages:");
|
.append("tiny subpages:");
|
||||||
for (int i = 1; i < tinySubpagePools.length; i ++) {
|
for (int i = 1; i < tinySubpagePools.length; i ++) {
|
||||||
PoolSubpage<T> head = tinySubpagePools[i];
|
PoolSubpage<T> head = tinySubpagePools[i];
|
||||||
if (head.next == head) {
|
if (head.next == head) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
buf.append(StringUtil.NEWLINE);
|
buf.append(StringUtil.NEWLINE)
|
||||||
buf.append(i);
|
.append(i)
|
||||||
buf.append(": ");
|
.append(": ");
|
||||||
PoolSubpage<T> s = head.next;
|
PoolSubpage<T> s = head.next;
|
||||||
for (;;) {
|
for (;;) {
|
||||||
buf.append(s);
|
buf.append(s);
|
||||||
@ -353,17 +353,17 @@ abstract class PoolArena<T> {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
buf.append(StringUtil.NEWLINE);
|
buf.append(StringUtil.NEWLINE)
|
||||||
buf.append("small subpages:");
|
.append("small subpages:");
|
||||||
for (int i = 1; i < smallSubpagePools.length; i ++) {
|
for (int i = 1; i < smallSubpagePools.length; i ++) {
|
||||||
PoolSubpage<T> head = smallSubpagePools[i];
|
PoolSubpage<T> head = smallSubpagePools[i];
|
||||||
if (head.next == head) {
|
if (head.next == head) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
buf.append(StringUtil.NEWLINE);
|
buf.append(StringUtil.NEWLINE)
|
||||||
buf.append(i);
|
.append(i)
|
||||||
buf.append(": ");
|
.append(": ");
|
||||||
PoolSubpage<T> s = head.next;
|
PoolSubpage<T> s = head.next;
|
||||||
for (;;) {
|
for (;;) {
|
||||||
buf.append(s);
|
buf.append(s);
|
||||||
|
@ -416,16 +416,16 @@ final class PoolChunk<T> {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String toString() {
|
public String toString() {
|
||||||
StringBuilder buf = new StringBuilder();
|
return new StringBuilder()
|
||||||
buf.append("Chunk(");
|
.append("Chunk(")
|
||||||
buf.append(Integer.toHexString(System.identityHashCode(this)));
|
.append(Integer.toHexString(System.identityHashCode(this)))
|
||||||
buf.append(": ");
|
.append(": ")
|
||||||
buf.append(usage());
|
.append(usage())
|
||||||
buf.append("%, ");
|
.append("%, ")
|
||||||
buf.append(chunkSize - freeBytes);
|
.append(chunkSize - freeBytes)
|
||||||
buf.append('/');
|
.append('/')
|
||||||
buf.append(chunkSize);
|
.append(chunkSize)
|
||||||
buf.append(')');
|
.append(')')
|
||||||
return buf.toString();
|
.toString();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -19,8 +19,6 @@ import java.util.Collections;
|
|||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
import java.util.TreeSet;
|
import java.util.TreeSet;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The default {@link Cookie} implementation.
|
* The default {@link Cookie} implementation.
|
||||||
*/
|
*/
|
||||||
@ -308,26 +306,26 @@ public class DefaultCookie implements Cookie {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String toString() {
|
public String toString() {
|
||||||
StringBuilder buf = new StringBuilder();
|
StringBuilder buf = new StringBuilder()
|
||||||
buf.append(getName());
|
.append(getName())
|
||||||
buf.append('=');
|
.append('=')
|
||||||
buf.append(getValue());
|
.append(getValue());
|
||||||
if (getDomain() != null) {
|
if (getDomain() != null) {
|
||||||
buf.append(", domain=");
|
buf.append(", domain=")
|
||||||
buf.append(getDomain());
|
.append(getDomain());
|
||||||
}
|
}
|
||||||
if (getPath() != null) {
|
if (getPath() != null) {
|
||||||
buf.append(", path=");
|
buf.append(", path=")
|
||||||
buf.append(getPath());
|
.append(getPath());
|
||||||
}
|
}
|
||||||
if (getComment() != null) {
|
if (getComment() != null) {
|
||||||
buf.append(", comment=");
|
buf.append(", comment=")
|
||||||
buf.append(getComment());
|
.append(getComment());
|
||||||
}
|
}
|
||||||
if (getMaxAge() >= 0) {
|
if (getMaxAge() >= 0) {
|
||||||
buf.append(", maxAge=");
|
buf.append(", maxAge=")
|
||||||
buf.append(getMaxAge());
|
.append(getMaxAge())
|
||||||
buf.append('s');
|
.append('s');
|
||||||
}
|
}
|
||||||
if (isSecure()) {
|
if (isSecure()) {
|
||||||
buf.append(", secure");
|
buf.append(", secure");
|
||||||
|
@ -54,14 +54,15 @@ public abstract class DefaultHttpMessage extends DefaultHttpObject implements Ht
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String toString() {
|
public String toString() {
|
||||||
StringBuilder buf = new StringBuilder();
|
StringBuilder buf = new StringBuilder()
|
||||||
buf.append(StringUtil.simpleClassName(this));
|
.append(StringUtil.simpleClassName(this))
|
||||||
buf.append("(version: ");
|
.append("(version: ")
|
||||||
buf.append(getProtocolVersion().text());
|
.append(getProtocolVersion().text())
|
||||||
buf.append(", keepAlive: ");
|
.append(", keepAlive: ")
|
||||||
buf.append(HttpHeaders.isKeepAlive(this));
|
.append(HttpHeaders.isKeepAlive(this))
|
||||||
buf.append(')');
|
.append(')')
|
||||||
buf.append(StringUtil.NEWLINE);
|
.append(StringUtil.NEWLINE);
|
||||||
|
|
||||||
appendHeaders(buf);
|
appendHeaders(buf);
|
||||||
|
|
||||||
// Remove the last newline.
|
// Remove the last newline.
|
||||||
@ -79,11 +80,15 @@ public abstract class DefaultHttpMessage extends DefaultHttpObject implements Ht
|
|||||||
}
|
}
|
||||||
|
|
||||||
void appendHeaders(StringBuilder buf) {
|
void appendHeaders(StringBuilder buf) {
|
||||||
for (Map.Entry<String, String> e: headers()) {
|
appendHeaders(buf, headers());
|
||||||
buf.append(e.getKey());
|
}
|
||||||
buf.append(": ");
|
|
||||||
buf.append(e.getValue());
|
void appendHeaders(StringBuilder buf, HttpHeaders headers) {
|
||||||
buf.append(StringUtil.NEWLINE);
|
for (Map.Entry<String, String> e: headers) {
|
||||||
|
buf.append(e.getKey())
|
||||||
|
.append(": ")
|
||||||
|
.append(e.getValue())
|
||||||
|
.append(StringUtil.NEWLINE);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -521,9 +521,9 @@ public abstract class HttpObjectDecoder extends ByteToMessageDecoder {
|
|||||||
char firstChar = line.charAt(0);
|
char firstChar = line.charAt(0);
|
||||||
if (name != null && (firstChar == ' ' || firstChar == '\t')) {
|
if (name != null && (firstChar == ' ' || firstChar == '\t')) {
|
||||||
StringBuilder buf = new StringBuilder(value.length() + line.length() + 1);
|
StringBuilder buf = new StringBuilder(value.length() + line.length() + 1);
|
||||||
buf.append(value);
|
buf.append(value)
|
||||||
buf.append(' ');
|
.append(' ')
|
||||||
buf.append(line.toString().trim());
|
.append(line.toString().trim());
|
||||||
value = buf.toString();
|
value = buf.toString();
|
||||||
} else {
|
} else {
|
||||||
if (name != null) {
|
if (name != null) {
|
||||||
@ -589,8 +589,8 @@ public abstract class HttpObjectDecoder extends ByteToMessageDecoder {
|
|||||||
String lineTrimmed = line.toString().trim();
|
String lineTrimmed = line.toString().trim();
|
||||||
CharSequence currentLastPos = current.get(lastPos);
|
CharSequence currentLastPos = current.get(lastPos);
|
||||||
StringBuilder b = new StringBuilder(currentLastPos.length() + lineTrimmed.length());
|
StringBuilder b = new StringBuilder(currentLastPos.length() + lineTrimmed.length());
|
||||||
b.append(currentLastPos);
|
b.append(currentLastPos)
|
||||||
b.append(lineTrimmed);
|
.append(lineTrimmed);
|
||||||
current.set(lastPos, b.toString());
|
current.set(lastPos, b.toString());
|
||||||
} else {
|
} else {
|
||||||
// Content-Length, Transfer-Encoding, or Trailer
|
// Content-Length, Transfer-Encoding, or Trailer
|
||||||
|
@ -60,9 +60,9 @@ public class HttpRequestEncoder extends HttpObjectEncoder<HttpRequest> {
|
|||||||
if (uri.lastIndexOf(SLASH, index) <= startIndex) {
|
if (uri.lastIndexOf(SLASH, index) <= startIndex) {
|
||||||
int len = uri.length();
|
int len = uri.length();
|
||||||
StringBuilder sb = new StringBuilder(len + 1);
|
StringBuilder sb = new StringBuilder(len + 1);
|
||||||
sb.append(uri, 0, index);
|
sb.append(uri, 0, index)
|
||||||
sb.append(SLASH);
|
.append(SLASH)
|
||||||
sb.append(uri, index, len);
|
.append(uri, index, len);
|
||||||
uri = sb.toString();
|
uri = sb.toString();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -541,11 +541,11 @@ public class HttpResponseStatus implements Comparable<HttpResponseStatus> {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String toString() {
|
public String toString() {
|
||||||
StringBuilder buf = new StringBuilder(reasonPhrase.length() + 5);
|
return new StringBuilder(reasonPhrase.length() + 5)
|
||||||
buf.append(code);
|
.append(code)
|
||||||
buf.append(' ');
|
.append(' ')
|
||||||
buf.append(reasonPhrase);
|
.append(reasonPhrase)
|
||||||
return buf.toString();
|
.toString();
|
||||||
}
|
}
|
||||||
|
|
||||||
void encode(ByteBuf buf) {
|
void encode(ByteBuf buf) {
|
||||||
|
@ -49,7 +49,6 @@ import static io.netty.buffer.Unpooled.*;
|
|||||||
* This encoder will help to encode Request for a FORM as POST.
|
* This encoder will help to encode Request for a FORM as POST.
|
||||||
*/
|
*/
|
||||||
public class HttpPostRequestEncoder implements ChunkedInput<HttpContent> {
|
public class HttpPostRequestEncoder implements ChunkedInput<HttpContent> {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Different modes to use to encode form data.
|
* Different modes to use to encode form data.
|
||||||
*/
|
*/
|
||||||
@ -560,42 +559,43 @@ public class HttpPostRequestEncoder implements ChunkedInput<HttpContent> {
|
|||||||
globalBodySize -= pastAttribute.size();
|
globalBodySize -= pastAttribute.size();
|
||||||
StringBuilder replacement = new StringBuilder(
|
StringBuilder replacement = new StringBuilder(
|
||||||
139 + multipartDataBoundary.length() + multipartMixedBoundary.length() * 2 +
|
139 + multipartDataBoundary.length() + multipartMixedBoundary.length() * 2 +
|
||||||
|
|
||||||
fileUpload.getFilename().length() + fileUpload.getName().length());
|
fileUpload.getFilename().length() + fileUpload.getName().length());
|
||||||
|
|
||||||
replacement.append("--");
|
replacement.append("--")
|
||||||
replacement.append(multipartDataBoundary);
|
.append(multipartDataBoundary)
|
||||||
replacement.append("\r\n");
|
.append("\r\n")
|
||||||
|
|
||||||
replacement.append(HttpPostBodyUtil.CONTENT_DISPOSITION);
|
.append(HttpPostBodyUtil.CONTENT_DISPOSITION)
|
||||||
replacement.append(": ");
|
.append(": ")
|
||||||
replacement.append(HttpPostBodyUtil.FORM_DATA);
|
.append(HttpPostBodyUtil.FORM_DATA)
|
||||||
replacement.append("; ");
|
.append("; ")
|
||||||
replacement.append(HttpPostBodyUtil.NAME);
|
.append(HttpPostBodyUtil.NAME)
|
||||||
replacement.append("=\"");
|
.append("=\"")
|
||||||
replacement.append(fileUpload.getName());
|
.append(fileUpload.getName())
|
||||||
replacement.append("\"\r\n");
|
.append("\"\r\n")
|
||||||
|
|
||||||
replacement.append(HttpHeaders.Names.CONTENT_TYPE);
|
.append(HttpHeaders.Names.CONTENT_TYPE)
|
||||||
replacement.append(": ");
|
.append(": ")
|
||||||
replacement.append(HttpPostBodyUtil.MULTIPART_MIXED);
|
.append(HttpPostBodyUtil.MULTIPART_MIXED)
|
||||||
replacement.append("; ");
|
.append("; ")
|
||||||
replacement.append(HttpHeaders.Values.BOUNDARY);
|
.append(HttpHeaders.Values.BOUNDARY)
|
||||||
replacement.append('=');
|
.append('=')
|
||||||
replacement.append(multipartMixedBoundary);
|
.append(multipartMixedBoundary)
|
||||||
replacement.append("\r\n\r\n");
|
.append("\r\n\r\n")
|
||||||
|
|
||||||
replacement.append("--");
|
.append("--")
|
||||||
replacement.append(multipartMixedBoundary);
|
.append(multipartMixedBoundary)
|
||||||
replacement.append("\r\n");
|
.append("\r\n")
|
||||||
|
|
||||||
replacement.append(HttpPostBodyUtil.CONTENT_DISPOSITION);
|
.append(HttpPostBodyUtil.CONTENT_DISPOSITION)
|
||||||
replacement.append(": ");
|
.append(": ")
|
||||||
replacement.append(HttpPostBodyUtil.ATTACHMENT);
|
.append(HttpPostBodyUtil.ATTACHMENT)
|
||||||
replacement.append("; ");
|
.append("; ")
|
||||||
replacement.append(HttpPostBodyUtil.FILENAME);
|
.append(HttpPostBodyUtil.FILENAME)
|
||||||
replacement.append("=\"");
|
.append("=\"")
|
||||||
replacement.append(fileUpload.getFilename());
|
.append(fileUpload.getFilename())
|
||||||
replacement.append("\"\r\n");
|
.append("\"\r\n");
|
||||||
|
|
||||||
pastAttribute.setValue(replacement.toString(), 1);
|
pastAttribute.setValue(replacement.toString(), 1);
|
||||||
pastAttribute.setValue("", 2);
|
pastAttribute.setValue("", 2);
|
||||||
|
@ -121,16 +121,16 @@ public class DefaultSpdyDataFrame extends DefaultSpdyStreamFrame implements Spdy
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String toString() {
|
public String toString() {
|
||||||
StringBuilder buf = new StringBuilder();
|
StringBuilder buf = new StringBuilder()
|
||||||
buf.append(StringUtil.simpleClassName(this));
|
.append(StringUtil.simpleClassName(this))
|
||||||
buf.append("(last: ");
|
.append("(last: ")
|
||||||
buf.append(isLast());
|
.append(isLast())
|
||||||
buf.append(')');
|
.append(')')
|
||||||
buf.append(StringUtil.NEWLINE);
|
.append(StringUtil.NEWLINE)
|
||||||
buf.append("--> Stream-ID = ");
|
.append("--> Stream-ID = ")
|
||||||
buf.append(streamId());
|
.append(streamId())
|
||||||
buf.append(StringUtil.NEWLINE);
|
.append(StringUtil.NEWLINE)
|
||||||
buf.append("--> Size = ");
|
.append("--> Size = ");
|
||||||
if (refCnt() == 0) {
|
if (refCnt() == 0) {
|
||||||
buf.append("(freed)");
|
buf.append("(freed)");
|
||||||
} else {
|
} else {
|
||||||
|
@ -83,14 +83,14 @@ public class DefaultSpdyGoAwayFrame implements SpdyGoAwayFrame {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String toString() {
|
public String toString() {
|
||||||
StringBuilder buf = new StringBuilder();
|
return new StringBuilder()
|
||||||
buf.append(StringUtil.simpleClassName(this));
|
.append(StringUtil.simpleClassName(this))
|
||||||
buf.append(StringUtil.NEWLINE);
|
.append(StringUtil.NEWLINE)
|
||||||
buf.append("--> Last-good-stream-ID = ");
|
.append("--> Last-good-stream-ID = ")
|
||||||
buf.append(lastGoodStreamId());
|
.append(lastGoodStreamId())
|
||||||
buf.append(StringUtil.NEWLINE);
|
.append(StringUtil.NEWLINE)
|
||||||
buf.append("--> Status: ");
|
.append("--> Status: ")
|
||||||
buf.append(status());
|
.append(status())
|
||||||
return buf.toString();
|
.toString();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -79,17 +79,17 @@ public class DefaultSpdyHeadersFrame extends DefaultSpdyStreamFrame
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String toString() {
|
public String toString() {
|
||||||
StringBuilder buf = new StringBuilder();
|
StringBuilder buf = new StringBuilder()
|
||||||
buf.append(StringUtil.simpleClassName(this));
|
.append(StringUtil.simpleClassName(this))
|
||||||
buf.append("(last: ");
|
.append("(last: ")
|
||||||
buf.append(isLast());
|
.append(isLast())
|
||||||
buf.append(')');
|
.append(')')
|
||||||
buf.append(StringUtil.NEWLINE);
|
.append(StringUtil.NEWLINE)
|
||||||
buf.append("--> Stream-ID = ");
|
.append("--> Stream-ID = ")
|
||||||
buf.append(streamId());
|
.append(streamId())
|
||||||
buf.append(StringUtil.NEWLINE);
|
.append(StringUtil.NEWLINE)
|
||||||
buf.append("--> Headers:");
|
.append("--> Headers:")
|
||||||
buf.append(StringUtil.NEWLINE);
|
.append(StringUtil.NEWLINE);
|
||||||
appendHeaders(buf);
|
appendHeaders(buf);
|
||||||
|
|
||||||
// Remove the last newline.
|
// Remove the last newline.
|
||||||
|
@ -46,11 +46,11 @@ public class DefaultSpdyPingFrame implements SpdyPingFrame {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String toString() {
|
public String toString() {
|
||||||
StringBuilder buf = new StringBuilder();
|
return new StringBuilder()
|
||||||
buf.append(StringUtil.simpleClassName(this));
|
.append(StringUtil.simpleClassName(this))
|
||||||
buf.append(StringUtil.NEWLINE);
|
.append(StringUtil.NEWLINE)
|
||||||
buf.append("--> ID = ");
|
.append("--> ID = ")
|
||||||
buf.append(id());
|
.append(id())
|
||||||
return buf.toString();
|
.toString();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -71,14 +71,14 @@ public class DefaultSpdyRstStreamFrame extends DefaultSpdyStreamFrame
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String toString() {
|
public String toString() {
|
||||||
StringBuilder buf = new StringBuilder();
|
return new StringBuilder()
|
||||||
buf.append(StringUtil.simpleClassName(this));
|
.append(StringUtil.simpleClassName(this))
|
||||||
buf.append(StringUtil.NEWLINE);
|
.append(StringUtil.NEWLINE)
|
||||||
buf.append("--> Stream-ID = ");
|
.append("--> Stream-ID = ")
|
||||||
buf.append(streamId());
|
.append(streamId())
|
||||||
buf.append(StringUtil.NEWLINE);
|
.append(StringUtil.NEWLINE)
|
||||||
buf.append("--> Status: ");
|
.append("--> Status: ")
|
||||||
buf.append(status());
|
.append(status())
|
||||||
return buf.toString();
|
.toString();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -152,10 +152,11 @@ public class DefaultSpdySettingsFrame implements SpdySettingsFrame {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String toString() {
|
public String toString() {
|
||||||
StringBuilder buf = new StringBuilder();
|
StringBuilder buf = new StringBuilder()
|
||||||
buf.append(StringUtil.simpleClassName(this));
|
.append(StringUtil.simpleClassName(this))
|
||||||
buf.append(StringUtil.NEWLINE);
|
.append(StringUtil.NEWLINE);
|
||||||
appendSettings(buf);
|
appendSettings(buf);
|
||||||
|
|
||||||
buf.setLength(buf.length() - StringUtil.NEWLINE.length());
|
buf.setLength(buf.length() - StringUtil.NEWLINE.length());
|
||||||
return buf.toString();
|
return buf.toString();
|
||||||
}
|
}
|
||||||
|
@ -52,17 +52,17 @@ public class DefaultSpdySynReplyFrame extends DefaultSpdyHeadersFrame
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String toString() {
|
public String toString() {
|
||||||
StringBuilder buf = new StringBuilder();
|
StringBuilder buf = new StringBuilder()
|
||||||
buf.append(StringUtil.simpleClassName(this));
|
.append(StringUtil.simpleClassName(this))
|
||||||
buf.append("(last: ");
|
.append("(last: ")
|
||||||
buf.append(isLast());
|
.append(isLast())
|
||||||
buf.append(')');
|
.append(')')
|
||||||
buf.append(StringUtil.NEWLINE);
|
.append(StringUtil.NEWLINE)
|
||||||
buf.append("--> Stream-ID = ");
|
.append("--> Stream-ID = ")
|
||||||
buf.append(streamId());
|
.append(streamId())
|
||||||
buf.append(StringUtil.NEWLINE);
|
.append(StringUtil.NEWLINE)
|
||||||
buf.append("--> Headers:");
|
.append("--> Headers:")
|
||||||
buf.append(StringUtil.NEWLINE);
|
.append(StringUtil.NEWLINE);
|
||||||
appendHeaders(buf);
|
appendHeaders(buf);
|
||||||
|
|
||||||
// Remove the last newline.
|
// Remove the last newline.
|
||||||
|
@ -102,27 +102,27 @@ public class DefaultSpdySynStreamFrame extends DefaultSpdyHeadersFrame
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String toString() {
|
public String toString() {
|
||||||
StringBuilder buf = new StringBuilder();
|
StringBuilder buf = new StringBuilder()
|
||||||
buf.append(StringUtil.simpleClassName(this));
|
.append(StringUtil.simpleClassName(this))
|
||||||
buf.append("(last: ");
|
.append("(last: ")
|
||||||
buf.append(isLast());
|
.append(isLast())
|
||||||
buf.append("; unidirectional: ");
|
.append("; unidirectional: ")
|
||||||
buf.append(isUnidirectional());
|
.append(isUnidirectional())
|
||||||
buf.append(')');
|
.append(')')
|
||||||
buf.append(StringUtil.NEWLINE);
|
.append(StringUtil.NEWLINE)
|
||||||
buf.append("--> Stream-ID = ");
|
.append("--> Stream-ID = ")
|
||||||
buf.append(streamId());
|
.append(streamId())
|
||||||
buf.append(StringUtil.NEWLINE);
|
.append(StringUtil.NEWLINE);
|
||||||
if (associatedStreamId != 0) {
|
if (associatedStreamId != 0) {
|
||||||
buf.append("--> Associated-To-Stream-ID = ");
|
buf.append("--> Associated-To-Stream-ID = ")
|
||||||
buf.append(associatedStreamId());
|
.append(associatedStreamId())
|
||||||
buf.append(StringUtil.NEWLINE);
|
.append(StringUtil.NEWLINE);
|
||||||
}
|
}
|
||||||
buf.append("--> Priority = ");
|
buf.append("--> Priority = ")
|
||||||
buf.append(priority());
|
.append(priority())
|
||||||
buf.append(StringUtil.NEWLINE);
|
.append(StringUtil.NEWLINE)
|
||||||
buf.append("--> Headers:");
|
.append("--> Headers:")
|
||||||
buf.append(StringUtil.NEWLINE);
|
.append(StringUtil.NEWLINE);
|
||||||
appendHeaders(buf);
|
appendHeaders(buf);
|
||||||
|
|
||||||
// Remove the last newline.
|
// Remove the last newline.
|
||||||
|
@ -69,14 +69,14 @@ public class DefaultSpdyWindowUpdateFrame implements SpdyWindowUpdateFrame {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String toString() {
|
public String toString() {
|
||||||
StringBuilder buf = new StringBuilder();
|
return new StringBuilder()
|
||||||
buf.append(StringUtil.simpleClassName(this));
|
.append(StringUtil.simpleClassName(this))
|
||||||
buf.append(StringUtil.NEWLINE);
|
.append(StringUtil.NEWLINE)
|
||||||
buf.append("--> Stream-ID = ");
|
.append("--> Stream-ID = ")
|
||||||
buf.append(streamId());
|
.append(streamId())
|
||||||
buf.append(StringUtil.NEWLINE);
|
.append(StringUtil.NEWLINE)
|
||||||
buf.append("--> Delta-Window-Size = ");
|
.append("--> Delta-Window-Size = ")
|
||||||
buf.append(deltaWindowSize());
|
.append(deltaWindowSize())
|
||||||
return buf.toString();
|
.toString();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -69,12 +69,11 @@ public class DecoderResult {
|
|||||||
}
|
}
|
||||||
|
|
||||||
String cause = cause().toString();
|
String cause = cause().toString();
|
||||||
StringBuilder buf = new StringBuilder(cause.length() + 17);
|
return new StringBuilder(cause.length() + 17)
|
||||||
buf.append("failure(");
|
.append("failure(")
|
||||||
buf.append(cause);
|
.append(cause)
|
||||||
buf.append(')');
|
.append(')')
|
||||||
|
.toString();
|
||||||
return buf.toString();
|
|
||||||
} else {
|
} else {
|
||||||
return "unfinished";
|
return "unfinished";
|
||||||
}
|
}
|
||||||
|
@ -591,17 +591,16 @@ public class HashedWheelTimer implements Timer {
|
|||||||
final long currentTime = System.nanoTime();
|
final long currentTime = System.nanoTime();
|
||||||
long remaining = deadline - currentTime + timer.startTime;
|
long remaining = deadline - currentTime + timer.startTime;
|
||||||
|
|
||||||
StringBuilder buf = new StringBuilder(192);
|
StringBuilder buf = new StringBuilder(192)
|
||||||
buf.append(StringUtil.simpleClassName(this));
|
.append(StringUtil.simpleClassName(this))
|
||||||
buf.append('(');
|
.append('(')
|
||||||
|
.append("deadline: ");
|
||||||
buf.append("deadline: ");
|
|
||||||
if (remaining > 0) {
|
if (remaining > 0) {
|
||||||
buf.append(remaining);
|
buf.append(remaining)
|
||||||
buf.append(" ns later");
|
.append(" ns later");
|
||||||
} else if (remaining < 0) {
|
} else if (remaining < 0) {
|
||||||
buf.append(-remaining);
|
buf.append(-remaining)
|
||||||
buf.append(" ns ago");
|
.append(" ns ago");
|
||||||
} else {
|
} else {
|
||||||
buf.append("now");
|
buf.append("now");
|
||||||
}
|
}
|
||||||
@ -610,10 +609,10 @@ public class HashedWheelTimer implements Timer {
|
|||||||
buf.append(", cancelled");
|
buf.append(", cancelled");
|
||||||
}
|
}
|
||||||
|
|
||||||
buf.append(", task: ");
|
return buf.append(", task: ")
|
||||||
buf.append(task());
|
.append(task())
|
||||||
|
.append(')')
|
||||||
return buf.append(')').toString();
|
.toString();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -327,27 +327,27 @@ public final class ResourceLeakDetector<T> {
|
|||||||
array = lastRecords.toArray();
|
array = lastRecords.toArray();
|
||||||
}
|
}
|
||||||
|
|
||||||
StringBuilder buf = new StringBuilder(16384);
|
StringBuilder buf = new StringBuilder(16384)
|
||||||
buf.append(NEWLINE);
|
.append(NEWLINE)
|
||||||
buf.append("Recent access records: ");
|
.append("Recent access records: ")
|
||||||
buf.append(array.length);
|
.append(array.length)
|
||||||
buf.append(NEWLINE);
|
.append(NEWLINE);
|
||||||
|
|
||||||
if (array.length > 0) {
|
if (array.length > 0) {
|
||||||
for (int i = array.length - 1; i >= 0; i --) {
|
for (int i = array.length - 1; i >= 0; i --) {
|
||||||
buf.append('#');
|
buf.append('#')
|
||||||
buf.append(i + 1);
|
.append(i + 1)
|
||||||
buf.append(':');
|
.append(':')
|
||||||
buf.append(NEWLINE);
|
.append(NEWLINE)
|
||||||
buf.append(array[i]);
|
.append(array[i]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
buf.append("Created at:");
|
buf.append("Created at:")
|
||||||
buf.append(NEWLINE);
|
.append(NEWLINE)
|
||||||
buf.append(creationRecord);
|
.append(creationRecord);
|
||||||
buf.setLength(buf.length() - NEWLINE.length());
|
|
||||||
|
|
||||||
|
buf.setLength(buf.length() - NEWLINE.length());
|
||||||
return buf.toString();
|
return buf.toString();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -806,10 +806,10 @@ public class DefaultPromise<V> extends AbstractFuture<V> implements Promise<V> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
protected StringBuilder toStringBuilder() {
|
protected StringBuilder toStringBuilder() {
|
||||||
StringBuilder buf = new StringBuilder(64);
|
StringBuilder buf = new StringBuilder(64)
|
||||||
buf.append(StringUtil.simpleClassName(this));
|
.append(StringUtil.simpleClassName(this))
|
||||||
buf.append('@');
|
.append('@')
|
||||||
buf.append(Integer.toHexString(hashCode()));
|
.append(Integer.toHexString(hashCode()));
|
||||||
|
|
||||||
Object result = this.result;
|
Object result = this.result;
|
||||||
if (result == SUCCESS) {
|
if (result == SUCCESS) {
|
||||||
@ -817,9 +817,9 @@ public class DefaultPromise<V> extends AbstractFuture<V> implements Promise<V> {
|
|||||||
} else if (result == UNCANCELLABLE) {
|
} else if (result == UNCANCELLABLE) {
|
||||||
buf.append("(uncancellable)");
|
buf.append("(uncancellable)");
|
||||||
} else if (result instanceof CauseHolder) {
|
} else if (result instanceof CauseHolder) {
|
||||||
buf.append("(failure(");
|
buf.append("(failure(")
|
||||||
buf.append(((CauseHolder) result).cause);
|
.append(((CauseHolder) result).cause)
|
||||||
buf.append(')');
|
.append(')');
|
||||||
} else {
|
} else {
|
||||||
buf.append("(incomplete)");
|
buf.append("(incomplete)");
|
||||||
}
|
}
|
||||||
|
@ -129,9 +129,9 @@ class PromiseTask<V> extends DefaultPromise<V> implements RunnableFuture<V> {
|
|||||||
protected StringBuilder toStringBuilder() {
|
protected StringBuilder toStringBuilder() {
|
||||||
StringBuilder buf = super.toStringBuilder();
|
StringBuilder buf = super.toStringBuilder();
|
||||||
buf.setCharAt(buf.length() - 1, ',');
|
buf.setCharAt(buf.length() - 1, ',');
|
||||||
buf.append(" task: ");
|
|
||||||
buf.append(task);
|
return buf.append(" task: ")
|
||||||
buf.append(')');
|
.append(task)
|
||||||
return buf;
|
.append(')');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -149,13 +149,13 @@ final class ScheduledFutureTask<V> extends PromiseTask<V> implements ScheduledFu
|
|||||||
protected StringBuilder toStringBuilder() {
|
protected StringBuilder toStringBuilder() {
|
||||||
StringBuilder buf = super.toStringBuilder();
|
StringBuilder buf = super.toStringBuilder();
|
||||||
buf.setCharAt(buf.length() - 1, ',');
|
buf.setCharAt(buf.length() - 1, ',');
|
||||||
buf.append(" id: ");
|
|
||||||
buf.append(id);
|
return buf.append(" id: ")
|
||||||
buf.append(", deadline: ");
|
.append(id)
|
||||||
buf.append(deadlineNanos);
|
.append(", deadline: ")
|
||||||
buf.append(", period: ");
|
.append(deadlineNanos)
|
||||||
buf.append(periodNanos);
|
.append(", period: ")
|
||||||
buf.append(')');
|
.append(periodNanos)
|
||||||
return buf;
|
.append(')');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -239,7 +239,7 @@ public class HttpStaticFileServerHandler extends SimpleChannelInboundHandler<Ful
|
|||||||
throw new Error(e);
|
throw new Error(e);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!uri.startsWith("/")) {
|
if (uri.isEmpty() || uri.charAt(0) != '/') {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -250,7 +250,7 @@ public class HttpStaticFileServerHandler extends SimpleChannelInboundHandler<Ful
|
|||||||
// You will have to do something serious in the production environment.
|
// You will have to do something serious in the production environment.
|
||||||
if (uri.contains(File.separator + '.') ||
|
if (uri.contains(File.separator + '.') ||
|
||||||
uri.contains('.' + File.separator) ||
|
uri.contains('.' + File.separator) ||
|
||||||
uri.startsWith(".") || uri.endsWith(".") ||
|
uri.charAt(0) == '.' || uri.charAt(uri.length() - 1) == '.' ||
|
||||||
INSECURE_URI.matcher(uri).matches()) {
|
INSECURE_URI.matcher(uri).matches()) {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
@ -265,21 +265,20 @@ public class HttpStaticFileServerHandler extends SimpleChannelInboundHandler<Ful
|
|||||||
FullHttpResponse response = new DefaultFullHttpResponse(HTTP_1_1, OK);
|
FullHttpResponse response = new DefaultFullHttpResponse(HTTP_1_1, OK);
|
||||||
response.headers().set(CONTENT_TYPE, "text/html; charset=UTF-8");
|
response.headers().set(CONTENT_TYPE, "text/html; charset=UTF-8");
|
||||||
|
|
||||||
StringBuilder buf = new StringBuilder();
|
|
||||||
String dirPath = dir.getPath();
|
String dirPath = dir.getPath();
|
||||||
|
StringBuilder buf = new StringBuilder()
|
||||||
|
.append("<!DOCTYPE html>\r\n")
|
||||||
|
.append("<html><head><title>")
|
||||||
|
.append("Listing of: ")
|
||||||
|
.append(dirPath)
|
||||||
|
.append("</title></head><body>\r\n")
|
||||||
|
|
||||||
buf.append("<!DOCTYPE html>\r\n");
|
.append("<h3>Listing of: ")
|
||||||
buf.append("<html><head><title>");
|
.append(dirPath)
|
||||||
buf.append("Listing of: ");
|
.append("</h3>\r\n")
|
||||||
buf.append(dirPath);
|
|
||||||
buf.append("</title></head><body>\r\n");
|
|
||||||
|
|
||||||
buf.append("<h3>Listing of: ");
|
.append("<ul>")
|
||||||
buf.append(dirPath);
|
.append("<li><a href=\"../\">..</a></li>\r\n");
|
||||||
buf.append("</h3>\r\n");
|
|
||||||
|
|
||||||
buf.append("<ul>");
|
|
||||||
buf.append("<li><a href=\"../\">..</a></li>\r\n");
|
|
||||||
|
|
||||||
for (File f: dir.listFiles()) {
|
for (File f: dir.listFiles()) {
|
||||||
if (f.isHidden() || !f.canRead()) {
|
if (f.isHidden() || !f.canRead()) {
|
||||||
@ -291,11 +290,11 @@ public class HttpStaticFileServerHandler extends SimpleChannelInboundHandler<Ful
|
|||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
buf.append("<li><a href=\"");
|
buf.append("<li><a href=\"")
|
||||||
buf.append(name);
|
.append(name)
|
||||||
buf.append("\">");
|
.append("\">")
|
||||||
buf.append(name);
|
.append(name)
|
||||||
buf.append("</a></li>\r\n");
|
.append("</a></li>\r\n");
|
||||||
}
|
}
|
||||||
|
|
||||||
buf.append("</ul></body></html>\r\n");
|
buf.append("</ul></body></html>\r\n");
|
||||||
|
@ -66,9 +66,13 @@ public class SpdyFrameLogger extends ChannelDuplexHandler {
|
|||||||
|
|
||||||
private void log(SpdyFrame msg, Direction d) {
|
private void log(SpdyFrame msg, Direction d) {
|
||||||
if (logger.isEnabled(level)) {
|
if (logger.isEnabled(level)) {
|
||||||
StringBuilder b = new StringBuilder("\n----------------").append(d.name()).append("--------------------\n");
|
StringBuilder b = new StringBuilder(200)
|
||||||
b.append(msg);
|
.append("\n----------------")
|
||||||
b.append("\n------------------------------------");
|
.append(d.name())
|
||||||
|
.append("--------------------\n")
|
||||||
|
.append(msg)
|
||||||
|
.append("\n------------------------------------");
|
||||||
|
|
||||||
logger.log(level, b.toString());
|
logger.log(level, b.toString());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -170,11 +170,11 @@ public class LoggingHandler extends ChannelDuplexHandler {
|
|||||||
|
|
||||||
protected String format(ChannelHandlerContext ctx, String message) {
|
protected String format(ChannelHandlerContext ctx, String message) {
|
||||||
String chStr = ctx.channel().toString();
|
String chStr = ctx.channel().toString();
|
||||||
StringBuilder buf = new StringBuilder(chStr.length() + message.length() + 1);
|
return new StringBuilder(chStr.length() + message.length() + 1)
|
||||||
buf.append(chStr);
|
.append(chStr)
|
||||||
buf.append(' ');
|
.append(' ')
|
||||||
buf.append(message);
|
.append(message)
|
||||||
return buf.toString();
|
.toString();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@ -319,10 +319,10 @@ public class LoggingHandler extends ChannelDuplexHandler {
|
|||||||
protected String formatByteBuf(String eventName, ByteBuf buf) {
|
protected String formatByteBuf(String eventName, ByteBuf buf) {
|
||||||
int length = buf.readableBytes();
|
int length = buf.readableBytes();
|
||||||
int rows = length / 16 + (length % 15 == 0? 0 : 1) + 4;
|
int rows = length / 16 + (length % 15 == 0? 0 : 1) + 4;
|
||||||
StringBuilder dump = new StringBuilder(rows * 80 + eventName.length() + 16);
|
StringBuilder dump = new StringBuilder(rows * 80 + eventName.length() + 16)
|
||||||
|
|
||||||
dump.append(eventName).append('(').append(length).append('B').append(')');
|
.append(eventName).append('(').append(length).append('B').append(')')
|
||||||
dump.append(
|
.append(
|
||||||
NEWLINE + " +-------------------------------------------------+" +
|
NEWLINE + " +-------------------------------------------------+" +
|
||||||
NEWLINE + " | 0 1 2 3 4 5 6 7 8 9 a b c d e f |" +
|
NEWLINE + " | 0 1 2 3 4 5 6 7 8 9 a b c d e f |" +
|
||||||
NEWLINE + "+--------+-------------------------------------------------+----------------+");
|
NEWLINE + "+--------+-------------------------------------------------+----------------+");
|
||||||
@ -335,9 +335,9 @@ public class LoggingHandler extends ChannelDuplexHandler {
|
|||||||
int relIdx = i - startIndex;
|
int relIdx = i - startIndex;
|
||||||
int relIdxMod16 = relIdx & 15;
|
int relIdxMod16 = relIdx & 15;
|
||||||
if (relIdxMod16 == 0) {
|
if (relIdxMod16 == 0) {
|
||||||
dump.append(NEWLINE);
|
dump.append(NEWLINE)
|
||||||
dump.append(Long.toHexString(relIdx & 0xFFFFFFFFL | 0x100000000L));
|
.append(Long.toHexString(relIdx & 0xFFFFFFFFL | 0x100000000L))
|
||||||
dump.setCharAt(dump.length() - 9, '|');
|
.setCharAt(dump.length() - 9, '|');
|
||||||
dump.append('|');
|
dump.append('|');
|
||||||
}
|
}
|
||||||
dump.append(BYTE2HEX[buf.getUnsignedByte(i)]);
|
dump.append(BYTE2HEX[buf.getUnsignedByte(i)]);
|
||||||
@ -352,13 +352,13 @@ public class LoggingHandler extends ChannelDuplexHandler {
|
|||||||
|
|
||||||
if ((i - startIndex & 15) != 0) {
|
if ((i - startIndex & 15) != 0) {
|
||||||
int remainder = length & 15;
|
int remainder = length & 15;
|
||||||
dump.append(HEXPADDING[remainder]);
|
dump.append(HEXPADDING[remainder])
|
||||||
dump.append(" |");
|
.append(" |");
|
||||||
for (int j = i - remainder; j < i; j ++) {
|
for (int j = i - remainder; j < i; j ++) {
|
||||||
dump.append(BYTE2CHAR[buf.getUnsignedByte(j)]);
|
dump.append(BYTE2CHAR[buf.getUnsignedByte(j)]);
|
||||||
}
|
}
|
||||||
dump.append(BYTEPADDING[remainder]);
|
dump.append(BYTEPADDING[remainder])
|
||||||
dump.append('|');
|
.append('|');
|
||||||
}
|
}
|
||||||
|
|
||||||
dump.append(
|
dump.append(
|
||||||
@ -384,3 +384,4 @@ public class LoggingHandler extends ChannelDuplexHandler {
|
|||||||
return formatByteBuf(eventName, msg.content());
|
return formatByteBuf(eventName, msg.content());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -191,11 +191,11 @@ public final class UnitHelp {
|
|||||||
* Display current OS/ARCH.
|
* Display current OS/ARCH.
|
||||||
*/
|
*/
|
||||||
public static void logOsArch() {
|
public static void logOsArch() {
|
||||||
final StringBuilder text = new StringBuilder(1024);
|
final StringBuilder text = new StringBuilder(1024)
|
||||||
text.append("\n\t");
|
.append("\n\t")
|
||||||
text.append(System.getProperty("os.name"));
|
.append(System.getProperty("os.name"))
|
||||||
text.append("\n\t");
|
.append("\n\t")
|
||||||
text.append(System.getProperty("os.arch"));
|
.append(System.getProperty("os.arch"));
|
||||||
log.info("\n\t[os/arch]{}", text);
|
log.info("\n\t[os/arch]{}", text);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -396,42 +396,42 @@ public abstract class AbstractBootstrap<B extends AbstractBootstrap<B, C>, C ext
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String toString() {
|
public String toString() {
|
||||||
StringBuilder buf = new StringBuilder();
|
StringBuilder buf = new StringBuilder()
|
||||||
buf.append(StringUtil.simpleClassName(this));
|
.append(StringUtil.simpleClassName(this))
|
||||||
buf.append('(');
|
.append('(');
|
||||||
if (group != null) {
|
if (group != null) {
|
||||||
buf.append("group: ");
|
buf.append("group: ")
|
||||||
buf.append(StringUtil.simpleClassName(group));
|
.append(StringUtil.simpleClassName(group))
|
||||||
buf.append(", ");
|
.append(", ");
|
||||||
}
|
}
|
||||||
if (channelFactory != null) {
|
if (channelFactory != null) {
|
||||||
buf.append("channelFactory: ");
|
buf.append("channelFactory: ")
|
||||||
buf.append(channelFactory);
|
.append(channelFactory)
|
||||||
buf.append(", ");
|
.append(", ");
|
||||||
}
|
}
|
||||||
if (localAddress != null) {
|
if (localAddress != null) {
|
||||||
buf.append("localAddress: ");
|
buf.append("localAddress: ")
|
||||||
buf.append(localAddress);
|
.append(localAddress)
|
||||||
buf.append(", ");
|
.append(", ");
|
||||||
}
|
}
|
||||||
synchronized (options) {
|
synchronized (options) {
|
||||||
if (!options.isEmpty()) {
|
if (!options.isEmpty()) {
|
||||||
buf.append("options: ");
|
buf.append("options: ")
|
||||||
buf.append(options);
|
.append(options)
|
||||||
buf.append(", ");
|
.append(", ");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
synchronized (attrs) {
|
synchronized (attrs) {
|
||||||
if (!attrs.isEmpty()) {
|
if (!attrs.isEmpty()) {
|
||||||
buf.append("attrs: ");
|
buf.append("attrs: ")
|
||||||
buf.append(attrs);
|
.append(attrs)
|
||||||
buf.append(", ");
|
.append(", ");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (handler != null) {
|
if (handler != null) {
|
||||||
buf.append("handler: ");
|
buf.append("handler: ")
|
||||||
buf.append(handler);
|
.append(handler)
|
||||||
buf.append(", ");
|
.append(", ");
|
||||||
}
|
}
|
||||||
if (buf.charAt(buf.length() - 1) == '(') {
|
if (buf.charAt(buf.length() - 1) == '(') {
|
||||||
buf.append(')');
|
buf.append(')');
|
||||||
|
@ -224,10 +224,10 @@ public class Bootstrap extends AbstractBootstrap<Bootstrap, Channel> {
|
|||||||
|
|
||||||
StringBuilder buf = new StringBuilder(super.toString());
|
StringBuilder buf = new StringBuilder(super.toString());
|
||||||
buf.setLength(buf.length() - 1);
|
buf.setLength(buf.length() - 1);
|
||||||
buf.append(", remoteAddress: ");
|
|
||||||
buf.append(remoteAddress);
|
|
||||||
buf.append(')');
|
|
||||||
|
|
||||||
return buf.toString();
|
return buf.append(", remoteAddress: ")
|
||||||
|
.append(remoteAddress)
|
||||||
|
.append(')')
|
||||||
|
.toString();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -701,20 +701,20 @@ final class DefaultChannelPipeline implements ChannelPipeline {
|
|||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public String toString() {
|
public String toString() {
|
||||||
StringBuilder buf = new StringBuilder();
|
StringBuilder buf = new StringBuilder()
|
||||||
buf.append(StringUtil.simpleClassName(this));
|
.append(StringUtil.simpleClassName(this))
|
||||||
buf.append('{');
|
.append('{');
|
||||||
AbstractChannelHandlerContext ctx = head.next;
|
AbstractChannelHandlerContext ctx = head.next;
|
||||||
for (;;) {
|
for (;;) {
|
||||||
if (ctx == tail) {
|
if (ctx == tail) {
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
buf.append('(');
|
buf.append('(')
|
||||||
buf.append(ctx.name());
|
.append(ctx.name())
|
||||||
buf.append(" = ");
|
.append(" = ")
|
||||||
buf.append(ctx.handler().getClass().getName());
|
.append(ctx.handler().getClass().getName())
|
||||||
buf.append(')');
|
.append(')');
|
||||||
|
|
||||||
ctx = ctx.next;
|
ctx = ctx.next;
|
||||||
if (ctx == tail) {
|
if (ctx == tail) {
|
||||||
|
Loading…
Reference in New Issue
Block a user