Update the Java gPRC libraries to 0.14.1 .

This makes the regeneration instruction in much simpler (since now they do publish 64-bit Linux binaries), and more importantly, fixes a race condition between a client request and the gRPC server timeout thread.

Change-Id: I9c8b628530fa0192804f8e67b285963ac26110c4
diff --git a/scripts/bootstrap/compile.sh b/scripts/bootstrap/compile.sh
index 0c1df2a..09bb32c 100755
--- a/scripts/bootstrap/compile.sh
+++ b/scripts/bootstrap/compile.sh
@@ -41,13 +41,13 @@
   JAVA_HOME="${JAVA_HOME:-$(readlink -f $(which javac) | sed 's_/bin/javac__')}"
   if [ "${MACHINE_IS_64BIT}" = 'yes' ]; then
     PROTOC=${PROTOC:-third_party/protobuf/protoc-linux-x86_64.exe}
-    GRPC_JAVA_PLUGIN=${GRPC_JAVA_PLUGIN:-third_party/grpc/protoc-gen-grpc-java-0.13.2-linux-x86_64.exe}
+    GRPC_JAVA_PLUGIN=${GRPC_JAVA_PLUGIN:-third_party/grpc/protoc-gen-grpc-java-0.14.1-linux-x86_64.exe}
   else
     if [ "${MACHINE_IS_ARM}" = 'yes' ]; then
       PROTOC=${PROTOC:-third_party/protobuf/protoc-linux-arm32.exe}
     else
       PROTOC=${PROTOC:-third_party/protobuf/protoc-linux-x86_32.exe}
-      GRPC_JAVA_PLUGIN=${GRPC_JAVA_PLUGIN:-third_party/grpc/protoc-gen-grpc-java-0.13.2-linux-x86_32.exe}
+      GRPC_JAVA_PLUGIN=${GRPC_JAVA_PLUGIN:-third_party/grpc/protoc-gen-grpc-java-0.14.1-linux-x86_32.exe}
     fi
   fi
   ;;
@@ -59,7 +59,7 @@
   # We choose the 32-bit version for maximum compatiblity since 64-bit
   # linux binaries are only supported in FreeBSD-11.
   PROTOC=${PROTOC:-third_party/protobuf/protoc-linux-x86_32.exe}
-  GRPC_JAVA_PLUGIN=${GRPC_JAVA_PLUGIN:-third_party/grpc/protoc-gen-grpc-java-0.13.2-linux-x86_32.exe}
+  GRPC_JAVA_PLUGIN=${GRPC_JAVA_PLUGIN:-third_party/grpc/protoc-gen-grpc-java-0.14.1-linux-x86_32.exe}
   ;;
 
 darwin)
@@ -69,7 +69,7 @@
   fi
   if [ "${MACHINE_IS_64BIT}" = 'yes' ]; then
     PROTOC=${PROTOC:-third_party/protobuf/protoc-osx-x86_64.exe}
-    GRPC_JAVA_PLUGIN=${GRPC_JAVA_PLUGIN:-third_party/grpc/protoc-gen-grpc-java-0.13.2-osx-x86_64.exe}
+    GRPC_JAVA_PLUGIN=${GRPC_JAVA_PLUGIN:-third_party/grpc/protoc-gen-grpc-java-0.14.1-osx-x86_64.exe}
   else
     PROTOC=${PROTOC:-third_party/protobuf/protoc-osx-x86_32.exe}
   fi
@@ -84,10 +84,10 @@
   # We do not use the JNI library on Windows.
   if [ "${MACHINE_IS_64BIT}" = 'yes' ]; then
     PROTOC=${PROTOC:-third_party/protobuf/protoc-windows-x86_64.exe}
-    GRPC_JAVA_PLUGIN=${GRPC_JAVA_PLUGIN:-third_party/grpc/protoc-gen-grpc-java-0.13.2-windows-x86_64.exe}
+    GRPC_JAVA_PLUGIN=${GRPC_JAVA_PLUGIN:-third_party/grpc/protoc-gen-grpc-java-0.14.1-windows-x86_64.exe}
   else
     PROTOC=${PROTOC:-third_party/protobuf/protoc-windows-x86_32.exe}
-    GRPC_JAVA_PLUGIN=${GRPC_JAVA_PLUGIN:-third_party/grpc/protoc-gen-grpc-java-0.13.2-windows-x86_32.exe}
+    GRPC_JAVA_PLUGIN=${GRPC_JAVA_PLUGIN:-third_party/grpc/protoc-gen-grpc-java-0.14.1-windows-x86_32.exe}
   fi
 esac
 
