Dustin Sallings ha scritto:

On Mar 14, 2008, at 1:51, Massimo Marazza wrote:

2008-03-14 09:14:55.140 WARN net.spy.memcached.protocol.ascii.AsciiMemcachedNodeImpl: Discarding partially completed op
: [EMAIL PROTECTED]

This is where I need better documentation around failure cases. If I've sent any data and need to reconnect, I throw away the command and tell the client there was a cancellation (though from the server-side).

Exception in thread "Memcached IO over {MemcachedConnection to /127.0.0.1:11211}" java.nio.channels.CancelledKeyException at sun.nio.ch.SelectionKeyImpl.ensureValid(SelectionKeyImpl.java:55)
      at sun.nio.ch.SelectionKeyImpl.readyOps(SelectionKeyImpl.java:69)
at java.nio.channels.SelectionKey.isReadable(SelectionKey.java:271) at net.spy.memcached.MemcachedConnection.handleIO(MemcachedConnection.java:262) at net.spy.memcached.MemcachedConnection.handleIO(MemcachedConnection.java:180)
      at net.spy.memcached.MemcachedClient.run(MemcachedClient.java:730)

Ah, OK, here's a real bug. I've updated the report (yet again *sigh*).

java.lang.AssertionError: IO Thread is not running.
at net.spy.memcached.MemcachedClient.addOp(MemcachedClient.java:195) at net.spy.memcached.MemcachedClient.asyncStore(MemcachedClient.java:237)
      at net.spy.memcached.MemcachedClient.set(MemcachedClient.java:296)
at it.kataweb.memcached.memcachedWSAsync.doStartTag(memcachedWSAsync.java:191)

    Yes, this definitely means something I didn't expect to happen did.

    Thanks for the detailed report and your patience.
Thank you very much for your reply. Do you think you will make a fix?

I've tried this workaround in the singleton that creates the MemcachedClient object

public synchronized static MemcachedClient getIstance(String hostcache) throws Exception{
 if (memcachedClient == null) {
try { memcachedClient = new MemcachedClient(AddrUtil.getAddresses(hostcache));
   } catch(Exception e) { e.printStackTrace(); }
   }else{
     if (!memcachedClient.isAlive()){
try { memcachedClient = new MemcachedClient(AddrUtil.getAddresses(hostcache));
     } catch(Exception e) {e.printStackTrace();}
   }
   return memcachedClient;
 }
}

If the memcached server is down, when I try to get a MemcachedClient object for the first time, a new MemcachedClient object is created. Next times, when I try to get an istance, the MemcachedClient is alive so the thread is running trying to connect to memcached server. When the memcached server
goes up, the thread connects to server.
Do you think it could be a good workaround?

Massimo

Reply via email to