Skip to content

Instantly share code, notes, and snippets.

@chengfang
Last active October 1, 2019 03:00
Show Gist options
  • Save chengfang/47a4e54b48b08f3e835d41a1da5b4afd to your computer and use it in GitHub Desktop.
Save chengfang/47a4e54b48b08f3e835d41a1da5b4afd to your computer and use it in GitHub Desktop.

stateful-timeout-and-ejb-runtime-info

Ability to configure default global stateful timeout for Stateful Session Beans (SFSB)

EAP7-1243 https://issues.jboss.org/browse/EAP7-1243

Hard Requirement:

  • Users should be able to configure default global stateful timeout in server config file for all deployed stateful session beans.
    • If this configuration is absent, the current behavior should be preserved (i.e., stateful session beans do not timeout unless explictly removed by application)
    • add this configuration via CLI
    • remove this configuration via CLI
    • update this configuration to a new value via CLI
    • read this configuration value via CLI
  • @StatefulTomeout annotation in bean class should override this default global stateful timeout in server config file
  • stateful-timeout in ejb-jar.xml should override this default global stateful timeout in server config file

Non-requirement:

  • ability to configure default global stateful timeout in WildFly admin console
  • ability to specify default global stateful timeout in custom time unit

Impl Details:

  • add a new attribute, default-session-timeout to ejb3 subsystem schema, for example,
<subsystem xmlns="urn:jboss:domain:ejb3:6.0">
<session-bean>
    <stateless>
        <bean-instance-pool-ref pool-name="slsb-strict-max-pool"/>
    </stateless>
    
    <!-- add new attribute default-session-timeout -->
    <stateful default-session-timeout="600000"
      default-access-timeout="5000" cache-ref="simple" passivation-disabled-cache-ref="simple"/>
    
    <singleton default-access-timeout="5000"/>
    ...
</session-bean>

Test Plan:

  • structural tests with CLI CRUB operations of the new attribute default-session-timeout
  • behavioral tests of default stateful session timeout
    • when this attribute is absent in server config file, a stateful session bean should not timeout and be removed. This is the existing behavior before this RFE is implemented.
    • when this attribute is set to a certain value, a stateful session bean should timeout and subject to removal after this duration (there could be some delay between timeout and actual removal)
    • @StatefulTomeout annotation in bean class should override this attribute in server config file
    • stateful-timeout in ejb-jar.xml should override this attribute in server config file
  • transformer tests should be added to Ejb3TransformersTestCase

Expose EJB3 deployment information at runtime

EAP7-435 https://issues.jboss.org/browse/EAP7-435

WFLY-4699 https://issues.jboss.org/browse/WFLY-4699

Users should be able to view deployment information for an EJB as runtime resources via CLI or admin console. These deployment information comes from ejb-jar.xml and annotation on bean classes. With previous versions of WildFly, users could access them via JMX, and since JMX access does not exist in recent versions of WildFly, we need to expose them as runtime resources. Examples of such information:

  • Class name
  • JNDI name
  • Security roles
  • Bean statistics
  • Pool statistics

