RemoteAPIInstaller doesn't install before for current thread - AppEngine Remote API Java version 1.9.64

29 views
Skip to first unread message

Baojun Xu

unread,
Jun 28, 2019, 5:22:52 AM6/28/19
to Google App Engine
Hi Please look at the following code snippet:

****
     
if (ApiProxy.getCurrentEnvironment() == null) {
       
RemoteApiInstaller installer = new RemoteApiInstaller();
       
try {
          installer
.install(remoteApiOptions);
       
} catch (IOException e) {
         
...
       
}
     
}
****


What it should do is to install the remoteApiOptions for the current thread if it's not already installed. We check ApiProxy.getCurrentEnvironment() == null to see if the current thread has remote api installed.

However this does not work all the time. Sometimes we still have errors saying the remote api is not installed. Are we doing something wrong here?

Thanks
Baojun

Nicolas (Google Cloud Platform Support)

unread,
Jul 2, 2019, 5:27:38 PM7/2/19
to Google App Engine

Hi Baojun,

 

At first glance  the code snippet provided seem to be ok, you can compare it to this example on Github to troubleshoot it.

 

As I understand the issue you are facing is intermittent so are you sure you are not sharing instances of the class RemoteApiInstaller across threads?

 

Also as your issue seems to be a specific technical issue you would have better assistance from the community by posting in StackOverflow as Google Groups is intended for general discussion


Reply all
Reply to author
Forward
0 new messages