1 #ifndef CONNECTION_HANDLER_INCLUDED 2 #define CONNECTION_HANDLER_INCLUDED 3 4 /* Copyright (c) 2007, 2021, Oracle and/or its affiliates. 5 6 This program is free software; you can redistribute it and/or modify 7 it under the terms of the GNU General Public License, version 2.0, 8 as published by the Free Software Foundation. 9 10 This program is also distributed with certain software (including 11 but not limited to OpenSSL) that is licensed under separate terms, 12 as designated in a particular file or component or in included license 13 documentation. The authors of MySQL hereby grant you an additional 14 permission to link the program and your derivative works with the 15 separately licensed software that they have included with MySQL. 16 17 This program is distributed in the hope that it will be useful, 18 but WITHOUT ANY WARRANTY; without even the implied warranty of 19 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 20 GNU General Public License, version 2.0, for more details. 21 22 You should have received a copy of the GNU General Public License 23 along with this program; if not, write to the Free Software Foundation, 24 51 Franklin Street, Suite 500, Boston, MA 02110-1335 USA */ 25 26 #include "my_global.h" // uint 27 28 class THD; 29 class Channel_info; 30 class Connection_handler_manager; 31 32 33 /** 34 This abstract base class represents how connections are processed, 35 most importantly how they map to OS threads. 36 */ 37 class Connection_handler 38 { 39 protected: 40 friend class Connection_handler_manager; 41 Connection_handler()42 Connection_handler() {} ~Connection_handler()43 virtual ~Connection_handler() {} 44 45 /** 46 Add a connection. 47 48 @param channel_info Pointer to the Channel_info object. 49 50 @note If this function is successful (returns false), the ownership of 51 channel_info is transferred. Otherwise the caller is responsible for 52 its destruction. 53 54 @return true if processing of the new connection failed, false otherwise. 55 */ 56 virtual bool add_connection(Channel_info* channel_info) = 0; 57 58 /** 59 @return Maximum number of threads that can be created 60 by this connection handler. 61 */ 62 virtual uint get_max_threads() const = 0; 63 }; 64 65 #endif // CONNECTION_HANDLER_INCLUDED 66