All Downloads are FREE. Search and download functionalities are using the official Maven repository.

brainslug.flow.execution.impl.HashMapPropertyStore Maven / Gradle / Ivy

There is a newer version: 0.21
Show newest version
package brainslug.flow.execution.impl;

import brainslug.flow.execution.ExecutionProperties;
import brainslug.flow.execution.PropertyStore;
import brainslug.flow.model.Identifier;
import brainslug.util.Option;

import java.util.Collections;
import java.util.HashMap;
import java.util.Map;

public class HashMapPropertyStore implements PropertyStore {

  Map, ExecutionProperties> propertiesByInstance = Collections.synchronizedMap(new HashMap, ExecutionProperties>());

  @Override
  public void storeProperties(Identifier instanceId, ExecutionProperties properties) {
    propertiesByInstance.put(instanceId, properties);
  }

  @Override
  public ExecutionProperties loadProperties(Identifier instanceId) {
    return Option.of(propertiesByInstance.get(instanceId)).orElse(new ExecutionProperties());
  }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy