MCPcopy Index your code
hub / github.com/grpc/grpc-java / withValue

Method withValue

api/src/context/java/io/grpc/Context.java:342–346  ·  view source on GitHub ↗

Create a new context with the given key value set. The new context will cascade cancellation from its parent. Context withCredential = Context.current().withValue(CRED_KEY, cred); withCredential.run(new Runnable() { public void run() { readUserRecords(userId, CRED_KEY.get());

(Key<V> k1, V v1)

Source from the content-addressed store, hash-verified

340 * are unrelated, have separate keys for them.
341 */
342 public <V> Context withValue(Key<V> k1, V v1) {
343 Node<Key<?>, Object> newKeyValueEntries =
344 PersistentHashArrayMappedTrie.put(keyValueEntries, k1, v1);
345 return new Context(this, newKeyValueEntries);
346 }
347
348 /**
349 * Create a new context with the given key value set. The new context will cascade cancellation

Calls 1

putMethod · 0.95