Enterprise Design Patterns
• Transaction Patterns
•Concurrency Patterns
•Distributed Architecture Patterns
• Temporal Patterns
•Distributed Computing Patterns
•Database Patterns
Concurrency Patterns
•Active Object
•Half-Sync/Half-Async
• Leader/Followers
• Thread-Specific Storage
Active Object
It decouples method execution from method invocation to enhance concurrency and simplify synchronized access to objects that reside in their own thread of control
Components:• Proxy
• Client
• Method Request object
• Activation list
• Scheduler
• Servant
Half-Sync/Half-Async
This pattern decouples asynchronous and synchronous service processing in concurrent systems without reducing efficiency.
Decompose services in the system into two layers (synchronous and asynchronous) and add a queuing layer between them to mediate the communication between services in the asynchronous and synchronous layers.
Components:• Synchronous service layer
• Asynchronous service layer
• Queuing layer
• External event sources
• Asynchronous interrupts strategy
• Proactive I/O strategy
• Notification strategy
Leader/Followers
This pattern provides an efficient concurrency model where multiple threads take turns sharing a set of event sources in order to detect, demultiplex, dispatch, and process service requests that occur on the event sources
A pool of threads shares a set of event sources efficiently by taking turns,
demultiplexing events that arrive on these event sources and synchronously dispatching the events to application services that process them.
Components: • Handle set
• Event handlers
• Thread pool
• Leader role
• Follower role
• Processing role
Thread-Specific Storage
This pattern allows multiple threads to use one 'logically global' access point to retrieve an object that is local to a thread—called a 'threadspecific object'—without incurring locking overhead for each access to the object.
Components:• Thread-specific object
• Key factory
• Thread-specific object set
• Thread-specific object proxy
• Application threads