1 #ifndef PLUGIN_CONNECTION_HANDLER_INCLUDED 2 #define PLUGIN_CONNECTION_HANDLER_INCLUDED 3 4 /* 5 Copyright (c) 2013, 2021, Oracle and/or its affiliates. 6 7 This program is free software; you can redistribute it and/or modify 8 it under the terms of the GNU General Public License, version 2.0, 9 as published by the Free Software Foundation. 10 11 This program is also distributed with certain software (including 12 but not limited to OpenSSL) that is licensed under separate terms, 13 as designated in a particular file or component or in included license 14 documentation. The authors of MySQL hereby grant you an additional 15 permission to link the program and your derivative works with the 16 separately licensed software that they have included with MySQL. 17 18 This program is distributed in the hope that it will be useful, 19 but WITHOUT ANY WARRANTY; without even the implied warranty of 20 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 21 GNU General Public License, version 2.0, for more details. 22 23 You should have received a copy of the GNU General Public License 24 along with this program; if not, write to the Free Software 25 Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA 26 */ 27 28 #include "mysql/thread_pool_priv.h" // Plugin_connection_handler_functions 29 #include "conn_handler/connection_handler.h" // Connection_handler 30 31 class THD; 32 33 34 /** 35 This is a wrapper class around global free functions implemented 36 by connection handler plugins (e.g. thread pool). So instead of 37 plugins implementing a Connection_handler subclass, they supply 38 a set of function pointers to my_connection_handler_set() which 39 instantiates Plugin_connection_handler. 40 41 @see Connection_handler_functions struct. 42 */ 43 44 class Plugin_connection_handler : public Connection_handler 45 { 46 Connection_handler_functions *m_functions; 47 48 Plugin_connection_handler(const Plugin_connection_handler&); 49 Plugin_connection_handler& 50 operator=(const Plugin_connection_handler&); 51 52 public: Plugin_connection_handler(Connection_handler_functions * functions)53 Plugin_connection_handler(Connection_handler_functions *functions) 54 : m_functions(functions) 55 {} 56 ~Plugin_connection_handler()57 virtual ~Plugin_connection_handler() 58 { 59 m_functions->end(); 60 } 61 62 protected: add_connection(Channel_info * channel_info)63 virtual bool add_connection(Channel_info* channel_info) 64 { 65 return m_functions->add_connection(channel_info); 66 } 67 get_max_threads()68 virtual uint get_max_threads() const 69 { 70 return m_functions->max_threads; 71 } 72 }; 73 74 #endif // PLUGIN_CONNECTION_HANDLER_INCLUDED 75