Class 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 for WriteListener. 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 of WriteListenerWrapper.
    • 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.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Field Detail

      • context

        private final io.grpc.Context context
      • writeListener

        private final javax.servlet.WriteListener writeListener
    • Constructor Detail

      • WriteListenerWrapper

        public WriteListenerWrapper​(javax.servlet.WriteListener writeListener)
        Creates an instance of WriteListenerWrapper. It saves current Context at the time of creation.
        Parameters:
        writeListener - WriteListener object being wrapped.
        Since:
        0.25.0
    • 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 interface javax.servlet.WriteListener
        Throws:
        java.io.IOException
        Since:
        0.25.0
      • onError

        public void onError​(java.lang.Throwable t)
        Specified by:
        onError in interface javax.servlet.WriteListener