You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@sirona.apache.org by rm...@apache.org on 2013/11/25 17:08:57 UTC

svn commit: r1545333 - /incubator/sirona/site/instrumentation.html

Author: rmannibucau
Date: Mon Nov 25 16:08:57 2013
New Revision: 1545333

URL: http://svn.apache.org/r1545333
Log:
Site checkin for project Apache Sirona Incubator

Modified:
    incubator/sirona/site/instrumentation.html

Modified: incubator/sirona/site/instrumentation.html
URL: http://svn.apache.org/viewvc/incubator/sirona/site/instrumentation.html?rev=1545333&r1=1545332&r2=1545333&view=diff
==============================================================================
--- incubator/sirona/site/instrumentation.html (original)
+++ incubator/sirona/site/instrumentation.html Mon Nov 25 16:08:57 2013
@@ -467,6 +467,28 @@ public class Foo {
     }
 }
 </pre></div></div>
+<div class="section">
+<h2>Go further with sirona javaagent<a name="Go_further_with_sirona_javaagent"></a></h2>
+<p>Javaagent is extensible using <tt>InvocationListener</tt> API:</p>
+
+<div>
+<pre class="prettyprint linenums">
+public interface InvocationListener {
+    void before(AgentContext context);
+    void after(AgentContext context, Throwable error);
+    boolean accept(Counter.Key key, Object instance);
+}
+</pre></div>
+
+<ul>
+  
+<li><tt>accept</tt> method allows to filter by key/instance what is intercepted.</li>
+  
+<li><tt>before</tt> and <tt>after</tt> allows to put code around method executions. <tt>AgentContext</tt> supports contextual data through <tt>put</tt>/<tt>get</tt> methods.</li>
+</ul>
+<p>Note on contextual data: key is an int for performances reasons, ensure you don&#x2019;t conflict with another listener. Prefer to use negative int if possible.</p>
+<p><tt>InvocationListeners</tt> can be sorted using <tt>@Order</tt> annotation.</p>
+<p>They are picked using a plain old service provider interface (<tt>META-INF/services/org.apache.sirona.javaagent.spi.InvocationListener</tt>).</p></div>
                   </div>
           </div>