com.neeve.server.mon
Class SrvMonUtil

java.lang.Object
  extended by com.neeve.server.mon.SrvMonUtil

public final class SrvMonUtil
extends Object

Contains utilities to maintain a SrvMonHeartbeat object.

Threading:
This class is not safe for concurrent access by multiple threads.

Constructor Summary
SrvMonUtil()
           
 
Method Summary
static void addGaugeValue(SrvMonUserGaugeStat srvMonUserGaugeStat, IStats.Gauge gauge)
          Sets the value from a IStats.Gauge into a SrvMonUserGaugeStat.
static boolean addMonAppBusBindingInfo(SrvMonAppInfo appInfo, SrvMonAppBusBindingInfo busBindingInfo)
          Add bus binding information to an app information object
static boolean addMonAppBusChannelInfo(SrvMonAppBusBindingInfo busBindingInfo, SrvMonAppBusChannelInfo busChannelInfo)
          Add an app channel information object to a bus binding information object.
static boolean addMonAppBusChannelInfo(SrvMonAppInfo appInfo, String busBindingName, SrvMonAppBusChannelInfo busChannelInfo)
          Add an app channel information object to a bus information object.
static boolean addMonAppClientInfo(SrvMonAppInfo appInfo, SrvMonAppClientInfo clientInfo)
          Add an app client information object to an app's information object.
static boolean addMonAppFlowInfo(SrvMonAppInfo appInfo, SrvMonAppFlowInfo appFlowInfo)
          Add an app flow information object to an app's information object.
static SrvMonArgumentType convertToArgumentType(Class<?> targetType)
          Converts a primitive method parameter type to an SrvMonArgumentType
static SrvMonOptionType convertToOptionType(Class<?> targetType)
          Converts a primitive method parameter type to an SrvMonOptionType
static SrvMonReturnType convertToReturnType(Class<?> targetType)
          Converts a method return type to a SrvMonReturnType
static SrvMonAppBusBindingInfo createMonAppBusBindingInfo(String busBindingName)
          Create a new app bus binding information object
static SrvMonAppBusChannelInfo createMonAppBusChannelInfo(String busChannelName, boolean joined)
          Create a new app channel information object
static SrvMonAppClientInfo createMonAppClientInfo(String clientName)
          Create a new app client information object.
static SrvMonAppFlowInfo createMonAppFlowInfo(int flowid)
          Create a new app flow information object
static void formatTraceRecordTo(SrvMonTraceRecord traceRecord, Appendable sb)
          Formats a trace record.
static Object getGaugeValue(SrvMonUserGaugeStat srvMonUserGaugeStat)
          Gets the value from a SrvMonUserGaugeStat as an object.
static SrvMonAppBusBindingInfo getMonAppBusBindingInfo(SrvMonAppInfo appInfo, String busBindingName)
          Find an app bus binding information object in an app's information object
static Object getResponseValue(SrvMonInvokeCommandResponse response)
          Unpacks the return value from a SrvMonInvokeCommandResponse.
static PktPacket prepareMonAppBusBindingCreateMessage(String appName, SrvMonAppBusBindingInfo busBindingInfo)
          Prepare an app bus binding create event message.
static PktPacket prepareMonAppBusBindingDestroyMessage(String appName, String busBindingName)
          Prepare an app bus binding destroy event message.
static PktPacket prepareMonAppBusBindingStateChangeMessage(String appName, String busBindingName, SrvMonAppBusBindingState newState)
          Prepare an app bus binding state change event message
static PktPacket prepareMonAppBusChannelClosedMessage(String appName, String busBindingName, String busChannelName)
          Prepare an app bus channel closed event message.
static PktPacket prepareMonAppBusChannelOpenedMessage(String appName, String busBindingName, SrvMonAppBusChannelInfo busChannelInfo)
          Prepare an app bus channel opened event message.
static PktPacket prepareMonAppClientConnectMessage(String appName, SrvMonAppClientInfo clientInfo)
          Prepare an app client connect event message.
static PktPacket prepareMonAppClientDisconnectMessage(String appName, String clientName)
          Prepare an app client disconnect event message.
