code: public Memory getNodeMemory(MemoryFactory node, InternalWorkingMemory wm) {
          if( node.getMemoryId() >= this.memories.length() ) {
              resize( node );
          }
          Memory memory = this.memories.get( node.getMemoryId() );
  
          if( memory == null ) {
              memory = createNodeMemory( node, wm );
          }
  
          return memory;
      }
docs: The implementation tries to delay locking as much as possible, by running
  some potentially unsafe operations out of the critical session. In case it
  fails the checks, it will move into the critical sessions and re-check everything
  before effectively doing any change on data structures.