Autonomous Services as beans

Discussions

EJB design: Autonomous Services as beans

  1. Autonomous Services as beans (1 messages)

    Hi,
    An EJB method is invoked in response to a client request. A container instaniates a bean. Is it possible to have a bean which is like an autonomous service that is always running as a separate entity. By a service I mean something that doesn't directly interact with a client/user, but is executing in a stand-alone manner.
    thanks
  2. Autonomous Services as beans[ Go to top ]

    No, a bean cannot act as an autonomous service, as you've described. You need to do it a different way. If you're in a single JVM situation, you can simply create -- outside the EJB container -- a separate thread that creates an object to perform this service. Different app servers have different ways of allowing you to start up this thread at the same time as the app server.

    If you're in a multiple JVM situation (or want to be ready for one when it comes sometime in the future), do the same thing but make your object an RMI (or CORBA) server so it can be contacted by any of the remote JVMs.

    hope that helps,
    david