com.fasterxml.clustermate.service.state.NodeStateStoreHelper Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of clustermate-service Show documentation
Show all versions of clustermate-service Show documentation
Building blocks for ClusterMate-based services and servers.
package com.fasterxml.clustermate.service.state;
import java.io.File;
import com.fasterxml.clustermate.service.SharedServiceStuff;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.fasterxml.storemate.shared.IpAndPort;
import com.fasterxml.storemate.store.backend.StoreBackendBuilder;
import com.fasterxml.storemate.store.state.NodeStateStore;
public abstract class NodeStateStoreHelper
{
public static NodeStateStore defaultNodeStateStore(StoreBackendBuilder> backendBuilder,
SharedServiceStuff stuff, File metadataDir)
{
final ObjectMapper mapper = stuff.jsonMapper();
NodeStateStore nodeStates =
backendBuilder.buildNodeStateStore(metadataDir,
new JacksonBasedConverter(mapper, IpAndPort.class),
new JacksonBasedConverter(mapper, ActiveNodeState.class));
return nodeStates;
}
}