Question
Which design pattern is most suitable for controlling
access to a resource by limiting the number of clients that can use it concurrently?Solution
The Proxy Pattern is a structural design pattern used to control access to resources by acting as an intermediary or placeholder. It can implement restrictions like access control, caching, or logging. In the context of concurrency, the proxy ensures that only a limited number of clients access a resource at a time. For example, a proxy server can manage a pool of database connections, granting access to clients based on availability. This pattern reduces resource contention and improves system scalability and security. By isolating the resource, the Proxy Pattern adds flexibility and control over its usage. Why Other Options Are Incorrect :
- Singleton Pattern : Ensures a single instance of a class but does not control concurrent access.
- Factory Pattern : Focuses on object creation, unrelated to access control.
- Decorator Pattern : Enhances object functionality dynamically but does not manage access.
- Flyweight Pattern : Shares objects to save memory, not for controlling resource access.
Match the statements from column 1 with column 2 and find which of the following pair of statements given in the options make contextually and grammatic...
Choose the combination that completes the sentence.
Match Column I and Column II and choose the correct match from the given choices
Column (1)
In the following questions, two columns are given, Column 1 and Column 2. Each column contains 3 phrases. Match the phrases in Column 1 with the phrase...
Match the statements from column A with column B and find which of the following word given in the column B can be joined to make grammatical and meanin...
Choose the combination that completes the sentences.
In the following questions two columns are given containing three sentences/phrases each. In first column, sentences/phrases are A, B and C and in the ...
(A)Farmers staged demonstrations at several place...