Class WriteListenerWrapper
- java.lang.Object
-
- io.opencensus.contrib.http.servlet.WriteListenerWrapper
-
- All Implemented Interfaces:
java.util.EventListener,javax.servlet.WriteListener
@ExperimentalApi public class WriteListenerWrapper extends java.lang.Object implements javax.servlet.WriteListener
This class is a wrapper class forWriteListener. It facilitates executing asynchronous onWritePossible method in the original context at the time of creating the listener.- Since:
- 0.25.0
-
-
Field Summary
Fields Modifier and Type Field Description private io.grpc.Contextcontextprivate javax.servlet.WriteListenerwriteListener
-
Constructor Summary
Constructors Constructor Description WriteListenerWrapper(javax.servlet.WriteListener writeListener)Creates an instance ofWriteListenerWrapper.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidonError(java.lang.Throwable t)voidonWritePossible()It executes onWritePossible() method of the object being wrapped in the saved context.
-
-
-
Method Detail
-
onWritePossible
public void onWritePossible() throws java.io.IOExceptionIt executes onWritePossible() method of the object being wrapped in the saved context. It saves current context before executing the method and restores it after it is finished executing.- Specified by:
onWritePossiblein interfacejavax.servlet.WriteListener- Throws:
java.io.IOException- Since:
- 0.25.0
-
onError
public void onError(java.lang.Throwable t)
- Specified by:
onErrorin interfacejavax.servlet.WriteListener
-
-