diff --git a/third_party/grpc/BUILD b/third_party/grpc/BUILD
index 9693ea3..25d2a5f 100644
--- a/third_party/grpc/BUILD
+++ b/third_party/grpc/BUILD
@@ -9,22 +9,28 @@
 
 java_import(
     name = "grpc-jar",
-    jars = ["grpc-all-0.13.2.jar"],
+    jars = [
+        "grpc-netty-0.14.1.jar",
+        "grpc-protobuf-0.14.1.jar",
+        "grpc-protobuf-lite-0.14.1.jar",
+        "grpc-stub-0.14.1.jar",
+        "grpc-core-0.14.1.jar",
+    ],
     runtime_deps = ["//third_party:netty"],
 )
 
 filegroup(
     name = "grpc-java-plugin",
     srcs = select({
-        "//third_party:windows_mingw": ["protoc-gen-grpc-java-0.13.2-windows-x86_32.exe"],
-        "//third_party:windows_msys64_mingw64": ["protoc-gen-grpc-java-0.13.2-windows-x86_64.exe"],
-        "//third_party:windows_msys64": ["protoc-gen-grpc-java-0.13.2-windows-x86_64.exe"],
-        "//third_party:windows_clang": ["protoc-gen-grpc-java-0.13.2-windows-x86_64.exe"],
-        "//third_party:darwin": ["protoc-gen-grpc-java-0.13.2-osx-x86_64.exe"],
-        "//third_party:k8": ["protoc-gen-grpc-java-0.13.2-linux-x86_64.exe"],
-        "//third_party:piii": ["protoc-gen-grpc-java-0.13.2-linux-x86_32.exe"],
-        "//third_party:arm": ["protoc-gen-grpc-java-0.13.2-linux-x86_32.exe"],
-        "//third_party:freebsd": ["protoc-gen-grpc-java-0.13.2-linux-x86_32.exe"],
+        "//third_party:windows_mingw": ["protoc-gen-grpc-java-0.14.1-windows-x86_32.exe"],
+        "//third_party:windows_msys64_mingw64": ["protoc-gen-grpc-java-0.14.1-windows-x86_64.exe"],
+        "//third_party:windows_msys64": ["protoc-gen-grpc-java-0.14.1-windows-x86_64.exe"],
+        "//third_party:windows_clang": ["protoc-gen-grpc-java-0.14.1-windows-x86_64.exe"],
+        "//third_party:darwin": ["protoc-gen-grpc-java-0.14.1-osx-x86_64.exe"],
+        "//third_party:k8": ["protoc-gen-grpc-java-0.14.1-linux-x86_64.exe"],
+        "//third_party:piii": ["protoc-gen-grpc-java-0.14.1-linux-x86_32.exe"],
+        "//third_party:arm": ["protoc-gen-grpc-java-0.14.1-linux-x86_32.exe"],
+        "//third_party:freebsd": ["protoc-gen-grpc-java-0.14.1-linux-x86_32.exe"],
     }),
 )
 
diff --git a/third_party/grpc/README.bazel.md b/third_party/grpc/README.bazel.md
index 7631dd7..dc47426 100644
--- a/third_party/grpc/README.bazel.md
+++ b/third_party/grpc/README.bazel.md
@@ -11,33 +11,11 @@
 
 How to update the Java plugin:
 
-For any architecture other than 64-bit Linux, downloading it from Maven Central
-is fine. For 64-bit Linux, the plugin needs to be built statically:
-
-1. `git clone http://github.com/grpc/grpc-java`
-2. `git checkout <tag>` (current is `v0.13.2`, commithash `5933cea9`)
-3. Modify the linker args in compiler/build.gradle according to the instructions below
-4. Download the sources of protobuf (see `third_party/protobuf/README.md`) and compile it
-5. `export LDFLAGS=<protobuf dir>/src/.libs`
-6. `export CXXFLAGS=<protobuf dir>/src`
-7. `cd compiler; ../gradlew java_pluginExecutable`
-
-In `compiler/build.gradle`, this list of linker arguments:
-
-```
-          linker.args "-Wl,-Bstatic", "-lprotoc", "-lprotobuf", "-static-libgcc",
-                      "-static-libstdc++",
-                      "-Wl,-Bdynamic", "-lpthread", "-s"
-```
-
-needs to be replaced with this:
-
-```
-          linker.args "-Wl,-Bstatic", "-lprotoc", "-lprotobuf", "-static-libgcc",
-                      "-static-libstdc++",
-                      "-lpthread", "-lc", "-s", "-static"
-```
+Download it from Maven central. The project is called `protoc-gen-grpc-java`
+and the version is `0.14.1` .
 
 How to update the Java code:
 
