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.Context
context
private javax.servlet.WriteListener
writeListener
-
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 void
onError(java.lang.Throwable t)
void
onWritePossible()
It executes onWritePossible() method of the object being wrapped in the saved context.
-
-
-
Method Detail
-
onWritePossible
public void onWritePossible() throws java.io.IOException
It 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:
onWritePossible
in interfacejavax.servlet.WriteListener
- Throws:
java.io.IOException
- Since:
- 0.25.0
-
onError
public void onError(java.lang.Throwable t)
- Specified by:
onError
in interfacejavax.servlet.WriteListener
-
-