Search in sources :

Example 1 with DataReplicatedRecordStore

use of com.hazelcast.replicatedmap.impl.record.DataReplicatedRecordStore in project hazelcast by hazelcast.

the class PartitionContainer method buildConstructorFunction.

private ConstructorFunction<String, ReplicatedRecordStore> buildConstructorFunction() {
    return new ConstructorFunction<String, ReplicatedRecordStore>() {

        @Override
        public ReplicatedRecordStore createNew(String name) {
            ReplicatedMapConfig replicatedMapConfig = service.getReplicatedMapConfig(name);
            InMemoryFormat inMemoryFormat = replicatedMapConfig.getInMemoryFormat();
            AbstractReplicatedRecordStore replicatedRecordStorage = null;
            switch(inMemoryFormat) {
                case OBJECT:
                    replicatedRecordStorage = new ObjectReplicatedRecordStorage(name, service, partitionId);
                    break;
                case BINARY:
                    replicatedRecordStorage = new DataReplicatedRecordStore(name, service, partitionId);
                    break;
                case NATIVE:
                    throw new IllegalStateException("Native memory not yet supported for replicated map");
                default:
                    throw new IllegalStateException("Unhandled in memory format:" + inMemoryFormat);
            }
            return replicatedRecordStorage;
        }
    };
}
Also used : AbstractReplicatedRecordStore(com.hazelcast.replicatedmap.impl.record.AbstractReplicatedRecordStore) ReplicatedMapConfig(com.hazelcast.config.ReplicatedMapConfig) ObjectReplicatedRecordStorage(com.hazelcast.replicatedmap.impl.record.ObjectReplicatedRecordStorage) ConstructorFunction(com.hazelcast.util.ConstructorFunction) InMemoryFormat(com.hazelcast.config.InMemoryFormat) DataReplicatedRecordStore(com.hazelcast.replicatedmap.impl.record.DataReplicatedRecordStore)

Aggregations

InMemoryFormat (com.hazelcast.config.InMemoryFormat)1 ReplicatedMapConfig (com.hazelcast.config.ReplicatedMapConfig)1 AbstractReplicatedRecordStore (com.hazelcast.replicatedmap.impl.record.AbstractReplicatedRecordStore)1 DataReplicatedRecordStore (com.hazelcast.replicatedmap.impl.record.DataReplicatedRecordStore)1 ObjectReplicatedRecordStorage (com.hazelcast.replicatedmap.impl.record.ObjectReplicatedRecordStorage)1 ConstructorFunction (com.hazelcast.util.ConstructorFunction)1