geronimo-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Jay D. McHugh" <>
Subject Re: Question on letting several EJB3 SLSB timer beans share one interface class
Date Thu, 15 May 2008 01:46:21 GMT
Hello again.

Just in case someone else needs to do this.  And, I must say that it is 
probably almost always a bad thing to do.  In most cases, the need to 
have the exact same interface exposed on a range of classes that perform 
completely different functions should be rare.  I just happen to have a 
block of

Here is how you would have several session bean classes that utilize the 
same interface class:

1) Create the one interface class.
2) Create the multiple bean classes implementing the interface class.

Here is where it gets interesting (not particularly interesting though)
3) Inject an instance of your bean using the following syntax:

@EJB(beanName="SpecificBeanImplementationClass") private 
GenericInterface specificBeanInstance;

That should have all been on one line, but it was too long so it 
auto-wrapped.  And of course the pretend names should be replaced with 
your particular class, interface, and instance names.

Maybe this might help someone else,


Jay McHugh wrote:
> (This will probably end up appearing twice eventually - sorry)
> Hello all,
> I have about 25 (currently - will probably increase over time) timer beans
> that really only need to expose the method to schedule them.
> But I haven't been able to figure out how to share one interface class and
> still be able to inject the correct, particular timer out of the 25
> different timer classes.
> Is this possible/has anyone done anything like this?
> Thanks,
> Jay

View raw message