mirror of https://github.com/grpc/grpc-java.git
Avoid request threads on AppEngine Java 8
While the code had correctly determined full threads were available, the call to MoreExecutors returned a request thread factory, which has limitations. Note that Async stub users may not be able to call GAE APIs in callbacks. This is because the threads aren't request threads. They can override the individual call's executor with com.google.appengine.api.ThreadManager.currentRequestThreadFactory() in an interceptor via callOptions.withExecutor(). Fixes #3296
This commit is contained in:
parent
23dfc84ccf
commit
521c55e9bd
|
|
@ -482,12 +482,10 @@ public final class GrpcUtil {
|
|||
* @return a {@link ThreadFactory}.
|
||||
*/
|
||||
public static ThreadFactory getThreadFactory(String nameFormat, boolean daemon) {
|
||||
ThreadFactory threadFactory = MoreExecutors.platformThreadFactory();
|
||||
if (IS_RESTRICTED_APPENGINE) {
|
||||
return threadFactory;
|
||||
return MoreExecutors.platformThreadFactory();
|
||||
} else {
|
||||
return new ThreadFactoryBuilder()
|
||||
.setThreadFactory(threadFactory)
|
||||
.setDaemon(daemon)
|
||||
.setNameFormat(nameFormat)
|
||||
.build();
|
||||
|
|
|
|||
Loading…
Reference in New Issue