<?xml version="1.0" encoding="UTF-8"?>
<section version="5.0" xml:id="services.ejb2.config" xml:lang="en"
         xmlns="http://docbook.org/ns/docbook"
         xmlns:xlink="http://www.w3.org/1999/xlink"
         xmlns:xi="http://www.w3.org/2001/XInclude"
         xmlns:svg="http://www.w3.org/2000/svg"
         xmlns:mml="http://www.w3.org/1998/Math/MathML"
         xmlns:html="http://www.w3.org/1999/xhtml"
         xmlns:db="http://docbook.org/ns/docbook">
  <info>
    <title>ejb2 Service configuration</title>
  </info>

  <para>This service provides containers for EJB2.1 components.</para>

  <para>An EJB container can be created from an <filename
  class="extension">ejb-jar</filename> file using one of the following
  possibilities:</para>

  <itemizedlist>
    <listitem>
      <para>The <filename class="extension">ejb-jar </filename>file has been
      copied under $JONAS_BASE/deploy</para>
    </listitem>

    <listitem>
      <para>The <filename class="extension">ejb-jar</filename> file is
      packaged inside an ear file as a component of a <xi:include
      href="../../variables.xml" xpointer="j2ee" /> application. The container
      will be created when the <xi:include href="../../variables.xml"
      xpointer="element(j2ee)" /> application will be deployed via the
      <emphasis role="bold">ear</emphasis> service.</para>
    </listitem>

    <listitem>
      <para>EJB containers may be dynamically created from ejb-jar files using
      the JonasAdmin tool.</para>
    </listitem>

    <listitem>
      <para>EJB containers may be dynamically created from ejb-jar files using
      the command jonas admin:</para>

      <screen>jonas admin -a &lt;some-dir&gt;/sb.jar</screen>
    </listitem>
  </itemizedlist>

  <para>The <emphasis role="bold">ejb</emphasis> service can (and by default
  does) provide monitoring options. Monitoring provides the following values
  at a per-EJB basis for stateful and stateless beans:</para>

  <itemizedlist>
    <listitem>
      <para><emphasis role="bold">Number of calls</emphasis> done on all
      methods.</para>
    </listitem>

    <listitem>
      <para><emphasis role="bold">Total business time</emphasis>, i.e. the
      time spent executing business (applicative) code.</para>
    </listitem>

    <listitem>
      <para><emphasis role="bold">Total time</emphasis>, i.e. the total time
      spent executing code (business code + container code).</para>
    </listitem>
  </itemizedlist>

  <para>The <emphasis role="bold">warningThreshold</emphasis> option can be
  used to generate a warning each time a method takes more than <emphasis
  role="bold">warningThreshold</emphasis> milliseconds to execute. By default,
  <emphasis role="bold">warningThreshold</emphasis> is set to 20
  seconds.</para>

  <para>Here is the part of <filename>jonas.properties</filename> concerning
  the <emphasis role="bold">ejb2 </emphasis>service:</para>

  <screen>###################### JOnAS EJB 2 Container service configuration
#
#  Set the name of the implementation class of the ejb2 service
jonas.service.ejb2.class    org.ow2.jonas.ejb2.internal.JOnASEJBService

#  Set the XML deployment descriptors parsing mode (with or without validation)
jonas.service.ejb2.parsingwithvalidation    true

# If enabled, the GenIC tool will be called if :
#  - JOnAS version of the ejb-jar is not the same version than the running JOnAS instance
#  - Stubs/Skels stored in the ejb-jar are not the same than the JOnAS current protocols.
# By default, this is enabled
jonas.service.ejb2.auto-genic    true

# Arguments for the auto GenIC (-invokecmd, -verbose, etc.)
jonas.service.ejb2.auto-genic.args -invokecmd

#  Note: these two settings can be overriden by the EJB descriptor.
#
#  If EJB monitoring is enabled, statistics about method call times will be
#  collected. This is a very lightweight measurement and should not have much
#  impact on performance.
jonas.service.ejb2.monitoringEnabled true
#  If EJB monitoring is enabled, this value indicates after how many
#  milliseconds spent executing an EJB method a warning message should be
#  displayed. If 0, no warning will ever be displayed.
jonas.service.ejb2.warningThreshold 20000</screen>

  <para>For customizing the <emphasis role="bold">ejb2</emphasis> service it
  is possible to:</para>

  <itemizedlist>
    <listitem>
      <para>Set or not the XML validation at the deployment descriptor parsing
      time</para>
    </listitem>

    <listitem>
      <para>Set or not the automatic generation via the GenIC tool</para>
    </listitem>

    <listitem>
      <para>Specify the arguments to pass to the GenIC tool</para>
    </listitem>
  </itemizedlist>
</section>
