2 simple eval/test questions 2003-07-31 - By Sam Fancourt
Back Q1: The answer is B - See the extracted text from the Java Tutorial pasted below (or read State Management Modes in the book). Q2: The answer is D - A factory pattern is used to create objects, ie: (from the J2EE Tutorial again): "the purpose of the home interface is to define the create methods that a remote client may invoke." You can also refer to the GoF definition of a Factory "Provide an interface for creating families of related or dependant objects without specifying their concrete classes"
Sam :-)
Stateful Session Beans The state of an object consists of the values of its instance variables. In a stateful session bean, the instance variables represent the state of a unique client-bean session. Because the client interacts ("talks") with its bean, this state is often called the conversational state. The state is retained for the duration of the client-bean session. If the client removes the bean or terminates, the session ends and the state disappears. This transient nature of the state is not a problem, however, because when the conversation between the client and the bean ends there is no need to retain the state. Stateless Session Beans A stateless session bean does not maintain a conversational state for a particular client. When a client invokes the method of a stateless bean, the bean's instance variables may contain a state, but only for the duration of the invocation. When the method is finished, the state is no longer retained. Except during method invocation, all instances of a stateless bean are equivalent, allowing the EJB container to assign an instance to any client. Because stateless session beans can support multiple clients, they can offer better scalability for applications that require large numbers of clients. Typically, an application requires fewer stateless session beans than stateful session beans to support the same number of clients. At times, the EJB container may write a stateful session bean to secondary storage. However, stateless session beans are never written to secondary storage. Therefore, stateless beans may offer better performance than stateful beans.
-- --Original Message-- -- From: Ivy Se [mailto:ivy12see@(protected)] Sent: Thursday, July 31, 2003 4:10 To: J2EEPATTERNS-INTEREST@(protected) Subject: 2 simple eval/test questions
Hi guys,
I've got 2 simple self eval quesion which I'm not sure of the answers. Can you guys help, please
Q1. Which statement is true about statefull session beans, but is NOT true about stateless session beans
A. State can be cached but is not representative of the client state
B. State can be cached but is representative of client state
C. State is persistent
D. State is cached first, then persisted.
Q2. Which pattern is used by the Home interface of an EJB
A. Proxy
B. Decorator
C. Mediator
D. Factory
===== Thank you.
Ivy Se
==================================================================== Community Web Site (Core J2EE Patterns Catalog - Online Version): http://java.sun.com/blueprints/corej2eepatterns Getting Started (Beta Version): http://developer.java.sun.com/developer/technicalArticles/J2EE/patterns/ Get the book: http://www.amazon.com/exec/obidos/ASIN/0130648841/corej2eepatte-20 (See http://tte-20.ora-code.com) List Archive: http://archives.java.sun.com/archives/j2eepatterns-interest.html Unsubscribing: email "signoff J2EEPATTERNS-INTEREST" to listserv@(protected)
==================================================================== Community Web Site (Core J2EE Patterns Catalog - Online Version): http://java.sun.com/blueprints/corej2eepatterns Getting Started (Beta Version): http://developer.java.sun.com/developer/technicalArticles/J2EE/patterns/ Get the book: http://www.amazon.com/exec/obidos/ASIN/0130648841/corej2eepatte-20 (See http://tte-20.ora-code.com) List Archive: http://archives.java.sun.com/archives/j2eepatterns-interest.html Unsubscribing: email "signoff J2EEPATTERNS-INTEREST" to listserv@(protected)
|
|