<commit_before>package com.geekbeast.rhizome.pods.hazelcast;

import java.util.Collection;
import java.util.Map;
import java.util.concurrent.ConcurrentMap;

import com.google.common.base.Preconditions;
import com.google.common.collect.Collections2;
import com.google.common.collect.Maps;
import com.hazelcast.config.MapConfig;
import com.hazelcast.config.SerializerConfig;
import com.hazelcast.nio.serialization.Serializer;
import com.kryptnostic.rhizome.mapstores.SelfRegisteringMapStore;

public class RegistryBasedHazelcastInstanceConfigurationPod extends BaseHazelcastInstanceConfigurationPod {
    private static final ConcurrentMap<Class<?>, Serializer>                  serializerRegistry = Maps.newConcurrentMap();
    private static final ConcurrentMap<String, SelfRegisteringMapStore<?, ?>> mapRegistry        = Maps.newConcurrentMap();

    @Override
    protected Collection<SerializerConfig> getSerializerConfigs() {
        return Collections2.transform( serializerRegistry.entrySet(), e -> {
            return new SerializerConfig().setTypeClass( e.getKey() ).setImplementation( e.getValue() );
        } );
    }

    @Override
    protected Map<String, MapConfig> getMapConfigs() {
        return Maps.transformEntries( mapRegistry, ( k, v ) -> {
            return v.getMapConfig();
        } );
    }

    public static void register( String mapName, SelfRegisteringMapStore<?, ?> mapStore ) {
        Preconditions.checkArgument( mapRegistry.putIfAbsent( mapName, mapStore ) == null, "Map already registered" );
        ;
    }

    public static void register( Class<?> hzSerializableClass, Serializer serializer ) {
        Preconditions.checkArgument(
                serializerRegistry.putIfAbsent( hzSerializableClass, serializer ) == null,
                "Serializer already registered" );
        ;
    }
}<commit_msg>Need to allow multiple registrations.<commit_after>package com.geekbeast.rhizome.pods.hazelcast;

import java.util.Collection;
import java.util.Map;
import java.util.concurrent.ConcurrentMap;

import com.google.common.base.Preconditions;
import com.google.common.collect.Collections2;
import com.google.common.collect.Maps;
import com.hazelcast.config.MapConfig;
import com.hazelcast.config.SerializerConfig;
import com.hazelcast.nio.serialization.Serializer;
import com.kryptnostic.rhizome.mapstores.SelfRegisteringMapStore;

public class RegistryBasedHazelcastInstanceConfigurationPod extends BaseHazelcastInstanceConfigurationPod {
    private static final ConcurrentMap<Class<?>, Serializer>                  serializerRegistry = Maps.newConcurrentMap();
    private static final ConcurrentMap<String, SelfRegisteringMapStore<?, ?>> mapRegistry        = Maps.newConcurrentMap();

    @Override
    protected Collection<SerializerConfig> getSerializerConfigs() {
        return Collections2.transform( serializerRegistry.entrySet(), e -> {
            return new SerializerConfig().setTypeClass( e.getKey() ).setImplementation( e.getValue() );
        } );
    }

    @Override
    protected Map<String, MapConfig> getMapConfigs() {
        return Maps.transformEntries( mapRegistry, ( k, v ) -> {
            return v.getMapConfig();
        } );
    }

    public static void register( String mapName, SelfRegisteringMapStore<?, ?> mapStore ) {
        Preconditions.checkArgument( mapRegistry.putIfAbsent( mapName, mapStore ) == null, "Map already registered" );
        ;
    }

    public static void register( Class<?> hzSerializableClass, Serializer serializer ) {
        serializerRegistry.put( hzSerializableClass, serializer );
    }
}
{'fraction_non_alphanumeric': 0.09844271412680757, 'fraction_numerical': 0.0011123470522803114, 'mean_word_length': 3.9477303988995875, 'pattern_counts': {'":': 0, '<': 19, '<?xml version=': 0, '>': 23, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '836259', 'n_tokens_mistral': 993, 'n_tokens_neox': 975, 'n_words': 197}