Class MonitoringProxy

java.lang.Object
net.bull.javamelody.MonitoringProxy
All Implemented Interfaces:
Serializable, InvocationHandler

public class MonitoringProxy extends Object implements InvocationHandler, Serializable
Proxy de monitoring pour tout façade ayant une interface. Il est destiné à un compteur pour les statistiques d'exécutions de méthodes sur les "façades métiers" qui ne sont ni EJB 3 ni Spring. Il s'utilise comme ceci : facade = MonitoringProxy.createProxy(facade);
Author:
Emeric Vernat
See Also:
  • Constructor Details

    • MonitoringProxy

      protected MonitoringProxy(Object facade)
      Constructeur privé : instanciation pour méthode createProxy ci-dessous.
      Parameters:
      facade - Object
    • MonitoringProxy

      protected MonitoringProxy(Object facade, String name)
      Constructeur privé : instanciation pour méthode createProxy ci-dessous.
      Parameters:
      facade - Object
      name - override of the interface name in the statistics
  • Method Details

    • createProxy

      public static <T> T createProxy(T facade)
      Création d'un proxy de monitoring pour une façade.
      Type Parameters:
      T - Type de la façade (une interface en général).
      Parameters:
      facade - Instance de la façade
      Returns:
      Proxy de la façade
    • createProxy

      public static <T> T createProxy(T facade, String name)
      Création d'un proxy de monitoring pour une façade, en spécifiant le nom qui sera affiché dans le monitoring.
      Type Parameters:
      T - Type de la façade (une interface en général).
      Parameters:
      facade - Instance de la façade
      name - override of the interface name in the statistics
      Returns:
      Proxy de la façade
    • invoke

      public Object invoke(Object proxy, Method method, Object[] args) throws Throwable
      Intercepte une exécution de méthode sur une façade.
      Specified by:
      invoke in interface InvocationHandler
      Parameters:
      proxy - Object
      method - Method
      args - Object[]
      Returns:
      Object
      Throws:
      Throwable - t
    • invokeTarget

      public static Object invokeTarget(Object target, Method method, Object[] args, String requestName) throws IllegalAccessException, InvocationTargetException
      Invoke target.
      Parameters:
      target - Instance to call
      method - Method to call
      args - Method arguments
      requestName - Request name to display
      Returns:
      Result
      Throws:
      IllegalAccessException - e
      InvocationTargetException - e
    • getRequestName

      protected String getRequestName(Method method)
    • getName

      protected String getName()
    • createProxy

      protected static <T> T createProxy(T facade, MonitoringProxy monitoringProxy)