{"action":"created","comment":{"url":"https://api.github.com/repos/grpc/grpc-java/pulls/comments/34623869","id":34623869,"diff_hunk":"@@ -0,0 +1,653 @@\n+/*\n+ * Copyright 2015, Google Inc. All rights reserved.\n+ *\n+ * Redistribution and use in source and binary forms, with or without\n+ * modification, are permitted provided that the following conditions are\n+ * met:\n+ *\n+ *    * Redistributions of source code must retain the above copyright\n+ * notice, this list of conditions and the following disclaimer.\n+ *    * Redistributions in binary form must reproduce the above\n+ * copyright notice, this list of conditions and the following disclaimer\n+ * in the documentation and/or other materials provided with the\n+ * distribution.\n+ *\n+ *    * Neither the name of Google Inc. nor the names of its\n+ * contributors may be used to endorse or promote products derived from\n+ * this software without specific prior written permission.\n+ *\n+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS\n+ * \"AS IS\" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT\n+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR\n+ * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT\n+ * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,\n+ * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT\n+ * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,\n+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY\n+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT\n+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE\n+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.\n+ */\n+package io.grpc;\n+\n+import com.google.common.base.Preconditions;\n+import com.google.common.util.concurrent.MoreExecutors;\n+import com.google.common.util.concurrent.ThreadFactoryBuilder;\n+\n+import java.io.Closeable;\n+import java.io.IOException;\n+import java.util.ArrayDeque;\n+import java.util.ArrayList;\n+import java.util.concurrent.Callable;\n+import java.util.concurrent.Executor;\n+import java.util.concurrent.Executors;\n+import java.util.concurrent.ScheduledExecutorService;\n+import java.util.concurrent.ScheduledFuture;\n+import java.util.concurrent.TimeUnit;\n+import java.util.concurrent.TimeoutException;\n+\n+import javax.annotation.Nullable;\n+\n+\n+/**\n+ * A context propagation mechanism which carries deadlines, cancellation signals,\n+ * and other scoped values across API boundaries and between threads. Examples of functionality\n+ * propagated via context include:\n+ * <ul>\n+ *   <li>Deadlines for a local operation or remote call.</li>\n+ *   <li>Security principals & credentials.</li>\n+ *   <li>Local and distributed tracing context.</li>\n+ * </ul>\n+ *\n+ * <p>Context is not intended for passing optional parameters to an API and developers should\n+ * take care to avoid excessive dependence on context when designing an API.\n+ *\n+ * <p>If Context is being used in an environment that needs to support class unloading it is the\n+ * responsibility of the application to ensure that all contexts are properly cancelled.\n+ *\n+ */\n+public class Context {\n+\n+  /**\n+   * Use a shared resource to retain the {@link ScheduledExecutorService} used to\n+   * implement deadline based context cancellation. This allows the executor to be\n+   * shutdown if its not in use thereby allowing Context to be unloaded.\n+   */\n+  static final SharedResourceHolder.Resource<ScheduledExecutorService> SCHEDULER =\n+      new SharedResourceHolder.Resource<ScheduledExecutorService>() {\n+        private static final String name = \"context-scheduler\";\n+        @Override\n+        public ScheduledExecutorService create() {\n+          return Executors.newScheduledThreadPool(1, new ThreadFactoryBuilder()\n+              .setNameFormat(name + \"-%d\")\n+              .setDaemon(true)\n+              .build());\n+        }\n+\n+        @Override\n+        public void close(ScheduledExecutorService instance) {\n+          instance.shutdown();\n+        }\n+\n+        @Override\n+        public String toString() {\n+          return name;\n+        }\n+      };\n+\n+  /**\n+   * Stack of context objects which is used to record attach & detach history on a thread.\n+   */\n+  private static final ThreadLocal<ArrayDeque<Context>> contextStack =\n+      new ThreadLocal<ArrayDeque<Context>>() {\n+    @Override\n+    protected ArrayDeque<Context> initialValue() {\n+      return new ArrayDeque<Context>();\n+    }\n+  };\n+\n+  private static final Object[][] EMPTY_ENTRIES = new Object[0][2];\n+\n+  /**\n+   * The logical root context which is {@link #current()} if no other context is bound. This context\n+   * is not cancellable and so will not cascade cancellation or retain listeners.\n+   */\n+  public static final Context ROOT = new Context(null);\n+\n+  /**\n+   * Create a {@link Key} with the given name.\n+   */\n+  public static <T> Key<T> key(String name) {\n+    return new Key<T>(name);\n+  }\n+\n+  /**\n+   * Create a {@link Key} with the given name and default value.\n+   */\n+  public static <T> Key<T> keyWithDefault(String name, T defaultValue) {\n+    return new Key<T>(name, defaultValue);\n+  }\n+\n+  /**\n+   * Return the context associated with the current thread, will never return {@code null} as\n+   * the {@link #ROOT} context is implicitly associated with all threads.\n+   *\n+   * <p>Will never return {@link CancellableContext} even if one is attached, instead a\n+   * {@link Context} is returned with the same properties and lifetime. This is to avoid\n+   * code stealing the ability to cancel arbitrarily.\n+   */\n+  public static Context current() {\n+    ArrayDeque<Context> stack = contextStack.get();\n+    if (stack.isEmpty()) {\n+      return ROOT;\n+    }\n+    return stack.peekLast();\n+  }\n+\n+  private final Context parent;\n+  private final Object[][] keyValueEntries;\n+  private final boolean cascadesCancellation;\n+  private ArrayList<ExecutableListener> listeners;\n+  private CancellationListener parentListener = new CancellationListener() {\n+    @Override\n+    public void cancelled(Context context) {\n+      notifyAndClearListeners();\n+    }\n+  };\n+\n+  /**\n+   * Construct a context that cannot be cancelled and will not cascade cancellation from its parent.\n+   */\n+  private Context(Context parent) {\n+    this.parent = parent;\n+    keyValueEntries = EMPTY_ENTRIES;\n+    cascadesCancellation = false;\n+  }\n+\n+  /**\n+   * Construct a context that cannot be cancelled but will cascade cancellation from its parent if\n+   * it is cancellable.\n+   */\n+  private Context(Context parent, Object[][] keyValueEntries) {\n+    this.parent = parent;\n+    this.keyValueEntries = keyValueEntries;\n+    cascadesCancellation = true;\n+  }\n+\n+  boolean canBeCancelled() {\n+    // A context is cancellable if it cascades from its parent and its parent is\n+    // cancellable.\n+    return (cascadesCancellation && this.parent != null && this.parent.canBeCancelled());\n+  }\n+\n+  /**\n+   * Create a new context which is independently cancellable, the new context will cascade\n+   * cancellation from its parent.\n+   */\n+  public CancellableContext withCancellation() {\n+    return new CancellableContext(this);\n+  }\n+\n+  /**\n+   * Create a new context which will cancel itself after an absolute deadline expressed as\n+   * nanoseconds in the {@link System#nanoTime()} clock.\n+   *\n+   * <p>It is recommended that callers only use this method when propagating a derivative of\n+   * a received existing deadline. When establishing a new deadline {@link #withDeadlineAfter}\n+   * is the better mechanism.\n+   */\n+  public CancellableContext withDeadlineNanoTime(long deadlineNanoTime) {\n+    return withDeadlineAfter(Math.max(0, deadlineNanoTime - System.nanoTime()),\n+        TimeUnit.NANOSECONDS);\n+  }\n+\n+  /**\n+   * Create a new context which will cancel itself after the given {@code duration} from now.\n+   */\n+  public CancellableContext withDeadlineAfter(long duration, TimeUnit unit) {\n+    Preconditions.checkArgument(duration >= 0, \"duration must be greater than or equal to 0\");\n+    Preconditions.checkNotNull(unit, \"unit\");\n+    return new CancellableContext(this, unit.toNanos(duration));\n+  }\n+\n+  /**\n+   * Create a new context with the given key value set. The new context will cascade cancellation\n+   * from its parent.\n+   */\n+  public <V> Context withValue(Key<V> k1, V v1) {\n+    return new Context(this, new Object[][]{{k1, v1}});\n+  }\n+\n+  /**\n+   * Create a new context with the given key value set. The new context will cascade cancellation\n+   * from its parent.\n+   */\n+  public <V1, V2> Context withValues(Key<V1> k1, V1 v1, Key<V2> k2, V2 v2) {\n+    return new Context(this, new Object[][]{{k1, v1}, {k2, v2}});\n+  }\n+\n+  /**\n+   * Create a new context with the given key value set. The new context will cascade cancellation\n+   * from its parent.\n+   */\n+  public <V1, V2, V3> Context withValues(Key<V1> k1, V1 v1, Key<V2> k2, V2 v2, Key<V3> k3, V3 v3) {\n+    return new Context(this, new Object[][]{{k1, v1}, {k2, v2}, {k3, v3}});\n+  }\n+\n+  /**\n+   * Create a new context which copies the values of this context but does not propagate it's\n+   * cancellation and is it's own independent root for cancellation.\n+   */\n+  public CancellableContext fork() {\n+    return new Context(this).withCancellation();\n+  }\n+\n+  /**\n+   * Attach this context to the thread and make it {@link #current}, the previously current context\n+   * will be restored when detach is called. It is allowed to attach contexts where\n+   * {@link #isCancelled()} is {@code true}.\n+   */\n+  public void attach() {\n+    contextStack.get().addLast(this);\n+  }\n+\n+  /**\n+   * Returns {@code true} if this context is {@link #current}, {@code false} otherwise.\n+   */\n+  public boolean isCurrent() {\n+    return current() == this;\n+  }\n+\n+  /**\n+   * Detach the current context from the thread and restore the context that was previously\n+   * attached to the thread as the 'current' context.\n+   *\n+   * @throws java.lang.IllegalStateException if this context is not {@link #current()}.\n+   */\n+  public void detach() {\n+    ArrayDeque<Context> stack = contextStack.get();\n+    if (stack.isEmpty()) {\n+      if (this == ROOT) {\n+        throw new IllegalStateException(\"Cannot detach root\");\n+      } else {\n+        throw new IllegalStateException(\"Cannot detach non-root context when root is current\");\n+      }\n+    }\n+    if (stack.peekLast() != this) {\n+      throw new IllegalStateException(\"Cannot detach a context that is not current\");\n+    }\n+    stack.removeLast();\n+  }\n+\n+  /**\n+   * Is this context cancelled.\n+   */\n+  public boolean isCancelled() {\n+    if (parent == null || !cascadesCancellation) {\n+      return false;\n+    } else {\n+      return parent.isCancelled();\n+    }\n+  }\n+\n+  /**\n+   * Return the cause of the cancellation or {@code null} if context was cancelled without a cause.\n+   */\n+  @Nullable\n+  public Throwable cause() {\n+    if (parent == null || !cascadesCancellation) {\n+      return null;\n+    } else {\n+      return parent.cause();\n+    }\n+  }\n+\n+  /**\n+   * Add a listener that will be notified when the context becomes cancelled.\n+   */\n+  public void addListener(final CancellationListener cancellationListener,\n+                          final Executor executor) {\n+    Preconditions.checkNotNull(cancellationListener);\n+    Preconditions.checkNotNull(executor);\n+    if (canBeCancelled()) {\n+      ExecutableListener executableListener =\n+          new ExecutableListener(executor, cancellationListener);\n+      synchronized (this) {\n+        if (isCancelled()) {\n+          executableListener.deliver();\n+        } else {\n+          if (listeners == null) {\n+            // Now that we have a listener we need to listen to our parent so\n+            // we can cascade listener notification.\n+            listeners = new ArrayList<ExecutableListener>();\n+            if (parent.canBeCancelled()) {\n+              parent.addListener(parentListener, MoreExecutors.directExecutor());\n+            }\n+          }\n+          listeners.add(executableListener);\n+        }\n+      }\n+    } else {\n+      // Discussion point: Should we throw or suppress.\n+    }\n+  }\n+\n+  /**\n+   * Remove a {@link CancellationListener}.\n+   */\n+  public void removeListener(CancellationListener cancellationListener) {\n+    synchronized (this) {\n+      if (listeners != null) {\n+        for (int i = listeners.size() - 1; i >= 0; i--) {\n+          if (listeners.get(i).listener == cancellationListener) {\n+            listeners.remove(i);\n+          }\n+        }\n+        // We have no listeners so no need to listen to our parent\n+        if (listeners.isEmpty()) {\n+          parent.removeListener(parentListener);\n+          listeners = null;\n+        }\n+      }\n+    }\n+  }\n+\n+  /**\n+   * Notify all listeners that this context has been cancelled and immediately release\n+   * any reference to them so that they may be garbage collected.\n+   */\n+  void notifyAndClearListeners() {\n+    ArrayList<ExecutableListener> tmpListeners = null;\n+    synchronized (this) {\n+      if (listeners != null) {\n+        tmpListeners = listeners;\n+        listeners = null;\n+      }\n+    }\n+    if (tmpListeners != null) {\n+      for (int i = 0; i < tmpListeners.size(); i++) {\n+        try {\n+          tmpListeners.get(i).deliver();\n+        } catch (Throwable t) {\n+          // Ignore\n+        }\n+      }\n+      parent.removeListener(parentListener);\n+    }\n+  }\n+\n+  // Used in tests to ensure that listeners are defined and released based on\n+  // cancellation propagation. It's very important to ensure that we do not\n+  // accidentally retain listeners.\n+  int listenerCount() {\n+    synchronized (this) {\n+      return listeners == null ? 0 : listeners.size();\n+    }\n+  }\n+\n+  /**\n+   * Wrap a {@link Runnable} so that it executes with this context as the {@link #current} context.\n+   */\n+  public Runnable wrap(final Runnable r) {\n+    return new Runnable() {\n+      @Override\n+      public void run() {\n+        attach();\n+        try {\n+          r.run();\n+        } finally {\n+          detach();\n+        }\n+      }\n+    };\n+  }\n+\n+  /**\n+   * Wrap a {@link Callable} so that it executes with this context as the {@link #current} context.\n+   */\n+  public <C> Callable<C> wrap(final Callable<C> c) {\n+    return new Callable<C>() {\n+      @Override\n+      public C call() throws Exception {\n+        attach();\n+        try {\n+          return c.call();\n+        } finally {\n+          detach();\n+        }\n+      }\n+    };\n+  }\n+\n+  /**\n+   * Lookup the value for a key in the context inheritance chain.\n+   */\n+  private Object lookup(Key key) {\n+    for (int i = 0; i < keyValueEntries.length; i++) {\n+      if (key.equals(keyValueEntries[i][0])) {\n+        return keyValueEntries[i][1];\n+      }\n+    }\n+    if (parent == null) {\n+      return null;\n+    }\n+    return parent.lookup(key);\n+  }\n+\n+  /**\n+   * A context which inherits cancellation from its parent but which can also be independently\n+   * cancelled and which will propagate cancellation to it's descendants.\n+   */\n+  public static final class CancellableContext extends Context {\n+\n+    /**\n+     * Used with cancelledUpdater. 0->not cancelled, 1->cancelled.\n+     */\n+    @SuppressWarnings(\"unused\")\n+    private boolean cancelled;\n+    private Throwable cause;\n+    private final Context dummy;\n+    private ScheduledFuture<?> scheduledFuture;\n+\n+    /**\n+     * Create a cancellable context that does not have a deadline.\n+     */\n+    private CancellableContext(Context parent) {\n+      super(parent, EMPTY_ENTRIES);\n+      // Create a dummy that inherits from this to attach and detach so that you cannot retrieve a\n+      // cancellable context from Context.current()\n+      dummy = new Context(this, EMPTY_ENTRIES);\n+    }\n+\n+    /**\n+     * Create a cancellable context that has a deadline.\n+     */\n+    private CancellableContext(Context parent, long delayNanos) {\n+      super(parent, EMPTY_ENTRIES);\n+      // Create a dummy that inherits from this to attach and detach so that you cannot retrieve a\n+      // cancellable context from Context.current()\n+      dummy = new Context(this, EMPTY_ENTRIES);\n+      scheduledFuture = SCHEDULER.create().schedule(new Runnable() {\n+        @Override\n+        public void run() {\n+          cancel(new TimeoutException(\"context timed out\"));\n+        }\n+      }, delayNanos, TimeUnit.NANOSECONDS);\n+    }\n+\n+\n+    @Override\n+    public void attach() {\n+      dummy.attach();\n+    }\n+\n+    @Override\n+    public void detach() {\n+      dummy.detach();\n+    }\n+\n+    @Override\n+    public boolean isCurrent() {\n+      return dummy.isCurrent();\n+    }\n+\n+    /**\n+     * Attach this context to the thread and return a {@link java.lang.AutoCloseable} that can be\n+     * used with try-with-resource statements to properly {@link #detach} and {@link #cancel}\n+     * the context on completion.\n+     *\n+     * @return a {@link java.io.Closeable} which can be used with try-with-resource blocks.\n+     */\n+    public Closeable attachAsCloseable() {\n+      attach();\n+      return new Closeable() {\n+        @Override\n+        public void close() throws IOException {\n+          detachAndCancel(null);\n+        }\n+      };\n+    }\n+\n+    /**\n+     * Cancel this context and optionally provide a cause for the cancellation, all listeners\n+     * are notified immediately on the calling thread.\n+     *\n+     * @return {@code true} if this context cancelled the context and notified listeners,\n+     *    {@code false} if the context was already cancelled.\n+     */\n+    public boolean cancel(@Nullable Throwable cause) {\n+      synchronized (this) {\n+        if (!cancelled) {\n+          cancelled = true;\n+          if (scheduledFuture != null) {\n+            // If we have a scheduled cancellation pending attempt to cancel it.\n+            scheduledFuture.cancel(false);\n+            scheduledFuture = null;\n+          }\n+          this.cause = cause;\n+          notifyAndClearListeners();\n+          return true;\n+        }\n+        return false;\n+      }\n+    }\n+\n+    /**\n+     * Cancel this context and detach it from the current context from the thread and restore the\n+     * context that was previously attached to the thread as the 'current' context.\n+     *\n+     * @throws java.lang.IllegalStateException if this context is not {@link #current()}.\n+     */\n+    public void detachAndCancel(@Nullable Throwable cause) {\n+      try {\n+        detach();\n+      } finally {\n+        cancel(cause);\n+      }\n+    }\n+\n+    @Override\n+    protected boolean canBeCancelled() {\n+      return true;\n+    }\n+\n+    @Override\n+    public boolean isCancelled() {\n+      synchronized (this) {\n+        if (cancelled) {\n+          return true;\n+        }\n+        // Detect cancellation of parent in the case where we have no listeners and\n+        // record it.\n+        if (super.isCancelled()) {\n+          cancel(super.cause());\n+          return true;\n+        }\n+      }\n+      return false;\n+    }\n+\n+    @Nullable\n+    @Override\n+    public Throwable cause() {\n+      if (isCancelled()) {\n+        return cause;\n+      }\n+      return null;\n+    }\n+  }\n+\n+  /**\n+   * A listener notified on context cancellation.\n+   */\n+  public interface CancellationListener {\n+    /**\n+     * @param context the newly cancelled context.\n+     */\n+    public void cancelled(Context context);","path":"core/src/main/java/io/grpc/Context.java","position":683,"original_position":587,"commit_id":"cb701a1a6abe26db2f2d8861a817b304301e25b3","original_commit_id":"5d8971a880411e67688f23b0d55c3438f43d19b6","user":{"login":"louiscryan","id":9046588,"avatar_url":"https://avatars.githubusercontent.com/u/9046588?v=3","gravatar_id":"","url":"https://api.github.com/users/louiscryan","html_url":"https://github.com/louiscryan","followers_url":"https://api.github.com/users/louiscryan/followers","following_url":"https://api.github.com/users/louiscryan/following{/other_user}","gists_url":"https://api.github.com/users/louiscryan/gists{/gist_id}","starred_url":"https://api.github.com/users/louiscryan/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/louiscryan/subscriptions","organizations_url":"https://api.github.com/users/louiscryan/orgs","repos_url":"https://api.github.com/users/louiscryan/repos","events_url":"https://api.github.com/users/louiscryan/events{/privacy}","received_events_url":"https://api.github.com/users/louiscryan/received_events","type":"User","site_admin":false},"body":"Agreed, I'm amenable to adding\r\n\r\nKey.get(Context c)\r\n\r\nto address this issue","created_at":"2015-07-14T21:45:36Z","updated_at":"2015-07-14T21:45:36Z","html_url":"https://github.com/grpc/grpc-java/pull/562#discussion_r34623869","pull_request_url":"https://api.github.com/repos/grpc/grpc-java/pulls/562","_links":{"self":{"href":"https://api.github.com/repos/grpc/grpc-java/pulls/comments/34623869"},"html":{"href":"https://github.com/grpc/grpc-java/pull/562#discussion_r34623869"},"pull_request":{"href":"https://api.github.com/repos/grpc/grpc-java/pulls/562"}}},"pull_request":{"url":"https://api.github.com/repos/grpc/grpc-java/pulls/562","id":38487483,"html_url":"https://github.com/grpc/grpc-java/pull/562","diff_url":"https://github.com/grpc/grpc-java/pull/562.diff","patch_url":"https://github.com/grpc/grpc-java/pull/562.patch","issue_url":"https://api.github.com/repos/grpc/grpc-java/issues/562","number":562,"state":"open","locked":false,"title":"Initial context API","user":{"login":"louiscryan","id":9046588,"avatar_url":"https://avatars.githubusercontent.com/u/9046588?v=3","gravatar_id":"","url":"https://api.github.com/users/louiscryan","html_url":"https://github.com/louiscryan","followers_url":"https://api.github.com/users/louiscryan/followers","following_url":"https://api.github.com/users/louiscryan/following{/other_user}","gists_url":"https://api.github.com/users/louiscryan/gists{/gist_id}","starred_url":"https://api.github.com/users/louiscryan/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/louiscryan/subscriptions","organizations_url":"https://api.github.com/users/louiscryan/orgs","repos_url":"https://api.github.com/users/louiscryan/repos","events_url":"https://api.github.com/users/louiscryan/events{/privacy}","received_events_url":"https://api.github.com/users/louiscryan/received_events","type":"User","site_admin":false},"body":"@jhump @ejona86 @nmittler \r\n\r\nThis is an initial skeleton for the proposed Context API, lets use this PR to iterate on what we want.\r\n\r\nHere are some general goals....\r\n\r\n- Provide for cascading closure (similar to cancellation in Go's Context)\r\n- Simple & small enough that its OK to digest on Android\r\n- Provides some simple type-safety for values but strictly limits keys to strings\r\n- Interaction with ThreadLocal tries not to be 'magical', anything attached must be explicitly detached. GRPC guarantees that it's code will be safe in this regard.\r\n- Easy to adapt to your IOC container of choice\r\n\r\n\r\n\r\nFixes https://github.com/grpc/grpc-java/issues/262","created_at":"2015-06-24T21:04:59Z","updated_at":"2015-07-14T21:45:36Z","closed_at":null,"merged_at":null,"merge_commit_sha":"af7b316bcd14182396c9df0e4782ccdd023deb99","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/grpc/grpc-java/pulls/562/commits","review_comments_url":"https://api.github.com/repos/grpc/grpc-java/pulls/562/comments","review_comment_url":"https://api.github.com/repos/grpc/grpc-java/pulls/comments{/number}","comments_url":"https://api.github.com/repos/grpc/grpc-java/issues/562/comments","statuses_url":"https://api.github.com/repos/grpc/grpc-java/statuses/cb701a1a6abe26db2f2d8861a817b304301e25b3","head":{"label":"louiscryan:ContextAPI","ref":"ContextAPI","sha":"cb701a1a6abe26db2f2d8861a817b304301e25b3","user":{"login":"louiscryan","id":9046588,"avatar_url":"https://avatars.githubusercontent.com/u/9046588?v=3","gravatar_id":"","url":"https://api.github.com/users/louiscryan","html_url":"https://github.com/louiscryan","followers_url":"https://api.github.com/users/louiscryan/followers","following_url":"https://api.github.com/users/louiscryan/following{/other_user}","gists_url":"https://api.github.com/users/louiscryan/gists{/gist_id}","starred_url":"https://api.github.com/users/louiscryan/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/louiscryan/subscriptions","organizations_url":"https://api.github.com/users/louiscryan/orgs","repos_url":"https://api.github.com/users/louiscryan/repos","events_url":"https://api.github.com/users/louiscryan/events{/privacy}","received_events_url":"https://api.github.com/users/louiscryan/received_events","type":"User","site_admin":false},"repo":{"id":31382190,"name":"grpc-java","full_name":"louiscryan/grpc-java","owner":{"login":"louiscryan","id":9046588,"avatar_url":"https://avatars.githubusercontent.com/u/9046588?v=3","gravatar_id":"","url":"https://api.github.com/users/louiscryan","html_url":"https://github.com/louiscryan","followers_url":"https://api.github.com/users/louiscryan/followers","following_url":"https://api.github.com/users/louiscryan/following{/other_user}","gists_url":"https://api.github.com/users/louiscryan/gists{/gist_id}","starred_url":"https://api.github.com/users/louiscryan/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/louiscryan/subscriptions","organizations_url":"https://api.github.com/users/louiscryan/orgs","repos_url":"https://api.github.com/users/louiscryan/repos","events_url":"https://api.github.com/users/louiscryan/events{/privacy}","received_events_url":"https://api.github.com/users/louiscryan/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/louiscryan/grpc-java","description":"The Java gRPC implementation. HTTP/2 based RPC","fork":true,"url":"https://api.github.com/repos/louiscryan/grpc-java","forks_url":"https://api.github.com/repos/louiscryan/grpc-java/forks","keys_url":"https://api.github.com/repos/louiscryan/grpc-java/keys{/key_id}","collaborators_url":"https://api.github.com/repos/louiscryan/grpc-java/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/louiscryan/grpc-java/teams","hooks_url":"https://api.github.com/repos/louiscryan/grpc-java/hooks","issue_events_url":"https://api.github.com/repos/louiscryan/grpc-java/issues/events{/number}","events_url":"https://api.github.com/repos/louiscryan/grpc-java/events","assignees_url":"https://api.github.com/repos/louiscryan/grpc-java/assignees{/user}","branches_url":"https://api.github.com/repos/louiscryan/grpc-java/branches{/branch}","tags_url":"https://api.github.com/repos/louiscryan/grpc-java/tags","blobs_url":"https://api.github.com/repos/louiscryan/grpc-java/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/louiscryan/grpc-java/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/louiscryan/grpc-java/git/refs{/sha}","trees_url":"https://api.github.com/repos/louiscryan/grpc-java/git/trees{/sha}","statuses_url":"https://api.github.com/repos/louiscryan/grpc-java/statuses/{sha}","languages_url":"https://api.github.com/repos/louiscryan/grpc-java/languages","stargazers_url":"https://api.github.com/repos/louiscryan/grpc-java/stargazers","contributors_url":"https://api.github.com/repos/louiscryan/grpc-java/contributors","subscribers_url":"https://api.github.com/repos/louiscryan/grpc-java/subscribers","subscription_url":"https://api.github.com/repos/louiscryan/grpc-java/subscription","commits_url":"https://api.github.com/repos/louiscryan/grpc-java/commits{/sha}","git_commits_url":"https://api.github.com/repos/louiscryan/grpc-java/git/commits{/sha}","comments_url":"https://api.github.com/repos/louiscryan/grpc-java/comments{/number}","issue_comment_url":"https://api.github.com/repos/louiscryan/grpc-java/issues/comments{/number}","contents_url":"https://api.github.com/repos/louiscryan/grpc-java/contents/{+path}","compare_url":"https://api.github.com/repos/louiscryan/grpc-java/compare/{base}...{head}","merges_url":"https://api.github.com/repos/louiscryan/grpc-java/merges","archive_url":"https://api.github.com/repos/louiscryan/grpc-java/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/louiscryan/grpc-java/downloads","issues_url":"https://api.github.com/repos/louiscryan/grpc-java/issues{/number}","pulls_url":"https://api.github.com/repos/louiscryan/grpc-java/pulls{/number}","milestones_url":"https://api.github.com/repos/louiscryan/grpc-java/milestones{/number}","notifications_url":"https://api.github.com/repos/louiscryan/grpc-java/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/louiscryan/grpc-java/labels{/name}","releases_url":"https://api.github.com/repos/louiscryan/grpc-java/releases{/id}","created_at":"2015-02-26T18:33:49Z","updated_at":"2015-05-01T20:01:16Z","pushed_at":"2015-07-14T17:16:15Z","git_url":"git://github.com/louiscryan/grpc-java.git","ssh_url":"git@github.com:louiscryan/grpc-java.git","clone_url":"https://github.com/louiscryan/grpc-java.git","svn_url":"https://github.com/louiscryan/grpc-java","homepage":"","size":3236,"stargazers_count":0,"watchers_count":0,"language":"Java","has_issues":false,"has_downloads":false,"has_wiki":false,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":0,"forks":0,"open_issues":0,"watchers":0,"default_branch":"master"}},"base":{"label":"grpc:master","ref":"master","sha":"652abe2f63fa6a797221cea48000ec3e662fa1e0","user":{"login":"grpc","id":7802525,"avatar_url":"https://avatars.githubusercontent.com/u/7802525?v=3","gravatar_id":"","url":"https://api.github.com/users/grpc","html_url":"https://github.com/grpc","followers_url":"https://api.github.com/users/grpc/followers","following_url":"https://api.github.com/users/grpc/following{/other_user}","gists_url":"https://api.github.com/users/grpc/gists{/gist_id}","starred_url":"https://api.github.com/users/grpc/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/grpc/subscriptions","organizations_url":"https://api.github.com/users/grpc/orgs","repos_url":"https://api.github.com/users/grpc/repos","events_url":"https://api.github.com/users/grpc/events{/privacy}","received_events_url":"https://api.github.com/users/grpc/received_events","type":"Organization","site_admin":false},"repo":{"id":27729926,"name":"grpc-java","full_name":"grpc/grpc-java","owner":{"login":"grpc","id":7802525,"avatar_url":"https://avatars.githubusercontent.com/u/7802525?v=3","gravatar_id":"","url":"https://api.github.com/users/grpc","html_url":"https://github.com/grpc","followers_url":"https://api.github.com/users/grpc/followers","following_url":"https://api.github.com/users/grpc/following{/other_user}","gists_url":"https://api.github.com/users/grpc/gists{/gist_id}","starred_url":"https://api.github.com/users/grpc/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/grpc/subscriptions","organizations_url":"https://api.github.com/users/grpc/orgs","repos_url":"https://api.github.com/users/grpc/repos","events_url":"https://api.github.com/users/grpc/events{/privacy}","received_events_url":"https://api.github.com/users/grpc/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/grpc/grpc-java","description":"The Java gRPC implementation. HTTP/2 based RPC","fork":false,"url":"https://api.github.com/repos/grpc/grpc-java","forks_url":"https://api.github.com/repos/grpc/grpc-java/forks","keys_url":"https://api.github.com/repos/grpc/grpc-java/keys{/key_id}","collaborators_url":"https://api.github.com/repos/grpc/grpc-java/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/grpc/grpc-java/teams","hooks_url":"https://api.github.com/repos/grpc/grpc-java/hooks","issue_events_url":"https://api.github.com/repos/grpc/grpc-java/issues/events{/number}","events_url":"https://api.github.com/repos/grpc/grpc-java/events","assignees_url":"https://api.github.com/repos/grpc/grpc-java/assignees{/user}","branches_url":"https://api.github.com/repos/grpc/grpc-java/branches{/branch}","tags_url":"https://api.github.com/repos/grpc/grpc-java/tags","blobs_url":"https://api.github.com/repos/grpc/grpc-java/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/grpc/grpc-java/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/grpc/grpc-java/git/refs{/sha}","trees_url":"https://api.github.com/repos/grpc/grpc-java/git/trees{/sha}","statuses_url":"https://api.github.com/repos/grpc/grpc-java/statuses/{sha}","languages_url":"https://api.github.com/repos/grpc/grpc-java/languages","stargazers_url":"https://api.github.com/repos/grpc/grpc-java/stargazers","contributors_url":"https://api.github.com/repos/grpc/grpc-java/contributors","subscribers_url":"https://api.github.com/repos/grpc/grpc-java/subscribers","subscription_url":"https://api.github.com/repos/grpc/grpc-java/subscription","commits_url":"https://api.github.com/repos/grpc/grpc-java/commits{/sha}","git_commits_url":"https://api.github.com/repos/grpc/grpc-java/git/commits{/sha}","comments_url":"https://api.github.com/repos/grpc/grpc-java/comments{/number}","issue_comment_url":"https://api.github.com/repos/grpc/grpc-java/issues/comments{/number}","contents_url":"https://api.github.com/repos/grpc/grpc-java/contents/{+path}","compare_url":"https://api.github.com/repos/grpc/grpc-java/compare/{base}...{head}","merges_url":"https://api.github.com/repos/grpc/grpc-java/merges","archive_url":"https://api.github.com/repos/grpc/grpc-java/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/grpc/grpc-java/downloads","issues_url":"https://api.github.com/repos/grpc/grpc-java/issues{/number}","pulls_url":"https://api.github.com/repos/grpc/grpc-java/pulls{/number}","milestones_url":"https://api.github.com/repos/grpc/grpc-java/milestones{/number}","notifications_url":"https://api.github.com/repos/grpc/grpc-java/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/grpc/grpc-java/labels{/name}","releases_url":"https://api.github.com/repos/grpc/grpc-java/releases{/id}","created_at":"2014-12-08T19:00:00Z","updated_at":"2015-07-14T08:29:37Z","pushed_at":"2015-07-14T21:45:22Z","git_url":"git://github.com/grpc/grpc-java.git","ssh_url":"git@github.com:grpc/grpc-java.git","clone_url":"https://github.com/grpc/grpc-java.git","svn_url":"https://github.com/grpc/grpc-java","homepage":"","size":19215,"stargazers_count":781,"watchers_count":781,"language":"Java","has_issues":true,"has_downloads":false,"has_wiki":false,"has_pages":false,"forks_count":177,"mirror_url":null,"open_issues_count":89,"forks":177,"open_issues":89,"watchers":781,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/grpc/grpc-java/pulls/562"},"html":{"href":"https://github.com/grpc/grpc-java/pull/562"},"issue":{"href":"https://api.github.com/repos/grpc/grpc-java/issues/562"},"comments":{"href":"https://api.github.com/repos/grpc/grpc-java/issues/562/comments"},"review_comments":{"href":"https://api.github.com/repos/grpc/grpc-java/pulls/562/comments"},"review_comment":{"href":"https://api.github.com/repos/grpc/grpc-java/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/grpc/grpc-java/pulls/562/commits"},"statuses":{"href":"https://api.github.com/repos/grpc/grpc-java/statuses/cb701a1a6abe26db2f2d8861a817b304301e25b3"}}}}