static PktPacket prepareMonAppFlowCreateMessage(String appName, SrvMonAppFlowInfo appFlowInfo)
          Prepare an app flow create event message.
static PktPacket prepareMonAppLoadedMessage(SrvMonAppInfo appInfo)
          Prepare a new app loaded event message
static PktPacket prepareMonAppStateChangeMessage(SrvMonAppInfo appInfo)
          Prepare an app state change event message
static PktPacket prepareMonAppUnloadedMessage(String appName)
          Prepare an app unloaded event message
static SrvMonHeartbeatMessage prepareMonHeartbeatMessage(long statsCollectionStartWallTime, long statsCollectionStartTime, long statsCollectionEndTime, String serverName, SrvMonSysStats sysStats, XCollection<SrvMonPoolStats> poolStats, XCollection<SrvMonAdminClientStats> adminClientStats, XCollection<SrvMonAppInfo> appsInfo, XCollection<SrvMonAppStats> appsStats)
          Prepare a server heartbeat message.
static void printCommmandUsage(ISrvMonCommandDescription command, Appendable builder)
          Appends command usage to an Appendable
static boolean removeMonAppBusBindingInfo(SrvMonAppInfo appInfo, String busBindingName)
          Remove an app's binding information object from the app's information object.
static boolean removeMonAppBusChannelInfo(SrvMonAppInfo appInfo, String busBindingName, String busChannelName)
          Remove an app channel information object from a bus information object.
static boolean removeMonAppClientInfo(SrvMonAppInfo appInfo, String clientName)
          Remove an app's client information object from an app's information object.
static PktPacket serializeToPacket(IRogMessage message, boolean disposeMessage)
           
static void setBackingMessage(AepApplicationExceptionEvent event)
           
static void setBackingMessage(AepBusBindingCreatedEvent event)
           
static void setBackingMessage(AepBusBindingCreateFailedEvent event)
           
static void setBackingMessage(AepBusBindingDestroyedEvent event)
           
static void setBackingMessage(AepBusBindingDownEvent event)
           
static void setBackingMessage(AepBusBindingOpenedEvent event)
           
static void setBackingMessage(AepBusBindingOpenFailedEvent event)
           
static void setBackingMessage(AepBusBindingOpeningEvent event)
           
static void setBackingMessage(AepBusBindingUpEvent event)
           
static void setBackingMessage(AepChannelDownEvent event)
           
static void setBackingMessage(AepChannelUpEvent event)
           
static void setBackingMessage(AepDuplicateAcknowledgementAlertEvent event)
           
static void setBackingMessage(AepEngineActiveEvent event)
           
static void setBackingMessage(AepEngineCreatedEvent event)
           
static void setBackingMessage(AepEngineStartedEvent event)
           
static void setBackingMessage(AepEngineStoppedEvent event)
           
static void setBackingMessage(AepEngineStoppingEvent event)
           
static void setBackingMessage(AepInboundLogExceptionEvent event)
           
static void setBackingMessage(AepMessageTraceLoggingExceptionEvent event)
           
static void setBackingMessage(AepMessagingFailedEvent event)
           
static void setBackingMessage(AepMessagingPrestartEvent event)
           
static void setBackingMessage(AepMessagingStartedEvent event)
           
static void setBackingMessage(AepMessagingStartFailedEvent event)
           
static void setBackingMessage(AepOutboundLogExceptionEvent event)
           
static void setBackingMessage(AepOutOfOrderSendCommitCompletionAlertEvent event)
           
static void setBackingMessage(AepSendExceptionEvent event)
           
static void setBackingMessage(AepStatsAlertEvent event)
           
static void setBackingMessage(AepStuckAlertEvent event)
           
static void setBackingMessage(AepUnhandledMessageEvent event)
           
static void setBackingMessage(MessageBusBindingReconnectedEvent event)
           
static void setBackingMessage(MessageBusBindingReconnectingEvent event)
           
static void setBackingMessage(com.neeve.ods.impl.StoreBindingFailedEvent event)
           
static void setBackingMessage(com.neeve.ods.impl.StoreBindingRoleChangedEvent event)
           
static void setBackingMessage(com.neeve.ods.impl.StoreMemberDownEvent event)
           
