Package com.atlassian.bitbucket.request
Interface RequestManager
public interface RequestManager
Sets up and tears down all logic for processing requests, such as logging, access logging, profiling and publishing
 
RequestStartedEvent and
 RequestEndedEvent.- 
Method SummaryModifier and TypeMethodDescription<T,E extends Exception> 
 TdoAsRequest(RequestCallback<T, E> callback, RequestInfoProvider requestInfoProvider) Sets up and tears down all logic for processing requests.<T> RequestLocal<T> Creates a newRequestLocalto get/set values in the currentRequestContext.<T> RequestLocal<T> newRequestLocal(Consumer<T> cleanupListener) Creates a newRequestLocalto get/set values in the currentRequestContext.
- 
Method Details- 
doAsRequest@Nullable <T,E extends Exception> T doAsRequest(@Nonnull RequestCallback<T, E> callback, @Nonnull RequestInfoProvider requestInfoProvider) throws ESets up and tears down all logic for processing requests.- Type Parameters:
- T- type of the request
- E- type of exception
- Parameters:
- callback- called after the- RequestStartedEventhas been published.
- requestInfoProvider- provides request details such as sessionId, remoteAddress that are used to set up logging.
- Returns:
- the return value of the callback
- Throws:
- E- when- RequestCallback.withRequest(RequestContext)throws an exception.
 
- 
getRequestContext- Returns:
- the context of the current request. Returns nullif there is no current request, for instance when running a task in a background thread.
 
- 
getRequestId- Returns:
- a highly unique (though not guaranteeably unique) request ID. Returns nullif there is no current request, for instance when running a task in a background thread.
- Since:
- 5.0
- See Also:
 
- 
getRequestMetadata- Returns:
- the metadata of the current request. Returns nullif there is no current request.
 
- 
newRequestLocalCreates a newRequestLocalto get/set values in the currentRequestContext. Conceptually similar to aThreadLocal, but tied to the currentRequestContextinstead of the current thread.- Type Parameters:
- T- the value type
- Returns:
- the RequestLocal
- Since:
- 7.9
 
- 
newRequestLocalCreates a newRequestLocalto get/set values in the currentRequestContext. Conceptually similar to aThreadLocal, but tied to the currentRequestContextinstead of the current thread.- Type Parameters:
- T- the value type
- Parameters:
- cleanupListener- optional listener that is invoked when an- RequestContexthas completed and all values in the context are removed. The- cleanupListeneris NOT called if the- RequestLocaldoes not contain a value for the- RequestContextthat is being wrapped up.
- Returns:
- the RequestLocal
- Since:
- 7.9
 
 
-