Author: rhs
Date: Tue Apr 22 12:15:39 2008
New Revision: 650617
URL: http://svn.apache.org/viewvc?rev=650617&view=rev
Log:
QPID-832: moved more 0-8 specific code into 0-8 subclasses
Modified:
incubator/qpid/branches/thegreatmerge/qpid/java/client/src/main/java/org/apache/qpid/client/BasicMessageConsumer.java
incubator/qpid/branches/thegreatmerge/qpid/java/client/src/main/java/org/apache/qpid/client/BasicMessageConsumer_0_10.java
incubator/qpid/branches/thegreatmerge/qpid/java/client/src/main/java/org/apache/qpid/client/BasicMessageConsumer_0_8.java
Modified:
incubator/qpid/branches/thegreatmerge/qpid/java/client/src/main/java/org/apache/qpid/client/BasicMessageConsumer.java
URL:
http://svn.apache.org/viewvc/incubator/qpid/branches/thegreatmerge/qpid/java/client/src/main/java/org/apache/qpid/client/BasicMessageConsumer.java?rev=650617&r1=650616&r2=650617&view=diff
==============================================================================
---
incubator/qpid/branches/thegreatmerge/qpid/java/client/src/main/java/org/apache/qpid/client/BasicMessageConsumer.java
(original)
+++
incubator/qpid/branches/thegreatmerge/qpid/java/client/src/main/java/org/apache/qpid/client/BasicMessageConsumer.java
Tue Apr 22 12:15:39 2008
@@ -546,18 +546,9 @@
// The Synchronized block only needs to protect network
traffic.
synchronized (_connection.getFailoverMutex())
{
- BasicCancelBody body =
getSession().getMethodRegistry().createBasicCancelBody(_consumerTag, false);
-
- final AMQFrame cancelFrame =
body.generateFrame(_channelId);
-
try
{
- _protocolHandler.syncWrite(cancelFrame,
BasicCancelOkBody.class);
-
- if (_logger.isDebugEnabled())
- {
- _logger.debug("CancelOk'd for consumer:" +
debugIdentity());
- }
+ sendCancel();
}
catch (AMQException e)
{
@@ -592,7 +583,7 @@
}
}
- public abstract void sendCancel() throws JMSAMQException;
+ abstract void sendCancel() throws AMQException, FailoverException;
/**
* Called when you need to invalidate a consumer. Used for example when
failover has occurred and the client has
Modified:
incubator/qpid/branches/thegreatmerge/qpid/java/client/src/main/java/org/apache/qpid/client/BasicMessageConsumer_0_10.java
URL:
http://svn.apache.org/viewvc/incubator/qpid/branches/thegreatmerge/qpid/java/client/src/main/java/org/apache/qpid/client/BasicMessageConsumer_0_10.java?rev=650617&r1=650616&r2=650617&view=diff
==============================================================================
---
incubator/qpid/branches/thegreatmerge/qpid/java/client/src/main/java/org/apache/qpid/client/BasicMessageConsumer_0_10.java
(original)
+++
incubator/qpid/branches/thegreatmerge/qpid/java/client/src/main/java/org/apache/qpid/client/BasicMessageConsumer_0_10.java
Tue Apr 22 12:15:39 2008
@@ -211,20 +211,13 @@
* This method is invoked when this consumer is stopped.
* It tells the broker to stop delivering messages to this consumer.
*/
- public void sendCancel() throws JMSAMQException
+ void sendCancel() throws AMQException
{
((AMQSession_0_10)
getSession()).getQpidSession().messageCancel(getConsumerTag().toString());
((AMQSession_0_10) getSession()).getQpidSession().sync();
// confirm cancel
getSession().confirmConsumerCancelled(getConsumerTag());
- try
- {
- ((AMQSession_0_10) getSession()).getCurrentException();
- }
- catch (AMQException e)
- {
- throw new JMSAMQException("Problem when stopping consumer", e);
- }
+ ((AMQSession_0_10) getSession()).getCurrentException();
}
void notifyMessage(UnprocessedMessage messageFrame, int channelId)
Modified:
incubator/qpid/branches/thegreatmerge/qpid/java/client/src/main/java/org/apache/qpid/client/BasicMessageConsumer_0_8.java
URL:
http://svn.apache.org/viewvc/incubator/qpid/branches/thegreatmerge/qpid/java/client/src/main/java/org/apache/qpid/client/BasicMessageConsumer_0_8.java?rev=650617&r1=650616&r2=650617&view=diff
==============================================================================
---
incubator/qpid/branches/thegreatmerge/qpid/java/client/src/main/java/org/apache/qpid/client/BasicMessageConsumer_0_8.java
(original)
+++
incubator/qpid/branches/thegreatmerge/qpid/java/client/src/main/java/org/apache/qpid/client/BasicMessageConsumer_0_8.java
Tue Apr 22 12:15:39 2008
@@ -51,30 +51,17 @@
acknowledgeMode, noConsume, autoClose);
}
- public void sendCancel() throws JMSAMQException
+ void sendCancel() throws AMQException, FailoverException
{
- final AMQFrame cancelFrame =
_connection.getProtocolHandler().getMethodRegistry().
- createBasicCancelBody(_consumerTag, //
consumerTag
- false). // nowait
- generateFrame(_channelId);
+ BasicCancelBody body =
getSession().getMethodRegistry().createBasicCancelBody(_consumerTag, false);
- try
- {
- _protocolHandler.syncWrite(cancelFrame, BasicCancelOkBody.class);
+ final AMQFrame cancelFrame = body.generateFrame(_channelId);
- if (_logger.isDebugEnabled())
- {
- _logger.debug("CancelOk'd for consumer:" + debugIdentity());
- }
+ _protocolHandler.syncWrite(cancelFrame, BasicCancelOkBody.class);
- }
- catch (AMQException e)
+ if (_logger.isDebugEnabled())
{
- throw new JMSAMQException("Error closing consumer: " + e, e);
- }
- catch (FailoverException e)
- {
- throw new JMSAMQException("FailoverException interrupted basic
cancel.", e);
+ _logger.debug("CancelOk'd for consumer:" + debugIdentity());
}
}
@@ -86,5 +73,5 @@
messageFrame.getRoutingKey(), messageFrame.getContentHeader(),
messageFrame.getBodies());
}
-
+
}