[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Ping in XmlBlasterConnection



pra at mint.se wrote:
> 
> Hi,
> I am a little confused over the ping method in XmlBlasterConnection. I
> would like to use it to check connections, but it does not return
> anything and have no Exception in the signature.
> 
> Looking at the code it seems as if it should throw an exception, but
> that it will never do that:
> 
> public void ping()
>    {
>       if (isReconnectPolling)
>          return;
>       try {
>          driver.ping();
>          if (Log.CALL) Log.call(ME, "ping success() ...");
>          return;
>       } catch(ConnectionException e) {
>          if (Log.TRACE) Log.trace(ME, "ping failed, xmlBlaster seems to be down, try to reactivate connection ...");
>          try {
>             handleConnectionException(e);
>          } catch(XmlBlasterException ep) {
>             if (Log.TRACE) Log.trace(ME, "Exception in ping! " + ep.reason);
>          }
>       }
>       return ; // never reached, there is always an exception thrown
>    }
> 
> Is this a bug or feature ;-)

Every driver implementation has a method 

  public void ping() throws ConnectionException

which throws a ConnectionException on problems.
See for example:
 
xmlBlaster/src/java/org/xmlBlaster/client/protocol/corba/CorbaConnection.java
or
 
xmlBlaster/src/java/org/xmlBlaster/client/protocol/rmi/RmiConnection.java

In the code above we then call
   handleConnectionException(e);

which does the magic.

Hope it helps,

Marcel

-- 
Marcel Ruff
mailto:ruff at swand.lake.de
http://www.lake.de/home/lake/swand/
http://www.xmlBlaster.org