You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@qpid.apache.org by Steve Huston <sh...@riverace.com> on 2009/11/25 02:07:58 UTC

C++: Plugin::initOrder???

A new method was added this week: qpid::Plugin::initOrder()

How should this be used? As author of a new plugin (2, actually) I
might need to know about this... Could we please do this sort of
addition/change in the open?

-Steve


---------------------------------------------------------------------
Apache Qpid - AMQP Messaging Implementation
Project:      http://qpid.apache.org
Use/Interact: mailto:dev-subscribe@qpid.apache.org


Re: [c++] Plugin initialization ordering (was Re: C++: Plugin::initOrder???)

Posted by Alan Conway <ac...@redhat.com>.
On 11/30/2009 10:52 AM, Andrew Stitcher wrote:
> On Fri, 2009-11-27 at 11:33 -0500, Alan Conway wrote:
>> ...
>> Point taken and apologies again. Lets have the discussion now and if we come up
>> with a better solution I'll be happy to implement it. I've opened:
>>
>> https://issues.apache.org/jira/browse/QPID-2223
>
> One comment I'd make is that the implementation is, how shall I put it,
> unscalable.
>
> Using a vector, and sorting it for every insertion of a plugin, starts
> to be a problem if you have a large number of plugins. Okay, you'd
> probably need many more plugins than we currently have but isn't that
> what we have the set<>  or perhaps map<>  data structures for?
>
> If the sort was run just once after all the plugins have been added it'd
> be fine, but otherwise I'd suggest using a set<>  with a custom "operator
> <".
>

I'd be surprised if anyone ever loaded 1000s or even 100s of plugins, but it 
would be easy to fix if you think that's a real concern.

---------------------------------------------------------------------
Apache Qpid - AMQP Messaging Implementation
Project:      http://qpid.apache.org
Use/Interact: mailto:dev-subscribe@qpid.apache.org


Re: [c++] Plugin initialization ordering (was Re: C++: Plugin::initOrder???)

Posted by Andrew Stitcher <as...@redhat.com>.
On Fri, 2009-11-27 at 11:33 -0500, Alan Conway wrote:
> ...
> Point taken and apologies again. Lets have the discussion now and if we come up 
> with a better solution I'll be happy to implement it. I've opened:
> 
> https://issues.apache.org/jira/browse/QPID-2223

One comment I'd make is that the implementation is, how shall I put it,
unscalable.

Using a vector, and sorting it for every insertion of a plugin, starts
to be a problem if you have a large number of plugins. Okay, you'd
probably need many more plugins than we currently have but isn't that
what we have the set<> or perhaps map<> data structures for?

If the sort was run just once after all the plugins have been added it'd
be fine, but otherwise I'd suggest using a set<> with a custom "operator
<".

Andrew




---------------------------------------------------------------------
Apache Qpid - AMQP Messaging Implementation
Project:      http://qpid.apache.org
Use/Interact: mailto:dev-subscribe@qpid.apache.org


[c++] Plugin initialization ordering (was Re: C++: Plugin::initOrder???)

Posted by Alan Conway <ac...@redhat.com>.
On 11/25/2009 03:42 PM, Steve Huston wrote:
>> On 11/24/2009 08:07 PM, Steve Huston wrote:
>>> A new method was added this week: qpid::Plugin::initOrder()
[snip]
> Could you please document this mechanism and how it should be used
> somewhere?

I've extended the doc comment, is this clear?
      /** 

       * Initialization order. If a plugin does not override this, it 

       * returns DEFAULT_INIT_ORDER. Plugins that need to be initialized 

       * earlier/later than normal can override initOrder to return 

       * a lower/higher value than DEFAULT_INIT_ORDER. 

       */
      QPID_COMMON_EXTERN virtual int initOrder() const;


> The point is that other people develop related pieces and there was no
> discussion, rationale, etc. about it, how it's solving a problem, how
> to use it, etc. The only reason I found out about it was the
> entrypoint wasn't exported so the Windows build broke.

Point taken and apologies again. Lets have the discussion now and if we come up 
with a better solution I'll be happy to implement it. I've opened:

https://issues.apache.org/jira/browse/QPID-2223

---------------------------------------------------------------------
Apache Qpid - AMQP Messaging Implementation
Project:      http://qpid.apache.org
Use/Interact: mailto:dev-subscribe@qpid.apache.org


RE: C++: Plugin::initOrder???

Posted by Steve Huston <sh...@riverace.com>.
Hi Alan,

