[ 
https://issues.apache.org/jira/browse/QPID-5081?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13743178#comment-13743178
 ] 

Rob Godfrey commented on QPID-5081:
-----------------------------------

Further improvements could be made by trying to move the mechanic around 
autodelete tasks into common code

Currently QueueDeclareHandler has this code:

{code}
                queue.setAuthorizationHolder(protocolConnection);

                if (body.getExclusive())
                {
                    
queue.setExclusiveOwningSession(protocolConnection.getChannel(channelId));
                    queue.setAuthorizationHolder(protocolConnection);

                    if(!body.getDurable())
                    {
                        final AMQQueue q = queue;
                        final AMQProtocolSession.Task sessionCloseTask = new 
AMQProtocolSession.Task()
                        {
                            public void doTask(AMQProtocolSession session) 
throws AMQException
                            {
                                q.setExclusiveOwningSession(null);
                            }
                        };
                        
protocolConnection.addSessionCloseTask(sessionCloseTask);
                        queue.addQueueDeleteTask(new AMQQueue.Task() {
                            public void doTask(AMQQueue queue) throws 
AMQException
                            {
                                
protocolConnection.removeSessionCloseTask(sessionCloseTask);
                            }
                        });
                    }
                }
{code}

whereas we have the following in ServerSessionDelegate:

{code}
if (autoDelete && exclusive)
                {
                    final AMQQueue q = queue;
                    final ServerSession.Task deleteQueueTask = new 
ServerSession.Task()
                        {
                            public void doTask(ServerSession session)
                            {
                                try
                                {
                                    virtualHost.removeQueue(q);
                                }
                                catch (AMQException e)
                                {
                                    exception(session, method, e, "Cannot 
delete '" + method.getQueue());
                                }
                            }
                        };
                    final ServerSession s = (ServerSession) session;
                    s.addSessionCloseTask(deleteQueueTask);
                    queue.addQueueDeleteTask(new AMQQueue.Task()
                        {
                            public void doTask(AMQQueue queue) throws 
AMQException
                            {
                                s.removeSessionCloseTask(deleteQueueTask);
                            }
                        });
                }
                if (exclusive)
                {
                    final AMQQueue q = queue;
                    final ServerSession.Task removeExclusive = new 
ServerSession.Task()
                    {
                        public void doTask(ServerSession session)
                        {
                            q.setAuthorizationHolder(null);
                            q.setExclusiveOwningSession(null);
                        }
                    };
                    final ServerSession s = (ServerSession) session;
                    q.setExclusiveOwningSession(s);
                    s.addSessionCloseTask(removeExclusive);
                    queue.addQueueDeleteTask(new AMQQueue.Task()
                    {
                        public void doTask(AMQQueue queue) throws AMQException
                        {
                            s.removeSessionCloseTask(removeExclusive);
                        }
                    });
                }
{code}
                
> [Java Broker] Refactor creation of Queue within the broker
> ----------------------------------------------------------
>
>                 Key: QPID-5081
>                 URL: https://issues.apache.org/jira/browse/QPID-5081
>             Project: Qpid
>          Issue Type: Improvement
>            Reporter: Rob Godfrey
>
> 1. Modify the VirtualHost interface to hide the QueueRegistry, and route all 
> queue creation through the Virtual Host (cf QPID-4979 for Exchanges)
> 2. Modify the Queue Creation arguments to use the model argument names, 
> rather than the names used on the wire in AMQP commands (and build a utility 
> class for converting between these) 

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to