public
Description: A simple, asynchronous, single-threaded memcached client written in java.
Homepage: http://code.google.com/p/spymemcached/
Clone URL: git://github.com/dustin/java-memcached-client.git
commit  3d806bac909790a0fee4c655a5d005ecd30d464a
tree    1a962e56e4b4c20821286a2280e919aa1e648e0f
parent  9de48599d5a18cb5d59779e7c28713b517285aa4
java-memcached-client / src / main / java / net / spy / memcached / ConnectionFactory.java
100644 73 lines (59 sloc) 1.855 kb
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
package net.spy.memcached;
 
import java.io.IOException;
import java.net.InetSocketAddress;
import java.net.SocketAddress;
import java.nio.channels.SocketChannel;
import java.util.List;
import java.util.concurrent.BlockingQueue;
 
import net.spy.memcached.ops.Operation;
 
/**
* Factory for creating instances of MemcachedConnection.
* This is used to provide more fine-grained configuration of connections.
*/
public interface ConnectionFactory {
 
  /**
   * Create a MemcachedConnection for the given SocketAddresses.
   *
   * @param addrs the addresses of the memcached servers
   * @return a new MemcachedConnection connected to those addresses
   * @throws IOException for problems initializing the memcached connections
   */
  MemcachedConnection createConnection(List<InetSocketAddress> addrs)
    throws IOException;
 
  /**
   * Create a new memcached node.
   */
  MemcachedNode createMemcachedNode(SocketAddress sa,
      SocketChannel c, int bufSize);
 
  /**
   * Create a BlockingQueue for operations for a connection.
   */
  BlockingQueue<Operation> createOperationQueue();
 
  /**
   * Create a BlockingQueue for the operations currently expecting to read
   * responses from memcached.
   */
  BlockingQueue<Operation> createReadOperationQueue();
 
  /**
   * Create a BlockingQueue for the operations currently expecting to write
   * requests to memcached.
   */
  BlockingQueue<Operation> createWriteOperationQueue();
 
 
  /**
   * Create a NodeLocator instance for the given list of nodes.
   */
  NodeLocator createLocator(List<MemcachedNode> nodes);
 
  /**
   * Get the operation factory for connections built by this connection
   * factory.
   */
  OperationFactory getOperationFactory();
 
  /**
   * Get the operation timeout used by this connection.
   */
  long getOperationTimeout();
 
  /**
   * If true, the IO thread should be a daemon thread.
   */
  boolean isDaemon();
}