> On 11/24/2009 08:07 PM, Steve Huston wrote:
> > A new method was added this week: qpid::Plugin::initOrder()
> >
> > How should this be used? As author of a new plugin (2, actually) I
> > might need to know about this... Could we please do this sort of
> > addition/change in the open?
> 
> Apologies for the un-announced insertion. Plugin::initOrder 
> allows you to define 
> the order that plugins are initialized. It defaults to 1000, 
> to date only the 
> cluster plugin has a different order (1500) because it needs 
> to be initialized after the store.

Could you please document this mechanism and how it should be used
somewhere?

> It's not a pure virtual and shouldn't have any impact on 
> plugins that dont care about ordering.

The point is that other people develop related pieces and there was no
discussion, rationale, etc. about it, how it's solving a problem, how
to use it, etc. The only reason I found out about it was the
entrypoint wasn't exported so the Windows build broke.

-Steve


---------------------------------------------------------------------
Apache Qpid - AMQP Messaging Implementation
Project:      http://qpid.apache.org
Use/Interact: mailto:dev-subscribe@qpid.apache.org


Re: C++: Plugin::initOrder???

Posted by Alan Conway <ac...@redhat.com>.
On 11/24/2009 08:07 PM, Steve Huston wrote:
> A new method was added this week: qpid::Plugin::initOrder()
>
> How should this be used? As author of a new plugin (2, actually) I
> might need to know about this... Could we please do this sort of
> addition/change in the open?
>
> -Steve
>
>
> ---------------------------------------------------------------------
> Apache Qpid - AMQP Messaging Implementation
> Project:      http://qpid.apache.org
> Use/Interact: mailto:dev-subscribe@qpid.apache.org
>

Apologies for the un-announced insertion. Plugin::initOrder allows you to define 
the order that plugins are initialized. It defaults to 1000, to date only the 
cluster plugin has a different order (1500) because it needs to be initialized 
after the store.

It's not a pure virtual and shouldn't have any impact on plugins that dont care 
about ordering.

---------------------------------------------------------------------
Apache Qpid - AMQP Messaging Implementation
Project:      http://qpid.apache.org
Use/Interact: mailto:dev-subscribe@qpid.apache.org


Re: C++: Plugin::initOrder???

Posted by Rajith Attapattu <ra...@gmail.com>.
On Tue, Nov 24, 2009 at 9:17 PM, Carl Trieloff <cc...@redhat.com> wrote:
> Steve Huston wrote:
>>
>> A new method was added this week: qpid::Plugin::initOrder()
>>
>> How should this be used? As author of a new plugin (2, actually) I
>> might need to know about this... Could we please do this sort of
>> addition/change in the open?
>

It would be nice if we do a JIRA for this sort of thing.
Makes it easy for folks to keep track.

> Steve, What is the second plug-in?
>
> Carl.
>
> ---------------------------------------------------------------------
> Apache Qpid - AMQP Messaging Implementation
> Project:      http://qpid.apache.org
> Use/Interact: mailto:dev-subscribe@qpid.apache.org
>
>



-- 
Regards,

Rajith Attapattu
Red Hat
http://rajith.2rlabs.com/

---------------------------------------------------------------------
Apache Qpid - AMQP Messaging Implementation
Project:      http://qpid.apache.org
Use/Interact: mailto:dev-subscribe@qpid.apache.org


RE: C++: Plugin::initOrder???

Posted by Steve Huston <sh...@riverace.com>.
> -----Original Message-----
> From: Carl Trieloff [mailto:cctrieloff@redhat.com] 
> 
> Steve Huston wrote:
> > A new method was added this week: qpid::Plugin::initOrder()
> >
> > How should this be used? As author of a new plugin (2, actually) I
> > might need to know about this... Could we please do this sort of
> > addition/change in the open?
> 
> Steve, What is the second plug-in?

The Windows persistence module is 2 plug-ins (portable store and the
SQL layer).

-Steve


---------------------------------------------------------------------
Apache Qpid - AMQP Messaging Implementation
Project:      http://qpid.apache.org
Use/Interact: mailto:dev-subscribe@qpid.apache.org


Re: C++: Plugin::initOrder???

Posted by Carl Trieloff <cc...@redhat.com>.
Steve Huston wrote:
> A new method was added this week: qpid::Plugin::initOrder()
>
> How should this be used? As author of a new plugin (2, actually) I
> might need to know about this... Could we please do this sort of
> addition/change in the open?

Steve, What is the second plug-in?

Carl.

---------------------------------------------------------------------
Apache Qpid - AMQP Messaging Implementation
Project:      http://qpid.apache.org
Use/Interact: mailto:dev-subscribe@qpid.apache.org