1 | package net.spy.memcached; |
2 | |
3 | import java.net.SocketAddress; |
4 | import java.nio.channels.SocketChannel; |
5 | |
6 | import net.spy.memcached.protocol.binary.BinaryMemcachedNodeImpl; |
7 | import net.spy.memcached.protocol.binary.BinaryOperationFactory; |
8 | |
9 | /** |
10 | * Default connection factory for binary wire protocol connections. |
11 | */ |
12 | public class BinaryConnectionFactory extends DefaultConnectionFactory { |
13 | |
14 | /** |
15 | * Create a DefaultConnectionFactory with the default parameters. |
16 | */ |
17 | public BinaryConnectionFactory() { |
18 | super(); |
19 | } |
20 | |
21 | /** |
22 | * Create a BinaryConnectionFactory with the given maximum operation |
23 | * queue length, and the given read buffer size. |
24 | */ |
25 | public BinaryConnectionFactory(int len, int bufSize) { |
26 | super(len, bufSize); |
27 | } |
28 | |
29 | /** |
30 | * Construct a BinaryConnectionFactory with the given parameters. |
31 | * |
32 | * @param len the queue length. |
33 | * @param bufSize the buffer size |
34 | * @param hash the algorithm to use for hashing |
35 | */ |
36 | public BinaryConnectionFactory(int len, int bufSize, HashAlgorithm hash) { |
37 | super(len, bufSize, hash); |
38 | } |
39 | |
40 | @Override |
41 | public MemcachedNode createMemcachedNode(SocketAddress sa, |
42 | SocketChannel c, int bufSize) { |
43 | return new BinaryMemcachedNodeImpl(sa, c, bufSize, |
44 | createReadOperationQueue(), |
45 | createWriteOperationQueue(), |
46 | createOperationQueue()); |
47 | } |
48 | |
49 | @Override |
50 | public OperationFactory getOperationFactory() { |
51 | return new BinaryOperationFactory(); |
52 | } |
53 | |
54 | } |