code: public static void setGlobals(Message message, KnowledgeOperation operation, KnowledgeRuntimeEngine runtime, boolean singleton) {
          Globals globals = runtime.getSessionGlobals();
          if (globals != null) {
              Map<String, Object> globalsMap = new HashMap<String, Object>();
              globalsMap.put(GLOBALS, new ConcurrentHashMap<String, Object>());
              Map<String, Object> expressionMap = getMap(message, operation.getGlobalExpressionMappings(), null);
              if (expressionMap != null) {
                  globalsMap.putAll(expressionMap);
              }
              for (Entry<String, Object> globalsEntry : globalsMap.entrySet()) {
                  if (!singleton) {
                      globals.set(globalsEntry.getKey(), globalsEntry.getValue());
                  } else {
                      if (globals.get(globalsEntry.getKey()) == null
                          || (globalsEntry.getValue() != null && (globalsEntry.getValue() instanceof Map && !((Map)globalsEntry.getValue()).isEmpty()))) {
                          globals.set(globalsEntry.getKey(), globalsEntry.getValue());
                      }
                  }
              }
          }
      }
docs: Sets the globals.
  
  @param message the message
  @param operation the operation
  @param runtime the runtime engine
  @param singleton singleton