From 7db0c0970eac260626263314c30f0e20d4ef6c21 Mon Sep 17 00:00:00 2001 From: Alan Conway Date: Fri, 17 Oct 2008 16:45:24 +0000 Subject: QPID-1367 Mick Goulish: improvements to client-side failover. git-svn-id: https://svn.apache.org/repos/asf/incubator/qpid/trunk/qpid@705668 13f79535-47bb-0310-9956-ffa450edef68 --- cpp/src/qpid/client/FailoverSession.cpp | 28 +++++++++++++++++++++------- 1 file changed, 21 insertions(+), 7 deletions(-) (limited to 'cpp/src/qpid/client/FailoverSession.cpp') diff --git a/cpp/src/qpid/client/FailoverSession.cpp b/cpp/src/qpid/client/FailoverSession.cpp index a088a8c91b..25867c2a24 100644 --- a/cpp/src/qpid/client/FailoverSession.cpp +++ b/cpp/src/qpid/client/FailoverSession.cpp @@ -38,7 +38,7 @@ namespace qpid { namespace client { FailoverSession::FailoverSession ( ) : - name("no_name") + failover_in_progress(false) { // The session is created by FailoverConnection::newSession failoverSubscriptionManager = 0; @@ -170,11 +170,26 @@ FailoverSession::messageTransfer ( const string& destination, ) { - session.messageTransfer ( destination, - acceptMode, - acquireMode, - content - ); + while ( 1 ) + { + try + { + session.messageTransfer ( destination, + acceptMode, + acquireMode, + content + ); + break; + } + catch ( ... ) + { + // Take special action only if there is a failover in progress. + if ( ! failover_in_progress ) + break; + + usleep ( 1000 ); + } + } } @@ -583,7 +598,6 @@ FailoverSession::prepareForFailover ( Connection newConnection ) if ( failoverSubscriptionManager ) { - // failoverSubscriptionManager->prepareForFailover ( newSession ); } } -- cgit v1.2.1