Skip to content

Commit 52e7aff

Browse files
authored
Add Report Ownership to VisualVM Plugin (#96)
* Add Report Ownership to VisualVM Plugin * Fix javadoc errors * Finalize updates
1 parent 032724e commit 52e7aff

File tree

61 files changed

+1276
-13
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

61 files changed

+1276
-13
lines changed

coherence-visualvm-plugin/pom.xml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -267,6 +267,7 @@
267267
</execution>
268268
</executions>
269269
<configuration>
270+
<failOnError>false</failOnError>
270271
<source>8</source>
271272
<additionalDependencies>
272273
<additionalDependency>

coherence-visualvm-plugin/src/main/java/com/oracle/coherence/plugin/visualvm/CoherenceApplicationType.java

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright (c) 2021, 2023 Oracle and/or its affiliates. All rights reserved.
2+
* Copyright (c) 2021, 2024 Oracle and/or its affiliates. All rights reserved.
33
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
44
*
55
* This code is free software; you can redistribute it and/or modify it
@@ -46,6 +46,12 @@ public class CoherenceApplicationType
4646
{
4747
// ----- constructors ----------------------------------------------------
4848

49+
/**
50+
* Construct a {@link CoherenceApplicationType}
51+
* @param app {@link Application}
52+
* @param jvm {@link Jvm}
53+
* @param sMainClass main classpath
54+
*/
4955
public CoherenceApplicationType(Application app, Jvm jvm, String sMainClass)
5056
{
5157
String sDescription = f_mapClasses.get(sMainClass);
@@ -110,7 +116,7 @@ public Image getIcon()
110116
/**
111117
* {@link Map} of possible classes to detect.
112118
*/
113-
static final Map<String, String> f_mapClasses = new HashMap<String, String>();
119+
static final Map<String, String> f_mapClasses = new HashMap<>();
114120

115121
static
116122
{

coherence-visualvm-plugin/src/main/java/com/oracle/coherence/plugin/visualvm/CoherenceOptionsPanel.java

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -618,6 +618,9 @@ private String formatLine(String sFormat, long nTotalMillis, String sServiceName
618618
private final File f_fileLogFile;
619619
}
620620

621+
/**
622+
* Class returns unavailable metrics.
623+
*/
621624
public static class UnavailabilityMetrics
622625
{
623626
public UnavailabilityMetrics(String sServiceName, int nMember, int nPartitionId, String sAction, long millis, long nLineId)

coherence-visualvm-plugin/src/main/java/com/oracle/coherence/plugin/visualvm/helper/HttpRequestSender.java

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -628,6 +628,20 @@ public String getScheduledDistributions(String sService, String sDomainPartition
628628
return rootNode.get("scheduledDistributions").asText();
629629
}
630630

631+
@Override
632+
public String getServiceOwnership(String sService, int nNodeID)
633+
throws Exception
634+
{
635+
URLBuilder urlBuilder = getBasePath().addPathSegment(SERVICES)
636+
.addPathSegment(encodeServiceName(sService)).addPathSegment(MEMBERS)
637+
.addPathSegment(Integer.toString(nNodeID)).addPathSegment("ownership")
638+
.addQueryParameter(LINKS, "")
639+
.addQueryParameter("verbose", "true");
640+
641+
JsonNode rootNode = getResponseJson(sendGetRequest(urlBuilder));
642+
return rootNode.toString();
643+
}
644+
631645
@Override
632646
public String getServiceDescription(String sService, String sDomainPartition)
633647
throws Exception
@@ -1196,6 +1210,9 @@ public JsonNode getDataForProxyMembers() throws Exception
11961210
/**
11971211
* Get the view data in the cluster.
11981212
*
1213+
* @param sServiceName the name of the service
1214+
* @param sViewName the name of the view
1215+
*
11991216
* @return the data for all the cluster members
12001217
* @throws Exception in case of errors
12011218
*/

coherence-visualvm-plugin/src/main/java/com/oracle/coherence/plugin/visualvm/helper/JMXRequestSender.java

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -318,6 +318,20 @@ public String getServiceDescription(String sService, String sDomainPartition)
318318
return (String) invoke(new ObjectName(sFQN), "getServiceDescription", new Object[0], new String[0]);
319319
}
320320

321+
@Override
322+
public String getServiceOwnership(String sService, int nNodeID)
323+
throws Exception
324+
{
325+
Set<ObjectName> setResult = getServiceObjectName(sService, null, getLocalMemberId());
326+
327+
String sFQN = getFirstResult(setResult);
328+
329+
String sResult = (String) invoke(new ObjectName(sFQN), "reportOwnership",
330+
new Object[]{true}, new String[]{boolean.class.getName()});
331+
332+
return String.format("{\"ownership\":\"%s\"}", sResult);
333+
}
334+
321335
@Override
322336
public Set<Object[]> getPartitionAssignmentAttributes(String sService, String sDomainPartition)
323337
throws Exception

0 commit comments

Comments
 (0)