How is an asynchronous task started in a servlet?
- asyncTask.start()
- beginAsync()
- initAsync()
- startAsync()
An asynchronous task in a servlet is started using the startAsync() method. This method initiates asynchronous processing and returns an AsyncContext for managing the asynchronous task.
How is a servlet configured in a web application?
The tag is used to define a servlet in the web.xml file. The element specifies the fully qualified name of the servlet class, providing the configuration necessary for the servlet container to manage the servlet.
The practice of breaking down a transaction into smaller parts to reduce locking is known as _________.
- Batch Processing
- Fragmentation
- Isolation
- Partitioning
The practice of breaking down a transaction into smaller parts to reduce locking is known as Batch Processing, where a transaction is divided into smaller batches to minimize the duration of locks and increase concurrency.
In database optimization, _________ refers to the process of storing frequently accessed data in a temporary storage area.
- caching
- indexing
- locking
- normalization
In database optimization, caching refers to the process of storing frequently accessed data in a temporary storage area, reducing the need to fetch it from the original source repeatedly.
Which interface must be implemented by a servlet for asynchronous processing?
- AsyncListener
- AsyncProcessor
- Asynchronous
- Callable
A servlet must implement the Async interface to support asynchronous processing. This interface provides methods for starting and completing asynchronous tasks.
What is the purpose of the AsyncContext in asynchronous servlets?
- To manage asynchronous operations
- To manage request attributes
- To manage servlet configuration
- To manage session attributes
The purpose of the AsyncContext in asynchronous servlets is to manage asynchronous operations, providing methods for starting and completing asynchronous tasks.
The __________ method of AsyncContext is used to dispatch the request to another servlet.
- dispatch()
- forward()
- include()
- sendRedirect()
The dispatch() method of AsyncContext is used to dispatch the request to another servlet during asynchronous processing.
What is the primary use of RequestDispatcher in servlets?
- Forwarding requests
- Initializing servlets
- Processing GET requests
- Sending redirect responses
The primary use of RequestDispatcher in servlets is for forwarding requests to another resource (servlet, JSP, or HTML) on the server.
What method is used to complete the asynchronous process and send a response?
- complete()
- finalize()
- finish()
- sendResponse()
The complete() method is used to complete the asynchronous process and send a response in asynchronous servlets.
How can a servlet determine if an incoming request supports asynchronous processing?
- canAsyncProcess()
- isAsyncRequest()
- isAsyncSupported()
- supportsAsync()
The isAsyncSupported() method is used by a servlet to determine if an incoming request supports asynchronous processing.