static void setBackingMessage(com.neeve.ods.impl.StoreMemberInitCompleteEvent event)
           
static void setBackingMessage(com.neeve.ods.impl.StoreMemberUpEvent event)
           
static void setBackingMessage(com.neeve.ods.impl.StoreTransactionLogRepairedEvent event)
           
static void setBackingMessage(UnhandledMessageEvent event)
           
static boolean updateMonAppBusBindingState(SrvMonAppInfo appInfo, String busBindingName, SrvMonAppBusBindingState newState)
          Update an app's binding information state
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

SrvMonUtil

public SrvMonUtil()
Method Detail

serializeToPacket

public static final PktPacket serializeToPacket(IRogMessage message,
                                                boolean disposeMessage)

createMonAppBusBindingInfo

public static final SrvMonAppBusBindingInfo createMonAppBusBindingInfo(String busBindingName)
Create a new app bus binding information object

Parameters:
busBindingName - The name of the bus binding whose info to create

addMonAppBusBindingInfo

public static final boolean addMonAppBusBindingInfo(SrvMonAppInfo appInfo,
                                                    SrvMonAppBusBindingInfo busBindingInfo)
Add bus binding information to an app information object

Parameters:
appInfo - The app information object
busBindingInfo - The bus binding information to add
Returns:
Returns true if the information was added successfully. A value of false indicates that the monitoring storage quota for app bus binding info has been reached.

getMonAppBusBindingInfo

public static final SrvMonAppBusBindingInfo getMonAppBusBindingInfo(SrvMonAppInfo appInfo,
                                                                    String busBindingName)
Find an app bus binding information object in an app's information object

Parameters:
appInfo - The app's info object to look in.
busBindingName - The name of the bus binding whose information to find

updateMonAppBusBindingState

public static final boolean updateMonAppBusBindingState(SrvMonAppInfo appInfo,
                                                        String busBindingName,
                                                        SrvMonAppBusBindingState newState)
Update an app's binding information state

Parameters:
appInfo - The app info object in which to update the binding info
busBindingName - The name of the bus binding whose info to update
newState - The new state.
Returns:
Returns true if the state was update successfully. A return value of false indicates that no bus with the supplied name was found in the supplied app info object.

removeMonAppBusBindingInfo

public static final boolean removeMonAppBusBindingInfo(SrvMonAppInfo appInfo,
                                                       String busBindingName)
Remove an app's binding information object from the app's information object.

Parameters:
appInfo - The app info object from which to remove the binding info object
busBindingName - The name of the bus binding whose information to remove.
Returns:
Returns true if the bus was removed successfully. A return value of false indicates that the specified bus was not found in the app's information object.

createMonAppBusChannelInfo

public static final SrvMonAppBusChannelInfo createMonAppBusChannelInfo(String busChannelName,
                                                                       boolean joined)
Create a new app channel information object

Parameters:
busChannelName - The name of the channel.
joined - True if the channel has been joined.

addMonAppBusChannelInfo

public static final boolean addMonAppBusChannelInfo(SrvMonAppBusBindingInfo busBindingInfo,
                                                    SrvMonAppBusChannelInfo busChannelInfo)
Add an app channel information object to a bus binding information object.

Parameters:
busBindingInfo - The bus binding information object to add to.
busChannelInfo - The channel info object to add.
Returns:
Returns true if the channel was added successfully. A return value of false indicates that the monitoring storage quota for app channels (per bus) has been reached.

addMonAppBusChannelInfo

public static final boolean addMonAppBusChannelInfo(SrvMonAppInfo appInfo,
                                                    String busBindingName,
                                                    SrvMonAppBusChannelInfo busChannelInfo)
Add an app channel information object to a bus information object.

Parameters:
appInfo - The app information object in which to add.
busBindingName - The name of the bus binding whose information object to add.
busChannelInfo - The bus channel info.
Returns:
Returns true if the channel was added successfully. A return value of false indicates that either the monitoring storage quota for app channels (per bus) has been reached or the specified bus was not found in the app's information object.

removeMonAppBusChannelInfo

