tomee-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Thiago Veronezi <thi...@veronezi.org>
Subject Re: patch: spend time in bussines method
Date Fri, 13 Jan 2012 02:09:54 GMT
Hi,

It seems the log call for the _invoke method is there since 2007. I think
it could be removed to save some "if" calls in production.
If you want to log the execution of your business methods
without polluting your code, you can use interceptors. Check the use of
"@AroundInvoke".

http://openejb.apache.org/callbacks.html
http://docs.oracle.com/javaee/6/tutorial/doc/gkedm.html#gkecy

[]s,
Thiago.



On Thu, Jan 12, 2012 at 5:05 AM, m1k0 <m1k0.register@gmail.com> wrote:

> Hi,
> I propose some patch to ejb-core 3.1.2
>
>
> # This patch file was generated by NetBeans IDE
> # Following Index: paths are relative to:
>
> /home/m1k0/Projekty/opensource/repos/asf/openejb/tags/openejb-3.1.2/container/openejb-core/src/main/java/org/apache/openejb/core/ivm
> # This patch can be applied using context Tools: Patch action on respective
> folder.
> # It uses platform neutral UTF-8 encoding and \n newlines.
> # Above lines and this line are ignored by the patching process.
> Index: EjbObjectProxyHandler.java
> --- EjbObjectProxyHandler.java Base (BASE)
> +++ EjbObjectProxyHandler.java Locally Modified (Based On LOCAL)
> @@ -58,9 +58,10 @@
>     public Object _invoke(Object p, Class interfce, Method m, Object[] a)
> throws Throwable {
>         java.lang.Object retValue = null;
>         java.lang.Throwable exc = null;
> -
> +        long startInMilis = 0;
>         try {
>             if (logger.isDebugEnabled()) {
> +                startInMilis = System.currentTimeMillis();
>                 logger.debug("invoking method " + m.getName() + " on " +
> deploymentID + " with identity " + primaryKey);
>             }
>             Integer operation = (Integer) dispatchTable.get(m.getName());
> @@ -145,10 +146,11 @@
>             throw new RemoteException("Unknown Container Exception",
> oe.getRootCause());
>         } finally {
>             if (logger.isDebugEnabled()) {
> +                long duration = System.currentTimeMillis() - startInMilis;
>                 if (exc == null) {
> -                    logger.debug("finished invoking method " + m.getName()
> + ". Return value:" + retValue);
> +                    logger.debug("finished invoking method " + m.getName()
> + "[Spent time: "+duration+"ms]. Return value:" + retValue);
>                 } else {
> -                    logger.debug("finished invoking method " + m.getName()
> + " with exception " + exc);
> +                    logger.debug("finished invoking method " + m.getName()
> + "[Spent time: "+duration+"ms] with exception " + exc);
>                 }
>             }
>         }
>
>
> --
> View this message in context:
> http://openejb.979440.n4.nabble.com/patch-spend-time-in-bussines-method-tp4288464p4288464.html
> Sent from the OpenEJB User mailing list archive at Nabble.com.
>

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message