You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@openwhisk.apache.org by GitBox <gi...@apache.org> on 2019/01/16 05:39:52 UTC

[GitHub] upgle edited a comment on issue #4215: only nodejs and python runtime can reuse global scope variable

upgle edited a comment on issue #4215: only nodejs and python runtime can reuse global scope variable
URL: https://github.com/apache/incubator-openwhisk/issues/4215#issuecomment-454658774
 
 
   java runtime also supports global state (using static keyword) per container.
   
   _If an error occurs in the action code, global variables are not stored._
   
   ## Sample code
   
   ```java
   
   class Global {}
   
   public class Application {
       private static Global global;
       public static JsonObject main(JsonObject args) {
           if (global == null) {
               System.out.println("global is null");
               global = new Global();
           } else {
               System.out.println("global is not null");
           }
           return new JsonObject();
       }
   }
   ```

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services