Stateless: existing deployment info as runtime resources (http://wildscribe.github.io/WildFly/17.0//deployment/subsystem/ejb3/stateless-session-bean/index.html)

  • component-class-name The component's class name.
  • declared-roles The roles declared (via @DeclareRoles) on this EJB component.
  • execution-time Time spend within a bean method.
  • invocations Number of invocations processed.
  • methods Invocation metrics per method.
  • peak-concurrent-invocations Peak concurrent invocations.
  • pool-available-count The number of available (i.e. not in use) instances in the pool.
  • pool-create-count The number of bean instances that have been created.
  • pool-current-size The current size of the pool.
  • pool-max-size The maximum size of the pool.
  • pool-name The name of the pool.
  • pool-remove-count The number of bean instances that have been removed.
  • run-as-role The run-as role (if any) for this EJB component.
  • security-domain The security domain for this EJB component.
  • timers EJB timers associated with the component.
  • wait-time Time spend waiting to obtain an instance.

Stateful: existing deployment info as runtime resources (http://wildscribe.github.io/WildFly/17.0//deployment/subsystem/ejb3/stateful-session-bean/index.html)

  • cache-size Cache size.
  • component-class-name The component's class name.
  • declared-roles The roles declared (via @DeclareRoles) on this EJB component.
  • execution-time Time spend within a bean method.
  • invocations Number of invocations processed.
  • methods Invocation metrics per method.
  • passivated-count Passivated count.
  • peak-concurrent-invocations Peak concurrent invocations.
  • run-as-role The run-as role (if any) for this EJB component.
  • security-domain The security domain for this EJB component.
  • total-size Total size.
  • wait-time Time spend waiting to obtain an instance.

Singleton: existing deployment info as runtime resources (http://wildscribe.github.io/WildFly/17.0//deployment/subsystem/ejb3/singleton-bean/index.html)

  • component-class-name The component's class name.
  • declared-roles The roles declared (via @DeclareRoles) on this EJB component.
  • execution-time Time spend within a bean method.
  • invocations Number of invocations processed.
  • methods Invocation metrics per method.
  • peak-concurrent-invocations Peak concurrent invocations.
  • run-as-role The run-as role (if any) for this EJB component.
  • security-domain The security domain for this EJB component.
  • timers EJB timers associated with the component.
  • wait-time Time spend waiting to obtain an instance.

Potential deployment information to be exposed for stateless, stateful & singleton:

  • jndi bindings
  • description
  • display-name
  • icon
  • ejb-name
  • home (except singleton)
  • remote (except singleton)
  • local-home (except singleton)
  • local (except singleton)
  • business-local
  • business-remote
  • local-bean
  • service-endpoint (slsb only)
  • ejb-class
  • stateful-timeout (sfsb only)
  • timeout-method
  • init-on-startup (singleton only)
  • concurrency-management-type (sfsb & singleton only)
  • concurrent-method (sfsb & singleton only)
  • depends-on (singleton only)
  • init-method (sfsb only)
  • remove-method (sfsb only)
  • async-method
  • transaction-type
  • after-begin-method (sfsb only)
  • before-completion-method (sfsb only)
  • after-completion-method (sfsb only)
  • around-invoke
  • around-timeout
  • post-activate (sfsb only)
  • pre-passivate (sfsb only)
  • security-role-ref (need to check if already exposed with declared-roles)
  • security-identity (need to check if already exposed with run-as-role)
  • passivation-capable (sfsb only)

Message-driven Bean: existing deployment info as runtime resources (http://wildscribe.github.io/WildFly/17.0//deployment/subsystem/ejb3/message-driven-bean/index.html)

  • component-class-name The component's class name.
  • declared-roles The roles declared (via @DeclareRoles) on this EJB component.
  • delivery-active Indicates whether messages are delivered to this message-driven bean.
  • execution-time Time spend within a bean method.
  • invocations Number of invocations processed.
  • methods Invocation metrics per method.
  • peak-concurrent-invocations Peak concurrent invocations.
  • pool-available-count The number of available (i.e. not in use) instances in the pool.
  • pool-create-count The number of bean instances that have been created.
  • pool-current-size The current size of the pool.
  • pool-max-size The maximum size of the pool.
  • pool-name The name of the pool.
  • pool-remove-count The number of bean instances that have been removed.
  • run-as-role The run-as role (if any) for this EJB component.
  • security-domain The security domain for this EJB component.
  • timers EJB timers associated with the component.
  • wait-time Time spend waiting to obtain an instance.

Potential deployment information to be exposed for MDB:

  • jndi of message destination
  • description
  • display-name
  • icon
  • ejb-name
  • ejb-class
  • messaging-type
  • timeout-method
  • transaction-type
  • message-destination-type
  • message-destination-link
  • activation-config
  • around-invoke
  • around-timeout
  • security-role-ref
  • security-identity

Hard Requirement:

  • Users should be able to view ejb deployment information as runtime resources via CLI for all ejb bean types:
    • stateless
    • stateful
    • singleton
    • MDB
  • EJB deployment information can come from ejb-jar.xml or annotations on bean classes, or both. Users should be able to view the effective and merged deployment information as runtime resources via CLI.
  • Some deployment information, though not present in either ejb-jar.xml or annotations, are useful and therefore should also be exposed as runtime resources. For example, jndi bindings, invocation stats, etc.

Nice-to-have Requirement:

  • ability to read these deployment information from admin console

Non-requirement:

  • ability to modify these deployment information via CLI or admin console;
  • ability to expose deployment information from jboss-specific deployment descriptors;
  • ability to expose ALL deployment information from ejb-jar.xml and annotations for an EJB.
  • ability to expose deployment information from sources other than ejb3.

Test Plan:

  • verify that deployment information should be available as runtime info for all ejb bean types:
    • stateless
    • stateful
    • singleton
    • MDB
  • verify the correctly merged value is exposed as runtime resources via CLI, when some deployment information is specified in both ejb-jar.xml and annotations.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment