Ensurepass.com : Ensure you pass the IT Exams
2018 Jan Oracle Official New Released 1z0-895
100% Free Download! 100% Pass Guaranteed!
http://www.EnsurePass.com/1z0-895.html
Java EE 6 Enterprise JavaBeans Developer Certified Expert Exam
Question No: 31
Given two stateless session beans, ABean and BBean:
A client that is not executing within a transaction acquires an EJB reference to ABean and invokes the a() method on time. How many distinct transactions are started by the container after all processing has completed?
-
0
-
1
-
2
-
3
Answer: B
Explanation: Note: REQUIRED
If a client invokes the enterprise bean#39;s method while the client is associated with a transaction context, the container invokes the enterprise bean#39;s method in the client#39;s transaction context.
Reference: Enum TransactionAttributeType
Question No: 32
Given this code snippet from a JMS message driven bean class X:
When this bean class handles a message, which is correct?
-
After a message delivery the result is 1.
-
After a message delivery the result is 2.
-
After a message delivery the result is 12.
-
After a message delivery an exception is thrown.
-
After a message delivery the result is unpredictable.
-
This is NOT a compliant JMS message-driven bean.
Answer: F
Question No: 33
Which statement about message-driven beans is correct?
-
Each message-driven bean instance will be invoked by only one thread at a time.
-
When dispatching messages to message beam instances the container must preserve the order in which messages arrive.
-
If a message-driven bean is associated with a JMS queue, each bean instance in the pool will receive each message sent to the queue.
-
If a message driven bean is associated with a JMS durable subscription, each bean instance in the pool will receive each message sent to the durable subscription.
Answer: A
Question No: 34
Given code snippets from two files:
Which four code changes, when used together, create a valid JMS message-driven bean? (Choose four)
-
Make class MessageDog public
-
Make the MessageDog constructor no-arg
-
Make the MessageDog constructor public
-
Move the onMessage method to class MessageDog.
-
Change MessageDog so that it is NOT a subclass of Dog.
-
Make class MessageDog implement MessageListner instead of MessageDrivenBean.
Answer: A,B,C,F
Question No: 35
Which is a valid Postconstruct method in a message-driven bean class?
-
@PostConstruct
public boolean init() { return true; }
-
@PostConstruct private static void init () {}
-
@PostConstruct private void init ()
-
@PostConstruct public static void init () {}
Answer: C
Question No: 36
Which statement is correct about a Java EF client of a message driven bean?
-
The client can use JNDI to obtain a reference to a message destination.
-
The client can use JNDI to obtain a reference to a dependency injection.
-
The client can use JNDI to obtain a reference to a message-driven bean instance.
-
The client can use JNDI to look up a reference to the message-driven bean#39;s home interface.
Answer: A
Question No: 37
You are writing an EE component that functions as a message producer. The message producer sends message to a JMS queue. The component environment defines a resource-ref of type javax.jms.ConnectionFactory with the same jms/ConnectionFactory.
Which will correctly obtain a connection factory for a queue?
-
Context context = new initialContext();
Connectionfactory confac = (ConnectionFactory) Context.lookup (“java: comp/env/jms/ConnectionFactory”);
-
InitialContext Context = new Context () ;
QueueConnectionFactory confac = (QueueConnectionFactory) context.lookup (“java: comp/env/jms/Myfactory”);
-
@Resource (“ConnectionFactory”)
private static QueueConnectionFactory confac;
-
@Resource (loopkup = “jms/QueueConnectionFactory”) private static ConnectionFactoryconfac;
Answer: D
Explanation: A connection factory is the object a client uses to create a connection to a provider. A connection factory encapsulates a set of connection configuration parameters that has been defined by an administrator. Each connection factory is an instance of theConnectionFactory, QueueConnectionFactory, or TopicConnectionFactory interface
At the beginning of a JMS client program, you usually inject a connection factory resource into a ConnectionFactory object. For example, the following code fragment specifies a resource whose JNDI name is jms/ConnectionFactory and assigns it to a
ConnectionFactory object:
@Resource(lookup = quot;jms/ConnectionFactoryquot;) private static ConnectionFactory connectionFactory;
Reference: The Java EE 6 Tutoria, The JMS API Programming Model
Question No: 38
You are writing a client that sends a message to a JMS queue. Which statement is true?
-
You use a connection factory to create a session.
-
When you create a session, you specify whether or not it is transacted.
-
When you create a connection, you specify the acknowledgment mode.
-
When you create a message producer, you must specify the name of the destination to which you will send messages.
Answer: A Explanation: Note:
The SimpleMessageClient sends messages to the queue that the SimpleMessageBean listens to.
The client starts by injecting the connection factory and queue resources:
@Resource(mappedName=quot;jms/ConnectionFactoryquot;) private static ConnectionFactory connectionFactory;
@Resource(mappedName=quot;jms/Queuequot;) private static Queue queue;
Next, the client creates the connection, session, and message producer: connection = connectionFactory.createConnection();
session = connection.createSession(false, Session.AUTO_ACKNOWLEDGE); messageProducer = session.createProducer(queue);
Finally, the client sends several messages to the queue: message = session.createTextMessage();
for (int i = 0; i lt; NUM_MSGS; i ) { message.setText(quot;This is message quot; (i 1));
System.out.println(quot;Sending message: quot; message.getText()); messageProducer.send(message);
}
Question No: 39
Which two are true about the client view of a message-driven bean? (Choose two.)
-
References to message destinations can be infected.
-
References to message destinations cannot be looked up in the client#39;s JNDI namespace.
-
Clients of a message destination need to know that the destination is listened to by a pool of message consumers,
-
Clients of a message destination do NOT need to know that the destination is listened to by a message-driven bean.
Answer: B,C
Explanation: Client components do not locate message-driven beans and invoke methods directly on them.
Instead, a client accesses a message-driven bean through, for example, JMS by sending messagesto the message destination for which the message-driven bean class is the MessageListener.
Reference: The Java EE 6 Tutorial, What is a Message-Driven Bean?
Question No: 40
Given the following stateful bean:
-
@Stateful
-
@TransactionAttribute(TransactionAttributeType.SUPPORTS)
-
public class VideoBean implements video {
-
/ / insert code here
-
public void method () {}
15. }
Assuming no other transaction-related metadata, which code can be added at line 13 to guarantee that business method methodA will execute only if invoked with an active transaction?
-
@TransactionAttribute ()
-
@transactionmanagement(TransactionAttributeType.CONTAINER)
-
@TransactionAttribute(transactionAttributeType.MANDATORY)
-
@transactionAttribute(TransactionattributeType.RECQUIRES_NEW)
Answer: C
100% Ensurepass Free Download!
–Download Free Demo:1z0-895 Demo PDF
100% Ensurepass Free Guaranteed!
–1z0-895 Dumps
EnsurePass | ExamCollection | Testking | |
---|---|---|---|
Lowest Price Guarantee | Yes | No | No |
Up-to-Dated | Yes | No | No |
Real Questions | Yes | No | No |
Explanation | Yes | No | No |
PDF VCE | Yes | No | No |
Free VCE Simulator | Yes | No | No |
Instant Download | Yes | No | No |
100-105 Dumps VCE PDF
200-105 Dumps VCE PDF
300-101 Dumps VCE PDF
300-115 Dumps VCE PDF
300-135 Dumps VCE PDF
300-320 Dumps VCE PDF
400-101 Dumps VCE PDF
640-911 Dumps VCE PDF
640-916 Dumps VCE PDF
70-410 Dumps VCE PDF
70-411 Dumps VCE PDF
70-412 Dumps VCE PDF
70-413 Dumps VCE PDF
70-414 Dumps VCE PDF
70-417 Dumps VCE PDF
70-461 Dumps VCE PDF
70-462 Dumps VCE PDF
70-463 Dumps VCE PDF
70-464 Dumps VCE PDF
70-465 Dumps VCE PDF
70-480 Dumps VCE PDF
70-483 Dumps VCE PDF
70-486 Dumps VCE PDF
70-487 Dumps VCE PDF
220-901 Dumps VCE PDF
220-902 Dumps VCE PDF
N10-006 Dumps VCE PDF
SY0-401 Dumps VCE PDF