nerdexam
Oracle

1Z0-900 · Question #56

Which annotation do you use on line 1 to ensure that clients immediately time out when attempting to concurrently invoke callMethod () while another client is already accessing the bean?

The correct answer is D. @AccessTimeout (0). @AccessTimeout(0) tells the container to wait zero milliseconds before throwing a ConcurrentAccessTimeoutException, meaning any concurrent caller is rejected instantly without waiting. This is the only value that guarantees immediate timeout on contention. Why the distractors…

Implement Business Logic by Using EJBs

Question

Which annotation do you use on line 1 to ensure that clients immediately time out when attempting to concurrently invoke callMethod () while another client is already accessing the bean?

Options

  • A@AccessTimeout (value = 1, unit = TimeUnit.SECONDS)
  • B@AccessTimeout (null)
  • C@AccessTimeout (-1)
  • D@AccessTimeout (0)

How the community answered

(31 responses)
  • B
    6% (2)
  • C
    3% (1)
  • D
    90% (28)

Explanation

@AccessTimeout(0) tells the container to wait zero milliseconds before throwing a ConcurrentAccessTimeoutException, meaning any concurrent caller is rejected instantly without waiting. This is the only value that guarantees immediate timeout on contention.

Why the distractors are wrong:

  • A (value = 1, unit = SECONDS) causes a 1-second wait before timing out - not immediate.
  • B (null) is not valid syntax; @AccessTimeout requires a long value, so this won't compile.
  • C (-1) is the opposite of D: it means wait forever (no timeout), allowing the client to block indefinitely until the bean is free.

Memory tip: Think of it as a number line - -1 = infinite patience, 0 = zero patience (bail immediately), positive values = wait that many units. For an instant rejection, you want 0.

Topics

#EJB Concurrency#@AccessTimeout#Thread Access Control#Timeout Semantics

Community Discussion

No community discussion yet for this question.

Full 1Z0-900 Practice