MySQL 8.3.0
Source Code Documentation
message_service.h
Go to the documentation of this file.
1/* Copyright (c) 2019, 2023, Oracle and/or its affiliates.
2
3 This program is free software; you can redistribute it and/or modify
4 it under the terms of the GNU General Public License, version 2.0,
5 as published by the Free Software Foundation.
6
7 This program is also distributed with certain software (including
8 but not limited to OpenSSL) that is licensed under separate terms,
9 as designated in a particular file or component or in included license
10 documentation. The authors of MySQL hereby grant you an additional
11 permission to link the program and your derivative works with the
12 separately licensed software that they have included with MySQL.
13
14 This program is distributed in the hope that it will be useful,
15 but WITHOUT ANY WARRANTY; without even the implied warranty of
16 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 GNU General Public License, version 2.0, for more details.
18
19 You should have received a copy of the GNU General Public License
20 along with this program; if not, write to the Free Software
21 Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */
22
23#ifndef MESSAGE_SERVICE_H
24#define MESSAGE_SERVICE_H
25
29
30/**
31 Register default send message service.
32*/
34
35/**
36 Unregister default send message service.
37*/
39
40/**
41 @class Message_service_handler
42 Handles the deliver of recv service messages to subscribed modules.
43*/
45 public:
46 /**
47 Create a message service handler to deliver messages to recv subscribers.
48 */
50
52
53 /**
54 Initialize thread that will deliver messages.
55
56 @return returns 0 if succeeds, error otherwise
57 */
58 int initialize();
59
60 /**
61 Main loop that checks message availability.
62 */
63 void dispatcher();
64
65 /**
66 Terminate delivering message thread.
67
68 @return returns 0 if succeeds, error otherwise
69 */
70 int terminate();
71
72 /**
73 Add to queue a new message to be deliver to recv service subscribers.
74
75 @param[in] message message to be delivered
76 */
77 void add(Group_service_message *message);
78
79 /**
80 It will notify recv subscribers with a service message.
81
82 @param[in] service_message message to process
83
84 @return false if message is delivered, true otherwise
85 */
87
88 private:
89 /** Thread was terminated */
91 /** The current phase */
93 /** The thread lock to control access */
95 /** The thread signal mechanism to be terminated */
97 /** The state of the thread. */
99 /** Queue with service message to be delivered */
101};
102
103#endif /* MESSAGE_SERVICE_H */
Abortable synchronized queue extends synchronized queue allowing to abort methods waiting for element...
Definition: plugin_utils.h:261
Definition: group_service_message.h:33
Handles the deliver of recv service messages to subscribed modules.
Definition: message_service.h:44
bool m_aborted
Thread was terminated.
Definition: message_service.h:90
thread_state m_message_service_thd_state
The state of the thread.
Definition: message_service.h:98
mysql_cond_t m_message_service_run_cond
The thread signal mechanism to be terminated.
Definition: message_service.h:96
bool notify_message_service_recv(Group_service_message *service_message)
It will notify recv subscribers with a service message.
Definition: message_service.cc:272
Abortable_synchronized_queue< Group_service_message * > * m_incoming
Queue with service message to be delivered.
Definition: message_service.h:100
void dispatcher()
Main loop that checks message availability.
Definition: message_service.cc:148
int terminate()
Terminate delivering message thread.
Definition: message_service.cc:236
Message_service_handler()
Create a message service handler to deliver messages to recv subscribers.
Definition: message_service.cc:88
mysql_mutex_t m_message_service_run_lock
The thread lock to control access.
Definition: message_service.h:94
my_thread_handle m_message_service_pthd
The current phase.
Definition: message_service.h:92
int initialize()
Initialize thread that will deliver messages.
Definition: message_service.cc:118
void add(Group_service_message *message)
Add to queue a new message to be deliver to recv service subscribers.
Definition: message_service.cc:255
virtual ~Message_service_handler()
Definition: message_service.cc:98
bool unregister_gr_message_service_send()
Unregister default send message service.
Definition: message_service.cc:73
bool register_gr_message_service_send()
Register default send message service.
Definition: message_service.cc:56
Specifies macros to define Service Implementations.
Definition: my_thread_bits.h:57
An instrumented cond structure.
Definition: mysql_cond_bits.h:49
An instrumented mutex structure.
Definition: mysql_mutex_bits.h:49
Definition: plugin_utils.h:47