Mutual EJB possible?

Discussion in 'Java' started by Vjeran Marcinko, Oct 17, 2003.

  1. 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
     
    Vjeran Marcinko, Oct 17, 2003
    #1
    1. Advertising

  2. 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.
     
    Michael Borgwardt, Oct 17, 2003
    #2
    1. Advertising

  3. "Michael Borgwardt" <> wrote in message news:bmovr2$phjp5$-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
     
    Vjeran Marcinko, Oct 17, 2003
    #3
  4. 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.
     
    Michael Borgwardt, Oct 17, 2003
    #4
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Steve
    Replies:
    1
    Views:
    716
    John C. Bollinger
    Jul 15, 2003
  2. Mumbai Joe
    Replies:
    0
    Views:
    622
    Mumbai Joe
    Jul 29, 2003
  3. Jeremy Haile

    To EJB or not to EJB

    Jeremy Haile, Sep 3, 2003, in forum: Java
    Replies:
    5
    Views:
    555
    Christopher Blunck
    Sep 10, 2003
  4. Sriv Chakravarthy
    Replies:
    0
    Views:
    827
    Sriv Chakravarthy
    Sep 18, 2003
  5. Raymond Schanks
    Replies:
    0
    Views:
    685
    Raymond Schanks
    Aug 3, 2010
Loading...

Share This Page