// next() - core of plugin manager ** // //
| 897 | // ** next() - core of plugin manager ** // |
| 898 | // ************************************* // |
| 899 | void PluginSet::next(CheckStatusWrapper* status) |
| 900 | { |
| 901 | try |
| 902 | { |
| 903 | if (currentPlugin.hasData()) |
| 904 | { |
| 905 | currentPlugin = NULL; |
| 906 | } |
| 907 | |
| 908 | // Avoid concurrent load of the same module |
| 909 | static Static<Mutex> loadModuleMutex; |
| 910 | MutexLockGuard lmGuard(*(&loadModuleMutex), FB_FUNCTION); |
| 911 | |
| 912 | MutexLockGuard g(plugins->mutex, FB_FUNCTION); |
| 913 | |
| 914 | while (currentName.getWord(namesList, " \t,;")) |
| 915 | { |
| 916 | // First check - may be currentName is present among already configured plugins |
| 917 | ConfiguredPlugin* tmp = NULL; |
| 918 | if (plugins->get(MapKey(interfaceType, currentName), tmp)) |
| 919 | { |
| 920 | currentPlugin = tmp; |
| 921 | break; |
| 922 | } |
| 923 | |
| 924 | // setup loadinfo |
| 925 | PluginLoadInfo info(currentName.c_str()); |
| 926 | |
| 927 | // Check if module is loaded and load it if needed |
| 928 | RefPtr<PluginModule> m(modules->findModule(info.curModule)); |
| 929 | if (!m.hasData() && !flShutdown) |
| 930 | { |
| 931 | MutexUnlockGuard cout(plugins->mutex, FB_FUNCTION); |
| 932 | m = loadModule(info); |
| 933 | } |
| 934 | if (!m.hasData()) |
| 935 | { |
| 936 | continue; |
| 937 | } |
| 938 | |
| 939 | int r = m->findPlugin(interfaceType, info.regName); |
| 940 | if (r < 0) |
| 941 | { |
| 942 | loadError(Arg::Gds(isc_pman_plugin_notfound) << |
| 943 | info.curModule << info.regName << Arg::Num(interfaceType)); |
| 944 | } |
| 945 | |
| 946 | currentPlugin = FB_NEW ConfiguredPlugin(m, r, info.conf, info.plugConfigFile, currentName); |
| 947 | |
| 948 | plugins->put(MapKey(interfaceType, currentName), currentPlugin); |
| 949 | return; |
| 950 | } |
| 951 | } |
| 952 | catch (const Firebird::Exception& ex) |
| 953 | { |
| 954 | ex.stuffException(status); |
| 955 | } |
| 956 | } |
nothing calls this directly
no test coverage detected