Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Java > Mutual EJB possible?

Reply
Thread Tools

Mutual EJB possible?

 
 
Vjeran Marcinko
Guest
Posts: n/a
 
      10-17-2003
Hi folks.
I'm really fresh in EJB stuff, so at first I thought it was just another heavyweight framework, but more I think about it it seems that it is not suitable for every kind of application ...but moew like for stateless (due to nature of HTTP protocol) kind of web apps.

Anyway, is it possible to create something like singleton EJB ? I don't need referencing it through static accessor SingletonClass.getInstance(), I would fetch it from JNDI context, but I need just one instance of it to exist in EJB container ...
More concretly - let's say I want to make some 'ChatRoom' EJB, which would hold references of all connected clients, so it could dispatch messages to all room chatters when some message is placed into chat room ? Is EJB not meant to be used for this kind of applications ?

Regards,
Vjeran

 
Reply With Quote
 
 
 
 
Michael Borgwardt
Guest
Posts: n/a
 
      10-17-2003
Vjeran Marcinko wrote:
> Anyway, is it possible to create something like singleton EJB ? I don't need referencing it
> through static accessor SingletonClass.getInstance(), I would fetch it from JNDI

context, but
> I need just one instance of it to exist in EJB container ...


In that case, EJB isn't really what you need. At least not the way you seem to plan.


> More concretly - let's say I want to make some 'ChatRoom' EJB, which would hold references of all
> connected clients, so it could dispatch messages to all room chatters when some message

is placed
> into chat room ? Is EJB not meant to be used for this kind of applications ?


No, it would be serious overkill and a lot of unnecessary hassle.

EJBs only make sense when you can actually profit from their unique features,
namely the easy clustering and declarative transaction and security management.

 
Reply With Quote
 
 
 
 
Vjeran Marcinko
Guest
Posts: n/a
 
      10-17-2003

"Michael Borgwardt" <(E-Mail Removed)> wrote in message news:bmovr2$phjp5$(E-Mail Removed)-berlin.de...

> > More concretly - let's say I want to make some 'ChatRoom' EJB, which would hold references of all
> > connected clients, so it could dispatch messages to all room chatters when some message

> is placed
> > into chat room ? Is EJB not meant to be used for this kind of applications ?

>
> No, it would be serious overkill and a lot of unnecessary hassle.
>
> EJBs only make sense when you can actually profit from their unique features,
> namely the easy clustering and declarative transaction and security management.


I am user of lightweight frameworks such as Avalon, HiveMind etc... and I thought that people avoid EJBs just because it's too complex to learn and use for everyday needs, but now I see that complexity is not it's only disadvantage, but they also aren't suited for all kind of apps. For instance, "singleton" EJBs would be necessary for apps like chat server where you must have some mutual components for all connected clients.
I agree that for well-suited apps would EJBs offer great part of built-in functionality. Some of them you named above.

Cheers,
Vjeran

 
Reply With Quote
 
Michael Borgwardt
Guest
Posts: n/a
 
      10-17-2003
Vjeran Marcinko wrote:
> I am user of lightweight frameworks such as Avalon, HiveMind etc... and I thought that people avoid EJBs
> just because it's too complex to learn and use for everyday needs, but now I see that

complexity is not
> it's only disadvantage, but they also aren't suited for all kind of apps. For instance,

"singleton"
> EJBs would be necessary for apps like chat server where you must have some mutual

components for all
> connected clients.


Actually, I think that Message-driven EJBs might be just right for that general type of
application.





 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Possible to generate "ejb-jar.xml" from EJB class (source)? "ejb-jar.xml" appserver independent? Raymond Schanks Java 0 08-03-2010 08:21 AM
EJB-QL: writing a regular expression query using EJB QL Sriv Chakravarthy Java 0 09-18-2003 03:39 PM
To EJB or not to EJB Jeremy Haile Java 5 09-10-2003 03:52 AM
EJB on Weblogic7 : accessing Ejb thru *Local interface* fails due to JNDI lookup Mumbai Joe Java 0 07-29-2003 04:16 PM
Dynamically Access & Call An EJB From Another EJB? Steve Java 1 07-15-2003 06:47 PM



Advertisments