Package io.grpc
Class ServerTransportFilter
- java.lang.Object
-
- io.grpc.ServerTransportFilter
-
@ExperimentalApi("https://github.com/grpc/grpc-java/issues/2132") public abstract class ServerTransportFilter extends Object
Listens on server transport life-cycle events, with the capability to read and/or change transport attributes. Attributes returned by this filter will be merged intoServerCall.getAttributes()
.Multiple filters maybe registered to a server, in which case the output of a filter is the input of the next filter. For example, what returned by
transportReady(io.grpc.Attributes)
of a filter is passed to the same method of the next filter, and the last filter's return value is the effective transport attributes.Grpc
defines commonly used attributes.
-
-
Constructor Summary
Constructors Constructor Description ServerTransportFilter()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description Attributes
transportReady(Attributes transportAttrs)
Called when a transport is ready to process streams.void
transportTerminated(Attributes transportAttrs)
Called when a transport is terminated.
-
-
-
Method Detail
-
transportReady
public Attributes transportReady(Attributes transportAttrs)
Called when a transport is ready to process streams. All necessary handshakes, e.g., TLS handshake, are done at this point.Note the implementation should always inherit the passed-in attributes using
Attributes.newBuilder(transportAttrs)
, instead of creating one from scratch.- Parameters:
transportAttrs
- current transport attributes- Returns:
- new transport attributes. Default implementation returns the passed-in attributes intact.
-
transportTerminated
public void transportTerminated(Attributes transportAttrs)
Called when a transport is terminated. Default implementation is no-op.- Parameters:
transportAttrs
- the effective transport attributes, which is what returned bytransportReady(io.grpc.Attributes)
of the last executed filter.
-
-