]
Stuart Douglas commented on WFLY-3754:
--------------------------------------
After the stateless interceptors patch this one one instance of this interceptor should be
created, so even though it will still waste some memory it will not be per instance, but
rather per component.
EJB StatefulSessionComponentInstance methodMap includes final Object
methods
----------------------------------------------------------------------------
Key: WFLY-3754
URL:
https://issues.jboss.org/browse/WFLY-3754
Project: WildFly
Issue Type: Enhancement
Security Level: Public(Everyone can see)
Components: EJB
Affects Versions: 8.1.0.Final
Reporter: James Livingston
Assignee: David Lloyd
StatefulSessionComponentInstance has a methodMap which maintains the ChainedInterceptors
for each method. That currently includes final Object methods which are not Business
Methods for EJBs (EJB 3.1 4.9.5 "The method must not be declared as final or
static"), which results in extra memory overhead for what I believe is the useless
interceptors.
The amount of memory a ChainedInterceptor consumes varies between JVMs, but it is between
280 and 400 bytes in some heap dumps I looked at. With 6 final methods (wait, notify*,
getClass) on java.lang.Object that adds approximately 2kb of memory use to each instance
of each SFSB.
This can affect all BasicComponentInstance subclasses, but it is most noticeable for
SFSBs due to the larger number of instances.
The list of methods comes from ComponentConfiguration.getDefinedComponentMethods(), but
I'm not sure if filtering the final methods out should be done there or an
EJB-specific class since the rule about final methods is from the EJB spec. I'm also
not sure if toString, equals and hashCode() should be treated as EJB business methods
either.