public static final boolean removeMonAppBusChannelInfo(SrvMonAppInfo appInfo,
                                                       String busBindingName,
                                                       String busChannelName)
Remove an app channel information object from a bus information object.

Parameters:
appInfo - The app information object from which to remove.
busBindingName - The name of the bus binding whose information object to remove.
busChannelName - The channel to remove.
Returns:
Returns true if the channel was removed successfully. A return value of false indicates that the specified bus or channel was not found in the app's information object.

createMonAppClientInfo

public static final SrvMonAppClientInfo createMonAppClientInfo(String clientName)
Create a new app client information object.

Parameters:
clientName - The name of the new client.

addMonAppClientInfo

public static final boolean addMonAppClientInfo(SrvMonAppInfo appInfo,
                                                SrvMonAppClientInfo clientInfo)
Add an app client information object to an app's information object.

Parameters:
appInfo - The app information object in which to add the client info object.
clientInfo - The client information object to add.
Returns:
Returns true if the client was added successfully. A return value of false indicates that the monitoring storage quota for app clients has been reached.

removeMonAppClientInfo

public static final boolean removeMonAppClientInfo(SrvMonAppInfo appInfo,
                                                   String clientName)
Remove an app's client information object from an app's information object.

Parameters:
appInfo - The app information object from which to remove the client info object.
clientName - The name of the client whose information object to remove.
Returns:
Returns true if the client was removed successfully. A return value of false indicates that the specified client was not found in the app's information object.

createMonAppFlowInfo

public static final SrvMonAppFlowInfo createMonAppFlowInfo(int flowid)
Create a new app flow information object

Parameters:
flowid - The flow id.

addMonAppFlowInfo

public static final boolean addMonAppFlowInfo(SrvMonAppInfo appInfo,
                                              SrvMonAppFlowInfo appFlowInfo)
Add an app flow information object to an app's information object.

Parameters:
appInfo - The app information object in which to add the flow info object.
appFlowInfo - The flow information object to add.
Returns:
Returns true if the flow was added successfully. A return value of false indicates that the monitoring storage quota for app flows has been reached.

prepareMonAppLoadedMessage

public static final PktPacket prepareMonAppLoadedMessage(SrvMonAppInfo appInfo)
Prepare a new app loaded event message

Parameters:
appInfo - The app information used to prepare the message.

prepareMonAppStateChangeMessage

public static final PktPacket prepareMonAppStateChangeMessage(SrvMonAppInfo appInfo)
Prepare an app state change event message

Parameters:
appInfo - The app information used to prepare the message.

prepareMonAppBusBindingCreateMessage

public static final PktPacket prepareMonAppBusBindingCreateMessage(String appName,
                                                                   SrvMonAppBusBindingInfo busBindingInfo)
Prepare an app bus binding create event message.

Parameters:
appName - The name of the app to which the bus binding belongs.
busBindingInfo - The app's bus binding information object used to prepare the message.

prepareMonAppBusBindingStateChangeMessage

public static final PktPacket prepareMonAppBusBindingStateChangeMessage(String appName,
                                                                        String busBindingName,
                                                                        SrvMonAppBusBindingState newState)
Prepare an app bus binding state change event message

Parameters:
appName - The name of the app to which the bus binding belongs.
busBindingName - The name of the bus binding whose state has changed.
newState - The new bus state.

prepareMonAppBusBindingDestroyMessage

public static final PktPacket prepareMonAppBusBindingDestroyMessage(String appName,
                                                                    String busBindingName)
Prepare an app bus binding destroy event message.

Parameters:
appName - The name of the app to which the bus binding belongs.
busBindingName - The name of the bus binding what was destroyed.

prepareMonAppBusChannelOpenedMessage

public static final PktPacket prepareMonAppBusChannelOpenedMessage(String appName,
                                                                   String busBindingName,
                                                                   SrvMonAppBusChannelInfo busChannelInfo)
Prepare an app bus channel opened event message.

Parameters:
appName - The name of the app to which the channel belongs.
busBindingName - The name of the bus binding to which the channel belongs.
busChannelInfo - The channel information object to use to prepare the message.

prepareMonAppBusChannelClosedMessage

public static final PktPacket prepareMonAppBusChannelClosedMessage(String appName,
                                                                   String busBindingName,
                                                                   String busChannelName)
Prepare an app bus channel closed event message.

Parameters:
appName - The name of the app to which the channel belongs.
busBindingName - The name of the bus binding to which the channel belongs.
busChannelName - The name of the channel for which to prepare the message.

prepareMonAppClientConnectMessage

public static final PktPacket prepareMonAppClientConnectMessage(String appName,
                                                                SrvMonAppClientInfo clientInfo)
Prepare an app client connect event message.

Parameters:
appName - The name app to which the client connected.
clientInfo - The client information object used to prepare the message

prepareMonAppClientDisconnectMessage

public static final PktPacket prepareMonAppClientDisconnectMessage(String appName,
                                                                   String clientName)
Prepare an app client disconnect event message.

Parameters:
appName - The name app from which the client disconnected.
clientName - The name of the disconnected client.

prepareMonAppFlowCreateMessage

public static final PktPacket prepareMonAppFlowCreateMessage(String appName,
                                                             SrvMonAppFlowInfo appFlowInfo)
Prepare an app flow create event message.

Parameters:
appName - The name app to which the flow is established.
appFlowInfo - The flow information object used to prepare the message

prepareMonAppUnloadedMessage

public static final PktPacket prepareMonAppUnloadedMessage(String appName)
Prepare an app unloaded event message

Parameters:
appName - The name of the unloaded app.

prepareMonHeartbeatMessage

public static final SrvMonHeartbeatMessage prepareMonHeartbeatMessage(long statsCollectionStartWallTime,
                                                                      long statsCollectionStartTime,
                                                                      long statsCollectionEndTime,
                                                                      String serverName,
                                                                      SrvMonSysStats sysStats,
                                                                      XCollection<SrvMonPoolStats> poolStats,
                                                                      XCollection<SrvMonAdminClientStats> adminClientStats,
                                                                      XCollection<SrvMonAppInfo> appsInfo,
                                                                      XCollection<SrvMonAppStats> appsStats)
Prepare a server heartbeat message.

Parameters:
statsCollectionStartWallTime - The wall time, in milliseconds, when stats collection was started
statsCollectionStartTime - The time, in nanoseconds, stats collection was started
statsCollectionEndTime - The time, in nanoseconds, stats collection was ended
sysStats - The system statstics.
poolStats - The pool statistics.
adminClientStats - The admin client statistics.
appsInfo - The app information objects.
appsStats - The app statistics.

addGaugeValue

public static void addGaugeValue(SrvMonUserGaugeStat srvMonUserGaugeStat,
                                 IStats.Gauge gauge)
Sets the value from a IStats.Gauge into a SrvMonUserGaugeStat.

Parameters:
srvMonUserGaugeStat - The SrvMonUserGaugeStat
gauge - The Gauge with the value to add.

getGaugeValue

public static Object getGaugeValue(SrvMonUserGaugeStat srvMonUserGaugeStat)
Gets the value from a SrvMonUserGaugeStat as an object.

This method returns null if the type of the Gauge is unknown.

Returns:
The value or null if the type is unknown.

setBackingMessage

public static final void setBackingMessage(AepBusBindingCreatedEvent event)

setBackingMessage

public static final void setBackingMessage(AepBusBindingCreateFailedEvent event)

setBackingMessage

public static final void setBackingMessage(AepEngineCreatedEvent event)

setBackingMessage

public static final void setBackingMessage(com.neeve.ods.impl.StoreMemberUpEvent event)

setBackingMessage

public static final void setBackingMessage(com.neeve.ods.impl.StoreMemberInitCompleteEvent event)

setBackingMessage

public static final void setBackingMessage(AepEngineStartedEvent event)

setBackingMessage

public static final void setBackingMessage(AepBusBindingOpeningEvent event)

setBackingMessage

public static final void setBackingMessage(AepBusBindingOpenedEvent event)

setBackingMessage

public static final void setBackingMessage(AepBusBindingOpenFailedEvent event)

setBackingMessage

public static final void setBackingMessage(AepChannelUpEvent event)

setBackingMessage

