Skip to content

Commit

Permalink
DUBBO-166 增强 codec 避免数据 copy
Browse files Browse the repository at this point in the history
  • Loading branch information
kimi committed Oct 15, 2012
1 parent 5ed0e9f commit 955a1a7
Show file tree
Hide file tree
Showing 9 changed files with 1,077 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,12 @@ public final class ChannelBuffers {

public static final ChannelBuffer EMPTY_BUFFER = new HeapChannelBuffer(0);

private ChannelBuffers() {}

public static ChannelBuffer dynamicBuffer() {
return dynamicBuffer(256);
}

public static ChannelBuffer dynamicBuffer(int capacity) {
return new DynamicChannelBuffer(capacity);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -75,8 +75,7 @@ public void reset(URL url) {
}
try {
if (url.hasParameter(Constants.CODEC_KEY)) {
String c = url.getParameter(Constants.CODEC_KEY);
this.codec = ExtensionLoader.getExtensionLoader(ChannelCodec.class).getExtension(c);
this.codec = getChannelCodec(url);
}
} catch (Throwable t) {
logger.error(t.getMessage(), t);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@

import com.alibaba.dubbo.common.io.UnsafeByteArrayInputStream;
import com.alibaba.dubbo.common.io.UnsafeByteArrayOutputStream;
import com.alibaba.dubbo.common.utils.Assert;
import com.alibaba.dubbo.remoting.Channel;
import com.alibaba.dubbo.remoting.Codec;
import com.alibaba.dubbo.remoting.ChannelCodec;
Expand All @@ -33,6 +34,7 @@ public class ChannelCodecAdapter implements ChannelCodec {
private Codec codec;

public ChannelCodecAdapter(Codec codec) {
Assert.notNull(codec, "codec == null");
this.codec = codec;
}

Expand Down
Loading

0 comments on commit 955a1a7

Please sign in to comment.