54 final ExecutorService executorService = Executors.newFixedThreadPool(1000,
daemonThreadFactory());
57 final long start = System.currentTimeMillis();
59 for (
int i = 0; i < count; i++) {
61 executorService.execute(
new Runnable() {
69 OperationFuture<Boolean>
set = null;
70 for (
int j = 0; j < 3; j++) {
71 set = client.set(Integer.toString(key), 60, toPut);
74 OperationStatus status =
set.getStatus();
77 " key: " + key +
", time: " + (
new Date().getTime() - start) +
"ms, set: " + status);
79 executorService.execute(
new Runnable() {
84 if (random % 3 == 0) {
87 }
catch (InterruptedException e) {
92 Object
get = client.get(Integer.toString(key));
93 System.out.println(
"GET key: " + key +
" result: " +
get);
static MemcachedClient createClients()
Definition: CacheGrantManual.java:41
static CacheGrant testGrant()
Definition: CacheGrantManual.java:156
static int random()
Definition: CacheGrantManual.java:46
static ThreadFactory daemonThreadFactory()
Definition: CacheGrantManual.java:122
static void sleep(int seconds)
Definition: CacheGrantManual.java:114