Skip to content

Commit d7281f6

Browse files
committed
Add some comment for UDP client
Change-Id: I1be404decbab1a9d8778fb6cc783a2ed44114acd
1 parent c19fb9e commit d7281f6

File tree

4 files changed

+25
-10
lines changed

4 files changed

+25
-10
lines changed

src/main/com/danga/MemCached/MemCachedClient.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -289,8 +289,8 @@ public boolean isUseBinaryProtocol() {
289289
* used when you want to create a ASCIIClient/BinaryClient/UDPASCIIClient
290290
* instance
291291
*/
292-
protected MemCachedClient(String a, String b) {
293-
client = null;
292+
protected MemCachedClient(MemCachedClient client) {
293+
this.client = client;
294294
}
295295

296296
/**

src/main/com/schooner/MemCached/AscIIClient.java

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,8 @@
5353
/**
5454
* This client implements the text protocol of memcached in a very high
5555
* performance way.<br>
56-
* Please use the wrapper class {@link MemCachedClient2} for accessing the
56+
* <br>
57+
* Please use the wrapper class {@link MemCachedClient} for accessing the
5758
* memcached server.
5859
*
5960
* @author Xingen Wang
@@ -99,13 +100,13 @@ public AscIIClient() {
99100
* whether use binary protocol.
100101
*/
101102
public AscIIClient(String poolName) {
102-
super("a", "b");
103+
super((MemCachedClient) null);
103104
this.poolName = poolName;
104105
init();
105106
}
106107

107108
public AscIIClient(String poolName, ClassLoader cl, ErrorHandler eh) {
108-
super("a", "b");
109+
super((MemCachedClient) null);
109110
this.poolName = poolName;
110111
this.classLoader = cl;
111112
this.errorHandler = eh;

src/main/com/schooner/MemCached/AscIIUDPClient.java

Lines changed: 16 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -47,10 +47,23 @@
4747
import com.schooner.MemCached.command.SyncCommand;
4848

4949
/**
50-
* This client implements the text protocol of memcached in a very high
50+
* This client implements the UDP protocol of memcached in a very high
5151
* performance way.<br>
52-
* Please use the wrapper class {@link MemCachedClient2} for accessing the
53-
* memcached server.
52+
* <br>
53+
* Please use the wrapper class {@link MemCachedClient} for accessing the
54+
* memcached server.<br>
55+
* <br>
56+
*
57+
* When you are using memcached UDP protocol, pay attention that the data size
58+
* limit is about 64K due to the datagram length limit of UDP protocol.<br>
59+
* <br>
60+
*
61+
* A UDP datagram length field specifies the length in bytes of the entire
62+
* datagram: header and data. The minimum length is 8 bytes since that's the
63+
* length of the header. The field size sets a theoretical limit of 65,535 bytes
64+
* (8 byte header + 65,527 bytes of data) for a UDP datagram. The practical
65+
* limit for the data length which is imposed by the underlying IPv4 protocol is
66+
* 65,507 bytes (65,535 − 8 byte UDP header − 20 byte IP header).
5467
*
5568
* @author Xingen Wang
5669
* @since 2.5.0

src/main/com/schooner/MemCached/BinaryClient.java

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,8 @@
5353
/**
5454
* This client implements the binary protocol of memcached in a very high
5555
* performance way.<br>
56-
* Please use the wrapper class {@link MemCachedClient2} for accessing the
56+
* <br>
57+
* Please use the wrapper class {@link MemCachedClient} for accessing the
5758
* memcached server.
5859
*
5960
* @author Xingen Wang
@@ -102,7 +103,7 @@ public BinaryClient(String poolName) {
102103
}
103104

104105
public BinaryClient(String poolName, ClassLoader cl, ErrorHandler eh) {
105-
super("a", "b");
106+
super((MemCachedClient) null);
106107
this.poolName = poolName;
107108
this.classLoader = cl;
108109
this.errorHandler = eh;

0 commit comments

Comments
 (0)