-Simply download from Maven Central.
+Download it from Maven central. The jars are called `grpc-core`, `grpc-netty`,
+`grpc-protobuf`, `grpc-protobuf-lite`, `grpc-stub` and the version is
+`0.14.`.
diff --git a/third_party/grpc/grpc-all-0.13.2.jar b/third_party/grpc/grpc-all-0.13.2.jar
deleted file mode 100644
index 71ed77e..0000000
--- a/third_party/grpc/grpc-all-0.13.2.jar
+++ /dev/null
Binary files differ
diff --git a/third_party/grpc/grpc-core-0.14.1.jar b/third_party/grpc/grpc-core-0.14.1.jar
new file mode 100644
index 0000000..75cc8fc
--- /dev/null
+++ b/third_party/grpc/grpc-core-0.14.1.jar
Binary files differ
diff --git a/third_party/grpc/grpc-netty-0.14.1.jar b/third_party/grpc/grpc-netty-0.14.1.jar
new file mode 100644
index 0000000..31f493e
--- /dev/null
+++ b/third_party/grpc/grpc-netty-0.14.1.jar
Binary files differ
diff --git a/third_party/grpc/grpc-protobuf-0.14.1.jar b/third_party/grpc/grpc-protobuf-0.14.1.jar
new file mode 100644
index 0000000..5566474
--- /dev/null
+++ b/third_party/grpc/grpc-protobuf-0.14.1.jar
Binary files differ
diff --git a/third_party/grpc/grpc-protobuf-lite-0.14.1.jar b/third_party/grpc/grpc-protobuf-lite-0.14.1.jar
new file mode 100644
index 0000000..1b79382
--- /dev/null
+++ b/third_party/grpc/grpc-protobuf-lite-0.14.1.jar
Binary files differ
diff --git a/third_party/grpc/grpc-stub-0.14.1.jar b/third_party/grpc/grpc-stub-0.14.1.jar
new file mode 100644
index 0000000..c281b59
--- /dev/null
+++ b/third_party/grpc/grpc-stub-0.14.1.jar
Binary files differ
diff --git a/third_party/grpc/protoc-gen-grpc-java-0.13.2-linux-x86_32.exe b/third_party/grpc/protoc-gen-grpc-java-0.13.2-linux-x86_32.exe
deleted file mode 100755
index 9dbd553..0000000
--- a/third_party/grpc/protoc-gen-grpc-java-0.13.2-linux-x86_32.exe
+++ /dev/null
Binary files differ
diff --git a/third_party/grpc/protoc-gen-grpc-java-0.13.2-linux-x86_64.exe b/third_party/grpc/protoc-gen-grpc-java-0.13.2-linux-x86_64.exe
deleted file mode 100755
index 93904a2..0000000
--- a/third_party/grpc/protoc-gen-grpc-java-0.13.2-linux-x86_64.exe
+++ /dev/null
Binary files differ
diff --git a/third_party/grpc/protoc-gen-grpc-java-0.13.2-osx-x86_64.exe b/third_party/grpc/protoc-gen-grpc-java-0.13.2-osx-x86_64.exe
deleted file mode 100755
index 6054fac..0000000
--- a/third_party/grpc/protoc-gen-grpc-java-0.13.2-osx-x86_64.exe
+++ /dev/null
Binary files differ
diff --git a/third_party/grpc/protoc-gen-grpc-java-0.13.2-windows-x86_32.exe b/third_party/grpc/protoc-gen-grpc-java-0.13.2-windows-x86_32.exe
deleted file mode 100755
index b03994b..0000000
--- a/third_party/grpc/protoc-gen-grpc-java-0.13.2-windows-x86_32.exe
+++ /dev/null
Binary files differ
diff --git a/third_party/grpc/protoc-gen-grpc-java-0.13.2-windows-x86_64.exe b/third_party/grpc/protoc-gen-grpc-java-0.13.2-windows-x86_64.exe
deleted file mode 100755
index 5f720af..0000000
--- a/third_party/grpc/protoc-gen-grpc-java-0.13.2-windows-x86_64.exe
+++ /dev/null
Binary files differ
diff --git a/third_party/grpc/protoc-gen-grpc-java-0.14.1-linux-x86_32.exe b/third_party/grpc/protoc-gen-grpc-java-0.14.1-linux-x86_32.exe
new file mode 100755
index 0000000..9cf43ca
--- /dev/null
+++ b/third_party/grpc/protoc-gen-grpc-java-0.14.1-linux-x86_32.exe
Binary files differ
diff --git a/third_party/grpc/protoc-gen-grpc-java-0.14.1-linux-x86_64.exe b/third_party/grpc/protoc-gen-grpc-java-0.14.1-linux-x86_64.exe
new file mode 100755
index 0000000..93469d4
--- /dev/null
+++ b/third_party/grpc/protoc-gen-grpc-java-0.14.1-linux-x86_64.exe
Binary files differ
diff --git a/third_party/grpc/protoc-gen-grpc-java-0.14.1-osx-x86_64.exe b/third_party/grpc/protoc-gen-grpc-java-0.14.1-osx-x86_64.exe
new file mode 100755
index 0000000..fdade4c
--- /dev/null
+++ b/third_party/grpc/protoc-gen-grpc-java-0.14.1-osx-x86_64.exe
Binary files differ
diff --git a/third_party/grpc/protoc-gen-grpc-java-0.14.1-windows-x86_32.exe b/third_party/grpc/protoc-gen-grpc-java-0.14.1-windows-x86_32.exe
new file mode 100644
index 0000000..682a5bd
--- /dev/null
+++ b/third_party/grpc/protoc-gen-grpc-java-0.14.1-windows-x86_32.exe
Binary files differ
diff --git a/third_party/grpc/protoc-gen-grpc-java-0.14.1-windows-x86_64.exe b/third_party/grpc/protoc-gen-grpc-java-0.14.1-windows-x86_64.exe
new file mode 100644
index 0000000..b7352ce
--- /dev/null
+++ b/third_party/grpc/protoc-gen-grpc-java-0.14.1-windows-x86_64.exe
Binary files differ