newbie: Global EJB and more ...

S

Steven Woody

Hi group,

While thinking of how to transfer a tranditional client-server app
into J2EE, I got following two questions:

1, In a typical application, there should be some global (even
singleton) objects which are created on application startup code and
stay there until the program exiting. In the idiom of J2EE, what kind
of Beans act like this kind of global object? And, when and how these
global beans should be created?

2, I knew Beans have to be deployed onto the server before they come
to be available, but those Beans quit often need some objects to
complete its job, these objects may encapsulate a algorithem, may do
some management task, but they typically dont have to exposed to
client tire or web tire. I call these objects are intermediate
objects. My question is, should this kind of objects need to be a EJB?
My J2EE books seems only to mention three kinds of Beans,
SessionBeans, EntityBeans and MessageBeans. But what do I do for those
intermediate objects?

Thanks in advance.

--
(e-mail address removed)

%% (fortunes)
Q: How did you get into artificial intelligence?
A: Seemed logical -- I didn't have any real intelligence.
 
C

Chiron Paixos

Hi group,

While thinking of how to transfer a tranditional client-server app
into J2EE, I got following two questions:

1, In a typical application, there should be some global (even
singleton) objects which are created on application startup code and
stay there until the program exiting. In the idiom of J2EE, what kind
of Beans act like this kind of global object? And, when and how these
global beans should be created?

In the J2EE standard there is no definition for this kind of function.
So it might be implemented for a specific container as a manufacturer
specific extension. BTW there is usually no need to create instances
of any objects *before* the system starts normal operation. If you
need something to be prepared once to be used many times later until
shutdown - write a static class (with a Singleton pattern)
2, I knew Beans have to be deployed onto the server before they come
to be available, but those Beans quit often need some objects to
complete its job, these objects may encapsulate a algorithem, may do
some management task, but they typically dont have to exposed to
client tire or web tire. I call these objects are intermediate
objects. My question is, should this kind of objects need to be a EJB?
My J2EE books seems only to mention three kinds of Beans,
SessionBeans, EntityBeans and MessageBeans. But what do I do for those
intermediate objects?

What objects do those beans you mention in this question need to
complete their jobs? Either it's any kind of persistant data (Entity
Beans), interaction data from user/other application
(stateless/stateful session bean), or what else did you think of?
Remember you can still create "normal Java" objects like e.g. DTOs
(data transfer objects).
 
J

John C. Bollinger

Steven said:
1, In a typical application, there should be some global (even
singleton) objects which are created on application startup code and
stay there until the program exiting. In the idiom of J2EE, what kind
of Beans act like this kind of global object? And, when and how these
global beans should be created?

2, I knew Beans have to be deployed onto the server before they come
to be available, but those Beans quit often need some objects to
complete its job, these objects may encapsulate a algorithem, may do
some management task, but they typically dont have to exposed to
client tire or web tire. I call these objects are intermediate
objects. My question is, should this kind of objects need to be a EJB?
My J2EE books seems only to mention three kinds of Beans,
SessionBeans, EntityBeans and MessageBeans. But what do I do for those
intermediate objects?

Perhaps both questions are answered by the fact that EJBs may
instantiate and use objects of almost any class accessible to them.
Usage means invoking methods on such objects, and passing or accepting
them as method arguments, and returning them or accepting them as method
return values. EJBs are forbidden from performing actions that
interfere with their management by their container; such actions include
such things as starting threads and invoking System.exit().


John Bollinger
(e-mail address removed)
 
S

Steven Woody

Thanks!
Perhaps both questions are answered by the fact that EJBs may
instantiate and use objects of almost any class accessible to
them. Usage means invoking methods on such objects, and passing or
accepting them as method arguments, and returning them or accepting
them as method return values. EJBs are forbidden from performing
actions that interfere with their management by their container; such
actions include such things as starting threads and invoking
System.exit().


John Bollinger
(e-mail address removed)
 

Ask a Question

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

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,769
Messages
2,569,582
Members
45,058
Latest member
QQXCharlot

Latest Threads

Top