It bugs me because in some ways I'd like to stop supporting building on 1.6
(it's been EOL'd by Oracle for a bit now) (albeit we'd still want to ensure
that the built jars would work under 1.6 - which in this case they would).
Fighting all the different versions of the compiler with their own
particular bugs is no fun at all :-(

Ultimately the getChildren(Class<? extends ConfiguredObject) is always
going to work on a ConfuguredObject... and the others are just convenience
methods to save typing.

-- Rob


On 7 March 2014 16:33, Fraser Adams <fraser.ad...@blueyonder.co.uk> wrote:

> Might be worth adding a comment to org.apache.qpid.server.model.Queue to
> reflect this.
>
> did I mention comments.....
>
> Frase
>
>
> On 07/03/14 15:26, Rob Godfrey wrote:
>
>> .. and to answer myself for a third time... yes that was the issue
>>
>> both AMQQueue (the "implementation" interface) and Queue (the "model"
>> interface) define getConsumers(), with each returning a collection of
>> their
>> own brand of Consumers....
>>
>> AbstractQueue (the concrete implementation) implements both, and reutrns a
>> Collection of Consumer implementation objects which meets both these
>> definitions... and compiles fine in 1.7, but 1.6 barfs... Rather than try
>> to find a way of forcing the 1.6 compiler to work, I just removed from the
>> Queue interface as getChildren(Consumer.class) does the same thing and
>> getConsumers() was unused in the core codebase.
>>
>>
>> On 7 March 2014 16:13, Rob Godfrey <rob.j.godf...@gmail.com> wrote:
>>
>>
>>>
>>> On 7 March 2014 16:07, Fraser Adams <fraser.ad...@blueyonder.co.uk>
>>> wrote:
>>>
>>>  Why have you removed getConsumers() from org.apache.qpid.server.model.
>>>> Queue?
>>>>
>>>> I was using that!
>>>>
>>>>                      for (Consumer subscription : queue.getConsumers())
>>>>                      {
>>>>                          childAdded(queue, subscription);
>>>>                      }
>>>>
>>>>
>>>> So in order to be able to navigate between a Connection and a Queue you
>>>> wind up with Connection, Session, Subscription (AKA Consumer) and
>>>> Queue. I
>>>> maintained the references between Session and Queue via Consumer e.g. in
>>>> childAdded() in QmfManagementAgent I do:
>>>>
>>>>
>>>>  You can do
>>>
>>> for(Consumer subscription : queue.getChildren(Consumer.class))
>>>
>>> I would think...
>>>
>>> Not sure why it got removed - probably just as it wasn't being
>>> referenced... although it might have been some sort of clash between the
>>> AMQQueue and Queue versions of getConsumers() causing issues when they
>>> merged their functions
>>>
>>> -- Rob
>>>
>>>           else if (child instanceof Consumer) // AKA Subscription
>>>>          {
>>>>              // Subscriptions are a little more complex because in QMF
>>>> Subscriptions contain sessionRef and queueRef
>>>>              // properties whereas with the Java Broker model Consumer
>>>> is
>>>> a child of Queue and Session. To cope with
>>>>              // this we first try to create or retrieve the QMF
>>>> Subscription Object then add either the Queue or
>>>>              // Session reference depending on whether Queue or Session
>>>> was the parent of this addChild() call.
>>>>              if (!_objects.containsKey(child))
>>>>              {
>>>>                  data = new org.apache.qpid.server.qmf2.
>>>> agentdata.Subscription((Consumer)child);
>>>>                  _objects.put(child, data);
>>>>             }
>>>>
>>>>              org.apache.qpid.server.qmf2.agentdata.Subscription
>>>> subscription =
>>>> (org.apache.qpid.server.qmf2.agentdata.Subscription)_
>>>> objects.get(child);
>>>>
>>>>              QmfAgentData ref = _objects.get(object);
>>>>              if (ref != null)
>>>>              {
>>>>                  if (object instanceof Queue)
>>>>                  {
>>>>                      subscription.setQueueRef(ref.getObjectId(),
>>>> (Queue)object);
>>>>                      // Raise a Subscribe Event - N.B. Need to do it
>>>> *after* we've set the queueRef.
>>>> _agent.raiseEvent(subscription.createSubscribeEvent());
>>>>                  }
>>>>                  else if (object instanceof Session)
>>>>                  {
>>>>                      subscription.setSessionRef(ref.getObjectId());
>>>>                  }
>>>>              }
>>>>          }
>>>>
>>>>
>>>> getConsumers() still seems to be present in AMQQueue.java and in
>>>> AbstractQueue.java so I hope that it was just "over zealous" tidying of
>>>> the
>>>> org.apache.qpid.server.model.Queue interface - I'd quite like to have
>>>> it
>>>> back please.
>>>>
>>>>
>>>> Frase
>>>>
>>>>
>>>>
>>>>
>>>>
>>>>
>>>> ---------------------------------------------------------------------
>>>> To unsubscribe, e-mail: users-unsubscr...@qpid.apache.org
>>>> For additional commands, e-mail: users-h...@qpid.apache.org
>>>>
>>>>
>>>>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscr...@qpid.apache.org
> For additional commands, e-mail: users-h...@qpid.apache.org
>
>

Reply via email to