Skip to content

Commit 676b1c3

Browse files
committed
fix issue 21: Miss construction functions in MemCachedClient --
compatibility issue.
1 parent ab2cc7e commit 676b1c3

File tree

4 files changed

+158
-0
lines changed

4 files changed

+158
-0
lines changed

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

Lines changed: 142 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -371,6 +371,148 @@ public MemCachedClient(String poolName, boolean isTcp, boolean binaryProtocal) {
371371
client = isTcp ? new AscIIClient(poolName) : new AscIIUDPClient(poolName);
372372
}
373373

374+
/**
375+
* create memcached client.
376+
*
377+
* @param poolName
378+
* pool name
379+
* @param isTcp
380+
* is tcp protocol?
381+
* @param binaryProtocol
382+
* is binary protocol?
383+
* @param cl
384+
* classloader.
385+
* @param eh
386+
* errorhandler.
387+
* @deprecated will be removed in next release. <br>
388+
* Please use customized transcoder
389+
* {@link com.schooner.MemCached.AbstractTransCoder} to achieve
390+
* the same objective.
391+
*/
392+
public MemCachedClient(String poolName, boolean isTcp, boolean binaryProtocol, ClassLoader cl, ErrorHandler eh) {
393+
if (binaryProtocol)
394+
client = new BinaryClient(poolName, cl, eh);
395+
else
396+
client = isTcp ? new AscIIClient(poolName, cl, eh) : new AscIIUDPClient(poolName, cl, eh);
397+
}
398+
399+
/**
400+
* Creates a new instance of MemCacheClient but acceptes a passed in
401+
* ClassLoader.
402+
*
403+
* @param classLoader
404+
* ClassLoader object.
405+
* @deprecated will be removed in next release. <br>
406+
* Please use customized transcoder
407+
* {@link com.schooner.MemCached.AbstractTransCoder} to achieve
408+
* the same objective.
409+
*/
410+
411+
public MemCachedClient(ClassLoader classLoader) {
412+
this();
413+
client.setClassLoader(classLoader);
414+
}
415+
416+
/**
417+
* Creates a new instance of MemCacheClient but acceptes a passed in
418+
* ClassLoader and a passed in ErrorHandler.
419+
*
420+
* @param classLoader
421+
* ClassLoader object.
422+
* @param errorHandler
423+
* ErrorHandler object.
424+
* @deprecated will be removed in next release. <br>
425+
* Please use customized transcoder
426+
* {@link com.schooner.MemCached.AbstractTransCoder} to achieve
427+
* the same objective.
428+
*/
429+
public MemCachedClient(ClassLoader classLoader, ErrorHandler errorHandler) {
430+
this(null, true, false, classLoader, errorHandler);
431+
}
432+
433+
/**
434+
* Creates a new instance of MemCacheClient but acceptes a passed in
435+
* ClassLoader, ErrorHandler, and SockIOPool name.
436+
*
437+
* @param classLoader
438+
* ClassLoader object.
439+
* @param errorHandler
440+
* ErrorHandler object.
441+
* @param poolName
442+
* SockIOPool name
443+
* @deprecated will be removed in next release. <br>
444+
* Please use customized transcoder
445+
* {@link com.schooner.MemCached.AbstractTransCoder} to achieve
446+
* the same objective.
447+
*/
448+
449+
public MemCachedClient(ClassLoader classLoader, ErrorHandler errorHandler, String poolName) {
450+
this(poolName, true, false, classLoader, errorHandler);
451+
}
452+
453+
/**
454+
* Sets an optional ClassLoader to be used for serialization.
455+
*
456+
* @param classLoader
457+
* @deprecated will be removed in next release. <br>
458+
* Please use customized transcoder
459+
* {@link com.schooner.MemCached.AbstractTransCoder} to achieve
460+
* the same objective.
461+
*/
462+
public void setClassLoader(ClassLoader classLoader) {
463+
throw new UnsupportedOperationException();
464+
}
465+
466+
/**
467+
* Sets an optional ErrorHandler.
468+
*
469+
* @param errorHandler
470+
* @deprecated will be removed in next release. The purpose of adding this
471+
* support was to make it compatible with previous releases.
472+
*/
473+
474+
public void setErrorHandler(ErrorHandler errorHandler) {
475+
throw new UnsupportedOperationException();
476+
}
477+
478+
/**
479+
* Enable storing compressed data, provided it meets the threshold
480+
* requirements.
481+
*
482+
* If enabled, data will be stored in compressed form if it is<br/>
483+
* longer than the threshold length set with setCompressThreshold(int)<br/>
484+
* <br/>
485+
* The default is that compression is enabled.<br/>
486+
* <br/>
487+
* Even if compression is disabled, compressed data will be automatically<br/>
488+
* decompressed.
489+
*
490+
* @param compressEnable
491+
* <CODE>true</CODE> to enable compression, <CODE>false</CODE> to
492+
* disable compression
493+
* @deprecated will be removed in next release.
494+
*/
495+
public void setCompressEnable(boolean compressEnable) {
496+
throw new UnsupportedOperationException();
497+
}
498+
499+
/**
500+
* Sets the required length for data to be considered for compression.
501+
*
502+
* If the length of the data to be stored is not equal or larger than this
503+
* value, it will not be compressed.
504+
*
505+
* This defaults to 15 KB.
506+
*
507+
* @param compressThreshold
508+
* required length of data to consider compression
509+
* @deprecated will be removed in next release.
510+
*/
511+
512+
public void setCompressThreshold(long compressThreshold) {
513+
throw new UnsupportedOperationException();
514+
}
515+
374516
/**
375517
* Sets default String encoding when storing primitives as Strings. Default
376518
* is UTF-8.

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

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,11 @@
22

33
import javax.security.auth.callback.CallbackHandler;
44

5+
/**
6+
* @author Meng Li
7+
* @since 2.6.1
8+
* @see AuthInfo
9+
*/
510
public class AuthInfo {
611

712
private final CallbackHandler callbackHandler;

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

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,14 @@
1010

1111
import com.danga.MemCached.MemCachedClient;
1212

13+
/**
14+
* * {@link AuthSchoonerSockIOFactory} is used to create and destroy socket for
15+
* connection pool with authorized information.
16+
*
17+
* @author Meng Li
18+
* @since 2.6.1
19+
* @see AuthSchoonerSockIOFactory
20+
*/
1321
public class AuthSchoonerSockIOFactory extends SchoonerSockIOFactory {
1422

1523
// logger

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

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,9 @@
77
import com.schooner.MemCached.SchoonerSockIOPool.UDPSockIO;
88

99
/**
10+
* {@link SchoonerSockIOFactory} is used to create and destroy socket for
11+
* connection pool.
12+
*
1013
* @author Meng Li
1114
* @since 2.6.0
1215
* @see SchoonerSockIOFactory

0 commit comments

Comments
 (0)