You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@qpid.apache.org by ra...@apache.org on 2006/12/14 14:57:46 UTC

svn commit: r487214 - in /incubator/qpid/trunk/qpid/java/client/src/main/java/org/apache/qpid/client: AMQSession.java TopicPublisherAdapter.java

Author: rajith
Date: Thu Dec 14 05:57:45 2006
New Revision: 487214

URL: http://svn.apache.org/viewvc?view=rev&rev=487214
Log:
fixed a merge conflict for TopicPublisherAdapter.java and a possible fix for QPID-183

Modified:
    incubator/qpid/trunk/qpid/java/client/src/main/java/org/apache/qpid/client/AMQSession.java
    incubator/qpid/trunk/qpid/java/client/src/main/java/org/apache/qpid/client/TopicPublisherAdapter.java

Modified: incubator/qpid/trunk/qpid/java/client/src/main/java/org/apache/qpid/client/AMQSession.java
URL: http://svn.apache.org/viewvc/incubator/qpid/trunk/qpid/java/client/src/main/java/org/apache/qpid/client/AMQSession.java?view=diff&rev=487214&r1=487213&r2=487214
==============================================================================
--- incubator/qpid/trunk/qpid/java/client/src/main/java/org/apache/qpid/client/AMQSession.java (original)
+++ incubator/qpid/trunk/qpid/java/client/src/main/java/org/apache/qpid/client/AMQSession.java Thu Dec 14 05:57:45 2006
@@ -28,6 +28,7 @@
 import org.apache.qpid.client.message.JMSStreamMessage;
 import org.apache.qpid.client.message.MessageFactoryRegistry;
 import org.apache.qpid.client.message.UnprocessedMessage;
+import org.apache.qpid.client.protocol.AMQMethodEvent;
 import org.apache.qpid.client.protocol.AMQProtocolHandler;
 import org.apache.qpid.client.util.FlowControllingBlockingQueue;
 import org.apache.qpid.framing.*;
@@ -1143,9 +1144,18 @@
     public void unsubscribe(String name) throws JMSException
     {
         checkNotClosed();
-
-        //send a queue.delete for the subscription
+   	      
         String queue = _connection.getClientID() + ":" + name;
+ 
+        AMQFrame queueDeclareFrame = QueueDeclareBody.createAMQFrame(_channelId,0,queue,true,false, false, false, true, null);        
+        
+        try {
+			AMQMethodEvent event = _connection.getProtocolHandler().syncWrite(queueDeclareFrame,QueueDeclareOkBody.class);
+			// if this method doen't throw an exception means we have received a queue declare ok.
+		} catch (AMQException e) {
+			throw new javax.jms.InvalidDestinationException("This destination doesn't exist");
+		}       
+        //send a queue.delete for the subscription
         AMQFrame frame = QueueDeleteBody.createAMQFrame(_channelId, 0, queue, false, false, true);
         _connection.getProtocolHandler().writeFrame(frame);
     }

Modified: incubator/qpid/trunk/qpid/java/client/src/main/java/org/apache/qpid/client/TopicPublisherAdapter.java
URL: http://svn.apache.org/viewvc/incubator/qpid/trunk/qpid/java/client/src/main/java/org/apache/qpid/client/TopicPublisherAdapter.java?view=diff&rev=487214&r1=487213&r2=487214
==============================================================================
--- incubator/qpid/trunk/qpid/java/client/src/main/java/org/apache/qpid/client/TopicPublisherAdapter.java (original)
+++ incubator/qpid/trunk/qpid/java/client/src/main/java/org/apache/qpid/client/TopicPublisherAdapter.java Thu Dec 14 05:57:45 2006
@@ -43,7 +43,12 @@
         _delegate.send(msg, deliveryMode, priority, timeToLive);
     }
 
-    public void publish(Topic topic, Message msg, int deliveryMode, int priority, long timeToLive)
+	public int getDeliveryMode() throws JMSException {
+		checkPreConditions();
+		return _delegate.getDeliveryMode();
+	}
+
+	public void publish(Topic topic, Message msg, int deliveryMode, int priority, long timeToLive)
             throws JMSException
     {
         checkPreConditions();
@@ -51,41 +56,37 @@
         _delegate.send(topic, msg, deliveryMode, priority, timeToLive);
     }
 
-    public void close() throws JMSException
+	public void close() throws JMSException
     {
         _delegate.close();
     }
 
-    public int getDeliveryMode() throws JMSException
-    {
-        return _delegate.getDeliveryMode();
-    }
-
+	public boolean getDisableMessageID() throws JMSException {
+		checkPreConditions();
+		return _delegate.getDisableMessageID();
+	}
+
+	public boolean getDisableMessageTimestamp() throws JMSException {
+		checkPreConditions();
+		return _delegate.getDisableMessageTimestamp();
+	}
+	
     public Destination getDestination() throws JMSException
     {
+		checkPreConditions();
         return _delegate.getDestination();
     }
 
-    public boolean getDisableMessageID() throws JMSException
-    {
-        return _delegate.getDisableMessageID();
-    }
-
-    public boolean getDisableMessageTimestamp() throws JMSException
-    {
-        return _delegate.getDisableMessageTimestamp();
-    }
-
-    public int getPriority() throws JMSException
-    {
-        return _delegate.getPriority();
-    }
-
-    public long getTimeToLive() throws JMSException
-    {
-        return _delegate.getTimeToLive();
-    }
-
+    public int getPriority() throws JMSException {
+		checkPreConditions();
+		return _delegate.getPriority();
+	}
+
+    public long getTimeToLive() throws JMSException {
+		checkPreConditions();
+		return _delegate.getTimeToLive();
+	}
+    
     public void send(Message msg) throws JMSException
     {
         checkPreConditions();