You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tomee.apache.org by David Blevins <da...@visi.com> on 2009/03/25 03:42:19 UTC

Re: Singleton Container

There have been some updates in the spec in regards to Singletons.   
Since a user pointed out the race condition on lazy instantiation  
issue that needs to be fixed, I've been digging in the code to  
implement these additions as well.

Some of the EJB 3.1 Singleton changes:

   -- Callbacks are transactional (we've actually had one user request  
this already)
   -- New @AccessTimeout annotation to configure how long clients are  
willing to wait for accessing a singleton with container managed  
security.

Additionally the xml equivalent for @Lock(READ) and @Lock(WRITE) has  
changed.

-David

On Jun 28, 2008, at 11:22 AM, David Blevins wrote:

> Since we're thinking of calling the release 3.1, I started looking  
> at implementing singleton beans.
>
> Started hacking last night and think I might have something working.
>
> Here are some of my "singleton" spec notes.  Perhaps too terse to  
> the point of being useless, but I figured I'd share anyway.
>
> In general, think stateless bean where there is exactly one instance  
> (no pool) that is created at startup and never destroyed.
>
> Singletons:
>
> - concurrent access
> - session bean
> - supports web services
> - not activated or passivated
> - can use javax.ejb.TimerService
> - can have EJBHome/EJBLocalHome interfaces
> - With @Startup created when app starts
> - @DependsOn allows for startup ordering
> - does not support remove
> - instances not discarded on system exception
> - Bean-Managed or Container-Managed Concurrency
> - Container-Managed Concurrency method attributes:
>    - ReadOnly (shared access)
>    - ReadWrite (exclussive access), the default
>
>
> Some related new API classes (subject to change):
> - @Singleton (class)
> - @Startup (class)
> - @DependsOn (class)
> - @ContainerManagedConcurrency (class)
> - @BeanManagedConcurrency (class)
> - @ReadOnly  (class, method)
> - @ReadWrite (class, method)
> - ConcurrentAccessTimeoutException
>
>
> Will post more details as I get them.
>
> -David
>
>