[jboss-user] [JBoss Cache: Core Edition] - Re: TcpDelegatingCacheLoader

lovelyliatroim do-not-reply at jboss.com
Mon Jan 12 04:56:21 EST 2009


"lovelyliatroim" wrote : anonymous wrote : 
  |   | No reason, really. Happy to accept a patch, to make this configurable using a cache loader property.
  |   | 
  | 
  | Created one for the 2.2.1.GA version
  | https://jira.jboss.org/jira/browse/JBCACHE-1451
  | 

Hi Manik,
   You might have to revert that patch or take a new one.

Here is the problem.



  |   protected transient Object invokeWithRetries(Method m, Object params[])
  |     {
  |         long endTime = System.currentTimeMillis() + (long)config.getTimeout();
  | _L2:
  |         return m.invoke(this, params);
  |         IllegalAccessException e;
  |         e;
  |         log.error("Should never get here!", e);
  |         continue; /* Loop/switch isn't completed */
  |         e;
  |         if(e.getCause() instanceof IOException)
  |         {
  |             try
  |             {
  |                 if(log.isDebugEnabled())
  |                 {
  |                     log.debug("Caught IOException.  Retrying.", e);
  |                 }
  |                 Thread.sleep(config.getReconnectWaitTime());
  |                 restart();
  |             }
  |             catch(IOException e1) { }
  |             catch(InterruptedException e1) { }
  |         } else
  |         {
  |             throw new CacheException("Problems invoking method call!", e);
  |         }
  |         if(System.currentTimeMillis() < endTime) goto _L2; else goto _L1
  | _L1:
  |         throw new CacheException((new StringBuilder()).append("Unable to communicate with TCPCacheServer(").append(config.getHost()).append(":").append(config.getPort()).append(") after ").append(config.getTimeout()).append(" millis, with reconnects every ").append(config.getReconnectWaitTime()).append(" millis.").toString());
  |     }
  | 

Problem is this, if we have a timeout,which the patch allows you to do, it throws an IOExcpeption. When we get an IOEXception we will call "restart" which tears down and up the socket even though its not needed. We shouldnt be tearing up and down the socket if we timeout.

2nd problem it is not thread safe. Multiple threads can call restart if we timeout. 


So you either revert it or take a 2nd patch. I have already adopted my version so patch is available if needed.

Just so you know about it.

Cheers,
LL


View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4200925#4200925

Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4200925



More information about the jboss-user mailing list