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

Fraser Adams commented on QPID-4760:
------------------------------------

committed to r1476219 an amended patch following a suggestion from Robbie 
Gemmell that avoided iterating through connections by getting the 
AMQConnectionModel from the AMQSessionModel in the getSessionAdapter() helper 
e.g.

    /**
     * Helper method to retrieve the SessionAdapter keyed by the 
AMQSessionModel.
     * This method first finds the ConnectionAdapter associated with the 
Session from this QueueAdapter's parent vhost
     * then it does a lookup on that to find the SessionAdapter keyed by the 
requested AMQSessionModel instance.
     * @param session the AMQSessionModel used to index the SessionAdapter.
     * @return the requested SessionAdapter or null if it can't be found.
     */
    private SessionAdapter getSessionAdapter(AMQSessionModel session)
    {
        // Retrieve the ConnectionModel associated with the SessionModel as a 
key to lookup the ConnectionAdapter.
        AMQConnectionModel connectionKey = session.getConnectionModel();

        // Lookup the ConnectionAdapter, from which we should be able to 
retrieve the SessionAdapter we really want.
        ConnectionAdapter connectionAdapter = 
_vhost.getConnectionAdapter(connectionKey);
        if (connectionAdapter == null)
        {
            return null; // If we can't find an associated ConnectionAdapter 
the SessionAdapter is a lost cause.
        }
        else
        {   // With a good ConnectionAdapter we can finally try to find the 
SessionAdapter we are actually looking for.
            SessionAdapter sessionAdapter = 
connectionAdapter.getSessionAdapter(session);
            if (sessionAdapter == null)
            {
                return null; // If the SessionAdapter isn't associated with the 
selected ConnectionAdapter give up.
            }
            else
            {
                return sessionAdapter;
            }
        }
    }


                
> Associate Java Broker QueueAdapter and SessionAdapter via ConsumerAdapter
> -------------------------------------------------------------------------
>
>                 Key: QPID-4760
>                 URL: https://issues.apache.org/jira/browse/QPID-4760
>             Project: Qpid
>          Issue Type: Improvement
>          Components: Java Broker
>            Reporter: Fraser Adams
>            Priority: Minor
>             Fix For: 0.23
>
>         Attachments: subscription.patch
>
>
> In the management model it should be possible to navigate from a Connection 
> through its associated Sessions to Queues via Subscriptions/Consumers.
> Basically Subscription is an association class linking Session and Queue.
> In the Java Broker Management Model there was code missing that should allow 
> the SessionAdapter to getSubscriptions().
> This patch provides code to do the necessary object registrations to allow 
> the Subscriptions in SessionAdapter to be correctly maintained thus allowing 
> navigation from Connection to Queue and vice versa.

--
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