- ThreadLocal class simplifies the development of thread-safe concurrent programs.
- It ensures the object stored in this class not shared between threads.
- It is as an alternative to synchronization, to improve scalablity in transaction-intensive environments.
- Classes encapsulated in ThreadLocal are automatically thread-safe in a pretty simple way, since it's clear that anything stored in ThreadLocal is not shared between threads.
Asynchronous Communication Advantages: Requests need not be targeted to specific server. Service need not be available when request is made. No blocking, so resources could be freed. Could use connectionless protocol Disadvantages: Response times are unpredictable. Error handling usually more complex. Usually requires connection-oriented protocol. Harder to design apps Synchronous Communication Advantages: Easy to program Outcome is known immediately Error recovery easier (usually) Better real-time response (usually) Disadvantages: Service must be up and ready. Requestor blocks, held resources are “tied up”. Usually requires connection-oriented protocol
Comments
Post a Comment