summaryrefslogtreecommitdiff
path: root/java/broker
diff options
context:
space:
mode:
Diffstat (limited to 'java/broker')
-rw-r--r--java/broker/src/main/java/org/apache/qpid/server/protocol/AMQMinaProtocolSession.java7
-rw-r--r--java/broker/src/main/java/org/apache/qpid/server/protocol/AMQProtocolSession.java2
-rw-r--r--java/broker/src/main/java/org/apache/qpid/server/protocol/AMQProtocolSessionMBean.java29
-rw-r--r--java/broker/src/main/java/org/apache/qpid/server/protocol/ManagedConnection.java9
4 files changed, 15 insertions, 32 deletions
diff --git a/java/broker/src/main/java/org/apache/qpid/server/protocol/AMQMinaProtocolSession.java b/java/broker/src/main/java/org/apache/qpid/server/protocol/AMQMinaProtocolSession.java
index 6ba78ba722..7a9dfbc67c 100644
--- a/java/broker/src/main/java/org/apache/qpid/server/protocol/AMQMinaProtocolSession.java
+++ b/java/broker/src/main/java/org/apache/qpid/server/protocol/AMQMinaProtocolSession.java
@@ -316,8 +316,13 @@ public class AMQMinaProtocolSession implements AMQProtocolSession,
return _channelMap.get(channelId);
}
- public void addChannel(AMQChannel channel)
+ public void addChannel(AMQChannel channel) throws AMQException
{
+ if (_closed)
+ {
+ throw new AMQException("Session is closed");
+ }
+
_channelMap.put(channel.getChannelId(), channel);
checkForNotification();
}
diff --git a/java/broker/src/main/java/org/apache/qpid/server/protocol/AMQProtocolSession.java b/java/broker/src/main/java/org/apache/qpid/server/protocol/AMQProtocolSession.java
index 03d0c50dac..a75627d240 100644
--- a/java/broker/src/main/java/org/apache/qpid/server/protocol/AMQProtocolSession.java
+++ b/java/broker/src/main/java/org/apache/qpid/server/protocol/AMQProtocolSession.java
@@ -70,7 +70,7 @@ public interface AMQProtocolSession
* @param channel the channel to associate with this session. It is an error to
* associate the same channel with more than one session but this is not validated.
*/
- void addChannel(AMQChannel channel);
+ void addChannel(AMQChannel channel) throws AMQException;
/**
* Close a specific channel. This will remove any resources used by the channel, including:
diff --git a/java/broker/src/main/java/org/apache/qpid/server/protocol/AMQProtocolSessionMBean.java b/java/broker/src/main/java/org/apache/qpid/server/protocol/AMQProtocolSessionMBean.java
index a47d462810..d57f9b9be1 100644
--- a/java/broker/src/main/java/org/apache/qpid/server/protocol/AMQProtocolSessionMBean.java
+++ b/java/broker/src/main/java/org/apache/qpid/server/protocol/AMQProtocolSessionMBean.java
@@ -18,6 +18,9 @@
package org.apache.qpid.server.protocol;
import org.apache.qpid.AMQException;
+import org.apache.qpid.protocol.AMQConstant;
+import org.apache.qpid.framing.ConnectionCloseBody;
+import org.apache.qpid.framing.AMQFrame;
import org.apache.qpid.server.AMQChannel;
import org.apache.qpid.server.management.AMQManagedObject;
import org.apache.qpid.server.management.MBeanConstructor;
@@ -183,33 +186,17 @@ public class AMQProtocolSessionMBean extends AMQManagedObject implements Managed
}
/**
- * @see AMQMinaProtocolSession#closeChannel(int)
- */
- public void closeChannel(int id) throws JMException
- {
- try
- {
- AMQChannel channel = _session.getChannel(id);
- if (channel == null)
- {
- throw new JMException("The channel (channel Id = " + id + ") does not exist");
- }
-
- _session.closeChannel(id);
- }
- catch (AMQException ex)
- {
- throw new MBeanException(ex, ex.toString());
- }
- }
-
- /**
* closes the connection. The administrator can use this management operation to close connection to free up
* resources.
* @throws JMException
*/
public void closeConnection() throws JMException
{
+
+ final AMQFrame response = ConnectionCloseBody.createAMQFrame(0, AMQConstant.REPLY_SUCCESS.getCode(),
+ "Broker Management Console has closing the connection.", 0, 0);
+ _session.writeFrame(response);
+
try
{
_session.closeSession();
diff --git a/java/broker/src/main/java/org/apache/qpid/server/protocol/ManagedConnection.java b/java/broker/src/main/java/org/apache/qpid/server/protocol/ManagedConnection.java
index 2f3102b048..1a7b7e9e96 100644
--- a/java/broker/src/main/java/org/apache/qpid/server/protocol/ManagedConnection.java
+++ b/java/broker/src/main/java/org/apache/qpid/server/protocol/ManagedConnection.java
@@ -114,15 +114,6 @@ public interface ManagedConnection
void rollbackTransactions(@MBeanOperationParameter(name="channel Id", description="channel Id")int channelId) throws JMException;
/**
- * Unsubscribes the consumers and unregisters the channel from managed objects.
- */
- @MBeanOperation(name="closeChannel",
- description="Closes the channel with given channel Id and connected consumers will be unsubscribed",
- impact= MBeanOperationInfo.ACTION)
- void closeChannel(@MBeanOperationParameter(name="channel Id", description="channel Id")int channelId)
- throws Exception;
-
- /**
* Closes all the related channels and unregisters this connection from managed objects.
*/
@MBeanOperation(name="closeConnection",