mirror of
https://gitee.com/jmix/cuba.git
synced 2024-12-01 10:47:37 +08:00
PL-7117 ClusterManager per-class usage performance statistics (fix review: javadoc, jmx operation descriptions, handle class name is null)
This commit is contained in:
parent
273d4ab610
commit
af6613068b
@ -16,6 +16,7 @@
|
||||
*/
|
||||
package com.haulmont.cuba.core.app;
|
||||
|
||||
import com.haulmont.bali.util.Preconditions;
|
||||
import com.haulmont.cuba.core.global.GlobalConfig;
|
||||
import com.haulmont.cuba.core.global.Resources;
|
||||
import com.haulmont.cuba.core.sys.AppContext;
|
||||
@ -276,7 +277,7 @@ public class ClusterManager implements ClusterManagerAPI, AppContext.Listener {
|
||||
}
|
||||
|
||||
@Override
|
||||
public String printClusterStatesStat() {
|
||||
public String printSharedStateStat() {
|
||||
StringBuilder clusterStateStat = new StringBuilder();
|
||||
for (Map.Entry<String, ClusterListener> entry : listeners.entrySet()) {
|
||||
byte[] data = null;
|
||||
@ -309,6 +310,7 @@ public class ClusterManager implements ClusterManagerAPI, AppContext.Listener {
|
||||
|
||||
@Override
|
||||
public long getSentMessages(String className) {
|
||||
Preconditions.checkNotNullArgument(className, "Message class is null");
|
||||
MessageStat stat = messagesStat.get(className);
|
||||
if (stat != null) {
|
||||
return stat.getSentMessages();
|
||||
@ -318,6 +320,7 @@ public class ClusterManager implements ClusterManagerAPI, AppContext.Listener {
|
||||
|
||||
@Override
|
||||
public long getSentBytes(String className) {
|
||||
Preconditions.checkNotNullArgument(className, "Message class is null");
|
||||
MessageStat stat = messagesStat.get(className);
|
||||
if (stat != null) {
|
||||
return stat.getSentBytes();
|
||||
@ -327,6 +330,7 @@ public class ClusterManager implements ClusterManagerAPI, AppContext.Listener {
|
||||
|
||||
@Override
|
||||
public long getReceivedMessages(String className) {
|
||||
Preconditions.checkNotNullArgument(className, "Message class is null");
|
||||
MessageStat stat = messagesStat.get(className);
|
||||
if (stat != null) {
|
||||
return stat.getReceivedMessages();
|
||||
@ -336,6 +340,7 @@ public class ClusterManager implements ClusterManagerAPI, AppContext.Listener {
|
||||
|
||||
@Override
|
||||
public long getReceivedBytes(String className) {
|
||||
Preconditions.checkNotNullArgument(className, "Message class is null");
|
||||
MessageStat stat = messagesStat.get(className);
|
||||
if (stat != null) {
|
||||
return stat.getReceivedBytes();
|
||||
|
@ -105,37 +105,37 @@ public interface ClusterManagerAPI {
|
||||
int getMessagesCount();
|
||||
|
||||
/**
|
||||
* Serialize cluster state and get state statistics
|
||||
* @return statistic
|
||||
* Shared state statistics
|
||||
* @return statistics
|
||||
*/
|
||||
String printClusterStatesStat();
|
||||
String printSharedStateStat();
|
||||
|
||||
/**
|
||||
* Sent/received messages statistic
|
||||
* @return statistic
|
||||
* Sent/received messages statistics
|
||||
* @return statistics
|
||||
*/
|
||||
String printMessagesStat();
|
||||
|
||||
/**
|
||||
* Get sent messages count statistic for specified {@param className}
|
||||
* Get sent messages count for specified {@param className}
|
||||
* @return messages count
|
||||
*/
|
||||
long getSentMessages(String className);
|
||||
|
||||
/**
|
||||
* Get sent bytes statistic for specified {@param className}
|
||||
* Get sent bytes for specified {@param className}
|
||||
* @return size in bytes
|
||||
*/
|
||||
long getSentBytes(String className);
|
||||
|
||||
/**
|
||||
* Get received messages count statistic for specified {@param className}
|
||||
* Get received messages count for specified {@param className}
|
||||
* @return messages count
|
||||
*/
|
||||
long getReceivedMessages(String className);
|
||||
|
||||
/**
|
||||
* Get received bytes statistic for specified {@param className}
|
||||
* Get received bytes for specified {@param className}
|
||||
* @return size in bytes
|
||||
*/
|
||||
long getReceivedBytes(String className);
|
||||
|
@ -21,8 +21,8 @@ import com.haulmont.cuba.core.app.ClusterManagerAPI;
|
||||
import org.apache.commons.lang.exception.ExceptionUtils;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import javax.inject.Inject;
|
||||
|
||||
@Component("cuba_ClusterManagerMBean")
|
||||
@ -83,8 +83,8 @@ public class ClusterManager implements ClusterManagerMBean {
|
||||
}
|
||||
|
||||
@Override
|
||||
public String printClusterStatesStat() {
|
||||
return clusterManager.printClusterStatesStat();
|
||||
public String printSharedStateStat() {
|
||||
return clusterManager.printSharedStateStat();
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -94,21 +94,21 @@ public class ClusterManager implements ClusterManagerMBean {
|
||||
|
||||
@Override
|
||||
public long getSentMessages(String className) {
|
||||
return clusterManager.getSentMessages(className);
|
||||
return className == null ? -1 : clusterManager.getSentMessages(className);
|
||||
}
|
||||
|
||||
@Override
|
||||
public long getSentBytes(String className) {
|
||||
return clusterManager.getSentBytes(className);
|
||||
return className == null ? -1 : clusterManager.getSentBytes(className);
|
||||
}
|
||||
|
||||
@Override
|
||||
public long getReceivedMessages(String className) {
|
||||
return clusterManager.getReceivedMessages(className);
|
||||
return className == null ? -1 : clusterManager.getReceivedMessages(className);
|
||||
}
|
||||
|
||||
@Override
|
||||
public long getReceivedBytes(String className) {
|
||||
return clusterManager.getReceivedBytes(className);
|
||||
return className == null ? -1 : clusterManager.getReceivedBytes(className);
|
||||
}
|
||||
}
|
||||
|
@ -61,21 +61,21 @@ public interface ClusterManagerMBean {
|
||||
*/
|
||||
int getMessagesCount();
|
||||
|
||||
@ManagedOperation(description = "Serialize cluster state and get state statistics")
|
||||
String printClusterStatesStat();
|
||||
@ManagedOperation(description = "Shared state statistics")
|
||||
String printSharedStateStat();
|
||||
|
||||
@ManagedOperation(description = "Sent/received messages statistic")
|
||||
@ManagedOperation(description = "Sent/received messages statistics")
|
||||
String printMessagesStat();
|
||||
|
||||
@ManagedOperation(description = "Get sent messages count statistic for specified class")
|
||||
@ManagedOperation(description = "Get sent messages count for specified class")
|
||||
long getSentMessages(String className);
|
||||
|
||||
@ManagedOperation(description = "Get sent bytes statistic for specified class")
|
||||
@ManagedOperation(description = "Get sent bytes for specified class")
|
||||
long getSentBytes(String className);
|
||||
|
||||
@ManagedOperation(description = "Get received messages count statistic for specified class")
|
||||
@ManagedOperation(description = "Get received messages count for specified class")
|
||||
long getReceivedMessages(String className);
|
||||
|
||||
@ManagedOperation(description = "Get received bytes statistic for specified class")
|
||||
@ManagedOperation(description = "Get received bytes for specified class")
|
||||
long getReceivedBytes(String className);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user