id
int32
0
165k
repo
stringlengths
7
58
path
stringlengths
12
218
func_name
stringlengths
3
140
original_string
stringlengths
73
34.1k
language
stringclasses
1 value
code
stringlengths
73
34.1k
code_tokens
list
docstring
stringlengths
3
16k
docstring_tokens
list
sha
stringlengths
40
40
url
stringlengths
105
339
127,300
apereo/cas
core/cas-server-core-authentication-api/src/main/java/org/apereo/cas/authentication/handler/support/AbstractUsernamePasswordAuthenticationHandler.java
AbstractUsernamePasswordAuthenticationHandler.transformUsername
protected void transformUsername(final UsernamePasswordCredential userPass) throws AccountNotFoundException { if (StringUtils.isBlank(userPass.getUsername())) { throw new AccountNotFoundException("Username is null."); } LOGGER.debug("Transforming credential username via [{}]", this.p...
java
protected void transformUsername(final UsernamePasswordCredential userPass) throws AccountNotFoundException { if (StringUtils.isBlank(userPass.getUsername())) { throw new AccountNotFoundException("Username is null."); } LOGGER.debug("Transforming credential username via [{}]", this.p...
[ "protected", "void", "transformUsername", "(", "final", "UsernamePasswordCredential", "userPass", ")", "throws", "AccountNotFoundException", "{", "if", "(", "StringUtils", ".", "isBlank", "(", "userPass", ".", "getUsername", "(", ")", ")", ")", "{", "throw", "new"...
Transform username. @param userPass the user pass @throws AccountNotFoundException the account not found exception
[ "Transform", "username", "." ]
b4b306433a8782cef803a39bea5b1f96740e0e9b
https://github.com/apereo/cas/blob/b4b306433a8782cef803a39bea5b1f96740e0e9b/core/cas-server-core-authentication-api/src/main/java/org/apereo/cas/authentication/handler/support/AbstractUsernamePasswordAuthenticationHandler.java#L97-L107
127,301
grpc/grpc-java
services/src/main/java/io/grpc/services/HealthStatusManager.java
HealthStatusManager.setStatus
public void setStatus(String service, ServingStatus status) { checkNotNull(status, "status"); healthService.setStatus(service, status); }
java
public void setStatus(String service, ServingStatus status) { checkNotNull(status, "status"); healthService.setStatus(service, status); }
[ "public", "void", "setStatus", "(", "String", "service", ",", "ServingStatus", "status", ")", "{", "checkNotNull", "(", "status", ",", "\"status\"", ")", ";", "healthService", ".", "setStatus", "(", "service", ",", "status", ")", ";", "}" ]
Updates the status of the server. @param service the name of some aspect of the server that is associated with a health status. This name can have no relation with the gRPC services that the server is running with. It can also be an empty String {@code ""} per the gRPC specification. @param status is one of the values ...
[ "Updates", "the", "status", "of", "the", "server", "." ]
973885457f9609de232d2553b82c67f6c3ff57bf
https://github.com/grpc/grpc-java/blob/973885457f9609de232d2553b82c67f6c3ff57bf/services/src/main/java/io/grpc/services/HealthStatusManager.java#L65-L68
127,302
grpc/grpc-java
core/src/main/java/io/grpc/internal/StatsTraceContext.java
StatsTraceContext.newClientContext
public static StatsTraceContext newClientContext( final CallOptions callOptions, final Attributes transportAttrs, Metadata headers) { List<ClientStreamTracer.Factory> factories = callOptions.getStreamTracerFactories(); if (factories.isEmpty()) { return NOOP; } ClientStreamTracer.StreamInfo i...
java
public static StatsTraceContext newClientContext( final CallOptions callOptions, final Attributes transportAttrs, Metadata headers) { List<ClientStreamTracer.Factory> factories = callOptions.getStreamTracerFactories(); if (factories.isEmpty()) { return NOOP; } ClientStreamTracer.StreamInfo i...
[ "public", "static", "StatsTraceContext", "newClientContext", "(", "final", "CallOptions", "callOptions", ",", "final", "Attributes", "transportAttrs", ",", "Metadata", "headers", ")", "{", "List", "<", "ClientStreamTracer", ".", "Factory", ">", "factories", "=", "ca...
Factory method for the client-side.
[ "Factory", "method", "for", "the", "client", "-", "side", "." ]
973885457f9609de232d2553b82c67f6c3ff57bf
https://github.com/grpc/grpc-java/blob/973885457f9609de232d2553b82c67f6c3ff57bf/core/src/main/java/io/grpc/internal/StatsTraceContext.java#L50-L66
127,303
grpc/grpc-java
core/src/main/java/io/grpc/internal/StatsTraceContext.java
StatsTraceContext.newServerContext
public static StatsTraceContext newServerContext( List<? extends ServerStreamTracer.Factory> factories, String fullMethodName, Metadata headers) { if (factories.isEmpty()) { return NOOP; } StreamTracer[] tracers = new StreamTracer[factories.size()]; for (int i = 0; i < tracers.le...
java
public static StatsTraceContext newServerContext( List<? extends ServerStreamTracer.Factory> factories, String fullMethodName, Metadata headers) { if (factories.isEmpty()) { return NOOP; } StreamTracer[] tracers = new StreamTracer[factories.size()]; for (int i = 0; i < tracers.le...
[ "public", "static", "StatsTraceContext", "newServerContext", "(", "List", "<", "?", "extends", "ServerStreamTracer", ".", "Factory", ">", "factories", ",", "String", "fullMethodName", ",", "Metadata", "headers", ")", "{", "if", "(", "factories", ".", "isEmpty", ...
Factory method for the server-side.
[ "Factory", "method", "for", "the", "server", "-", "side", "." ]
973885457f9609de232d2553b82c67f6c3ff57bf
https://github.com/grpc/grpc-java/blob/973885457f9609de232d2553b82c67f6c3ff57bf/core/src/main/java/io/grpc/internal/StatsTraceContext.java#L71-L83
127,304
grpc/grpc-java
alts/src/main/java/io/grpc/alts/internal/RpcProtocolVersionsUtil.java
RpcProtocolVersionsUtil.isGreaterThanOrEqualTo
@VisibleForTesting static boolean isGreaterThanOrEqualTo(Version first, Version second) { if ((first.getMajor() > second.getMajor()) || (first.getMajor() == second.getMajor() && first.getMinor() >= second.getMinor())) { return true; } return false; }
java
@VisibleForTesting static boolean isGreaterThanOrEqualTo(Version first, Version second) { if ((first.getMajor() > second.getMajor()) || (first.getMajor() == second.getMajor() && first.getMinor() >= second.getMinor())) { return true; } return false; }
[ "@", "VisibleForTesting", "static", "boolean", "isGreaterThanOrEqualTo", "(", "Version", "first", ",", "Version", "second", ")", "{", "if", "(", "(", "first", ".", "getMajor", "(", ")", ">", "second", ".", "getMajor", "(", ")", ")", "||", "(", "first", "...
Returns true if first Rpc Protocol Version is greater than or equal to the second one. Returns false otherwise.
[ "Returns", "true", "if", "first", "Rpc", "Protocol", "Version", "is", "greater", "than", "or", "equal", "to", "the", "second", "one", ".", "Returns", "false", "otherwise", "." ]
973885457f9609de232d2553b82c67f6c3ff57bf
https://github.com/grpc/grpc-java/blob/973885457f9609de232d2553b82c67f6c3ff57bf/alts/src/main/java/io/grpc/alts/internal/RpcProtocolVersionsUtil.java#L53-L60
127,305
grpc/grpc-java
alts/src/main/java/io/grpc/alts/internal/RpcProtocolVersionsUtil.java
RpcProtocolVersionsUtil.checkRpcProtocolVersions
static RpcVersionsCheckResult checkRpcProtocolVersions( RpcProtocolVersions localVersions, RpcProtocolVersions peerVersions) { Version maxCommonVersion; Version minCommonVersion; // maxCommonVersion is MIN(local.max, peer.max) if (isGreaterThanOrEqualTo(localVersions.getMaxRpcVersion(), peerVersio...
java
static RpcVersionsCheckResult checkRpcProtocolVersions( RpcProtocolVersions localVersions, RpcProtocolVersions peerVersions) { Version maxCommonVersion; Version minCommonVersion; // maxCommonVersion is MIN(local.max, peer.max) if (isGreaterThanOrEqualTo(localVersions.getMaxRpcVersion(), peerVersio...
[ "static", "RpcVersionsCheckResult", "checkRpcProtocolVersions", "(", "RpcProtocolVersions", "localVersions", ",", "RpcProtocolVersions", "peerVersions", ")", "{", "Version", "maxCommonVersion", ";", "Version", "minCommonVersion", ";", "// maxCommonVersion is MIN(local.max, peer.max...
Performs check between local and peer Rpc Protocol Versions. This function returns true and the highest common version if there exists a common Rpc Protocol Version to use, and returns false and null otherwise.
[ "Performs", "check", "between", "local", "and", "peer", "Rpc", "Protocol", "Versions", ".", "This", "function", "returns", "true", "and", "the", "highest", "common", "version", "if", "there", "exists", "a", "common", "Rpc", "Protocol", "Version", "to", "use", ...
973885457f9609de232d2553b82c67f6c3ff57bf
https://github.com/grpc/grpc-java/blob/973885457f9609de232d2553b82c67f6c3ff57bf/alts/src/main/java/io/grpc/alts/internal/RpcProtocolVersionsUtil.java#L67-L90
127,306
grpc/grpc-java
netty/src/main/java/io/grpc/netty/NettyClientHandler.java
NettyClientHandler.createStream
private void createStream(final CreateStreamCommand command, final ChannelPromise promise) throws Exception { if (lifecycleManager.getShutdownThrowable() != null) { command.stream().setNonExistent(); // The connection is going away (it is really the GOAWAY case), // just terminate the st...
java
private void createStream(final CreateStreamCommand command, final ChannelPromise promise) throws Exception { if (lifecycleManager.getShutdownThrowable() != null) { command.stream().setNonExistent(); // The connection is going away (it is really the GOAWAY case), // just terminate the st...
[ "private", "void", "createStream", "(", "final", "CreateStreamCommand", "command", ",", "final", "ChannelPromise", "promise", ")", "throws", "Exception", "{", "if", "(", "lifecycleManager", ".", "getShutdownThrowable", "(", ")", "!=", "null", ")", "{", "command", ...
Attempts to create a new stream from the given command. If there are too many active streams, the creation request is queued.
[ "Attempts", "to", "create", "a", "new", "stream", "from", "the", "given", "command", ".", "If", "there", "are", "too", "many", "active", "streams", "the", "creation", "request", "is", "queued", "." ]
973885457f9609de232d2553b82c67f6c3ff57bf
https://github.com/grpc/grpc-java/blob/973885457f9609de232d2553b82c67f6c3ff57bf/netty/src/main/java/io/grpc/netty/NettyClientHandler.java#L511-L590
127,307
grpc/grpc-java
netty/src/main/java/io/grpc/netty/NettyClientHandler.java
NettyClientHandler.cancelStream
private void cancelStream(ChannelHandlerContext ctx, CancelClientStreamCommand cmd, ChannelPromise promise) { NettyClientStream.TransportState stream = cmd.stream(); Status reason = cmd.reason(); if (reason != null) { stream.transportReportStatus(reason, true, new Metadata()); } if (!cmd...
java
private void cancelStream(ChannelHandlerContext ctx, CancelClientStreamCommand cmd, ChannelPromise promise) { NettyClientStream.TransportState stream = cmd.stream(); Status reason = cmd.reason(); if (reason != null) { stream.transportReportStatus(reason, true, new Metadata()); } if (!cmd...
[ "private", "void", "cancelStream", "(", "ChannelHandlerContext", "ctx", ",", "CancelClientStreamCommand", "cmd", ",", "ChannelPromise", "promise", ")", "{", "NettyClientStream", ".", "TransportState", "stream", "=", "cmd", ".", "stream", "(", ")", ";", "Status", "...
Cancels this stream.
[ "Cancels", "this", "stream", "." ]
973885457f9609de232d2553b82c67f6c3ff57bf
https://github.com/grpc/grpc-java/blob/973885457f9609de232d2553b82c67f6c3ff57bf/netty/src/main/java/io/grpc/netty/NettyClientHandler.java#L595-L607
127,308
grpc/grpc-java
netty/src/main/java/io/grpc/netty/NettyClientHandler.java
NettyClientHandler.sendPingFrame
private void sendPingFrame(ChannelHandlerContext ctx, SendPingCommand msg, ChannelPromise promise) { // Don't check lifecycleManager.getShutdownStatus() since we want to allow pings after shutdown // but before termination. After termination, messages will no longer arrive because the // pipeline clea...
java
private void sendPingFrame(ChannelHandlerContext ctx, SendPingCommand msg, ChannelPromise promise) { // Don't check lifecycleManager.getShutdownStatus() since we want to allow pings after shutdown // but before termination. After termination, messages will no longer arrive because the // pipeline clea...
[ "private", "void", "sendPingFrame", "(", "ChannelHandlerContext", "ctx", ",", "SendPingCommand", "msg", ",", "ChannelPromise", "promise", ")", "{", "// Don't check lifecycleManager.getShutdownStatus() since we want to allow pings after shutdown", "// but before termination. After termi...
Sends a PING frame. If a ping operation is already outstanding, the callback in the message is registered to be called when the existing operation completes, and no new frame is sent.
[ "Sends", "a", "PING", "frame", ".", "If", "a", "ping", "operation", "is", "already", "outstanding", "the", "callback", "in", "the", "message", "is", "registered", "to", "be", "called", "when", "the", "existing", "operation", "completes", "and", "no", "new", ...
973885457f9609de232d2553b82c67f6c3ff57bf
https://github.com/grpc/grpc-java/blob/973885457f9609de232d2553b82c67f6c3ff57bf/netty/src/main/java/io/grpc/netty/NettyClientHandler.java#L623-L675
127,309
grpc/grpc-java
netty/src/main/java/io/grpc/netty/NettyClientHandler.java
NettyClientHandler.goingAway
private void goingAway(Status status) { lifecycleManager.notifyShutdown(status); final Status goAwayStatus = lifecycleManager.getShutdownStatus(); final int lastKnownStream = connection().local().lastStreamKnownByPeer(); try { connection().forEachActiveStream(new Http2StreamVisitor() { @Ov...
java
private void goingAway(Status status) { lifecycleManager.notifyShutdown(status); final Status goAwayStatus = lifecycleManager.getShutdownStatus(); final int lastKnownStream = connection().local().lastStreamKnownByPeer(); try { connection().forEachActiveStream(new Http2StreamVisitor() { @Ov...
[ "private", "void", "goingAway", "(", "Status", "status", ")", "{", "lifecycleManager", ".", "notifyShutdown", "(", "status", ")", ";", "final", "Status", "goAwayStatus", "=", "lifecycleManager", ".", "getShutdownStatus", "(", ")", ";", "final", "int", "lastKnown...
Handler for a GOAWAY being received. Fails any streams created after the last known stream.
[ "Handler", "for", "a", "GOAWAY", "being", "received", ".", "Fails", "any", "streams", "created", "after", "the", "last", "known", "stream", "." ]
973885457f9609de232d2553b82c67f6c3ff57bf
https://github.com/grpc/grpc-java/blob/973885457f9609de232d2553b82c67f6c3ff57bf/netty/src/main/java/io/grpc/netty/NettyClientHandler.java#L708-L730
127,310
grpc/grpc-java
api/src/jmh/java/io/grpc/CallOptionsBenchmark.java
CallOptionsBenchmark.withOption
@Benchmark @BenchmarkMode(Mode.SampleTime) @OutputTimeUnit(TimeUnit.NANOSECONDS) public CallOptions withOption() { CallOptions opts = CallOptions.DEFAULT; for (int i = 0; i < customOptions.size(); i++) { opts = opts.withOption(customOptions.get(i), "value"); } return opts; }
java
@Benchmark @BenchmarkMode(Mode.SampleTime) @OutputTimeUnit(TimeUnit.NANOSECONDS) public CallOptions withOption() { CallOptions opts = CallOptions.DEFAULT; for (int i = 0; i < customOptions.size(); i++) { opts = opts.withOption(customOptions.get(i), "value"); } return opts; }
[ "@", "Benchmark", "@", "BenchmarkMode", "(", "Mode", ".", "SampleTime", ")", "@", "OutputTimeUnit", "(", "TimeUnit", ".", "NANOSECONDS", ")", "public", "CallOptions", "withOption", "(", ")", "{", "CallOptions", "opts", "=", "CallOptions", ".", "DEFAULT", ";", ...
Adding custom call options without duplicate keys.
[ "Adding", "custom", "call", "options", "without", "duplicate", "keys", "." ]
973885457f9609de232d2553b82c67f6c3ff57bf
https://github.com/grpc/grpc-java/blob/973885457f9609de232d2553b82c67f6c3ff57bf/api/src/jmh/java/io/grpc/CallOptionsBenchmark.java#L70-L79
127,311
grpc/grpc-java
api/src/jmh/java/io/grpc/CallOptionsBenchmark.java
CallOptionsBenchmark.withOptionDuplicates
@Benchmark @BenchmarkMode(Mode.SampleTime) @OutputTimeUnit(TimeUnit.NANOSECONDS) public CallOptions withOptionDuplicates() { CallOptions opts = allOpts; for (int i = 1; i < shuffledCustomOptions.size(); i++) { opts = opts.withOption(shuffledCustomOptions.get(i), "value2"); } return opts; }
java
@Benchmark @BenchmarkMode(Mode.SampleTime) @OutputTimeUnit(TimeUnit.NANOSECONDS) public CallOptions withOptionDuplicates() { CallOptions opts = allOpts; for (int i = 1; i < shuffledCustomOptions.size(); i++) { opts = opts.withOption(shuffledCustomOptions.get(i), "value2"); } return opts; }
[ "@", "Benchmark", "@", "BenchmarkMode", "(", "Mode", ".", "SampleTime", ")", "@", "OutputTimeUnit", "(", "TimeUnit", ".", "NANOSECONDS", ")", "public", "CallOptions", "withOptionDuplicates", "(", ")", "{", "CallOptions", "opts", "=", "allOpts", ";", "for", "("...
Adding custom call options, overwritting existing keys.
[ "Adding", "custom", "call", "options", "overwritting", "existing", "keys", "." ]
973885457f9609de232d2553b82c67f6c3ff57bf
https://github.com/grpc/grpc-java/blob/973885457f9609de232d2553b82c67f6c3ff57bf/api/src/jmh/java/io/grpc/CallOptionsBenchmark.java#L84-L93
127,312
grpc/grpc-java
netty/src/main/java/io/grpc/netty/NettyServerBuilder.java
NettyServerBuilder.bossEventLoopGroup
public NettyServerBuilder bossEventLoopGroup(EventLoopGroup group) { if (group != null) { return bossEventLoopGroupPool(new FixedObjectPool<>(group)); } return bossEventLoopGroupPool(DEFAULT_BOSS_EVENT_LOOP_GROUP_POOL); }
java
public NettyServerBuilder bossEventLoopGroup(EventLoopGroup group) { if (group != null) { return bossEventLoopGroupPool(new FixedObjectPool<>(group)); } return bossEventLoopGroupPool(DEFAULT_BOSS_EVENT_LOOP_GROUP_POOL); }
[ "public", "NettyServerBuilder", "bossEventLoopGroup", "(", "EventLoopGroup", "group", ")", "{", "if", "(", "group", "!=", "null", ")", "{", "return", "bossEventLoopGroupPool", "(", "new", "FixedObjectPool", "<>", "(", "group", ")", ")", ";", "}", "return", "bo...
Provides the boss EventGroupLoop to the server. <p>It's an optional parameter. If the user has not provided one when the server is built, the builder will use the default one which is static. <p>You must also provide corresponding {@link io.netty.channel.Channel} type using {@link #channelType(Class)} and {@link #wor...
[ "Provides", "the", "boss", "EventGroupLoop", "to", "the", "server", "." ]
973885457f9609de232d2553b82c67f6c3ff57bf
https://github.com/grpc/grpc-java/blob/973885457f9609de232d2553b82c67f6c3ff57bf/netty/src/main/java/io/grpc/netty/NettyServerBuilder.java#L194-L199
127,313
grpc/grpc-java
netty/src/main/java/io/grpc/netty/NettyServerBuilder.java
NettyServerBuilder.workerEventLoopGroup
public NettyServerBuilder workerEventLoopGroup(EventLoopGroup group) { if (group != null) { return workerEventLoopGroupPool(new FixedObjectPool<>(group)); } return workerEventLoopGroupPool(DEFAULT_WORKER_EVENT_LOOP_GROUP_POOL); }
java
public NettyServerBuilder workerEventLoopGroup(EventLoopGroup group) { if (group != null) { return workerEventLoopGroupPool(new FixedObjectPool<>(group)); } return workerEventLoopGroupPool(DEFAULT_WORKER_EVENT_LOOP_GROUP_POOL); }
[ "public", "NettyServerBuilder", "workerEventLoopGroup", "(", "EventLoopGroup", "group", ")", "{", "if", "(", "group", "!=", "null", ")", "{", "return", "workerEventLoopGroupPool", "(", "new", "FixedObjectPool", "<>", "(", "group", ")", ")", ";", "}", "return", ...
Provides the worker EventGroupLoop to the server. <p>It's an optional parameter. If the user has not provided one when the server is built, the builder will create one. <p>You must also provide corresponding {@link io.netty.channel.Channel} type using {@link #channelType(Class)} and {@link #bossEventLoopGroup(EventLo...
[ "Provides", "the", "worker", "EventGroupLoop", "to", "the", "server", "." ]
973885457f9609de232d2553b82c67f6c3ff57bf
https://github.com/grpc/grpc-java/blob/973885457f9609de232d2553b82c67f6c3ff57bf/netty/src/main/java/io/grpc/netty/NettyServerBuilder.java#L230-L235
127,314
grpc/grpc-java
netty/src/main/java/io/grpc/netty/NettyServerBuilder.java
NettyServerBuilder.keepAliveTimeout
public NettyServerBuilder keepAliveTimeout(long keepAliveTimeout, TimeUnit timeUnit) { checkArgument(keepAliveTimeout > 0L, "keepalive timeout must be positive"); keepAliveTimeoutInNanos = timeUnit.toNanos(keepAliveTimeout); keepAliveTimeoutInNanos = KeepAliveManager.clampKeepAliveTimeoutInNanos(kee...
java
public NettyServerBuilder keepAliveTimeout(long keepAliveTimeout, TimeUnit timeUnit) { checkArgument(keepAliveTimeout > 0L, "keepalive timeout must be positive"); keepAliveTimeoutInNanos = timeUnit.toNanos(keepAliveTimeout); keepAliveTimeoutInNanos = KeepAliveManager.clampKeepAliveTimeoutInNanos(kee...
[ "public", "NettyServerBuilder", "keepAliveTimeout", "(", "long", "keepAliveTimeout", ",", "TimeUnit", "timeUnit", ")", "{", "checkArgument", "(", "keepAliveTimeout", ">", "0L", ",", "\"keepalive timeout must be positive\"", ")", ";", "keepAliveTimeoutInNanos", "=", "timeU...
Sets a custom keepalive timeout, the timeout for keepalive ping requests. An unreasonably small value might be increased. @since 1.3.0
[ "Sets", "a", "custom", "keepalive", "timeout", "the", "timeout", "for", "keepalive", "ping", "requests", ".", "An", "unreasonably", "small", "value", "might", "be", "increased", "." ]
973885457f9609de232d2553b82c67f6c3ff57bf
https://github.com/grpc/grpc-java/blob/973885457f9609de232d2553b82c67f6c3ff57bf/netty/src/main/java/io/grpc/netty/NettyServerBuilder.java#L392-L402
127,315
grpc/grpc-java
netty/src/main/java/io/grpc/netty/NettyServerBuilder.java
NettyServerBuilder.permitKeepAliveTime
public NettyServerBuilder permitKeepAliveTime(long keepAliveTime, TimeUnit timeUnit) { checkArgument(keepAliveTime >= 0, "permit keepalive time must be non-negative"); permitKeepAliveTimeInNanos = timeUnit.toNanos(keepAliveTime); return this; }
java
public NettyServerBuilder permitKeepAliveTime(long keepAliveTime, TimeUnit timeUnit) { checkArgument(keepAliveTime >= 0, "permit keepalive time must be non-negative"); permitKeepAliveTimeInNanos = timeUnit.toNanos(keepAliveTime); return this; }
[ "public", "NettyServerBuilder", "permitKeepAliveTime", "(", "long", "keepAliveTime", ",", "TimeUnit", "timeUnit", ")", "{", "checkArgument", "(", "keepAliveTime", ">=", "0", ",", "\"permit keepalive time must be non-negative\"", ")", ";", "permitKeepAliveTimeInNanos", "=", ...
Specify the most aggressive keep-alive time clients are permitted to configure. The server will try to detect clients exceeding this rate and when detected will forcefully close the connection. The default is 5 minutes. <p>Even though a default is defined that allows some keep-alives, clients must not use keep-alive w...
[ "Specify", "the", "most", "aggressive", "keep", "-", "alive", "time", "clients", "are", "permitted", "to", "configure", ".", "The", "server", "will", "try", "to", "detect", "clients", "exceeding", "this", "rate", "and", "when", "detected", "will", "forcefully"...
973885457f9609de232d2553b82c67f6c3ff57bf
https://github.com/grpc/grpc-java/blob/973885457f9609de232d2553b82c67f6c3ff57bf/netty/src/main/java/io/grpc/netty/NettyServerBuilder.java#L477-L481
127,316
grpc/grpc-java
android/src/main/java/io/grpc/android/AndroidChannelBuilder.java
AndroidChannelBuilder.sslSocketFactory
@Deprecated public AndroidChannelBuilder sslSocketFactory(SSLSocketFactory factory) { try { OKHTTP_CHANNEL_BUILDER_CLASS .getMethod("sslSocketFactory", SSLSocketFactory.class) .invoke(delegateBuilder, factory); return this; } catch (Exception e) { throw new RuntimeExcepti...
java
@Deprecated public AndroidChannelBuilder sslSocketFactory(SSLSocketFactory factory) { try { OKHTTP_CHANNEL_BUILDER_CLASS .getMethod("sslSocketFactory", SSLSocketFactory.class) .invoke(delegateBuilder, factory); return this; } catch (Exception e) { throw new RuntimeExcepti...
[ "@", "Deprecated", "public", "AndroidChannelBuilder", "sslSocketFactory", "(", "SSLSocketFactory", "factory", ")", "{", "try", "{", "OKHTTP_CHANNEL_BUILDER_CLASS", ".", "getMethod", "(", "\"sslSocketFactory\"", ",", "SSLSocketFactory", ".", "class", ")", ".", "invoke", ...
Set the delegate channel builder's sslSocketFactory. @deprecated Use {@link #fromBuilder(ManagedChannelBuilder)} with a pre-configured ManagedChannelBuilder instead.
[ "Set", "the", "delegate", "channel", "builder", "s", "sslSocketFactory", "." ]
973885457f9609de232d2553b82c67f6c3ff57bf
https://github.com/grpc/grpc-java/blob/973885457f9609de232d2553b82c67f6c3ff57bf/android/src/main/java/io/grpc/android/AndroidChannelBuilder.java#L137-L147
127,317
grpc/grpc-java
android/src/main/java/io/grpc/android/AndroidChannelBuilder.java
AndroidChannelBuilder.scheduledExecutorService
@Deprecated public AndroidChannelBuilder scheduledExecutorService( ScheduledExecutorService scheduledExecutorService) { try { OKHTTP_CHANNEL_BUILDER_CLASS .getMethod("scheduledExecutorService", ScheduledExecutorService.class) .invoke(delegateBuilder, scheduledExecutorService); ...
java
@Deprecated public AndroidChannelBuilder scheduledExecutorService( ScheduledExecutorService scheduledExecutorService) { try { OKHTTP_CHANNEL_BUILDER_CLASS .getMethod("scheduledExecutorService", ScheduledExecutorService.class) .invoke(delegateBuilder, scheduledExecutorService); ...
[ "@", "Deprecated", "public", "AndroidChannelBuilder", "scheduledExecutorService", "(", "ScheduledExecutorService", "scheduledExecutorService", ")", "{", "try", "{", "OKHTTP_CHANNEL_BUILDER_CLASS", ".", "getMethod", "(", "\"scheduledExecutorService\"", ",", "ScheduledExecutorServi...
Set the delegate channel builder's scheduledExecutorService. @deprecated Use {@link #fromBuilder(ManagedChannelBuilder)} with a pre-configured ManagedChannelBuilder instead.
[ "Set", "the", "delegate", "channel", "builder", "s", "scheduledExecutorService", "." ]
973885457f9609de232d2553b82c67f6c3ff57bf
https://github.com/grpc/grpc-java/blob/973885457f9609de232d2553b82c67f6c3ff57bf/android/src/main/java/io/grpc/android/AndroidChannelBuilder.java#L155-L167
127,318
grpc/grpc-java
netty/src/main/java/io/grpc/netty/GrpcSslContexts.java
GrpcSslContexts.defaultSslProvider
private static SslProvider defaultSslProvider() { if (OpenSsl.isAvailable()) { logger.log(Level.FINE, "Selecting OPENSSL"); return SslProvider.OPENSSL; } Provider provider = findJdkProvider(); if (provider != null) { logger.log(Level.FINE, "Selecting JDK with provider {0}", provider); ...
java
private static SslProvider defaultSslProvider() { if (OpenSsl.isAvailable()) { logger.log(Level.FINE, "Selecting OPENSSL"); return SslProvider.OPENSSL; } Provider provider = findJdkProvider(); if (provider != null) { logger.log(Level.FINE, "Selecting JDK with provider {0}", provider); ...
[ "private", "static", "SslProvider", "defaultSslProvider", "(", ")", "{", "if", "(", "OpenSsl", ".", "isAvailable", "(", ")", ")", "{", "logger", ".", "log", "(", "Level", ".", "FINE", ",", "\"Selecting OPENSSL\"", ")", ";", "return", "SslProvider", ".", "O...
Returns OpenSSL if available, otherwise returns the JDK provider.
[ "Returns", "OpenSSL", "if", "available", "otherwise", "returns", "the", "JDK", "provider", "." ]
973885457f9609de232d2553b82c67f6c3ff57bf
https://github.com/grpc/grpc-java/blob/973885457f9609de232d2553b82c67f6c3ff57bf/netty/src/main/java/io/grpc/netty/GrpcSslContexts.java#L243-L261
127,319
grpc/grpc-java
core/src/main/java/io/grpc/internal/InternalSubchannel.java
InternalSubchannel.resetConnectBackoff
void resetConnectBackoff() { try { synchronized (lock) { if (state.getState() != TRANSIENT_FAILURE) { return; } cancelReconnectTask(); channelLogger.log(ChannelLogLevel.INFO, "CONNECTING; backoff interrupted"); gotoNonErrorState(CONNECTING); startNewTr...
java
void resetConnectBackoff() { try { synchronized (lock) { if (state.getState() != TRANSIENT_FAILURE) { return; } cancelReconnectTask(); channelLogger.log(ChannelLogLevel.INFO, "CONNECTING; backoff interrupted"); gotoNonErrorState(CONNECTING); startNewTr...
[ "void", "resetConnectBackoff", "(", ")", "{", "try", "{", "synchronized", "(", "lock", ")", "{", "if", "(", "state", ".", "getState", "(", ")", "!=", "TRANSIENT_FAILURE", ")", "{", "return", ";", "}", "cancelReconnectTask", "(", ")", ";", "channelLogger", ...
Immediately attempt to reconnect if the current state is TRANSIENT_FAILURE. Otherwise this method has no effect.
[ "Immediately", "attempt", "to", "reconnect", "if", "the", "current", "state", "is", "TRANSIENT_FAILURE", ".", "Otherwise", "this", "method", "has", "no", "effect", "." ]
973885457f9609de232d2553b82c67f6c3ff57bf
https://github.com/grpc/grpc-java/blob/973885457f9609de232d2553b82c67f6c3ff57bf/core/src/main/java/io/grpc/internal/InternalSubchannel.java#L332-L346
127,320
grpc/grpc-java
core/src/main/java/io/grpc/internal/InternalSubchannel.java
InternalSubchannel.updateAddresses
public void updateAddresses(List<EquivalentAddressGroup> newAddressGroups) { Preconditions.checkNotNull(newAddressGroups, "newAddressGroups"); checkListHasNoNulls(newAddressGroups, "newAddressGroups contains null entry"); Preconditions.checkArgument(!newAddressGroups.isEmpty(), "newAddressGroups is empty");...
java
public void updateAddresses(List<EquivalentAddressGroup> newAddressGroups) { Preconditions.checkNotNull(newAddressGroups, "newAddressGroups"); checkListHasNoNulls(newAddressGroups, "newAddressGroups contains null entry"); Preconditions.checkArgument(!newAddressGroups.isEmpty(), "newAddressGroups is empty");...
[ "public", "void", "updateAddresses", "(", "List", "<", "EquivalentAddressGroup", ">", "newAddressGroups", ")", "{", "Preconditions", ".", "checkNotNull", "(", "newAddressGroups", ",", "\"newAddressGroups\"", ")", ";", "checkListHasNoNulls", "(", "newAddressGroups", ",",...
Replaces the existing addresses, avoiding unnecessary reconnects.
[ "Replaces", "the", "existing", "addresses", "avoiding", "unnecessary", "reconnects", "." ]
973885457f9609de232d2553b82c67f6c3ff57bf
https://github.com/grpc/grpc-java/blob/973885457f9609de232d2553b82c67f6c3ff57bf/core/src/main/java/io/grpc/internal/InternalSubchannel.java#L369-L405
127,321
grpc/grpc-java
okhttp/src/main/java/io/grpc/okhttp/OkHttpProtocolNegotiator.java
OkHttpProtocolNegotiator.createNegotiator
@VisibleForTesting static OkHttpProtocolNegotiator createNegotiator(ClassLoader loader) { boolean android = true; try { // Attempt to find Android 2.3+ APIs. loader.loadClass("com.android.org.conscrypt.OpenSSLSocketImpl"); } catch (ClassNotFoundException e1) { logger.log(Level.FINE, "Una...
java
@VisibleForTesting static OkHttpProtocolNegotiator createNegotiator(ClassLoader loader) { boolean android = true; try { // Attempt to find Android 2.3+ APIs. loader.loadClass("com.android.org.conscrypt.OpenSSLSocketImpl"); } catch (ClassNotFoundException e1) { logger.log(Level.FINE, "Una...
[ "@", "VisibleForTesting", "static", "OkHttpProtocolNegotiator", "createNegotiator", "(", "ClassLoader", "loader", ")", "{", "boolean", "android", "=", "true", ";", "try", "{", "// Attempt to find Android 2.3+ APIs.", "loader", ".", "loadClass", "(", "\"com.android.org.con...
Creates corresponding negotiator according to whether on Android.
[ "Creates", "corresponding", "negotiator", "according", "to", "whether", "on", "Android", "." ]
973885457f9609de232d2553b82c67f6c3ff57bf
https://github.com/grpc/grpc-java/blob/973885457f9609de232d2553b82c67f6c3ff57bf/okhttp/src/main/java/io/grpc/okhttp/OkHttpProtocolNegotiator.java#L58-L77
127,322
grpc/grpc-java
okhttp/src/main/java/io/grpc/okhttp/OkHttpProtocolNegotiator.java
OkHttpProtocolNegotiator.configureTlsExtensions
protected void configureTlsExtensions( SSLSocket sslSocket, String hostname, List<Protocol> protocols) { platform.configureTlsExtensions(sslSocket, hostname, protocols); }
java
protected void configureTlsExtensions( SSLSocket sslSocket, String hostname, List<Protocol> protocols) { platform.configureTlsExtensions(sslSocket, hostname, protocols); }
[ "protected", "void", "configureTlsExtensions", "(", "SSLSocket", "sslSocket", ",", "String", "hostname", ",", "List", "<", "Protocol", ">", "protocols", ")", "{", "platform", ".", "configureTlsExtensions", "(", "sslSocket", ",", "hostname", ",", "protocols", ")", ...
Configure TLS extensions.
[ "Configure", "TLS", "extensions", "." ]
973885457f9609de232d2553b82c67f6c3ff57bf
https://github.com/grpc/grpc-java/blob/973885457f9609de232d2553b82c67f6c3ff57bf/okhttp/src/main/java/io/grpc/okhttp/OkHttpProtocolNegotiator.java#L105-L108
127,323
grpc/grpc-java
grpclb/src/main/java/io/grpc/grpclb/GrpclbClientLoadRecorder.java
GrpclbClientLoadRecorder.recordDroppedRequest
void recordDroppedRequest(String token) { callsStartedUpdater.getAndIncrement(this); callsFinishedUpdater.getAndIncrement(this); synchronized (this) { LongHolder holder; if ((holder = callsDroppedPerToken.get(token)) == null) { callsDroppedPerToken.put(token, (holder = new LongHolder())...
java
void recordDroppedRequest(String token) { callsStartedUpdater.getAndIncrement(this); callsFinishedUpdater.getAndIncrement(this); synchronized (this) { LongHolder holder; if ((holder = callsDroppedPerToken.get(token)) == null) { callsDroppedPerToken.put(token, (holder = new LongHolder())...
[ "void", "recordDroppedRequest", "(", "String", "token", ")", "{", "callsStartedUpdater", ".", "getAndIncrement", "(", "this", ")", ";", "callsFinishedUpdater", ".", "getAndIncrement", "(", "this", ")", ";", "synchronized", "(", "this", ")", "{", "LongHolder", "h...
Records that a request has been dropped as instructed by the remote balancer.
[ "Records", "that", "a", "request", "has", "been", "dropped", "as", "instructed", "by", "the", "remote", "balancer", "." ]
973885457f9609de232d2553b82c67f6c3ff57bf
https://github.com/grpc/grpc-java/blob/973885457f9609de232d2553b82c67f6c3ff57bf/grpclb/src/main/java/io/grpc/grpclb/GrpclbClientLoadRecorder.java#L86-L97
127,324
grpc/grpc-java
grpclb/src/main/java/io/grpc/grpclb/GrpclbClientLoadRecorder.java
GrpclbClientLoadRecorder.generateLoadReport
ClientStats generateLoadReport() { ClientStats.Builder statsBuilder = ClientStats.newBuilder() .setTimestamp(Timestamps.fromNanos(time.currentTimeNanos())) .setNumCallsStarted(callsStartedUpdater.getAndSet(this, 0)) .setNumCallsFinished(callsFinishedUpdater.getAndSet(this, 0)) ...
java
ClientStats generateLoadReport() { ClientStats.Builder statsBuilder = ClientStats.newBuilder() .setTimestamp(Timestamps.fromNanos(time.currentTimeNanos())) .setNumCallsStarted(callsStartedUpdater.getAndSet(this, 0)) .setNumCallsFinished(callsFinishedUpdater.getAndSet(this, 0)) ...
[ "ClientStats", "generateLoadReport", "(", ")", "{", "ClientStats", ".", "Builder", "statsBuilder", "=", "ClientStats", ".", "newBuilder", "(", ")", ".", "setTimestamp", "(", "Timestamps", ".", "fromNanos", "(", "time", ".", "currentTimeNanos", "(", ")", ")", "...
Generate the report with the data recorded this LB stream since the last report.
[ "Generate", "the", "report", "with", "the", "data", "recorded", "this", "LB", "stream", "since", "the", "last", "report", "." ]
973885457f9609de232d2553b82c67f6c3ff57bf
https://github.com/grpc/grpc-java/blob/973885457f9609de232d2553b82c67f6c3ff57bf/grpclb/src/main/java/io/grpc/grpclb/GrpclbClientLoadRecorder.java#L102-L126
127,325
grpc/grpc-java
stub/src/main/java/io/grpc/stub/ClientCalls.java
ClientCalls.cancelThrow
private static RuntimeException cancelThrow(ClientCall<?, ?> call, Throwable t) { try { call.cancel(null, t); } catch (Throwable e) { assert e instanceof RuntimeException || e instanceof Error; logger.log(Level.SEVERE, "RuntimeException encountered while closing call", e); } if (t inst...
java
private static RuntimeException cancelThrow(ClientCall<?, ?> call, Throwable t) { try { call.cancel(null, t); } catch (Throwable e) { assert e instanceof RuntimeException || e instanceof Error; logger.log(Level.SEVERE, "RuntimeException encountered while closing call", e); } if (t inst...
[ "private", "static", "RuntimeException", "cancelThrow", "(", "ClientCall", "<", "?", ",", "?", ">", "call", ",", "Throwable", "t", ")", "{", "try", "{", "call", ".", "cancel", "(", "null", ",", "t", ")", ";", "}", "catch", "(", "Throwable", "e", ")",...
Cancels a call, and throws the exception. @param t must be a RuntimeException or Error
[ "Cancels", "a", "call", "and", "throws", "the", "exception", "." ]
973885457f9609de232d2553b82c67f6c3ff57bf
https://github.com/grpc/grpc-java/blob/973885457f9609de232d2553b82c67f6c3ff57bf/stub/src/main/java/io/grpc/stub/ClientCalls.java#L247-L261
127,326
grpc/grpc-java
api/src/main/java/io/grpc/CompressorRegistry.java
CompressorRegistry.register
public void register(Compressor c) { String encoding = c.getMessageEncoding(); checkArgument(!encoding.contains(","), "Comma is currently not allowed in message encoding"); compressors.put(encoding, c); }
java
public void register(Compressor c) { String encoding = c.getMessageEncoding(); checkArgument(!encoding.contains(","), "Comma is currently not allowed in message encoding"); compressors.put(encoding, c); }
[ "public", "void", "register", "(", "Compressor", "c", ")", "{", "String", "encoding", "=", "c", ".", "getMessageEncoding", "(", ")", ";", "checkArgument", "(", "!", "encoding", ".", "contains", "(", "\",\"", ")", ",", "\"Comma is currently not allowed in message...
Registers a compressor for both decompression and message encoding negotiation. @param c The compressor to register
[ "Registers", "a", "compressor", "for", "both", "decompression", "and", "message", "encoding", "negotiation", "." ]
973885457f9609de232d2553b82c67f6c3ff57bf
https://github.com/grpc/grpc-java/blob/973885457f9609de232d2553b82c67f6c3ff57bf/api/src/main/java/io/grpc/CompressorRegistry.java#L72-L76
127,327
grpc/grpc-java
api/src/main/java/io/grpc/Metadata.java
Metadata.containsKey
public boolean containsKey(Key<?> key) { for (int i = 0; i < size; i++) { if (bytesEqual(key.asciiName(), name(i))) { return true; } } return false; }
java
public boolean containsKey(Key<?> key) { for (int i = 0; i < size; i++) { if (bytesEqual(key.asciiName(), name(i))) { return true; } } return false; }
[ "public", "boolean", "containsKey", "(", "Key", "<", "?", ">", "key", ")", "{", "for", "(", "int", "i", "=", "0", ";", "i", "<", "size", ";", "i", "++", ")", "{", "if", "(", "bytesEqual", "(", "key", ".", "asciiName", "(", ")", ",", "name", "...
Returns true if a value is defined for the given key. <p>This is done by linear search, so if it is followed by {@link #get} or {@link #getAll}, prefer calling them directly and checking the return value against {@code null}.
[ "Returns", "true", "if", "a", "value", "is", "defined", "for", "the", "given", "key", "." ]
973885457f9609de232d2553b82c67f6c3ff57bf
https://github.com/grpc/grpc-java/blob/973885457f9609de232d2553b82c67f6c3ff57bf/api/src/main/java/io/grpc/Metadata.java#L177-L184
127,328
grpc/grpc-java
api/src/main/java/io/grpc/Metadata.java
Metadata.get
@Nullable public <T> T get(Key<T> key) { for (int i = size - 1; i >= 0; i--) { if (bytesEqual(key.asciiName(), name(i))) { return key.parseBytes(value(i)); } } return null; }
java
@Nullable public <T> T get(Key<T> key) { for (int i = size - 1; i >= 0; i--) { if (bytesEqual(key.asciiName(), name(i))) { return key.parseBytes(value(i)); } } return null; }
[ "@", "Nullable", "public", "<", "T", ">", "T", "get", "(", "Key", "<", "T", ">", "key", ")", "{", "for", "(", "int", "i", "=", "size", "-", "1", ";", "i", ">=", "0", ";", "i", "--", ")", "{", "if", "(", "bytesEqual", "(", "key", ".", "asc...
Returns the last metadata entry added with the name 'name' parsed as T. @return the parsed metadata entry or null if there are none.
[ "Returns", "the", "last", "metadata", "entry", "added", "with", "the", "name", "name", "parsed", "as", "T", "." ]
973885457f9609de232d2553b82c67f6c3ff57bf
https://github.com/grpc/grpc-java/blob/973885457f9609de232d2553b82c67f6c3ff57bf/api/src/main/java/io/grpc/Metadata.java#L191-L199
127,329
grpc/grpc-java
api/src/main/java/io/grpc/Metadata.java
Metadata.getAll
@Nullable public <T> Iterable<T> getAll(final Key<T> key) { for (int i = 0; i < size; i++) { if (bytesEqual(key.asciiName(), name(i))) { return new IterableAt<>(key, i); } } return null; }
java
@Nullable public <T> Iterable<T> getAll(final Key<T> key) { for (int i = 0; i < size; i++) { if (bytesEqual(key.asciiName(), name(i))) { return new IterableAt<>(key, i); } } return null; }
[ "@", "Nullable", "public", "<", "T", ">", "Iterable", "<", "T", ">", "getAll", "(", "final", "Key", "<", "T", ">", "key", ")", "{", "for", "(", "int", "i", "=", "0", ";", "i", "<", "size", ";", "i", "++", ")", "{", "if", "(", "bytesEqual", ...
Returns all the metadata entries named 'name', in the order they were received, parsed as T, or null if there are none. The iterator is not guaranteed to be "live." It may or may not be accurate if Metadata is mutated.
[ "Returns", "all", "the", "metadata", "entries", "named", "name", "in", "the", "order", "they", "were", "received", "parsed", "as", "T", "or", "null", "if", "there", "are", "none", ".", "The", "iterator", "is", "not", "guaranteed", "to", "be", "live", "."...
973885457f9609de232d2553b82c67f6c3ff57bf
https://github.com/grpc/grpc-java/blob/973885457f9609de232d2553b82c67f6c3ff57bf/api/src/main/java/io/grpc/Metadata.java#L252-L260
127,330
grpc/grpc-java
api/src/main/java/io/grpc/Metadata.java
Metadata.keys
@SuppressWarnings("deprecation") // The String ctor is deprecated, but fast. public Set<String> keys() { if (isEmpty()) { return Collections.emptySet(); } Set<String> ks = new HashSet<>(size); for (int i = 0; i < size; i++) { ks.add(new String(name(i), 0 /* hibyte */)); } // immuta...
java
@SuppressWarnings("deprecation") // The String ctor is deprecated, but fast. public Set<String> keys() { if (isEmpty()) { return Collections.emptySet(); } Set<String> ks = new HashSet<>(size); for (int i = 0; i < size; i++) { ks.add(new String(name(i), 0 /* hibyte */)); } // immuta...
[ "@", "SuppressWarnings", "(", "\"deprecation\"", ")", "// The String ctor is deprecated, but fast.", "public", "Set", "<", "String", ">", "keys", "(", ")", "{", "if", "(", "isEmpty", "(", ")", ")", "{", "return", "Collections", ".", "emptySet", "(", ")", ";", ...
Returns set of all keys in store. @return unmodifiable Set of keys
[ "Returns", "set", "of", "all", "keys", "in", "store", "." ]
973885457f9609de232d2553b82c67f6c3ff57bf
https://github.com/grpc/grpc-java/blob/973885457f9609de232d2553b82c67f6c3ff57bf/api/src/main/java/io/grpc/Metadata.java#L267-L278
127,331
grpc/grpc-java
api/src/main/java/io/grpc/Metadata.java
Metadata.expand
private void expand(int newCapacity) { byte[][] newNamesAndValues = new byte[newCapacity][]; if (!isEmpty()) { System.arraycopy(namesAndValues, 0, newNamesAndValues, 0, len()); } namesAndValues = newNamesAndValues; }
java
private void expand(int newCapacity) { byte[][] newNamesAndValues = new byte[newCapacity][]; if (!isEmpty()) { System.arraycopy(namesAndValues, 0, newNamesAndValues, 0, len()); } namesAndValues = newNamesAndValues; }
[ "private", "void", "expand", "(", "int", "newCapacity", ")", "{", "byte", "[", "]", "[", "]", "newNamesAndValues", "=", "new", "byte", "[", "newCapacity", "]", "[", "", "]", ";", "if", "(", "!", "isEmpty", "(", ")", ")", "{", "System", ".", "arrayc...
Expands to exactly the desired capacity.
[ "Expands", "to", "exactly", "the", "desired", "capacity", "." ]
973885457f9609de232d2553b82c67f6c3ff57bf
https://github.com/grpc/grpc-java/blob/973885457f9609de232d2553b82c67f6c3ff57bf/api/src/main/java/io/grpc/Metadata.java#L302-L308
127,332
grpc/grpc-java
api/src/main/java/io/grpc/Metadata.java
Metadata.discardAll
@ExperimentalApi("https://github.com/grpc/grpc-java/issues/4691") public <T> void discardAll(Key<T> key) { if (isEmpty()) { return; } int writeIdx = 0; int readIdx = 0; for (; readIdx < size; readIdx++) { if (bytesEqual(key.asciiName(), name(readIdx))) { continue; } ...
java
@ExperimentalApi("https://github.com/grpc/grpc-java/issues/4691") public <T> void discardAll(Key<T> key) { if (isEmpty()) { return; } int writeIdx = 0; int readIdx = 0; for (; readIdx < size; readIdx++) { if (bytesEqual(key.asciiName(), name(readIdx))) { continue; } ...
[ "@", "ExperimentalApi", "(", "\"https://github.com/grpc/grpc-java/issues/4691\"", ")", "public", "<", "T", ">", "void", "discardAll", "(", "Key", "<", "T", ">", "key", ")", "{", "if", "(", "isEmpty", "(", ")", ")", "{", "return", ";", "}", "int", "writeIdx...
Remove all values for the given key without returning them. This is a minor performance optimization if you do not need the previous values.
[ "Remove", "all", "values", "for", "the", "given", "key", "without", "returning", "them", ".", "This", "is", "a", "minor", "performance", "optimization", "if", "you", "do", "not", "need", "the", "previous", "values", "." ]
973885457f9609de232d2553b82c67f6c3ff57bf
https://github.com/grpc/grpc-java/blob/973885457f9609de232d2553b82c67f6c3ff57bf/api/src/main/java/io/grpc/Metadata.java#L371-L390
127,333
grpc/grpc-java
api/src/main/java/io/grpc/Metadata.java
Metadata.merge
public void merge(Metadata other) { if (other.isEmpty()) { return; } int remaining = cap() - len(); if (isEmpty() || remaining < other.len()) { expand(len() + other.len()); } System.arraycopy(other.namesAndValues, 0, namesAndValues, len(), other.len()); size += other.size; }
java
public void merge(Metadata other) { if (other.isEmpty()) { return; } int remaining = cap() - len(); if (isEmpty() || remaining < other.len()) { expand(len() + other.len()); } System.arraycopy(other.namesAndValues, 0, namesAndValues, len(), other.len()); size += other.size; }
[ "public", "void", "merge", "(", "Metadata", "other", ")", "{", "if", "(", "other", ".", "isEmpty", "(", ")", ")", "{", "return", ";", "}", "int", "remaining", "=", "cap", "(", ")", "-", "len", "(", ")", ";", "if", "(", "isEmpty", "(", ")", "||"...
Perform a simple merge of two sets of metadata. <p>This is a purely additive operation, because a single key can be associated with multiple values.
[ "Perform", "a", "simple", "merge", "of", "two", "sets", "of", "metadata", "." ]
973885457f9609de232d2553b82c67f6c3ff57bf
https://github.com/grpc/grpc-java/blob/973885457f9609de232d2553b82c67f6c3ff57bf/api/src/main/java/io/grpc/Metadata.java#L423-L433
127,334
grpc/grpc-java
api/src/main/java/io/grpc/Metadata.java
Metadata.merge
public void merge(Metadata other, Set<Key<?>> keys) { Preconditions.checkNotNull(other, "other"); // Use ByteBuffer for equals and hashCode. Map<ByteBuffer, Key<?>> asciiKeys = new HashMap<>(keys.size()); for (Key<?> key : keys) { asciiKeys.put(ByteBuffer.wrap(key.asciiName()), key); } for...
java
public void merge(Metadata other, Set<Key<?>> keys) { Preconditions.checkNotNull(other, "other"); // Use ByteBuffer for equals and hashCode. Map<ByteBuffer, Key<?>> asciiKeys = new HashMap<>(keys.size()); for (Key<?> key : keys) { asciiKeys.put(ByteBuffer.wrap(key.asciiName()), key); } for...
[ "public", "void", "merge", "(", "Metadata", "other", ",", "Set", "<", "Key", "<", "?", ">", ">", "keys", ")", "{", "Preconditions", ".", "checkNotNull", "(", "other", ",", "\"other\"", ")", ";", "// Use ByteBuffer for equals and hashCode.", "Map", "<", "Byte...
Merge values from the given set of keys into this set of metadata. If a key is present in keys, then all of the associated values will be copied over. @param other The source of the new key values. @param keys The subset of matching key we want to copy, if they exist in the source.
[ "Merge", "values", "from", "the", "given", "set", "of", "keys", "into", "this", "set", "of", "metadata", ".", "If", "a", "key", "is", "present", "in", "keys", "then", "all", "of", "the", "associated", "values", "will", "be", "copied", "over", "." ]
973885457f9609de232d2553b82c67f6c3ff57bf
https://github.com/grpc/grpc-java/blob/973885457f9609de232d2553b82c67f6c3ff57bf/api/src/main/java/io/grpc/Metadata.java#L442-L458
127,335
grpc/grpc-java
core/src/main/java/io/grpc/internal/DelayedStream.java
DelayedStream.cancel
@Override public void cancel(final Status reason) { checkNotNull(reason, "reason"); boolean delegateToRealStream = true; ClientStreamListener listenerToClose = null; synchronized (this) { // If realStream != null, then either setStream() or cancel() has been called if (realStream == null) ...
java
@Override public void cancel(final Status reason) { checkNotNull(reason, "reason"); boolean delegateToRealStream = true; ClientStreamListener listenerToClose = null; synchronized (this) { // If realStream != null, then either setStream() or cancel() has been called if (realStream == null) ...
[ "@", "Override", "public", "void", "cancel", "(", "final", "Status", "reason", ")", "{", "checkNotNull", "(", "reason", ",", "\"reason\"", ")", ";", "boolean", "delegateToRealStream", "=", "true", ";", "ClientStreamListener", "listenerToClose", "=", "null", ";",...
When this method returns, passThrough is guaranteed to be true
[ "When", "this", "method", "returns", "passThrough", "is", "guaranteed", "to", "be", "true" ]
973885457f9609de232d2553b82c67f6c3ff57bf
https://github.com/grpc/grpc-java/blob/973885457f9609de232d2553b82c67f6c3ff57bf/core/src/main/java/io/grpc/internal/DelayedStream.java#L250-L279
127,336
grpc/grpc-java
core/src/main/java/io/grpc/internal/TransportFrameUtil.java
TransportFrameUtil.toHttp2Headers
public static byte[][] toHttp2Headers(Metadata headers) { byte[][] serializedHeaders = InternalMetadata.serialize(headers); // TODO(carl-mastrangelo): eventually remove this once all callers are updated. if (serializedHeaders == null) { return new byte[][]{}; } int k = 0; for (int i = 0; i...
java
public static byte[][] toHttp2Headers(Metadata headers) { byte[][] serializedHeaders = InternalMetadata.serialize(headers); // TODO(carl-mastrangelo): eventually remove this once all callers are updated. if (serializedHeaders == null) { return new byte[][]{}; } int k = 0; for (int i = 0; i...
[ "public", "static", "byte", "[", "]", "[", "]", "toHttp2Headers", "(", "Metadata", "headers", ")", "{", "byte", "[", "]", "[", "]", "serializedHeaders", "=", "InternalMetadata", ".", "serialize", "(", "headers", ")", ";", "// TODO(carl-mastrangelo): eventually r...
Transform the given headers to a format where only spec-compliant ASCII characters are allowed. Binary header values are encoded by Base64 in the result. It is safe to modify the returned array, but not to modify any of the underlying byte arrays. @return the interleaved keys and values.
[ "Transform", "the", "given", "headers", "to", "a", "format", "where", "only", "spec", "-", "compliant", "ASCII", "characters", "are", "allowed", ".", "Binary", "header", "values", "are", "encoded", "by", "Base64", "in", "the", "result", ".", "It", "is", "s...
973885457f9609de232d2553b82c67f6c3ff57bf
https://github.com/grpc/grpc-java/blob/973885457f9609de232d2553b82c67f6c3ff57bf/core/src/main/java/io/grpc/internal/TransportFrameUtil.java#L50-L86
127,337
grpc/grpc-java
core/src/main/java/io/grpc/internal/Http2ClientStreamTransportState.java
Http2ClientStreamTransportState.transportDataReceived
protected void transportDataReceived(ReadableBuffer frame, boolean endOfStream) { if (transportError != null) { // We've already detected a transport error and now we're just accumulating more detail // for it. transportError = transportError.augmentDescription("DATA-----------------------------\n...
java
protected void transportDataReceived(ReadableBuffer frame, boolean endOfStream) { if (transportError != null) { // We've already detected a transport error and now we're just accumulating more detail // for it. transportError = transportError.augmentDescription("DATA-----------------------------\n...
[ "protected", "void", "transportDataReceived", "(", "ReadableBuffer", "frame", ",", "boolean", "endOfStream", ")", "{", "if", "(", "transportError", "!=", "null", ")", "{", "// We've already detected a transport error and now we're just accumulating more detail", "// for it.", ...
Called by subclasses whenever a data frame is received from the transport. @param frame the received data frame @param endOfStream {@code true} if there will be no more data received for this stream
[ "Called", "by", "subclasses", "whenever", "a", "data", "frame", "is", "received", "from", "the", "transport", "." ]
973885457f9609de232d2553b82c67f6c3ff57bf
https://github.com/grpc/grpc-java/blob/973885457f9609de232d2553b82c67f6c3ff57bf/core/src/main/java/io/grpc/internal/Http2ClientStreamTransportState.java#L129-L156
127,338
grpc/grpc-java
core/src/main/java/io/grpc/internal/Http2ClientStreamTransportState.java
Http2ClientStreamTransportState.transportTrailersReceived
protected void transportTrailersReceived(Metadata trailers) { Preconditions.checkNotNull(trailers, "trailers"); if (transportError == null && !headersReceived) { transportError = validateInitialMetadata(trailers); if (transportError != null) { transportErrorMetadata = trailers; } }...
java
protected void transportTrailersReceived(Metadata trailers) { Preconditions.checkNotNull(trailers, "trailers"); if (transportError == null && !headersReceived) { transportError = validateInitialMetadata(trailers); if (transportError != null) { transportErrorMetadata = trailers; } }...
[ "protected", "void", "transportTrailersReceived", "(", "Metadata", "trailers", ")", "{", "Preconditions", ".", "checkNotNull", "(", "trailers", ",", "\"trailers\"", ")", ";", "if", "(", "transportError", "==", "null", "&&", "!", "headersReceived", ")", "{", "tra...
Called by subclasses for the terminal trailer metadata on a stream. @param trailers the received terminal trailer metadata
[ "Called", "by", "subclasses", "for", "the", "terminal", "trailer", "metadata", "on", "a", "stream", "." ]
973885457f9609de232d2553b82c67f6c3ff57bf
https://github.com/grpc/grpc-java/blob/973885457f9609de232d2553b82c67f6c3ff57bf/core/src/main/java/io/grpc/internal/Http2ClientStreamTransportState.java#L163-L179
127,339
grpc/grpc-java
core/src/main/java/io/grpc/internal/Http2ClientStreamTransportState.java
Http2ClientStreamTransportState.statusFromTrailers
private Status statusFromTrailers(Metadata trailers) { Status status = trailers.get(InternalStatus.CODE_KEY); if (status != null) { return status.withDescription(trailers.get(InternalStatus.MESSAGE_KEY)); } // No status; something is broken. Try to provide a resonanable error. if (headersRecei...
java
private Status statusFromTrailers(Metadata trailers) { Status status = trailers.get(InternalStatus.CODE_KEY); if (status != null) { return status.withDescription(trailers.get(InternalStatus.MESSAGE_KEY)); } // No status; something is broken. Try to provide a resonanable error. if (headersRecei...
[ "private", "Status", "statusFromTrailers", "(", "Metadata", "trailers", ")", "{", "Status", "status", "=", "trailers", ".", "get", "(", "InternalStatus", ".", "CODE_KEY", ")", ";", "if", "(", "status", "!=", "null", ")", "{", "return", "status", ".", "with...
Extract the response status from trailers.
[ "Extract", "the", "response", "status", "from", "trailers", "." ]
973885457f9609de232d2553b82c67f6c3ff57bf
https://github.com/grpc/grpc-java/blob/973885457f9609de232d2553b82c67f6c3ff57bf/core/src/main/java/io/grpc/internal/Http2ClientStreamTransportState.java#L184-L201
127,340
grpc/grpc-java
core/src/main/java/io/grpc/internal/Http2ClientStreamTransportState.java
Http2ClientStreamTransportState.extractCharset
private static Charset extractCharset(Metadata headers) { String contentType = headers.get(GrpcUtil.CONTENT_TYPE_KEY); if (contentType != null) { String[] split = contentType.split("charset=", 2); try { return Charset.forName(split[split.length - 1].trim()); } catch (Exception t) { ...
java
private static Charset extractCharset(Metadata headers) { String contentType = headers.get(GrpcUtil.CONTENT_TYPE_KEY); if (contentType != null) { String[] split = contentType.split("charset=", 2); try { return Charset.forName(split[split.length - 1].trim()); } catch (Exception t) { ...
[ "private", "static", "Charset", "extractCharset", "(", "Metadata", "headers", ")", "{", "String", "contentType", "=", "headers", ".", "get", "(", "GrpcUtil", ".", "CONTENT_TYPE_KEY", ")", ";", "if", "(", "contentType", "!=", "null", ")", "{", "String", "[", ...
Inspect the raw metadata and figure out what charset is being used.
[ "Inspect", "the", "raw", "metadata", "and", "figure", "out", "what", "charset", "is", "being", "used", "." ]
973885457f9609de232d2553b82c67f6c3ff57bf
https://github.com/grpc/grpc-java/blob/973885457f9609de232d2553b82c67f6c3ff57bf/core/src/main/java/io/grpc/internal/Http2ClientStreamTransportState.java#L226-L237
127,341
grpc/grpc-java
core/src/main/java/io/grpc/internal/Http2ClientStreamTransportState.java
Http2ClientStreamTransportState.stripTransportDetails
private static void stripTransportDetails(Metadata metadata) { metadata.discardAll(HTTP2_STATUS); metadata.discardAll(InternalStatus.CODE_KEY); metadata.discardAll(InternalStatus.MESSAGE_KEY); }
java
private static void stripTransportDetails(Metadata metadata) { metadata.discardAll(HTTP2_STATUS); metadata.discardAll(InternalStatus.CODE_KEY); metadata.discardAll(InternalStatus.MESSAGE_KEY); }
[ "private", "static", "void", "stripTransportDetails", "(", "Metadata", "metadata", ")", "{", "metadata", ".", "discardAll", "(", "HTTP2_STATUS", ")", ";", "metadata", ".", "discardAll", "(", "InternalStatus", ".", "CODE_KEY", ")", ";", "metadata", ".", "discardA...
Strip HTTP transport implementation details so they don't leak via metadata into the application layer.
[ "Strip", "HTTP", "transport", "implementation", "details", "so", "they", "don", "t", "leak", "via", "metadata", "into", "the", "application", "layer", "." ]
973885457f9609de232d2553b82c67f6c3ff57bf
https://github.com/grpc/grpc-java/blob/973885457f9609de232d2553b82c67f6c3ff57bf/core/src/main/java/io/grpc/internal/Http2ClientStreamTransportState.java#L243-L247
127,342
grpc/grpc-java
core/src/main/java/io/grpc/internal/RetriableStream.java
RetriableStream.start
@Override public final void start(ClientStreamListener listener) { masterListener = listener; Status shutdownStatus = prestart(); if (shutdownStatus != null) { cancel(shutdownStatus); return; } class StartEntry implements BufferEntry { @Override public void runWith(Subst...
java
@Override public final void start(ClientStreamListener listener) { masterListener = listener; Status shutdownStatus = prestart(); if (shutdownStatus != null) { cancel(shutdownStatus); return; } class StartEntry implements BufferEntry { @Override public void runWith(Subst...
[ "@", "Override", "public", "final", "void", "start", "(", "ClientStreamListener", "listener", ")", "{", "masterListener", "=", "listener", ";", "Status", "shutdownStatus", "=", "prestart", "(", ")", ";", "if", "(", "shutdownStatus", "!=", "null", ")", "{", "...
Starts the first PRC attempt.
[ "Starts", "the", "first", "PRC", "attempt", "." ]
973885457f9609de232d2553b82c67f6c3ff57bf
https://github.com/grpc/grpc-java/blob/973885457f9609de232d2553b82c67f6c3ff57bf/core/src/main/java/io/grpc/internal/RetriableStream.java#L287-L337
127,343
grpc/grpc-java
core/src/main/java/io/grpc/internal/RetriableStream.java
RetriableStream.hasPotentialHedging
@GuardedBy("lock") private boolean hasPotentialHedging(State state) { return state.winningSubstream == null && state.hedgingAttemptCount < hedgingPolicy.maxAttempts && !state.hedgingFrozen; }
java
@GuardedBy("lock") private boolean hasPotentialHedging(State state) { return state.winningSubstream == null && state.hedgingAttemptCount < hedgingPolicy.maxAttempts && !state.hedgingFrozen; }
[ "@", "GuardedBy", "(", "\"lock\"", ")", "private", "boolean", "hasPotentialHedging", "(", "State", "state", ")", "{", "return", "state", ".", "winningSubstream", "==", "null", "&&", "state", ".", "hedgingAttemptCount", "<", "hedgingPolicy", ".", "maxAttempts", "...
only called when isHedging is true
[ "only", "called", "when", "isHedging", "is", "true" ]
973885457f9609de232d2553b82c67f6c3ff57bf
https://github.com/grpc/grpc-java/blob/973885457f9609de232d2553b82c67f6c3ff57bf/core/src/main/java/io/grpc/internal/RetriableStream.java#L658-L663
127,344
grpc/grpc-java
alts/src/main/java/io/grpc/alts/internal/NettyTsiHandshaker.java
NettyTsiHandshaker.getBytesToSendToPeer
void getBytesToSendToPeer(ByteBuf out) throws GeneralSecurityException { checkState(unwrapper != null, "protector already created"); try (BufUnwrapper unwrapper = this.unwrapper) { // Write as many bytes as possible into the buffer. int bytesWritten = 0; for (ByteBuffer nioBuffer : unwrapper.w...
java
void getBytesToSendToPeer(ByteBuf out) throws GeneralSecurityException { checkState(unwrapper != null, "protector already created"); try (BufUnwrapper unwrapper = this.unwrapper) { // Write as many bytes as possible into the buffer. int bytesWritten = 0; for (ByteBuffer nioBuffer : unwrapper.w...
[ "void", "getBytesToSendToPeer", "(", "ByteBuf", "out", ")", "throws", "GeneralSecurityException", "{", "checkState", "(", "unwrapper", "!=", "null", ",", "\"protector already created\"", ")", ";", "try", "(", "BufUnwrapper", "unwrapper", "=", "this", ".", "unwrapper...
Gets data that is ready to be sent to the to the remote peer. This should be called in a loop until no bytes are written to the output buffer. @param out the buffer to receive the bytes.
[ "Gets", "data", "that", "is", "ready", "to", "be", "sent", "to", "the", "to", "the", "remote", "peer", ".", "This", "should", "be", "called", "in", "a", "loop", "until", "no", "bytes", "are", "written", "to", "the", "output", "buffer", "." ]
973885457f9609de232d2553b82c67f6c3ff57bf
https://github.com/grpc/grpc-java/blob/973885457f9609de232d2553b82c67f6c3ff57bf/alts/src/main/java/io/grpc/alts/internal/NettyTsiHandshaker.java#L45-L69
127,345
grpc/grpc-java
alts/src/main/java/io/grpc/alts/internal/NettyTsiHandshaker.java
NettyTsiHandshaker.processBytesFromPeer
boolean processBytesFromPeer(ByteBuf data) throws GeneralSecurityException { checkState(unwrapper != null, "protector already created"); try (BufUnwrapper unwrapper = this.unwrapper) { int bytesRead = 0; boolean done = false; for (ByteBuffer nioBuffer : unwrapper.readableNioBuffers(data)) { ...
java
boolean processBytesFromPeer(ByteBuf data) throws GeneralSecurityException { checkState(unwrapper != null, "protector already created"); try (BufUnwrapper unwrapper = this.unwrapper) { int bytesRead = 0; boolean done = false; for (ByteBuffer nioBuffer : unwrapper.readableNioBuffers(data)) { ...
[ "boolean", "processBytesFromPeer", "(", "ByteBuf", "data", ")", "throws", "GeneralSecurityException", "{", "checkState", "(", "unwrapper", "!=", "null", ",", "\"protector already created\"", ")", ";", "try", "(", "BufUnwrapper", "unwrapper", "=", "this", ".", "unwra...
Process handshake data received from the remote peer. @return {@code true}, if the handshake has all the data it needs to process and {@code false}, if the method must be called again to complete processing.
[ "Process", "handshake", "data", "received", "from", "the", "remote", "peer", "." ]
973885457f9609de232d2553b82c67f6c3ff57bf
https://github.com/grpc/grpc-java/blob/973885457f9609de232d2553b82c67f6c3ff57bf/alts/src/main/java/io/grpc/alts/internal/NettyTsiHandshaker.java#L77-L99
127,346
grpc/grpc-java
api/src/main/java/io/grpc/ManagedChannelBuilder.java
ManagedChannelBuilder.forAddress
public static ManagedChannelBuilder<?> forAddress(String name, int port) { return ManagedChannelProvider.provider().builderForAddress(name, port); }
java
public static ManagedChannelBuilder<?> forAddress(String name, int port) { return ManagedChannelProvider.provider().builderForAddress(name, port); }
[ "public", "static", "ManagedChannelBuilder", "<", "?", ">", "forAddress", "(", "String", "name", ",", "int", "port", ")", "{", "return", "ManagedChannelProvider", ".", "provider", "(", ")", ".", "builderForAddress", "(", "name", ",", "port", ")", ";", "}" ]
Creates a channel with the target's address and port number. @see #forTarget(String) @since 1.0.0
[ "Creates", "a", "channel", "with", "the", "target", "s", "address", "and", "port", "number", "." ]
973885457f9609de232d2553b82c67f6c3ff57bf
https://github.com/grpc/grpc-java/blob/973885457f9609de232d2553b82c67f6c3ff57bf/api/src/main/java/io/grpc/ManagedChannelBuilder.java#L38-L40
127,347
grpc/grpc-java
core/src/main/java/io/grpc/internal/DnsNameResolver.java
DnsNameResolver.getNetworkAddressCacheTtlNanos
private static long getNetworkAddressCacheTtlNanos(boolean isAndroid) { if (isAndroid) { // on Android, ignore dns cache. return 0; } String cacheTtlPropertyValue = System.getProperty(NETWORKADDRESS_CACHE_TTL_PROPERTY); long cacheTtl = DEFAULT_NETWORK_CACHE_TTL_SECONDS; if (cacheTtlProp...
java
private static long getNetworkAddressCacheTtlNanos(boolean isAndroid) { if (isAndroid) { // on Android, ignore dns cache. return 0; } String cacheTtlPropertyValue = System.getProperty(NETWORKADDRESS_CACHE_TTL_PROPERTY); long cacheTtl = DEFAULT_NETWORK_CACHE_TTL_SECONDS; if (cacheTtlProp...
[ "private", "static", "long", "getNetworkAddressCacheTtlNanos", "(", "boolean", "isAndroid", ")", "{", "if", "(", "isAndroid", ")", "{", "// on Android, ignore dns cache.", "return", "0", ";", "}", "String", "cacheTtlPropertyValue", "=", "System", ".", "getProperty", ...
Returns value of network address cache ttl property if not Android environment. For android, DnsNameResolver does not cache the dns lookup result.
[ "Returns", "value", "of", "network", "address", "cache", "ttl", "property", "if", "not", "Android", "environment", ".", "For", "android", "DnsNameResolver", "does", "not", "cache", "the", "dns", "lookup", "result", "." ]
973885457f9609de232d2553b82c67f6c3ff57bf
https://github.com/grpc/grpc-java/blob/973885457f9609de232d2553b82c67f6c3ff57bf/core/src/main/java/io/grpc/internal/DnsNameResolver.java#L490-L509
127,348
grpc/grpc-java
core/src/main/java/io/grpc/internal/DnsNameResolver.java
DnsNameResolver.maybeChooseServiceConfig
@Nullable @VisibleForTesting static Map<String, ?> maybeChooseServiceConfig( Map<String, ?> choice, Random random, String hostname) { for (Entry<String, ?> entry : choice.entrySet()) { Verify.verify(SERVICE_CONFIG_CHOICE_KEYS.contains(entry.getKey()), "Bad key: %s", entry); } List<String> c...
java
@Nullable @VisibleForTesting static Map<String, ?> maybeChooseServiceConfig( Map<String, ?> choice, Random random, String hostname) { for (Entry<String, ?> entry : choice.entrySet()) { Verify.verify(SERVICE_CONFIG_CHOICE_KEYS.contains(entry.getKey()), "Bad key: %s", entry); } List<String> c...
[ "@", "Nullable", "@", "VisibleForTesting", "static", "Map", "<", "String", ",", "?", ">", "maybeChooseServiceConfig", "(", "Map", "<", "String", ",", "?", ">", "choice", ",", "Random", "random", ",", "String", "hostname", ")", "{", "for", "(", "Entry", "...
Determines if a given Service Config choice applies, and if so, returns it. @see <a href="https://github.com/grpc/proposal/blob/master/A2-service-configs-in-dns.md"> Service Config in DNS</a> @param choice The service config choice. @return The service config object or {@code null} if this choice does not apply.
[ "Determines", "if", "a", "given", "Service", "Config", "choice", "applies", "and", "if", "so", "returns", "it", "." ]
973885457f9609de232d2553b82c67f6c3ff57bf
https://github.com/grpc/grpc-java/blob/973885457f9609de232d2553b82c67f6c3ff57bf/core/src/main/java/io/grpc/internal/DnsNameResolver.java#L519-L568
127,349
grpc/grpc-java
stub/src/main/java/io/grpc/stub/MetadataUtils.java
MetadataUtils.attachHeaders
@ExperimentalApi("https://github.com/grpc/grpc-java/issues/1789") public static <T extends AbstractStub<T>> T attachHeaders(T stub, Metadata extraHeaders) { return stub.withInterceptors(newAttachHeadersInterceptor(extraHeaders)); }
java
@ExperimentalApi("https://github.com/grpc/grpc-java/issues/1789") public static <T extends AbstractStub<T>> T attachHeaders(T stub, Metadata extraHeaders) { return stub.withInterceptors(newAttachHeadersInterceptor(extraHeaders)); }
[ "@", "ExperimentalApi", "(", "\"https://github.com/grpc/grpc-java/issues/1789\"", ")", "public", "static", "<", "T", "extends", "AbstractStub", "<", "T", ">", ">", "T", "attachHeaders", "(", "T", "stub", ",", "Metadata", "extraHeaders", ")", "{", "return", "stub",...
Attaches a set of request headers to a stub. @param stub to bind the headers to. @param extraHeaders the headers to be passed by each call on the returned stub. @return an implementation of the stub with {@code extraHeaders} bound to each call.
[ "Attaches", "a", "set", "of", "request", "headers", "to", "a", "stub", "." ]
973885457f9609de232d2553b82c67f6c3ff57bf
https://github.com/grpc/grpc-java/blob/973885457f9609de232d2553b82c67f6c3ff57bf/stub/src/main/java/io/grpc/stub/MetadataUtils.java#L47-L50
127,350
grpc/grpc-java
stub/src/main/java/io/grpc/stub/MetadataUtils.java
MetadataUtils.captureMetadata
@ExperimentalApi("https://github.com/grpc/grpc-java/issues/1789") public static <T extends AbstractStub<T>> T captureMetadata( T stub, AtomicReference<Metadata> headersCapture, AtomicReference<Metadata> trailersCapture) { return stub.withInterceptors( newCaptureMetadataInterceptor(header...
java
@ExperimentalApi("https://github.com/grpc/grpc-java/issues/1789") public static <T extends AbstractStub<T>> T captureMetadata( T stub, AtomicReference<Metadata> headersCapture, AtomicReference<Metadata> trailersCapture) { return stub.withInterceptors( newCaptureMetadataInterceptor(header...
[ "@", "ExperimentalApi", "(", "\"https://github.com/grpc/grpc-java/issues/1789\"", ")", "public", "static", "<", "T", "extends", "AbstractStub", "<", "T", ">", ">", "T", "captureMetadata", "(", "T", "stub", ",", "AtomicReference", "<", "Metadata", ">", "headersCaptur...
Captures the last received metadata for a stub. Useful for testing @param stub to capture for @param headersCapture to record the last received headers @param trailersCapture to record the last received trailers @return an implementation of the stub that allows to access the last received call's headers and trailers v...
[ "Captures", "the", "last", "received", "metadata", "for", "a", "stub", ".", "Useful", "for", "testing" ]
973885457f9609de232d2553b82c67f6c3ff57bf
https://github.com/grpc/grpc-java/blob/973885457f9609de232d2553b82c67f6c3ff57bf/stub/src/main/java/io/grpc/stub/MetadataUtils.java#L102-L109
127,351
grpc/grpc-java
stub/src/main/java/io/grpc/stub/MetadataUtils.java
MetadataUtils.newCaptureMetadataInterceptor
public static ClientInterceptor newCaptureMetadataInterceptor( AtomicReference<Metadata> headersCapture, AtomicReference<Metadata> trailersCapture) { return new MetadataCapturingClientInterceptor(headersCapture, trailersCapture); }
java
public static ClientInterceptor newCaptureMetadataInterceptor( AtomicReference<Metadata> headersCapture, AtomicReference<Metadata> trailersCapture) { return new MetadataCapturingClientInterceptor(headersCapture, trailersCapture); }
[ "public", "static", "ClientInterceptor", "newCaptureMetadataInterceptor", "(", "AtomicReference", "<", "Metadata", ">", "headersCapture", ",", "AtomicReference", "<", "Metadata", ">", "trailersCapture", ")", "{", "return", "new", "MetadataCapturingClientInterceptor", "(", ...
Captures the last received metadata on a channel. Useful for testing. @param headersCapture to record the last received headers @param trailersCapture to record the last received trailers @return an implementation of the channel with captures installed.
[ "Captures", "the", "last", "received", "metadata", "on", "a", "channel", ".", "Useful", "for", "testing", "." ]
973885457f9609de232d2553b82c67f6c3ff57bf
https://github.com/grpc/grpc-java/blob/973885457f9609de232d2553b82c67f6c3ff57bf/stub/src/main/java/io/grpc/stub/MetadataUtils.java#L118-L121
127,352
grpc/grpc-java
okhttp/src/main/java/io/grpc/okhttp/OkHttpWritableBufferAllocator.java
OkHttpWritableBufferAllocator.allocate
@Override public WritableBuffer allocate(int capacityHint) { capacityHint = Math.min(MAX_BUFFER, Math.max(MIN_BUFFER, capacityHint)); return new OkHttpWritableBuffer(new Buffer(), capacityHint); }
java
@Override public WritableBuffer allocate(int capacityHint) { capacityHint = Math.min(MAX_BUFFER, Math.max(MIN_BUFFER, capacityHint)); return new OkHttpWritableBuffer(new Buffer(), capacityHint); }
[ "@", "Override", "public", "WritableBuffer", "allocate", "(", "int", "capacityHint", ")", "{", "capacityHint", "=", "Math", ".", "min", "(", "MAX_BUFFER", ",", "Math", ".", "max", "(", "MIN_BUFFER", ",", "capacityHint", ")", ")", ";", "return", "new", "OkH...
For OkHttp we will often return a buffer smaller than the requested capacity as this is the mechanism for chunking a large GRPC message over many DATA frames.
[ "For", "OkHttp", "we", "will", "often", "return", "a", "buffer", "smaller", "than", "the", "requested", "capacity", "as", "this", "is", "the", "mechanism", "for", "chunking", "a", "large", "GRPC", "message", "over", "many", "DATA", "frames", "." ]
973885457f9609de232d2553b82c67f6c3ff57bf
https://github.com/grpc/grpc-java/blob/973885457f9609de232d2553b82c67f6c3ff57bf/okhttp/src/main/java/io/grpc/okhttp/OkHttpWritableBufferAllocator.java#L46-L50
127,353
grpc/grpc-java
netty/src/main/java/io/grpc/netty/NettyServerHandler.java
NettyServerHandler.returnProcessedBytes
void returnProcessedBytes(Http2Stream http2Stream, int bytes) { try { decoder().flowController().consumeBytes(http2Stream, bytes); } catch (Http2Exception e) { throw new RuntimeException(e); } }
java
void returnProcessedBytes(Http2Stream http2Stream, int bytes) { try { decoder().flowController().consumeBytes(http2Stream, bytes); } catch (Http2Exception e) { throw new RuntimeException(e); } }
[ "void", "returnProcessedBytes", "(", "Http2Stream", "http2Stream", ",", "int", "bytes", ")", "{", "try", "{", "decoder", "(", ")", ".", "flowController", "(", ")", ".", "consumeBytes", "(", "http2Stream", ",", "bytes", ")", ";", "}", "catch", "(", "Http2Ex...
Returns the given processed bytes back to inbound flow control.
[ "Returns", "the", "given", "processed", "bytes", "back", "to", "inbound", "flow", "control", "." ]
973885457f9609de232d2553b82c67f6c3ff57bf
https://github.com/grpc/grpc-java/blob/973885457f9609de232d2553b82c67f6c3ff57bf/netty/src/main/java/io/grpc/netty/NettyServerHandler.java#L603-L609
127,354
grpc/grpc-java
netty/src/main/java/io/grpc/netty/NettyServerHandler.java
NettyServerHandler.sendGrpcFrame
private void sendGrpcFrame(ChannelHandlerContext ctx, SendGrpcFrameCommand cmd, ChannelPromise promise) throws Http2Exception { if (cmd.endStream()) { closeStreamWhenDone(promise, cmd.streamId()); } // Call the base class to write the HTTP/2 DATA frame. encoder().writeData(ctx, cmd.streamId(...
java
private void sendGrpcFrame(ChannelHandlerContext ctx, SendGrpcFrameCommand cmd, ChannelPromise promise) throws Http2Exception { if (cmd.endStream()) { closeStreamWhenDone(promise, cmd.streamId()); } // Call the base class to write the HTTP/2 DATA frame. encoder().writeData(ctx, cmd.streamId(...
[ "private", "void", "sendGrpcFrame", "(", "ChannelHandlerContext", "ctx", ",", "SendGrpcFrameCommand", "cmd", ",", "ChannelPromise", "promise", ")", "throws", "Http2Exception", "{", "if", "(", "cmd", ".", "endStream", "(", ")", ")", "{", "closeStreamWhenDone", "(",...
Sends the given gRPC frame to the client.
[ "Sends", "the", "given", "gRPC", "frame", "to", "the", "client", "." ]
973885457f9609de232d2553b82c67f6c3ff57bf
https://github.com/grpc/grpc-java/blob/973885457f9609de232d2553b82c67f6c3ff57bf/netty/src/main/java/io/grpc/netty/NettyServerHandler.java#L624-L631
127,355
grpc/grpc-java
netty/src/main/java/io/grpc/netty/NettyServerHandler.java
NettyServerHandler.sendResponseHeaders
private void sendResponseHeaders(ChannelHandlerContext ctx, SendResponseHeadersCommand cmd, ChannelPromise promise) throws Http2Exception { // TODO(carl-mastrangelo): remove this check once https://github.com/netty/netty/issues/6296 is // fixed. int streamId = cmd.stream().id(); Http2Stream stream...
java
private void sendResponseHeaders(ChannelHandlerContext ctx, SendResponseHeadersCommand cmd, ChannelPromise promise) throws Http2Exception { // TODO(carl-mastrangelo): remove this check once https://github.com/netty/netty/issues/6296 is // fixed. int streamId = cmd.stream().id(); Http2Stream stream...
[ "private", "void", "sendResponseHeaders", "(", "ChannelHandlerContext", "ctx", ",", "SendResponseHeadersCommand", "cmd", ",", "ChannelPromise", "promise", ")", "throws", "Http2Exception", "{", "// TODO(carl-mastrangelo): remove this check once https://github.com/netty/netty/issues/62...
Sends the response headers to the client.
[ "Sends", "the", "response", "headers", "to", "the", "client", "." ]
973885457f9609de232d2553b82c67f6c3ff57bf
https://github.com/grpc/grpc-java/blob/973885457f9609de232d2553b82c67f6c3ff57bf/netty/src/main/java/io/grpc/netty/NettyServerHandler.java#L636-L650
127,356
grpc/grpc-java
okhttp/third_party/okhttp/main/java/io/grpc/okhttp/internal/DistinguishedNameParser.java
DistinguishedNameParser.getEscaped
private char getEscaped() { pos++; if (pos == length) { throw new IllegalStateException("Unexpected end of DN: " + dn); } switch (chars[pos]) { case '"': case '\\': case ',': case '=': case '+': case '<': case '>': case '#': case ';': ca...
java
private char getEscaped() { pos++; if (pos == length) { throw new IllegalStateException("Unexpected end of DN: " + dn); } switch (chars[pos]) { case '"': case '\\': case ',': case '=': case '+': case '<': case '>': case '#': case ';': ca...
[ "private", "char", "getEscaped", "(", ")", "{", "pos", "++", ";", "if", "(", "pos", "==", "length", ")", "{", "throw", "new", "IllegalStateException", "(", "\"Unexpected end of DN: \"", "+", "dn", ")", ";", "}", "switch", "(", "chars", "[", "pos", "]", ...
returns escaped char
[ "returns", "escaped", "char" ]
973885457f9609de232d2553b82c67f6c3ff57bf
https://github.com/grpc/grpc-java/blob/973885457f9609de232d2553b82c67f6c3ff57bf/okhttp/third_party/okhttp/main/java/io/grpc/okhttp/internal/DistinguishedNameParser.java#L236-L263
127,357
grpc/grpc-java
okhttp/third_party/okhttp/main/java/io/grpc/okhttp/internal/DistinguishedNameParser.java
DistinguishedNameParser.findMostSpecific
public String findMostSpecific(String attributeType) { // Initialize internal state. pos = 0; beg = 0; end = 0; cur = 0; chars = dn.toCharArray(); String attType = nextAT(); if (attType == null) { return null; } while (true) { String attValue = ""; if (pos == ...
java
public String findMostSpecific(String attributeType) { // Initialize internal state. pos = 0; beg = 0; end = 0; cur = 0; chars = dn.toCharArray(); String attType = nextAT(); if (attType == null) { return null; } while (true) { String attValue = ""; if (pos == ...
[ "public", "String", "findMostSpecific", "(", "String", "attributeType", ")", "{", "// Initialize internal state.", "pos", "=", "0", ";", "beg", "=", "0", ";", "end", "=", "0", ";", "cur", "=", "0", ";", "chars", "=", "dn", ".", "toCharArray", "(", ")", ...
Parses the DN and returns the most significant attribute value for an attribute type, or null if none found. @param attributeType attribute type to look for (e.g. "ca")
[ "Parses", "the", "DN", "and", "returns", "the", "most", "significant", "attribute", "value", "for", "an", "attribute", "type", "or", "null", "if", "none", "found", "." ]
973885457f9609de232d2553b82c67f6c3ff57bf
https://github.com/grpc/grpc-java/blob/973885457f9609de232d2553b82c67f6c3ff57bf/okhttp/third_party/okhttp/main/java/io/grpc/okhttp/internal/DistinguishedNameParser.java#L353-L410
127,358
grpc/grpc-java
benchmarks/src/main/java/io/grpc/benchmarks/qps/OpenLoopClient.java
OpenLoopClient.main
public static void main(String... args) throws Exception { ClientConfiguration.Builder configBuilder = ClientConfiguration.newBuilder( ADDRESS, TARGET_QPS, CLIENT_PAYLOAD, SERVER_PAYLOAD, TLS, TESTCA, TRANSPORT, DURATION, SAVE_HISTOGRAM, FLOW_CONTROL_WINDOW); ClientConfiguration config; try ...
java
public static void main(String... args) throws Exception { ClientConfiguration.Builder configBuilder = ClientConfiguration.newBuilder( ADDRESS, TARGET_QPS, CLIENT_PAYLOAD, SERVER_PAYLOAD, TLS, TESTCA, TRANSPORT, DURATION, SAVE_HISTOGRAM, FLOW_CONTROL_WINDOW); ClientConfiguration config; try ...
[ "public", "static", "void", "main", "(", "String", "...", "args", ")", "throws", "Exception", "{", "ClientConfiguration", ".", "Builder", "configBuilder", "=", "ClientConfiguration", ".", "newBuilder", "(", "ADDRESS", ",", "TARGET_QPS", ",", "CLIENT_PAYLOAD", ",",...
Comment for checkstyle.
[ "Comment", "for", "checkstyle", "." ]
973885457f9609de232d2553b82c67f6c3ff57bf
https://github.com/grpc/grpc-java/blob/973885457f9609de232d2553b82c67f6c3ff57bf/benchmarks/src/main/java/io/grpc/benchmarks/qps/OpenLoopClient.java#L65-L79
127,359
grpc/grpc-java
benchmarks/src/main/java/io/grpc/benchmarks/qps/OpenLoopClient.java
OpenLoopClient.run
public void run() throws Exception { if (config == null) { return; } config.channels = 1; config.directExecutor = true; ManagedChannel ch = config.newChannel(); SimpleRequest req = config.newRequest(); LoadGenerationWorker worker = new LoadGenerationWorker(ch, req, config.targe...
java
public void run() throws Exception { if (config == null) { return; } config.channels = 1; config.directExecutor = true; ManagedChannel ch = config.newChannel(); SimpleRequest req = config.newRequest(); LoadGenerationWorker worker = new LoadGenerationWorker(ch, req, config.targe...
[ "public", "void", "run", "(", ")", "throws", "Exception", "{", "if", "(", "config", "==", "null", ")", "{", "return", ";", "}", "config", ".", "channels", "=", "1", ";", "config", ".", "directExecutor", "=", "true", ";", "ManagedChannel", "ch", "=", ...
Start the open loop client.
[ "Start", "the", "open", "loop", "client", "." ]
973885457f9609de232d2553b82c67f6c3ff57bf
https://github.com/grpc/grpc-java/blob/973885457f9609de232d2553b82c67f6c3ff57bf/benchmarks/src/main/java/io/grpc/benchmarks/qps/OpenLoopClient.java#L84-L102
127,360
grpc/grpc-java
okhttp/third_party/okhttp/main/java/io/grpc/okhttp/internal/Platform.java
Platform.getAppEngineProvider
private static Provider getAppEngineProvider() { try { // Forcibly load conscrypt as it is unlikely to be an installed provider on AppEngine return (Provider) Class.forName("org.conscrypt.OpenSSLProvider") .getConstructor().newInstance(); } catch (Throwable t) { throw new RuntimeExce...
java
private static Provider getAppEngineProvider() { try { // Forcibly load conscrypt as it is unlikely to be an installed provider on AppEngine return (Provider) Class.forName("org.conscrypt.OpenSSLProvider") .getConstructor().newInstance(); } catch (Throwable t) { throw new RuntimeExce...
[ "private", "static", "Provider", "getAppEngineProvider", "(", ")", "{", "try", "{", "// Forcibly load conscrypt as it is unlikely to be an installed provider on AppEngine", "return", "(", "Provider", ")", "Class", ".", "forName", "(", "\"org.conscrypt.OpenSSLProvider\"", ")", ...
Forcibly load the conscrypt security provider on AppEngine if it's available. If not fail.
[ "Forcibly", "load", "the", "conscrypt", "security", "provider", "on", "AppEngine", "if", "it", "s", "available", ".", "If", "not", "fail", "." ]
973885457f9609de232d2553b82c67f6c3ff57bf
https://github.com/grpc/grpc-java/blob/973885457f9609de232d2553b82c67f6c3ff57bf/okhttp/third_party/okhttp/main/java/io/grpc/okhttp/internal/Platform.java#L305-L313
127,361
grpc/grpc-java
core/src/main/java/io/grpc/internal/GrpcUtil.java
GrpcUtil.isGrpcContentType
public static boolean isGrpcContentType(String contentType) { if (contentType == null) { return false; } if (CONTENT_TYPE_GRPC.length() > contentType.length()) { return false; } contentType = contentType.toLowerCase(); if (!contentType.startsWith(CONTENT_TYPE_GRPC)) { // Not ...
java
public static boolean isGrpcContentType(String contentType) { if (contentType == null) { return false; } if (CONTENT_TYPE_GRPC.length() > contentType.length()) { return false; } contentType = contentType.toLowerCase(); if (!contentType.startsWith(CONTENT_TYPE_GRPC)) { // Not ...
[ "public", "static", "boolean", "isGrpcContentType", "(", "String", "contentType", ")", "{", "if", "(", "contentType", "==", "null", ")", "{", "return", "false", ";", "}", "if", "(", "CONTENT_TYPE_GRPC", ".", "length", "(", ")", ">", "contentType", ".", "le...
Indicates whether or not the given value is a valid gRPC content-type.
[ "Indicates", "whether", "or", "not", "the", "given", "value", "is", "a", "valid", "gRPC", "content", "-", "type", "." ]
973885457f9609de232d2553b82c67f6c3ff57bf
https://github.com/grpc/grpc-java/blob/973885457f9609de232d2553b82c67f6c3ff57bf/core/src/main/java/io/grpc/internal/GrpcUtil.java#L425-L450
127,362
grpc/grpc-java
core/src/main/java/io/grpc/internal/GrpcUtil.java
GrpcUtil.authorityToUri
public static URI authorityToUri(String authority) { Preconditions.checkNotNull(authority, "authority"); URI uri; try { uri = new URI(null, authority, null, null, null); } catch (URISyntaxException ex) { throw new IllegalArgumentException("Invalid authority: " + authority, ex); } ret...
java
public static URI authorityToUri(String authority) { Preconditions.checkNotNull(authority, "authority"); URI uri; try { uri = new URI(null, authority, null, null, null); } catch (URISyntaxException ex) { throw new IllegalArgumentException("Invalid authority: " + authority, ex); } ret...
[ "public", "static", "URI", "authorityToUri", "(", "String", "authority", ")", "{", "Preconditions", ".", "checkNotNull", "(", "authority", ",", "\"authority\"", ")", ";", "URI", "uri", ";", "try", "{", "uri", "=", "new", "URI", "(", "null", ",", "authority...
Parse an authority into a URI for retrieving the host and port.
[ "Parse", "an", "authority", "into", "a", "URI", "for", "retrieving", "the", "host", "and", "port", "." ]
973885457f9609de232d2553b82c67f6c3ff57bf
https://github.com/grpc/grpc-java/blob/973885457f9609de232d2553b82c67f6c3ff57bf/core/src/main/java/io/grpc/internal/GrpcUtil.java#L472-L481
127,363
grpc/grpc-java
core/src/main/java/io/grpc/internal/GrpcUtil.java
GrpcUtil.authorityFromHostAndPort
public static String authorityFromHostAndPort(String host, int port) { try { return new URI(null, null, host, port, null, null, null).getAuthority(); } catch (URISyntaxException ex) { throw new IllegalArgumentException("Invalid host or port: " + host + " " + port, ex); } }
java
public static String authorityFromHostAndPort(String host, int port) { try { return new URI(null, null, host, port, null, null, null).getAuthority(); } catch (URISyntaxException ex) { throw new IllegalArgumentException("Invalid host or port: " + host + " " + port, ex); } }
[ "public", "static", "String", "authorityFromHostAndPort", "(", "String", "host", ",", "int", "port", ")", "{", "try", "{", "return", "new", "URI", "(", "null", ",", "null", ",", "host", ",", "port", ",", "null", ",", "null", ",", "null", ")", ".", "g...
Combine a host and port into an authority string.
[ "Combine", "a", "host", "and", "port", "into", "an", "authority", "string", "." ]
973885457f9609de232d2553b82c67f6c3ff57bf
https://github.com/grpc/grpc-java/blob/973885457f9609de232d2553b82c67f6c3ff57bf/core/src/main/java/io/grpc/internal/GrpcUtil.java#L500-L506
127,364
grpc/grpc-java
core/src/main/java/io/grpc/internal/GrpcUtil.java
GrpcUtil.closeQuietly
static void closeQuietly(MessageProducer producer) { InputStream message; while ((message = producer.next()) != null) { closeQuietly(message); } }
java
static void closeQuietly(MessageProducer producer) { InputStream message; while ((message = producer.next()) != null) { closeQuietly(message); } }
[ "static", "void", "closeQuietly", "(", "MessageProducer", "producer", ")", "{", "InputStream", "message", ";", "while", "(", "(", "message", "=", "producer", ".", "next", "(", ")", ")", "!=", "null", ")", "{", "closeQuietly", "(", "message", ")", ";", "}...
Quietly closes all messages in MessageProducer.
[ "Quietly", "closes", "all", "messages", "in", "MessageProducer", "." ]
973885457f9609de232d2553b82c67f6c3ff57bf
https://github.com/grpc/grpc-java/blob/973885457f9609de232d2553b82c67f6c3ff57bf/core/src/main/java/io/grpc/internal/GrpcUtil.java#L737-L742
127,365
grpc/grpc-java
auth/src/main/java/io/grpc/auth/ClientAuthInterceptor.java
ClientAuthInterceptor.serviceUri
private URI serviceUri(Channel channel, MethodDescriptor<?, ?> method) throws StatusException { String authority = channel.authority(); if (authority == null) { throw Status.UNAUTHENTICATED.withDescription("Channel has no authority").asException(); } // Always use HTTPS, by definition. final S...
java
private URI serviceUri(Channel channel, MethodDescriptor<?, ?> method) throws StatusException { String authority = channel.authority(); if (authority == null) { throw Status.UNAUTHENTICATED.withDescription("Channel has no authority").asException(); } // Always use HTTPS, by definition. final S...
[ "private", "URI", "serviceUri", "(", "Channel", "channel", ",", "MethodDescriptor", "<", "?", ",", "?", ">", "method", ")", "throws", "StatusException", "{", "String", "authority", "=", "channel", ".", "authority", "(", ")", ";", "if", "(", "authority", "=...
Generate a JWT-specific service URI. The URI is simply an identifier with enough information for a service to know that the JWT was intended for it. The URI will commonly be verified with a simple string equality check.
[ "Generate", "a", "JWT", "-", "specific", "service", "URI", ".", "The", "URI", "is", "simply", "an", "identifier", "with", "enough", "information", "for", "a", "service", "to", "know", "that", "the", "JWT", "was", "intended", "for", "it", ".", "The", "URI...
973885457f9609de232d2553b82c67f6c3ff57bf
https://github.com/grpc/grpc-java/blob/973885457f9609de232d2553b82c67f6c3ff57bf/auth/src/main/java/io/grpc/auth/ClientAuthInterceptor.java#L97-L118
127,366
grpc/grpc-java
benchmarks/src/jmh/java/io/grpc/benchmarks/netty/HandlerRegistryBenchmark.java
HandlerRegistryBenchmark.setup
@Setup(Level.Trial) public void setup() throws Exception { registry = new MutableHandlerRegistry(); fullMethodNames = new ArrayList<>(serviceCount * methodCountPerService); for (int serviceIndex = 0; serviceIndex < serviceCount; ++serviceIndex) { String serviceName = randomString(); ServerServ...
java
@Setup(Level.Trial) public void setup() throws Exception { registry = new MutableHandlerRegistry(); fullMethodNames = new ArrayList<>(serviceCount * methodCountPerService); for (int serviceIndex = 0; serviceIndex < serviceCount; ++serviceIndex) { String serviceName = randomString(); ServerServ...
[ "@", "Setup", "(", "Level", ".", "Trial", ")", "public", "void", "setup", "(", ")", "throws", "Exception", "{", "registry", "=", "new", "MutableHandlerRegistry", "(", ")", ";", "fullMethodNames", "=", "new", "ArrayList", "<>", "(", "serviceCount", "*", "me...
Set up the registry.
[ "Set", "up", "the", "registry", "." ]
973885457f9609de232d2553b82c67f6c3ff57bf
https://github.com/grpc/grpc-java/blob/973885457f9609de232d2553b82c67f6c3ff57bf/benchmarks/src/jmh/java/io/grpc/benchmarks/netty/HandlerRegistryBenchmark.java#L64-L92
127,367
grpc/grpc-java
core/src/main/java/io/grpc/internal/ServiceConfigUtil.java
ServiceConfigUtil.getTimeoutFromMethodConfig
@Nullable static Long getTimeoutFromMethodConfig(Map<String, ?> methodConfig) { if (!methodConfig.containsKey(METHOD_CONFIG_TIMEOUT_KEY)) { return null; } String rawTimeout = getString(methodConfig, METHOD_CONFIG_TIMEOUT_KEY); try { return parseDuration(rawTimeout); } catch (ParseExcep...
java
@Nullable static Long getTimeoutFromMethodConfig(Map<String, ?> methodConfig) { if (!methodConfig.containsKey(METHOD_CONFIG_TIMEOUT_KEY)) { return null; } String rawTimeout = getString(methodConfig, METHOD_CONFIG_TIMEOUT_KEY); try { return parseDuration(rawTimeout); } catch (ParseExcep...
[ "@", "Nullable", "static", "Long", "getTimeoutFromMethodConfig", "(", "Map", "<", "String", ",", "?", ">", "methodConfig", ")", "{", "if", "(", "!", "methodConfig", ".", "containsKey", "(", "METHOD_CONFIG_TIMEOUT_KEY", ")", ")", "{", "return", "null", ";", "...
Returns the number of nanoseconds of timeout for the given method config. @return duration nanoseconds, or {@code null} if it isn't present.
[ "Returns", "the", "number", "of", "nanoseconds", "of", "timeout", "for", "the", "given", "method", "config", "." ]
973885457f9609de232d2553b82c67f6c3ff57bf
https://github.com/grpc/grpc-java/blob/973885457f9609de232d2553b82c67f6c3ff57bf/core/src/main/java/io/grpc/internal/ServiceConfigUtil.java#L262-L273
127,368
grpc/grpc-java
core/src/main/java/io/grpc/internal/ServiceConfigUtil.java
ServiceConfigUtil.getLoadBalancingConfigsFromServiceConfig
@SuppressWarnings("unchecked") @VisibleForTesting public static List<Map<String, ?>> getLoadBalancingConfigsFromServiceConfig( Map<String, ?> serviceConfig) { /* schema as follows { "loadBalancingConfig": [ {"xds" : { "balancerName": "balancer1", "childP...
java
@SuppressWarnings("unchecked") @VisibleForTesting public static List<Map<String, ?>> getLoadBalancingConfigsFromServiceConfig( Map<String, ?> serviceConfig) { /* schema as follows { "loadBalancingConfig": [ {"xds" : { "balancerName": "balancer1", "childP...
[ "@", "SuppressWarnings", "(", "\"unchecked\"", ")", "@", "VisibleForTesting", "public", "static", "List", "<", "Map", "<", "String", ",", "?", ">", ">", "getLoadBalancingConfigsFromServiceConfig", "(", "Map", "<", "String", ",", "?", ">", "serviceConfig", ")", ...
Extracts load balancing configs from a service config.
[ "Extracts", "load", "balancing", "configs", "from", "a", "service", "config", "." ]
973885457f9609de232d2553b82c67f6c3ff57bf
https://github.com/grpc/grpc-java/blob/973885457f9609de232d2553b82c67f6c3ff57bf/core/src/main/java/io/grpc/internal/ServiceConfigUtil.java#L311-L349
127,369
grpc/grpc-java
core/src/main/java/io/grpc/internal/ServiceConfigUtil.java
ServiceConfigUtil.unwrapLoadBalancingConfigList
@SuppressWarnings("unchecked") public static List<LbConfig> unwrapLoadBalancingConfigList(List<Map<String, ?>> list) { ArrayList<LbConfig> result = new ArrayList<>(); for (Map<String, ?> rawChildPolicy : list) { result.add(unwrapLoadBalancingConfig(rawChildPolicy)); } return Collections.unmodifi...
java
@SuppressWarnings("unchecked") public static List<LbConfig> unwrapLoadBalancingConfigList(List<Map<String, ?>> list) { ArrayList<LbConfig> result = new ArrayList<>(); for (Map<String, ?> rawChildPolicy : list) { result.add(unwrapLoadBalancingConfig(rawChildPolicy)); } return Collections.unmodifi...
[ "@", "SuppressWarnings", "(", "\"unchecked\"", ")", "public", "static", "List", "<", "LbConfig", ">", "unwrapLoadBalancingConfigList", "(", "List", "<", "Map", "<", "String", ",", "?", ">", ">", "list", ")", "{", "ArrayList", "<", "LbConfig", ">", "result", ...
Given a JSON list of LoadBalancingConfigs, and convert it into a list of LbConfig.
[ "Given", "a", "JSON", "list", "of", "LoadBalancingConfigs", "and", "convert", "it", "into", "a", "list", "of", "LbConfig", "." ]
973885457f9609de232d2553b82c67f6c3ff57bf
https://github.com/grpc/grpc-java/blob/973885457f9609de232d2553b82c67f6c3ff57bf/core/src/main/java/io/grpc/internal/ServiceConfigUtil.java#L370-L377
127,370
grpc/grpc-java
core/src/main/java/io/grpc/internal/ServiceConfigUtil.java
ServiceConfigUtil.getBalancerNameFromXdsConfig
public static String getBalancerNameFromXdsConfig(LbConfig xdsConfig) { Map<String, ?> map = xdsConfig.getRawConfigValue(); return getString(map, XDS_CONFIG_BALANCER_NAME_KEY); }
java
public static String getBalancerNameFromXdsConfig(LbConfig xdsConfig) { Map<String, ?> map = xdsConfig.getRawConfigValue(); return getString(map, XDS_CONFIG_BALANCER_NAME_KEY); }
[ "public", "static", "String", "getBalancerNameFromXdsConfig", "(", "LbConfig", "xdsConfig", ")", "{", "Map", "<", "String", ",", "?", ">", "map", "=", "xdsConfig", ".", "getRawConfigValue", "(", ")", ";", "return", "getString", "(", "map", ",", "XDS_CONFIG_BAL...
Extracts the loadbalancer name from xds loadbalancer config.
[ "Extracts", "the", "loadbalancer", "name", "from", "xds", "loadbalancer", "config", "." ]
973885457f9609de232d2553b82c67f6c3ff57bf
https://github.com/grpc/grpc-java/blob/973885457f9609de232d2553b82c67f6c3ff57bf/core/src/main/java/io/grpc/internal/ServiceConfigUtil.java#L382-L385
127,371
grpc/grpc-java
core/src/main/java/io/grpc/internal/ServiceConfigUtil.java
ServiceConfigUtil.getChildPolicyFromXdsConfig
@Nullable public static List<LbConfig> getChildPolicyFromXdsConfig(LbConfig xdsConfig) { Map<String, ?> map = xdsConfig.getRawConfigValue(); List<?> rawChildPolicies = getList(map, XDS_CONFIG_CHILD_POLICY_KEY); if (rawChildPolicies != null) { return unwrapLoadBalancingConfigList(checkObjectList(rawC...
java
@Nullable public static List<LbConfig> getChildPolicyFromXdsConfig(LbConfig xdsConfig) { Map<String, ?> map = xdsConfig.getRawConfigValue(); List<?> rawChildPolicies = getList(map, XDS_CONFIG_CHILD_POLICY_KEY); if (rawChildPolicies != null) { return unwrapLoadBalancingConfigList(checkObjectList(rawC...
[ "@", "Nullable", "public", "static", "List", "<", "LbConfig", ">", "getChildPolicyFromXdsConfig", "(", "LbConfig", "xdsConfig", ")", "{", "Map", "<", "String", ",", "?", ">", "map", "=", "xdsConfig", ".", "getRawConfigValue", "(", ")", ";", "List", "<", "?...
Extracts list of child policies from xds loadbalancer config.
[ "Extracts", "list", "of", "child", "policies", "from", "xds", "loadbalancer", "config", "." ]
973885457f9609de232d2553b82c67f6c3ff57bf
https://github.com/grpc/grpc-java/blob/973885457f9609de232d2553b82c67f6c3ff57bf/core/src/main/java/io/grpc/internal/ServiceConfigUtil.java#L390-L398
127,372
grpc/grpc-java
core/src/main/java/io/grpc/internal/ServiceConfigUtil.java
ServiceConfigUtil.getFallbackPolicyFromXdsConfig
@Nullable public static List<LbConfig> getFallbackPolicyFromXdsConfig(LbConfig xdsConfig) { Map<String, ?> map = xdsConfig.getRawConfigValue(); List<?> rawFallbackPolicies = getList(map, XDS_CONFIG_FALLBACK_POLICY_KEY); if (rawFallbackPolicies != null) { return unwrapLoadBalancingConfigList(checkObj...
java
@Nullable public static List<LbConfig> getFallbackPolicyFromXdsConfig(LbConfig xdsConfig) { Map<String, ?> map = xdsConfig.getRawConfigValue(); List<?> rawFallbackPolicies = getList(map, XDS_CONFIG_FALLBACK_POLICY_KEY); if (rawFallbackPolicies != null) { return unwrapLoadBalancingConfigList(checkObj...
[ "@", "Nullable", "public", "static", "List", "<", "LbConfig", ">", "getFallbackPolicyFromXdsConfig", "(", "LbConfig", "xdsConfig", ")", "{", "Map", "<", "String", ",", "?", ">", "map", "=", "xdsConfig", ".", "getRawConfigValue", "(", ")", ";", "List", "<", ...
Extracts list of fallback policies from xds loadbalancer config.
[ "Extracts", "list", "of", "fallback", "policies", "from", "xds", "loadbalancer", "config", "." ]
973885457f9609de232d2553b82c67f6c3ff57bf
https://github.com/grpc/grpc-java/blob/973885457f9609de232d2553b82c67f6c3ff57bf/core/src/main/java/io/grpc/internal/ServiceConfigUtil.java#L403-L411
127,373
grpc/grpc-java
core/src/main/java/io/grpc/internal/ServiceConfigUtil.java
ServiceConfigUtil.getList
@SuppressWarnings("unchecked") @Nullable static List<?> getList(Map<String, ?> obj, String key) { assert key != null; if (!obj.containsKey(key)) { return null; } Object value = obj.get(key); if (!(value instanceof List)) { throw new ClassCastException( String.format("value ...
java
@SuppressWarnings("unchecked") @Nullable static List<?> getList(Map<String, ?> obj, String key) { assert key != null; if (!obj.containsKey(key)) { return null; } Object value = obj.get(key); if (!(value instanceof List)) { throw new ClassCastException( String.format("value ...
[ "@", "SuppressWarnings", "(", "\"unchecked\"", ")", "@", "Nullable", "static", "List", "<", "?", ">", "getList", "(", "Map", "<", "String", ",", "?", ">", "obj", ",", "String", "key", ")", "{", "assert", "key", "!=", "null", ";", "if", "(", "!", "o...
Gets a list from an object for the given key. If the key is not present, this returns null. If the value is not a List, throws an exception.
[ "Gets", "a", "list", "from", "an", "object", "for", "the", "given", "key", ".", "If", "the", "key", "is", "not", "present", "this", "returns", "null", ".", "If", "the", "value", "is", "not", "a", "List", "throws", "an", "exception", "." ]
973885457f9609de232d2553b82c67f6c3ff57bf
https://github.com/grpc/grpc-java/blob/973885457f9609de232d2553b82c67f6c3ff57bf/core/src/main/java/io/grpc/internal/ServiceConfigUtil.java#L429-L442
127,374
grpc/grpc-java
netty/src/main/java/io/grpc/netty/JettyTlsUtil.java
JettyTlsUtil.isJettyAlpnConfigured
static synchronized boolean isJettyAlpnConfigured() { try { Class.forName("org.eclipse.jetty.alpn.ALPN", true, null); return true; } catch (ClassNotFoundException e) { jettyAlpnUnavailabilityCause = e; return false; } }
java
static synchronized boolean isJettyAlpnConfigured() { try { Class.forName("org.eclipse.jetty.alpn.ALPN", true, null); return true; } catch (ClassNotFoundException e) { jettyAlpnUnavailabilityCause = e; return false; } }
[ "static", "synchronized", "boolean", "isJettyAlpnConfigured", "(", ")", "{", "try", "{", "Class", ".", "forName", "(", "\"org.eclipse.jetty.alpn.ALPN\"", ",", "true", ",", "null", ")", ";", "return", "true", ";", "}", "catch", "(", "ClassNotFoundException", "e",...
Indicates whether or not the Jetty ALPN jar is installed in the boot classloader.
[ "Indicates", "whether", "or", "not", "the", "Jetty", "ALPN", "jar", "is", "installed", "in", "the", "boot", "classloader", "." ]
973885457f9609de232d2553b82c67f6c3ff57bf
https://github.com/grpc/grpc-java/blob/973885457f9609de232d2553b82c67f6c3ff57bf/netty/src/main/java/io/grpc/netty/JettyTlsUtil.java#L62-L70
127,375
grpc/grpc-java
netty/src/main/java/io/grpc/netty/JettyTlsUtil.java
JettyTlsUtil.isJettyNpnConfigured
static synchronized boolean isJettyNpnConfigured() { try { Class.forName("org.eclipse.jetty.npn.NextProtoNego", true, null); return true; } catch (ClassNotFoundException e) { jettyNpnUnavailabilityCause = e; return false; } }
java
static synchronized boolean isJettyNpnConfigured() { try { Class.forName("org.eclipse.jetty.npn.NextProtoNego", true, null); return true; } catch (ClassNotFoundException e) { jettyNpnUnavailabilityCause = e; return false; } }
[ "static", "synchronized", "boolean", "isJettyNpnConfigured", "(", ")", "{", "try", "{", "Class", ".", "forName", "(", "\"org.eclipse.jetty.npn.NextProtoNego\"", ",", "true", ",", "null", ")", ";", "return", "true", ";", "}", "catch", "(", "ClassNotFoundException",...
Indicates whether or not the Jetty NPN jar is installed in the boot classloader.
[ "Indicates", "whether", "or", "not", "the", "Jetty", "NPN", "jar", "is", "installed", "in", "the", "boot", "classloader", "." ]
973885457f9609de232d2553b82c67f6c3ff57bf
https://github.com/grpc/grpc-java/blob/973885457f9609de232d2553b82c67f6c3ff57bf/netty/src/main/java/io/grpc/netty/JettyTlsUtil.java#L83-L91
127,376
grpc/grpc-java
api/src/main/java/io/grpc/SynchronizationContext.java
SynchronizationContext.drain
public final void drain() { do { if (!drainingThread.compareAndSet(null, Thread.currentThread())) { return; } try { Runnable runnable; while ((runnable = queue.poll()) != null) { try { runnable.run(); } catch (Throwable t) { uncau...
java
public final void drain() { do { if (!drainingThread.compareAndSet(null, Thread.currentThread())) { return; } try { Runnable runnable; while ((runnable = queue.poll()) != null) { try { runnable.run(); } catch (Throwable t) { uncau...
[ "public", "final", "void", "drain", "(", ")", "{", "do", "{", "if", "(", "!", "drainingThread", ".", "compareAndSet", "(", "null", ",", "Thread", ".", "currentThread", "(", ")", ")", ")", "{", "return", ";", "}", "try", "{", "Runnable", "runnable", "...
Run all tasks in the queue in the current thread, if no other thread is running this method. Otherwise do nothing. <p>Upon returning, it guarantees that all tasks submitted by {@code #executeLater} before it have been or will eventually be run, while not requiring any more calls to {@code drain()}.
[ "Run", "all", "tasks", "in", "the", "queue", "in", "the", "current", "thread", "if", "no", "other", "thread", "is", "running", "this", "method", ".", "Otherwise", "do", "nothing", "." ]
973885457f9609de232d2553b82c67f6c3ff57bf
https://github.com/grpc/grpc-java/blob/973885457f9609de232d2553b82c67f6c3ff57bf/api/src/main/java/io/grpc/SynchronizationContext.java#L79-L98
127,377
grpc/grpc-java
stub/src/main/java/io/grpc/stub/AbstractStub.java
AbstractStub.withInterceptors
public final S withInterceptors(ClientInterceptor... interceptors) { return build(ClientInterceptors.intercept(channel, interceptors), callOptions); }
java
public final S withInterceptors(ClientInterceptor... interceptors) { return build(ClientInterceptors.intercept(channel, interceptors), callOptions); }
[ "public", "final", "S", "withInterceptors", "(", "ClientInterceptor", "...", "interceptors", ")", "{", "return", "build", "(", "ClientInterceptors", ".", "intercept", "(", "channel", ",", "interceptors", ")", ",", "callOptions", ")", ";", "}" ]
Returns a new stub that has the given interceptors attached to the underlying channel. @since 1.0.0
[ "Returns", "a", "new", "stub", "that", "has", "the", "given", "interceptors", "attached", "to", "the", "underlying", "channel", "." ]
973885457f9609de232d2553b82c67f6c3ff57bf
https://github.com/grpc/grpc-java/blob/973885457f9609de232d2553b82c67f6c3ff57bf/stub/src/main/java/io/grpc/stub/AbstractStub.java#L184-L186
127,378
grpc/grpc-java
netty/src/jmh/java/io/grpc/netty/InboundHeadersBenchmark.java
InboundHeadersBenchmark.setupRequestHeaders
private static void setupRequestHeaders() { requestHeaders = new AsciiString[18]; int i = 0; requestHeaders[i++] = AsciiString.of(":method"); requestHeaders[i++] = AsciiString.of("POST"); requestHeaders[i++] = AsciiString.of(":scheme"); requestHeaders[i++] = AsciiString.of("http"); requestHe...
java
private static void setupRequestHeaders() { requestHeaders = new AsciiString[18]; int i = 0; requestHeaders[i++] = AsciiString.of(":method"); requestHeaders[i++] = AsciiString.of("POST"); requestHeaders[i++] = AsciiString.of(":scheme"); requestHeaders[i++] = AsciiString.of("http"); requestHe...
[ "private", "static", "void", "setupRequestHeaders", "(", ")", "{", "requestHeaders", "=", "new", "AsciiString", "[", "18", "]", ";", "int", "i", "=", "0", ";", "requestHeaders", "[", "i", "++", "]", "=", "AsciiString", ".", "of", "(", "\":method\"", ")",...
Headers taken from the gRPC spec.
[ "Headers", "taken", "from", "the", "gRPC", "spec", "." ]
973885457f9609de232d2553b82c67f6c3ff57bf
https://github.com/grpc/grpc-java/blob/973885457f9609de232d2553b82c67f6c3ff57bf/netty/src/jmh/java/io/grpc/netty/InboundHeadersBenchmark.java#L52-L73
127,379
grpc/grpc-java
okhttp/src/main/java/io/grpc/okhttp/OkHttpClientTransport.java
OkHttpClientTransport.startPendingStreams
@GuardedBy("lock") private boolean startPendingStreams() { boolean hasStreamStarted = false; while (!pendingStreams.isEmpty() && streams.size() < maxConcurrentStreams) { OkHttpClientStream stream = pendingStreams.poll(); startStream(stream); hasStreamStarted = true; } return hasStrea...
java
@GuardedBy("lock") private boolean startPendingStreams() { boolean hasStreamStarted = false; while (!pendingStreams.isEmpty() && streams.size() < maxConcurrentStreams) { OkHttpClientStream stream = pendingStreams.poll(); startStream(stream); hasStreamStarted = true; } return hasStrea...
[ "@", "GuardedBy", "(", "\"lock\"", ")", "private", "boolean", "startPendingStreams", "(", ")", "{", "boolean", "hasStreamStarted", "=", "false", ";", "while", "(", "!", "pendingStreams", ".", "isEmpty", "(", ")", "&&", "streams", ".", "size", "(", ")", "<"...
Starts pending streams, returns true if at least one pending stream is started.
[ "Starts", "pending", "streams", "returns", "true", "if", "at", "least", "one", "pending", "stream", "is", "started", "." ]
973885457f9609de232d2553b82c67f6c3ff57bf
https://github.com/grpc/grpc-java/blob/973885457f9609de232d2553b82c67f6c3ff57bf/okhttp/src/main/java/io/grpc/okhttp/OkHttpClientTransport.java#L442-L451
127,380
grpc/grpc-java
okhttp/src/main/java/io/grpc/okhttp/OkHttpClientTransport.java
OkHttpClientTransport.onException
@Override public void onException(Throwable failureCause) { Preconditions.checkNotNull(failureCause, "failureCause"); Status status = Status.UNAVAILABLE.withCause(failureCause); startGoAway(0, ErrorCode.INTERNAL_ERROR, status); }
java
@Override public void onException(Throwable failureCause) { Preconditions.checkNotNull(failureCause, "failureCause"); Status status = Status.UNAVAILABLE.withCause(failureCause); startGoAway(0, ErrorCode.INTERNAL_ERROR, status); }
[ "@", "Override", "public", "void", "onException", "(", "Throwable", "failureCause", ")", "{", "Preconditions", ".", "checkNotNull", "(", "failureCause", ",", "\"failureCause\"", ")", ";", "Status", "status", "=", "Status", ".", "UNAVAILABLE", ".", "withCause", "...
Finish all active streams due to an IOException, then close the transport.
[ "Finish", "all", "active", "streams", "due", "to", "an", "IOException", "then", "close", "the", "transport", "." ]
973885457f9609de232d2553b82c67f6c3ff57bf
https://github.com/grpc/grpc-java/blob/973885457f9609de232d2553b82c67f6c3ff57bf/okhttp/src/main/java/io/grpc/okhttp/OkHttpClientTransport.java#L827-L832
127,381
grpc/grpc-java
okhttp/src/main/java/io/grpc/okhttp/OkHttpClientTransport.java
OkHttpClientTransport.onError
private void onError(ErrorCode errorCode, String moreDetail) { startGoAway(0, errorCode, toGrpcStatus(errorCode).augmentDescription(moreDetail)); }
java
private void onError(ErrorCode errorCode, String moreDetail) { startGoAway(0, errorCode, toGrpcStatus(errorCode).augmentDescription(moreDetail)); }
[ "private", "void", "onError", "(", "ErrorCode", "errorCode", ",", "String", "moreDetail", ")", "{", "startGoAway", "(", "0", ",", "errorCode", ",", "toGrpcStatus", "(", "errorCode", ")", ".", "augmentDescription", "(", "moreDetail", ")", ")", ";", "}" ]
Send GOAWAY to the server, then finish all active streams and close the transport.
[ "Send", "GOAWAY", "to", "the", "server", "then", "finish", "all", "active", "streams", "and", "close", "the", "transport", "." ]
973885457f9609de232d2553b82c67f6c3ff57bf
https://github.com/grpc/grpc-java/blob/973885457f9609de232d2553b82c67f6c3ff57bf/okhttp/src/main/java/io/grpc/okhttp/OkHttpClientTransport.java#L837-L839
127,382
grpc/grpc-java
okhttp/src/main/java/io/grpc/okhttp/OkHttpClientTransport.java
OkHttpClientTransport.toGrpcStatus
@VisibleForTesting static Status toGrpcStatus(ErrorCode code) { Status status = ERROR_CODE_TO_STATUS.get(code); return status != null ? status : Status.UNKNOWN.withDescription( "Unknown http2 error code: " + code.httpCode); }
java
@VisibleForTesting static Status toGrpcStatus(ErrorCode code) { Status status = ERROR_CODE_TO_STATUS.get(code); return status != null ? status : Status.UNKNOWN.withDescription( "Unknown http2 error code: " + code.httpCode); }
[ "@", "VisibleForTesting", "static", "Status", "toGrpcStatus", "(", "ErrorCode", "code", ")", "{", "Status", "status", "=", "ERROR_CODE_TO_STATUS", ".", "get", "(", "code", ")", ";", "return", "status", "!=", "null", "?", "status", ":", "Status", ".", "UNKNOW...
Returns a Grpc status corresponding to the given ErrorCode.
[ "Returns", "a", "Grpc", "status", "corresponding", "to", "the", "given", "ErrorCode", "." ]
973885457f9609de232d2553b82c67f6c3ff57bf
https://github.com/grpc/grpc-java/blob/973885457f9609de232d2553b82c67f6c3ff57bf/okhttp/src/main/java/io/grpc/okhttp/OkHttpClientTransport.java#L1017-L1022
127,383
grpc/grpc-java
core/src/main/java/io/grpc/internal/InUseStateAggregator.java
InUseStateAggregator.updateObjectInUse
public final void updateObjectInUse(T object, boolean inUse) { int origSize = inUseObjects.size(); if (inUse) { inUseObjects.add(object); if (origSize == 0) { handleInUse(); } } else { boolean removed = inUseObjects.remove(object); if (removed && origSize == 1) { ...
java
public final void updateObjectInUse(T object, boolean inUse) { int origSize = inUseObjects.size(); if (inUse) { inUseObjects.add(object); if (origSize == 0) { handleInUse(); } } else { boolean removed = inUseObjects.remove(object); if (removed && origSize == 1) { ...
[ "public", "final", "void", "updateObjectInUse", "(", "T", "object", ",", "boolean", "inUse", ")", "{", "int", "origSize", "=", "inUseObjects", ".", "size", "(", ")", ";", "if", "(", "inUse", ")", "{", "inUseObjects", ".", "add", "(", "object", ")", ";"...
Update the in-use state of an object. Initially no object is in use. <p>This may call into {@link #handleInUse} or {@link #handleNotInUse} when appropriate.
[ "Update", "the", "in", "-", "use", "state", "of", "an", "object", ".", "Initially", "no", "object", "is", "in", "use", "." ]
973885457f9609de232d2553b82c67f6c3ff57bf
https://github.com/grpc/grpc-java/blob/973885457f9609de232d2553b82c67f6c3ff57bf/core/src/main/java/io/grpc/internal/InUseStateAggregator.java#L35-L48
127,384
grpc/grpc-java
alts/src/main/java/io/grpc/alts/internal/AltsProtocolNegotiator.java
AltsProtocolNegotiator.createClientNegotiator
public static AltsProtocolNegotiator createClientNegotiator( final TsiHandshakerFactory handshakerFactory, final LazyChannel lazyHandshakerChannel) { final class ClientAltsProtocolNegotiator extends AltsProtocolNegotiator { @Override public ChannelHandler newHandler(GrpcHttp2ConnectionHandler grp...
java
public static AltsProtocolNegotiator createClientNegotiator( final TsiHandshakerFactory handshakerFactory, final LazyChannel lazyHandshakerChannel) { final class ClientAltsProtocolNegotiator extends AltsProtocolNegotiator { @Override public ChannelHandler newHandler(GrpcHttp2ConnectionHandler grp...
[ "public", "static", "AltsProtocolNegotiator", "createClientNegotiator", "(", "final", "TsiHandshakerFactory", "handshakerFactory", ",", "final", "LazyChannel", "lazyHandshakerChannel", ")", "{", "final", "class", "ClientAltsProtocolNegotiator", "extends", "AltsProtocolNegotiator"...
Creates a negotiator used for ALTS client.
[ "Creates", "a", "negotiator", "used", "for", "ALTS", "client", "." ]
973885457f9609de232d2553b82c67f6c3ff57bf
https://github.com/grpc/grpc-java/blob/973885457f9609de232d2553b82c67f6c3ff57bf/alts/src/main/java/io/grpc/alts/internal/AltsProtocolNegotiator.java#L60-L81
127,385
grpc/grpc-java
alts/src/main/java/io/grpc/alts/internal/AltsProtocolNegotiator.java
AltsProtocolNegotiator.createServerNegotiator
public static AltsProtocolNegotiator createServerNegotiator( final TsiHandshakerFactory handshakerFactory, final LazyChannel lazyHandshakerChannel) { final class ServerAltsProtocolNegotiator extends AltsProtocolNegotiator { @Override public ChannelHandler newHandler(GrpcHttp2ConnectionHandler grp...
java
public static AltsProtocolNegotiator createServerNegotiator( final TsiHandshakerFactory handshakerFactory, final LazyChannel lazyHandshakerChannel) { final class ServerAltsProtocolNegotiator extends AltsProtocolNegotiator { @Override public ChannelHandler newHandler(GrpcHttp2ConnectionHandler grp...
[ "public", "static", "AltsProtocolNegotiator", "createServerNegotiator", "(", "final", "TsiHandshakerFactory", "handshakerFactory", ",", "final", "LazyChannel", "lazyHandshakerChannel", ")", "{", "final", "class", "ServerAltsProtocolNegotiator", "extends", "AltsProtocolNegotiator"...
Creates a negotiator used for ALTS server.
[ "Creates", "a", "negotiator", "used", "for", "ALTS", "server", "." ]
973885457f9609de232d2553b82c67f6c3ff57bf
https://github.com/grpc/grpc-java/blob/973885457f9609de232d2553b82c67f6c3ff57bf/alts/src/main/java/io/grpc/alts/internal/AltsProtocolNegotiator.java#L89-L110
127,386
grpc/grpc-java
core/src/main/java/io/grpc/internal/Http2Ping.java
Http2Ping.addCallback
public void addCallback(final ClientTransport.PingCallback callback, Executor executor) { Runnable runnable; synchronized (this) { if (!completed) { callbacks.put(callback, executor); return; } // otherwise, invoke callback immediately (but not while holding lock) runnabl...
java
public void addCallback(final ClientTransport.PingCallback callback, Executor executor) { Runnable runnable; synchronized (this) { if (!completed) { callbacks.put(callback, executor); return; } // otherwise, invoke callback immediately (but not while holding lock) runnabl...
[ "public", "void", "addCallback", "(", "final", "ClientTransport", ".", "PingCallback", "callback", ",", "Executor", "executor", ")", "{", "Runnable", "runnable", ";", "synchronized", "(", "this", ")", "{", "if", "(", "!", "completed", ")", "{", "callbacks", ...
Registers a callback that is invoked when the ping operation completes. If this ping operation is already completed, the callback is invoked immediately. @param callback the callback to invoke @param executor the executor to use
[ "Registers", "a", "callback", "that", "is", "invoked", "when", "the", "ping", "operation", "completes", ".", "If", "this", "ping", "operation", "is", "already", "completed", "the", "callback", "is", "invoked", "immediately", "." ]
973885457f9609de232d2553b82c67f6c3ff57bf
https://github.com/grpc/grpc-java/blob/973885457f9609de232d2553b82c67f6c3ff57bf/core/src/main/java/io/grpc/internal/Http2Ping.java#L93-L105
127,387
grpc/grpc-java
core/src/main/java/io/grpc/internal/Http2Ping.java
Http2Ping.complete
public boolean complete() { Map<ClientTransport.PingCallback, Executor> callbacks; long roundTripTimeNanos; synchronized (this) { if (completed) { return false; } completed = true; roundTripTimeNanos = this.roundTripTimeNanos = stopwatch.elapsed(TimeUnit.NANOSECONDS); c...
java
public boolean complete() { Map<ClientTransport.PingCallback, Executor> callbacks; long roundTripTimeNanos; synchronized (this) { if (completed) { return false; } completed = true; roundTripTimeNanos = this.roundTripTimeNanos = stopwatch.elapsed(TimeUnit.NANOSECONDS); c...
[ "public", "boolean", "complete", "(", ")", "{", "Map", "<", "ClientTransport", ".", "PingCallback", ",", "Executor", ">", "callbacks", ";", "long", "roundTripTimeNanos", ";", "synchronized", "(", "this", ")", "{", "if", "(", "completed", ")", "{", "return", ...
Completes this operation successfully. The stopwatch given during construction is used to measure the elapsed time. Registered callbacks are invoked and provided the measured elapsed time. @return true if the operation is marked as complete; false if it was already complete
[ "Completes", "this", "operation", "successfully", ".", "The", "stopwatch", "given", "during", "construction", "is", "used", "to", "measure", "the", "elapsed", "time", ".", "Registered", "callbacks", "are", "invoked", "and", "provided", "the", "measured", "elapsed"...
973885457f9609de232d2553b82c67f6c3ff57bf
https://github.com/grpc/grpc-java/blob/973885457f9609de232d2553b82c67f6c3ff57bf/core/src/main/java/io/grpc/internal/Http2Ping.java#L123-L139
127,388
grpc/grpc-java
core/src/main/java/io/grpc/internal/Http2Ping.java
Http2Ping.failed
public void failed(Throwable failureCause) { Map<ClientTransport.PingCallback, Executor> callbacks; synchronized (this) { if (completed) { return; } completed = true; this.failureCause = failureCause; callbacks = this.callbacks; this.callbacks = null; } for (M...
java
public void failed(Throwable failureCause) { Map<ClientTransport.PingCallback, Executor> callbacks; synchronized (this) { if (completed) { return; } completed = true; this.failureCause = failureCause; callbacks = this.callbacks; this.callbacks = null; } for (M...
[ "public", "void", "failed", "(", "Throwable", "failureCause", ")", "{", "Map", "<", "ClientTransport", ".", "PingCallback", ",", "Executor", ">", "callbacks", ";", "synchronized", "(", "this", ")", "{", "if", "(", "completed", ")", "{", "return", ";", "}",...
Completes this operation exceptionally. Registered callbacks are invoked and provided the given throwable as the cause of failure. @param failureCause the cause of failure
[ "Completes", "this", "operation", "exceptionally", ".", "Registered", "callbacks", "are", "invoked", "and", "provided", "the", "given", "throwable", "as", "the", "cause", "of", "failure", "." ]
973885457f9609de232d2553b82c67f6c3ff57bf
https://github.com/grpc/grpc-java/blob/973885457f9609de232d2553b82c67f6c3ff57bf/core/src/main/java/io/grpc/internal/Http2Ping.java#L147-L161
127,389
grpc/grpc-java
core/src/main/java/io/grpc/internal/Http2Ping.java
Http2Ping.notifyFailed
public static void notifyFailed(PingCallback callback, Executor executor, Throwable cause) { doExecute(executor, asRunnable(callback, cause)); }
java
public static void notifyFailed(PingCallback callback, Executor executor, Throwable cause) { doExecute(executor, asRunnable(callback, cause)); }
[ "public", "static", "void", "notifyFailed", "(", "PingCallback", "callback", ",", "Executor", "executor", ",", "Throwable", "cause", ")", "{", "doExecute", "(", "executor", ",", "asRunnable", "(", "callback", ",", "cause", ")", ")", ";", "}" ]
Notifies the given callback that the ping operation failed. @param callback the callback @param executor the executor used to invoke the callback @param cause the cause of failure
[ "Notifies", "the", "given", "callback", "that", "the", "ping", "operation", "failed", "." ]
973885457f9609de232d2553b82c67f6c3ff57bf
https://github.com/grpc/grpc-java/blob/973885457f9609de232d2553b82c67f6c3ff57bf/core/src/main/java/io/grpc/internal/Http2Ping.java#L170-L172
127,390
grpc/grpc-java
core/src/main/java/io/grpc/internal/Http2Ping.java
Http2Ping.doExecute
private static void doExecute(Executor executor, Runnable runnable) { try { executor.execute(runnable); } catch (Throwable th) { log.log(Level.SEVERE, "Failed to execute PingCallback", th); } }
java
private static void doExecute(Executor executor, Runnable runnable) { try { executor.execute(runnable); } catch (Throwable th) { log.log(Level.SEVERE, "Failed to execute PingCallback", th); } }
[ "private", "static", "void", "doExecute", "(", "Executor", "executor", ",", "Runnable", "runnable", ")", "{", "try", "{", "executor", ".", "execute", "(", "runnable", ")", ";", "}", "catch", "(", "Throwable", "th", ")", "{", "log", ".", "log", "(", "Le...
Executes the given runnable. This prevents exceptions from propagating so that an exception thrown by one callback won't prevent subsequent callbacks from being executed.
[ "Executes", "the", "given", "runnable", ".", "This", "prevents", "exceptions", "from", "propagating", "so", "that", "an", "exception", "thrown", "by", "one", "callback", "won", "t", "prevent", "subsequent", "callbacks", "from", "being", "executed", "." ]
973885457f9609de232d2553b82c67f6c3ff57bf
https://github.com/grpc/grpc-java/blob/973885457f9609de232d2553b82c67f6c3ff57bf/core/src/main/java/io/grpc/internal/Http2Ping.java#L178-L184
127,391
grpc/grpc-java
core/src/main/java/io/grpc/internal/Http2Ping.java
Http2Ping.asRunnable
private static Runnable asRunnable(final ClientTransport.PingCallback callback, final long roundTripTimeNanos) { return new Runnable() { @Override public void run() { callback.onSuccess(roundTripTimeNanos); } }; }
java
private static Runnable asRunnable(final ClientTransport.PingCallback callback, final long roundTripTimeNanos) { return new Runnable() { @Override public void run() { callback.onSuccess(roundTripTimeNanos); } }; }
[ "private", "static", "Runnable", "asRunnable", "(", "final", "ClientTransport", ".", "PingCallback", "callback", ",", "final", "long", "roundTripTimeNanos", ")", "{", "return", "new", "Runnable", "(", ")", "{", "@", "Override", "public", "void", "run", "(", ")...
Returns a runnable that, when run, invokes the given callback, providing the given round-trip duration.
[ "Returns", "a", "runnable", "that", "when", "run", "invokes", "the", "given", "callback", "providing", "the", "given", "round", "-", "trip", "duration", "." ]
973885457f9609de232d2553b82c67f6c3ff57bf
https://github.com/grpc/grpc-java/blob/973885457f9609de232d2553b82c67f6c3ff57bf/core/src/main/java/io/grpc/internal/Http2Ping.java#L190-L199
127,392
grpc/grpc-java
core/src/main/java/io/grpc/internal/Http2Ping.java
Http2Ping.asRunnable
private static Runnable asRunnable(final ClientTransport.PingCallback callback, final Throwable failureCause) { return new Runnable() { @Override public void run() { callback.onFailure(failureCause); } }; }
java
private static Runnable asRunnable(final ClientTransport.PingCallback callback, final Throwable failureCause) { return new Runnable() { @Override public void run() { callback.onFailure(failureCause); } }; }
[ "private", "static", "Runnable", "asRunnable", "(", "final", "ClientTransport", ".", "PingCallback", "callback", ",", "final", "Throwable", "failureCause", ")", "{", "return", "new", "Runnable", "(", ")", "{", "@", "Override", "public", "void", "run", "(", ")"...
Returns a runnable that, when run, invokes the given callback, providing the given cause of failure.
[ "Returns", "a", "runnable", "that", "when", "run", "invokes", "the", "given", "callback", "providing", "the", "given", "cause", "of", "failure", "." ]
973885457f9609de232d2553b82c67f6c3ff57bf
https://github.com/grpc/grpc-java/blob/973885457f9609de232d2553b82c67f6c3ff57bf/core/src/main/java/io/grpc/internal/Http2Ping.java#L205-L213
127,393
grpc/grpc-java
core/src/main/java/io/grpc/internal/MessageDeframer.java
MessageDeframer.readRequiredBytes
private boolean readRequiredBytes() { int totalBytesRead = 0; int deflatedBytesRead = 0; try { if (nextFrame == null) { nextFrame = new CompositeReadableBuffer(); } // Read until the buffer contains all the required bytes. int missingBytes; while ((missingBytes = requi...
java
private boolean readRequiredBytes() { int totalBytesRead = 0; int deflatedBytesRead = 0; try { if (nextFrame == null) { nextFrame = new CompositeReadableBuffer(); } // Read until the buffer contains all the required bytes. int missingBytes; while ((missingBytes = requi...
[ "private", "boolean", "readRequiredBytes", "(", ")", "{", "int", "totalBytesRead", "=", "0", ";", "int", "deflatedBytesRead", "=", "0", ";", "try", "{", "if", "(", "nextFrame", "==", "null", ")", "{", "nextFrame", "=", "new", "CompositeReadableBuffer", "(", ...
Attempts to read the required bytes into nextFrame. @return {@code true} if all of the required bytes have been read.
[ "Attempts", "to", "read", "the", "required", "bytes", "into", "nextFrame", "." ]
973885457f9609de232d2553b82c67f6c3ff57bf
https://github.com/grpc/grpc-java/blob/973885457f9609de232d2553b82c67f6c3ff57bf/core/src/main/java/io/grpc/internal/MessageDeframer.java#L308-L366
127,394
grpc/grpc-java
core/src/main/java/io/grpc/internal/MessageDeframer.java
MessageDeframer.processHeader
private void processHeader() { int type = nextFrame.readUnsignedByte(); if ((type & RESERVED_MASK) != 0) { throw Status.INTERNAL.withDescription( "gRPC frame header malformed: reserved bits not zero") .asRuntimeException(); } compressedFlag = (type & COMPRESSED_FLAG_MASK) != 0;...
java
private void processHeader() { int type = nextFrame.readUnsignedByte(); if ((type & RESERVED_MASK) != 0) { throw Status.INTERNAL.withDescription( "gRPC frame header malformed: reserved bits not zero") .asRuntimeException(); } compressedFlag = (type & COMPRESSED_FLAG_MASK) != 0;...
[ "private", "void", "processHeader", "(", ")", "{", "int", "type", "=", "nextFrame", ".", "readUnsignedByte", "(", ")", ";", "if", "(", "(", "type", "&", "RESERVED_MASK", ")", "!=", "0", ")", "{", "throw", "Status", ".", "INTERNAL", ".", "withDescription"...
Processes the GRPC compression header which is composed of the compression flag and the outer frame length.
[ "Processes", "the", "GRPC", "compression", "header", "which", "is", "composed", "of", "the", "compression", "flag", "and", "the", "outer", "frame", "length", "." ]
973885457f9609de232d2553b82c67f6c3ff57bf
https://github.com/grpc/grpc-java/blob/973885457f9609de232d2553b82c67f6c3ff57bf/core/src/main/java/io/grpc/internal/MessageDeframer.java#L372-L395
127,395
grpc/grpc-java
core/src/main/java/io/grpc/internal/MessageDeframer.java
MessageDeframer.processBody
private void processBody() { // There is no reliable way to get the uncompressed size per message when it's compressed, // because the uncompressed bytes are provided through an InputStream whose total size is // unknown until all bytes are read, and we don't know when it happens. statsTraceCtx.inboundM...
java
private void processBody() { // There is no reliable way to get the uncompressed size per message when it's compressed, // because the uncompressed bytes are provided through an InputStream whose total size is // unknown until all bytes are read, and we don't know when it happens. statsTraceCtx.inboundM...
[ "private", "void", "processBody", "(", ")", "{", "// There is no reliable way to get the uncompressed size per message when it's compressed,", "// because the uncompressed bytes are provided through an InputStream whose total size is", "// unknown until all bytes are read, and we don't know when it ...
Processes the GRPC message body, which depending on frame header flags may be compressed.
[ "Processes", "the", "GRPC", "message", "body", "which", "depending", "on", "frame", "header", "flags", "may", "be", "compressed", "." ]
973885457f9609de232d2553b82c67f6c3ff57bf
https://github.com/grpc/grpc-java/blob/973885457f9609de232d2553b82c67f6c3ff57bf/core/src/main/java/io/grpc/internal/MessageDeframer.java#L400-L413
127,396
grpc/grpc-java
core/src/main/java/io/grpc/internal/ProxyDetectorImpl.java
ProxyDetectorImpl.overrideProxy
private static InetSocketAddress overrideProxy(String proxyHostPort) { if (proxyHostPort == null) { return null; } String[] parts = proxyHostPort.split(":", 2); int port = 80; if (parts.length > 1) { port = Integer.parseInt(parts[1]); } log.warning( "Detected GRPC_PROXY_...
java
private static InetSocketAddress overrideProxy(String proxyHostPort) { if (proxyHostPort == null) { return null; } String[] parts = proxyHostPort.split(":", 2); int port = 80; if (parts.length > 1) { port = Integer.parseInt(parts[1]); } log.warning( "Detected GRPC_PROXY_...
[ "private", "static", "InetSocketAddress", "overrideProxy", "(", "String", "proxyHostPort", ")", "{", "if", "(", "proxyHostPort", "==", "null", ")", "{", "return", "null", ";", "}", "String", "[", "]", "parts", "=", "proxyHostPort", ".", "split", "(", "\":\""...
GRPC_PROXY_EXP is deprecated but let's maintain compatibility for now.
[ "GRPC_PROXY_EXP", "is", "deprecated", "but", "let", "s", "maintain", "compatibility", "for", "now", "." ]
973885457f9609de232d2553b82c67f6c3ff57bf
https://github.com/grpc/grpc-java/blob/973885457f9609de232d2553b82c67f6c3ff57bf/core/src/main/java/io/grpc/internal/ProxyDetectorImpl.java#L284-L300
127,397
grpc/grpc-java
benchmarks/src/jmh/java/io/grpc/benchmarks/netty/SingleThreadBlockingQpsBenchmark.java
SingleThreadBlockingQpsBenchmark.setup
@Setup(Level.Trial) public void setup() throws Exception { super.setup(ExecutorType.DIRECT, ExecutorType.DIRECT, MessageSize.SMALL, MessageSize.SMALL, FlowWindowSize.MEDIUM, ChannelType.NIO, 1, 1); }
java
@Setup(Level.Trial) public void setup() throws Exception { super.setup(ExecutorType.DIRECT, ExecutorType.DIRECT, MessageSize.SMALL, MessageSize.SMALL, FlowWindowSize.MEDIUM, ChannelType.NIO, 1, 1); }
[ "@", "Setup", "(", "Level", ".", "Trial", ")", "public", "void", "setup", "(", ")", "throws", "Exception", "{", "super", ".", "setup", "(", "ExecutorType", ".", "DIRECT", ",", "ExecutorType", ".", "DIRECT", ",", "MessageSize", ".", "SMALL", ",", "Message...
Setup with direct executors, small payloads and the default flow control window.
[ "Setup", "with", "direct", "executors", "small", "payloads", "and", "the", "default", "flow", "control", "window", "." ]
973885457f9609de232d2553b82c67f6c3ff57bf
https://github.com/grpc/grpc-java/blob/973885457f9609de232d2553b82c67f6c3ff57bf/benchmarks/src/jmh/java/io/grpc/benchmarks/netty/SingleThreadBlockingQpsBenchmark.java#L42-L52
127,398
grpc/grpc-java
benchmarks/src/jmh/java/io/grpc/benchmarks/netty/SingleThreadBlockingQpsBenchmark.java
SingleThreadBlockingQpsBenchmark.blockingUnary
@Benchmark public Object blockingUnary() throws Exception { return ClientCalls.blockingUnaryCall( channels[0].newCall(unaryMethod, CallOptions.DEFAULT), Unpooled.EMPTY_BUFFER); }
java
@Benchmark public Object blockingUnary() throws Exception { return ClientCalls.blockingUnaryCall( channels[0].newCall(unaryMethod, CallOptions.DEFAULT), Unpooled.EMPTY_BUFFER); }
[ "@", "Benchmark", "public", "Object", "blockingUnary", "(", ")", "throws", "Exception", "{", "return", "ClientCalls", ".", "blockingUnaryCall", "(", "channels", "[", "0", "]", ".", "newCall", "(", "unaryMethod", ",", "CallOptions", ".", "DEFAULT", ")", ",", ...
Issue a unary call and wait for the response.
[ "Issue", "a", "unary", "call", "and", "wait", "for", "the", "response", "." ]
973885457f9609de232d2553b82c67f6c3ff57bf
https://github.com/grpc/grpc-java/blob/973885457f9609de232d2553b82c67f6c3ff57bf/benchmarks/src/jmh/java/io/grpc/benchmarks/netty/SingleThreadBlockingQpsBenchmark.java#L67-L71
127,399
grpc/grpc-java
api/src/main/java/io/grpc/ServerMethodDefinition.java
ServerMethodDefinition.withServerCallHandler
public ServerMethodDefinition<ReqT, RespT> withServerCallHandler( ServerCallHandler<ReqT, RespT> handler) { return new ServerMethodDefinition<>(method, handler); }
java
public ServerMethodDefinition<ReqT, RespT> withServerCallHandler( ServerCallHandler<ReqT, RespT> handler) { return new ServerMethodDefinition<>(method, handler); }
[ "public", "ServerMethodDefinition", "<", "ReqT", ",", "RespT", ">", "withServerCallHandler", "(", "ServerCallHandler", "<", "ReqT", ",", "RespT", ">", "handler", ")", "{", "return", "new", "ServerMethodDefinition", "<>", "(", "method", ",", "handler", ")", ";", ...
Create a new method definition with a different call handler. @param handler to bind to a cloned instance of this. @return a cloned instance of this with the new handler bound.
[ "Create", "a", "new", "method", "definition", "with", "a", "different", "call", "handler", "." ]
973885457f9609de232d2553b82c67f6c3ff57bf
https://github.com/grpc/grpc-java/blob/973885457f9609de232d2553b82c67f6c3ff57bf/api/src/main/java/io/grpc/ServerMethodDefinition.java#L63-L66