That looks right to me. Give it a try. Supplying trailer metadata is optional, so the empty metadata in your example should be fine.
---- Josh Humphries FullStory <https://www.fullstory.com/> | Atlanta, GA Software Engineer [email protected] On Sat, Jan 7, 2017 at 4:09 PM, Eugene Strulyov <[email protected]> wrote: > Will the following code work? > > Metadata trailers = new Metadata(); > > call.close(Status.UNAUTHENTICATED, trailers); > > return new ServerCall.Listener<ReqT>() {}; > > > Also, do I need to put anything in trailers or is it just to provide > additional information to the caller? > > > thanks, > > > Eugene > > > On Saturday, January 7, 2017 at 1:03:18 PM UTC-8, Josh Humphries wrote: >> >> In that case, you'd return a dummy (no op) listener and immediately call >> "serverCall.close(errorStatus, optionalTrailers)" to abort the operation. >> >> ---- >> >> Josh Humphries >> >> FullStory <https://www.fullstory.com/> | Atlanta, GA >> >> Software Engineer >> >> [email protected] >> >> On Sat, Jan 7, 2017 at 3:27 PM, Eugene Strulyov <[email protected]> >> wrote: >> >>> What is the proper way to abort a call in grpc-java ServerInterceptor? >>> interceptCall() returns >>> >>> ServerCall.Listener() and the javadoc says it must not be null. The >>> only examples I found return next.startCall(). >>> >>> >>> thanks, >>> >>> >>> Eugene >>> >>> >>> -- >>> You received this message because you are subscribed to the Google >>> Groups "grpc.io" group. >>> To unsubscribe from this group and stop receiving emails from it, send >>> an email to [email protected]. >>> To post to this group, send email to [email protected]. >>> Visit this group at https://groups.google.com/group/grpc-io. >>> To view this discussion on the web visit https://groups.google.com/d/ms >>> gid/grpc-io/51ba9e02-c7b7-447c-8282-61dc9981e7d6%40googlegroups.com >>> <https://groups.google.com/d/msgid/grpc-io/51ba9e02-c7b7-447c-8282-61dc9981e7d6%40googlegroups.com?utm_medium=email&utm_source=footer> >>> . >>> For more options, visit https://groups.google.com/d/optout. >>> >> >> -- You received this message because you are subscribed to the Google Groups "grpc.io" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To post to this group, send email to [email protected]. Visit this group at https://groups.google.com/group/grpc-io. To view this discussion on the web visit https://groups.google.com/d/msgid/grpc-io/CAO78j%2BKROi0R8K2Hx9zj4d%3DctmmgmmcHDpwdD1fd8PobN3RQ8Q%40mail.gmail.com. For more options, visit https://groups.google.com/d/optout.
