Week 4 - Singleton Session Beans Flashcards

1
Q

Why use a singleton session bean?

A

To create a shared instance for all clients.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

What is AtomicInteger?

A

some data structures from java.util.concurrent are thread-safe

AtomicInteger shared = new AtomicInteger(1);
public int increment() {
return shared.incrementAndGet();
}

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

What is a problem with using synchronized or locks for concurrency?

A

Bottlenecks

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
4
Q

What is container-managed concurrency?

A

The default for singleton session beans.

Annotate class or methods with:
@jakarta.ejb.Lock(locktype)

locktype is an enum defined in jakarta.ejb.LockType

READ allows concurrent access to all requests

WRITE (default) defines lock that can be held by one
thread at a time

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
5
Q

What is bean managed concurrency?

A

@jakarta.ejb.ConcurrencyManagement(BEAN)

make bean thread-safe manually using tools from java.util.concurrent

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
6
Q

What other session bean has the same lifecycle as a singleton session bean?

A

Stateless session bean
(Does not exist OR method-ready)

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
7
Q

What are value objects (data transfer objects)?

A

DTOs (Data Transfer Objects) are simple objects that carry data between different parts of a system. They are especially useful when transferring data reliably, ensuring that values (like a URL) remain consistent and unmodified during the transfer. Since some types, like URLs, are mutable, it’s important to copy them before passing them along to prevent unexpected changes.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
8
Q

Singleton beans are suitable for caching RSS feeds (T or F)

A

T

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
9
Q

What is an RSS feed?

A

An RSS feed (Really Simple Syndication) is a way for websites to share their latest content with you automatically, without you needing to visit the site directly.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
10
Q
A
How well did you know this?
1
Not at all
2
3
4
5
Perfectly