diff options
author | Andrew Stitcher <astitcher@apache.org> | 2010-04-27 22:20:25 +0000 |
---|---|---|
committer | Andrew Stitcher <astitcher@apache.org> | 2010-04-27 22:20:25 +0000 |
commit | 3c67ad1d03e3edb68cd3482b5b6a489c175eea6a (patch) | |
tree | 5a19e7bba84ab3393a61752dedcc2682f4caf441 /cpp/src | |
parent | 647b536f27bfb52e45213a75d5dc38e07c13eb0c (diff) | |
download | qpid-python-3c67ad1d03e3edb68cd3482b5b6a489c175eea6a.tar.gz |
Load client side plugins just before creating the first Connection.
git-svn-id: https://svn.apache.org/repos/asf/qpid/trunk/qpid@938701 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'cpp/src')
-rw-r--r-- | cpp/src/qpid/client/ConnectionImpl.cpp | 11 | ||||
-rw-r--r-- | cpp/src/qpid/client/LoadPlugins.cpp | 14 | ||||
-rw-r--r-- | cpp/src/qpid/client/LoadPlugins.h | 33 |
3 files changed, 54 insertions, 4 deletions
diff --git a/cpp/src/qpid/client/ConnectionImpl.cpp b/cpp/src/qpid/client/ConnectionImpl.cpp index 23e312ad72..63a21c1205 100644 --- a/cpp/src/qpid/client/ConnectionImpl.cpp +++ b/cpp/src/qpid/client/ConnectionImpl.cpp @@ -21,6 +21,7 @@ #include "qpid/client/ConnectionImpl.h" +#include "qpid/client/LoadPlugins.h" #include "qpid/client/Connector.h" #include "qpid/client/ConnectionSettings.h" #include "qpid/client/SessionImpl.h" @@ -162,10 +163,14 @@ public: } -// Ensure the IO threads exist: -// This needs to be called in the Connection constructor -// so that they will still exist at last connection destruction void ConnectionImpl::init() { + // Ensure that the plugin modules have been loaded + // This will make sure that any plugin protocols are available + theModuleLoader(); + + // Ensure the IO threads exist: + // This needs to be called in the Connection constructor + // so that they will still exist at last connection destruction (void) theIO(); } diff --git a/cpp/src/qpid/client/LoadPlugins.cpp b/cpp/src/qpid/client/LoadPlugins.cpp index 82cdedc7fe..246eb60c67 100644 --- a/cpp/src/qpid/client/LoadPlugins.cpp +++ b/cpp/src/qpid/client/LoadPlugins.cpp @@ -19,6 +19,8 @@ * */ +#include "LoadPlugins.h" + #ifdef HAVE_CONFIG_H # include "config.h" #endif @@ -26,9 +28,13 @@ #include "qpid/sys/Shlib.h" #include <string> #include <vector> + using std::vector; using std::string; +namespace qpid { +namespace client { + namespace { struct LoadtimeInitialise { @@ -47,6 +53,12 @@ struct LoadtimeInitialise { qpid::loadModuleDir (moduleOptions.loadDir, isDefault); } } -} init; +}; } // namespace + +void theModuleLoader() { + static LoadtimeInitialise l; +} + +}} // namespace qpid::client diff --git a/cpp/src/qpid/client/LoadPlugins.h b/cpp/src/qpid/client/LoadPlugins.h new file mode 100644 index 0000000000..0be4ae9f0c --- /dev/null +++ b/cpp/src/qpid/client/LoadPlugins.h @@ -0,0 +1,33 @@ +/* + * + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + * + */ + +#ifndef _LoadPlugins_ +#define _LoadPlugins_ + +namespace qpid { +namespace client { + +void theModuleLoader(); + +}} + + +#endif |