[ https://issues.apache.org/jira/browse/GEODE-8521?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17236382#comment-17236382 ]
ASF GitHub Bot commented on GEODE-8521: --------------------------------------- bschuchardt commented on a change in pull request #5763: URL: https://github.com/apache/geode/pull/5763#discussion_r527913185 ########## File path: geode-core/src/main/java/org/apache/geode/internal/monitoring/ThreadsMonitoringImpl.java ########## @@ -96,39 +98,60 @@ public void updateThreadStatus() { @Override public boolean startMonitor(Mode mode) { - AbstractExecutor absExtgroup; + return startMonitoring(createAbstractExecutor(mode)); + } + + @Override + public void endMonitor() { + this.monitorMap.remove(Thread.currentThread().getId()); + } + + @VisibleForTesting + boolean isMonitoring() { + return monitorMap.containsKey(Thread.currentThread().getId()); + } + + @Override + public AbstractExecutor createAbstractExecutor(Mode mode) { switch (mode) { case FunctionExecutor: - absExtgroup = new FunctionExecutionPooledExecutorGroup(this); - break; + return new FunctionExecutionPooledExecutorGroup(); case PooledExecutor: - absExtgroup = new PooledExecutorGroup(this); - break; + return new PooledExecutorGroup(); case SerialQueuedExecutor: - absExtgroup = new SerialQueuedExecutorGroup(this); - break; + return new SerialQueuedExecutorGroup(); case OneTaskOnlyExecutor: - absExtgroup = new OneTaskOnlyExecutorGroup(this); - break; + return new OneTaskOnlyExecutorGroup(); case ScheduledThreadExecutor: - absExtgroup = new ScheduledThreadPoolExecutorWKAGroup(this); - break; + return new ScheduledThreadPoolExecutorWKAGroup(); case AGSExecutor: - absExtgroup = new GatewaySenderEventProcessorGroup(this); - break; + return new GatewaySenderEventProcessorGroup(); + case P2PReaderExecutor: + return new P2PReaderExecutorGroup(); default: - return false; + throw new IllegalStateException("Unhandled mode=" + mode); } - this.monitorMap.put(Thread.currentThread().getId(), absExtgroup); + } + + @Override + public boolean startMonitoring(AbstractExecutor executor) { + executor.setStartTime(System.currentTimeMillis()); Review comment: having the monitor thread set the time is a good idea. Another thing you could do is have the Monitor thread record the current time when it wakes up and use that for new entries in the map. GMSHealthMonitor's monitor thread does something like that. ---------------------------------------------------------------- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. For queries about this service, please contact Infrastructure at: us...@infra.apache.org > Add P2P message reader threads to thread monitoring > --------------------------------------------------- > > Key: GEODE-8521 > URL: https://issues.apache.org/jira/browse/GEODE-8521 > Project: Geode > Issue Type: Wish > Components: messaging > Reporter: Kirk Lund > Assignee: Darrel Schneider > Priority: Major > Labels: GeodeOperationAPI, pull-request-available > > Add P2P message reader threads to thread monitoring to help with identifying > stuck P2P message readers. -- This message was sent by Atlassian Jira (v8.3.4#803005)