Glyn Normington wrote:
>
> >1. Write a regular old Singleton
>
> This probably involves updating static contrary to the restriction in
> section 18.1.2 of the EJB 1.1 spec and can lead to inconsistent runtime
> semantics, although it can be argued that this restriction is only
> intended to apply to fields of the enterprise bean class itself and not
> those of 'helper' classes.

To be clear, the 1.1 spec only prohibits read/write static fields. Here is the
relevant section:

     An enterprise Bean must not use read/write static fields. Using
     read-only static fields is allowed. Therefore, it is recommended
     that all static fields in the enterprise bean class be declared as
     final.

The classic pattern for the Singleton class uses a read-only static field to
hold the Singleton reference, so it would be allowed.

The rationale for this restriction would apply to helper classes as well, so
even though the spec refers specifically to EJBs, I would argue that the
restriction against read/write statics applies to helper classes.
Unfortunately, helper classes are not always written specifically for EJBs and
the developer may not be able to modify the helper class as needed.

===========================================================================
To unsubscribe, send email to [EMAIL PROTECTED] and include in the body
of the message "signoff EJB-INTEREST".  For general help, send email to
[EMAIL PROTECTED] and include in the body of the message "help".

Reply via email to