@@ -0,0 +1,1953 @@
+package net.rubyeye.xmemcached.example;%0A%0Aimport java.io.IOException;%0Aimport java.net.InetSocketAddress;%0A%0Aimport net.rubyeye.xmemcached.MemcachedClient;%0Aimport net.rubyeye.xmemcached.MemcachedClientBuilder;%0Aimport net.rubyeye.xmemcached.MemcachedClientStateListener;%0Aimport net.rubyeye.xmemcached.XMemcachedClientBuilder;%0Aimport net.rubyeye.xmemcached.utils.AddrUtil;%0A%0Aclass MyListener implements MemcachedClientStateListener %7B%0A%0A%09public void onConnected(MemcachedClient memcachedClient,%0A%09%09%09InetSocketAddress inetSocketAddress) %7B%0A%09%09System.out.println(%22Connect to %22 + inetSocketAddress);%0A%09%7D%0A%0A%09public void onDisconnected(MemcachedClient memcachedClient,%0A%09%09%09InetSocketAddress inetSocketAddress) %7B%0A%09%09System.out.println(%22Disconnect from %22 + inetSocketAddress);%0A%0A%09%7D%0A%0A%09public void onException(MemcachedClient memcachedClient, Throwable throwable) %7B%0A%09%09throwable.printStackTrace();%0A%0A%09%7D%0A%0A%09public void onShutDown(MemcachedClient memcachedClient) %7B%0A%09%09System.out.println(%22MemcachedClient has been shutdown%22);%0A%0A%09%7D%0A%0A%09public void onStarted(MemcachedClient memcachedClient) %7B%0A%09%09System.out.println(%22MemcachedClient has been started%22);%0A%0A%09%7D%0A%0A%7D%0A%0Apublic class MemcachedStateListenerExample %7B%0A%09public static void main(String%5B%5D args) %7B%0A%09%09if (args.length %3C 1) %7B%0A%09%09%09System.err%0A%09%09%09%09%09.println(%22Useage:java MemcachedStateListenerExample %5Bservers%5D%22);%0A%09%09%09System.exit(1);%0A%09%09%7D%0A%09%09MemcachedClient memcachedClient = getMemcachedClient(args%5B0%5D);%0A%09%09try %7B%0A%09%09%09memcachedClient.shutdown();%0A%09%09%7D catch (IOException e) %7B%0A%09%09%09e.printStackTrace();%0A%09%09%7D%0A%09%7D%0A%0A%09public static MemcachedClient getMemcachedClient(String servers) %7B%0A%09%09try %7B%0A%09%09%09// use text protocol by default%0A%09%09%09MemcachedClientBuilder builder = new XMemcachedClientBuilder(%0A%09%09%09%09%09AddrUtil.getAddresses(servers));%0A%09%09%09// Add my state listener%0A%09%09%09builder.addStateListener(new MyListener());%0A%09%09%09return builder.build();%0A%09%09%7D catch (IOException e) %7B%0A%09%09%09System.err.println(%22Create MemcachedClient fail%22);%0A%09%09%09e.printStackTrace();%0A%09%09%7D%0A%09%09return null;%0A%09%7D%0A%0A%7D%0A

Add MemcachedStateListenerExample