Skip to content

[ISSUE #4211] Add JavaDoc for eventmesh.runtime.admin APIs (not in dashboard) #4272

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 41 commits into from
Jul 27, 2023
Merged
Changes from 1 commit
Commits
Show all changes
41 commits
Select commit Hold shift + click to select a range
fa3c5a1
doc: Add JavaDoc for ClientManageController
Pil0tXia Jul 9, 2023
a83cd32
doc: Add JavaDoc for HttpHandlerManager
Pil0tXia Jul 9, 2023
9fffc8f
doc: Add JavaDoc for AbstractHttpHandler
Pil0tXia Jul 9, 2023
09739e8
doc: Add JavaDoc for ConfigurationHandler
Pil0tXia Jul 9, 2023
6e7257e
doc: Add JavaDoc for MetricsHandler
Pil0tXia Jul 9, 2023
54bc903
doc: Add JavaDoc for RegistryHandler
Pil0tXia Jul 9, 2023
582d81c
doc: Add JavaDoc for TopicHandler
Pil0tXia Jul 9, 2023
3885058
doc: Add JavaDoc for EventHandler
Pil0tXia Jul 9, 2023
eab155b
doc: Add JavaDoc for TCPClientHandler
Pil0tXia Jul 9, 2023
d18cc93
doc: Add JavaDoc for HTTPClientHandler
Pil0tXia Jul 10, 2023
95edf72
doc: Add JavaDoc for GrpcClientHandler
Pil0tXia Jul 10, 2023
a7af5c2
doc: Add JavaDoc for HookConfigOperationManager (Outside)
Pil0tXia Jul 10, 2023
328ce28
doc: Add JavaDoc for InsertWebHookConfigHandler
Pil0tXia Jul 10, 2023
d8c55fc
doc: Add JavaDoc for UpdateWebHookConfigHandler
Pil0tXia Jul 11, 2023
0959c86
doc: Add JavaDoc for DeleteWebHookConfigHandler
Pil0tXia Jul 11, 2023
435cb3a
Merge branch 'master' into pil0txia_doc_4211
Pil0tXia Jul 14, 2023
eb387a2
doc: Update JavaDoc for QueryWebHookConfigByIdHandler (WIP)
Pil0tXia Jul 14, 2023
c1bdf06
Breaking Change: Update JavaDoc for HookConfigOperationManager
Pil0tXia Jul 15, 2023
bf3a842
Breaking Change: Update JavaDoc for QueryWebHookConfigByIdHandler
Pil0tXia Jul 15, 2023
7a6a422
doc: Update JavaDoc for InsertWebHookConfigHandler
Pil0tXia Jul 16, 2023
2fc8e63
doc: Update JavaDoc for UpdateWebHookConfigHandler
Pil0tXia Jul 16, 2023
7e80fe0
doc: Update JavaDoc for DeleteWebHookConfigHandler
Pil0tXia Jul 16, 2023
da70ec3
doc: Add JavaDoc for QueryWebHookConfigByManufacturerHandler
Pil0tXia Jul 16, 2023
5ccd27a
doc: Add JavaDoc for QueryRecommendEventMeshHandler
Pil0tXia Jul 19, 2023
24d2e5a
doc: Add JavaDoc for RedirectClientByIpPortHandler
Pil0tXia Jul 20, 2023
c66b76b
doc: Add JavaDoc for RedirectClientByPathHandler and multiple minor c…
Pil0tXia Jul 21, 2023
963a1e1
doc: Add JavaDoc for RedirectClientBySubSystemHandler
Pil0tXia Jul 21, 2023
f847b21
doc: Add JavaDoc for RejectClientByIpPortHandler
Pil0tXia Jul 21, 2023
0ede8ef
doc: Add JavaDoc for RejectClientBySubSystemHandler
Pil0tXia Jul 21, 2023
f0d8cb6
doc: Add JavaDoc for RejectAllClientHandler
Pil0tXia Jul 21, 2023
ae4fb87
doc: Add JavaDoc for ShowClientBySystemHandler
Pil0tXia Jul 21, 2023
ce7110c
doc: Add JavaDoc for ShowListenClientByTopicHandler and multiple mino…
Pil0tXia Jul 21, 2023
464ff18
doc: Add JavaDoc for ShowClientHandler and multiple minor changes
Pil0tXia Jul 21, 2023
fbb1a8c
fix: Remove redundant throw and its JavaDoc
Pil0tXia Jul 21, 2023
eff24cd
fix: redundant import and formatting
Pil0tXia Jul 21, 2023
a757f84
feat: Streamline and Reduce existing single-line comments
Pil0tXia Jul 22, 2023
9222824
Optimize: Explain more clearly why HookConfigOperationManager is not …
Pil0tXia Jul 24, 2023
0890078
Optimze: Explain HookConfigOperationManager more clearly in WebHookCo…
Pil0tXia Jul 24, 2023
18fa9ac
Optimize: Concise the implement of handle()
Pil0tXia Jul 24, 2023
b2d4ca8
Optimze: Remove some relatively simple comments
Pil0tXia Jul 24, 2023
22abd32
Fix: CI report reference not found
Pil0tXia Jul 24, 2023
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
doc: Add JavaDoc for RejectAllClientHandler
  • Loading branch information
Pil0tXia committed Jul 21, 2023
commit f0d8cb6f5ed198dce36b946a1d6ffcfccc744405
Original file line number Diff line number Diff line change
Expand Up @@ -39,27 +39,47 @@

import lombok.extern.slf4j.Slf4j;

/**
* This class handles the HTTP requests of {@code /clientManage/rejectAllClient} endpoint,
* which is used to reject ALL client connections belonging to the current EventMesh server node.
* <p>
* CAUTION: USE WITH CARE
* <p>
* It uses the {@link EventMeshTcp2Client#serverGoodby2Client} method to close the matching client connection.
*
* @see AbstractHttpHandler
*/

@Slf4j
@EventHttpHandler(path = "/clientManage/rejectAllClient")
public class RejectAllClientHandler extends AbstractHttpHandler {

private final transient EventMeshTCPServer eventMeshTCPServer;

/**
* Constructs a new instance with the provided server instance and HTTP handler manager.
*
* @param eventMeshTCPServer the TCP server instance of EventMesh
* @param httpHandlerManager Manages the registration of {@linkplain com.sun.net.httpserver.HttpHandler HttpHandler}
* for an {@link com.sun.net.httpserver.HttpServer HttpServer}.
*/
public RejectAllClientHandler(final EventMeshTCPServer eventMeshTCPServer,
final HttpHandlerManager httpHandlerManager) {
super(httpHandlerManager);
this.eventMeshTCPServer = eventMeshTCPServer;
}

/**
* remove all clients accessed by eventMesh
*
* @param httpExchange
* @throws IOException
* Handles the HTTP requests by rejecting all clients.
* <p>
* This method is an implementation of {@linkplain com.sun.net.httpserver.HttpHandler#handle(HttpExchange) HttpHandler.handle()}.
* @param httpExchange the exchange containing the request from the client and used to send the response
* @throws IOException if an I/O error occurs while handling the request
*/
@Override
public void handle(final HttpExchange httpExchange) throws IOException {
try (OutputStream out = httpExchange.getResponseBody()) {
// Retrieve the mapping between EventMesh TCP Server's ClientSessionGroupMapping and Session objects
final ClientSessionGroupMapping clientSessionGroupMapping = eventMeshTCPServer.getClientSessionGroupMapping();
final ConcurrentHashMap<InetSocketAddress, Session> sessionMap = clientSessionGroupMapping.getSessionMap();
final List<InetSocketAddress> successRemoteAddrs = new ArrayList<>();
Expand All @@ -68,9 +88,11 @@ public void handle(final HttpExchange httpExchange) throws IOException {
log.info("rejectAllClient in admin====================");
}
if (!sessionMap.isEmpty()) {
// Iterate through the sessionMap and close each client connection
for (final Map.Entry<InetSocketAddress, Session> entry : sessionMap.entrySet()) {
final InetSocketAddress addr = EventMeshTcp2Client.serverGoodby2Client(
eventMeshTCPServer, entry.getValue(), clientSessionGroupMapping);
// If the rejection is successful, add the remote client address to a list of successfully rejected addresses
if (addr != null) {
successRemoteAddrs.add(addr);
}
Expand All @@ -85,6 +107,7 @@ public void handle(final HttpExchange httpExchange) throws IOException {
return;
}
NetUtils.sendSuccessResponseHeaders(httpExchange);
// Serialize the successfully rejected client addresses and write it to the response output stream to be sent back to the client
out.write(String.format("rejectAllClient success! sessionMap size {%d}, had reject {%s}", sessionMap.size(),
NetUtils.addressToString(successRemoteAddrs)).getBytes(Constants.DEFAULT_CHARSET));
} catch (Exception e) {
Expand Down