public static final void setBackingMessage(AepBusBindingUpEvent event)

setBackingMessage

public static final void setBackingMessage(AepMessagingPrestartEvent event)

setBackingMessage

public static final void setBackingMessage(AepMessagingStartedEvent event)

setBackingMessage

public static final void setBackingMessage(AepMessagingStartFailedEvent event)

setBackingMessage

public static final void setBackingMessage(AepEngineActiveEvent event)

setBackingMessage

public static final void setBackingMessage(com.neeve.ods.impl.StoreBindingRoleChangedEvent event)

setBackingMessage

public static final void setBackingMessage(com.neeve.ods.impl.StoreMemberDownEvent event)

setBackingMessage

public static final void setBackingMessage(com.neeve.ods.impl.StoreBindingFailedEvent event)

setBackingMessage

public static final void setBackingMessage(AepChannelDownEvent event)

setBackingMessage

public static final void setBackingMessage(AepBusBindingDownEvent event)

setBackingMessage

public static final void setBackingMessage(AepMessagingFailedEvent event)

setBackingMessage

public static final void setBackingMessage(AepBusBindingDestroyedEvent event)

setBackingMessage

public static final void setBackingMessage(AepEngineStoppedEvent event)

setBackingMessage

public static void setBackingMessage(AepEngineStoppingEvent event)

setBackingMessage

public static final void setBackingMessage(com.neeve.ods.impl.StoreTransactionLogRepairedEvent event)

setBackingMessage

public static final void setBackingMessage(AepDuplicateAcknowledgementAlertEvent event)

setBackingMessage

public static final void setBackingMessage(AepInboundLogExceptionEvent event)

setBackingMessage

public static final void setBackingMessage(AepOutboundLogExceptionEvent event)

setBackingMessage

public static final void setBackingMessage(AepOutOfOrderSendCommitCompletionAlertEvent event)

setBackingMessage

public static final void setBackingMessage(AepSendExceptionEvent event)

setBackingMessage

public static final void setBackingMessage(AepStatsAlertEvent event)

setBackingMessage

public static final void setBackingMessage(AepStuckAlertEvent event)

setBackingMessage

public static final void setBackingMessage(UnhandledMessageEvent event)

setBackingMessage

public static final void setBackingMessage(AepMessageTraceLoggingExceptionEvent event)

setBackingMessage

public static final void setBackingMessage(AepUnhandledMessageEvent event)

setBackingMessage

public static final void setBackingMessage(MessageBusBindingReconnectingEvent event)

setBackingMessage

public static final void setBackingMessage(MessageBusBindingReconnectedEvent event)

setBackingMessage

public static final void setBackingMessage(AepApplicationExceptionEvent event)

convertToArgumentType

public static final SrvMonArgumentType convertToArgumentType(Class<?> targetType)
Converts a primitive method parameter type to an SrvMonArgumentType

Parameters:
targetType - a command parameter type.
Returns:
The corresponding SrvMonArgumentType.

convertToReturnType

public static final SrvMonReturnType convertToReturnType(Class<?> targetType)
Converts a method return type to a SrvMonReturnType

Parameters:
targetType - a command return type.
Returns:
The corresponding SrvMonReturnType.

convertToOptionType

public static final SrvMonOptionType convertToOptionType(Class<?> targetType)
Converts a primitive method parameter type to an SrvMonOptionType

Parameters:
targetType - a command parameter type.
Returns:
The corresponding SrvMonOptionType.

printCommmandUsage

public static final void printCommmandUsage(ISrvMonCommandDescription command,
                                            Appendable builder)
Appends command usage to an Appendable

Parameters:
builder - The Appendable

formatTraceRecordTo

public static final void formatTraceRecordTo(SrvMonTraceRecord traceRecord,
                                             Appendable sb)
Formats a trace record.

Parameters:
traceRecord - The trace record.
sb - The target

getResponseValue

public static Object getResponseValue(SrvMonInvokeCommandResponse response)
Unpacks the return value from a SrvMonInvokeCommandResponse.

Parameters:
response - The response containing the value.
Returns:
The response value.


Copyright © 2016 Neeve Research, LLC. All Rights Reserved.