Package krati.store

Examples of krati.store.DataStore


            registration.unregister();
        }
    }

    public Producer createProducer() throws Exception {
        DataStore dataStore = null;
        KratiDataStoreRegistration registration = dataStoreRegistry.get(path);
        if (registration != null) {
            dataStore = registration.getDataStore();
        }
        if (dataStore == null || !dataStore.isOpen()) {
            dataStore = KratiHelper.createDataStore(path, initialCapacity, segmentFileSize, segmentFactory, hashFunction, keySerializer, valueSerializer);
            dataStoreRegistry.put(path, new KratiDataStoreRegistration(dataStore));
        }
        return new KratiProducer(this, dataStore);
    }
View Full Code Here


        }
        return new KratiProducer(this, dataStore);
    }

    public Consumer createConsumer(Processor processor) throws Exception {
        DataStore dataStore = null;
        KratiDataStoreRegistration registration = dataStoreRegistry.get(path);
        if (registration != null) {
            dataStore = registration.getDataStore();
        }
        if (dataStore == null || !dataStore.isOpen()) {
            dataStore = KratiHelper.createDataStore(path, initialCapacity, segmentFileSize, segmentFactory, hashFunction, keySerializer, valueSerializer);
            dataStoreRegistry.put(path, new KratiDataStoreRegistration(dataStore));
        }
        return new KratiConsumer(this, processor, dataStore);
    }
View Full Code Here

     * @param valueSerializer The serializer used for values,defaults to {@link org.apache.camel.component.krati.serializer.KratiDefaultSerializer}.
     * @return
     */
    public static DataStore createDataStore(String path, int initialCapacity, int segmentFileSize, SegmentFactory segmentFactory,
                                            HashFunction hashFunction, Serializer keySerializer, Serializer valueSerializer) {
        DataStore result = null;
        File homeDir = new File(path);
        homeDir.mkdirs();
        try {
            StoreConfig storeConfig = new StoreConfig(homeDir, initialCapacity);
            storeConfig.setSegmentFactory(segmentFactory);
            storeConfig.setHashFunction(hashFunction);
            storeConfig.setSegmentFileSizeMB(segmentFileSize);
            DataStore dynamicDataStore = new DynamicDataStore(storeConfig);
            result = new SerializableObjectStore(dynamicDataStore, keySerializer, valueSerializer);
        } catch (Exception e) {
            throw new RuntimeCamelException("Failed to create Krati DataStore.", e);
        }
        return result;
View Full Code Here

     * @param valueSerializer The serializer used for values,defaults to {@link org.apache.camel.component.krati.serializer.KratiDefaultSerializer}.
     * @return
     */
    public static DataStore createDataStore(String path, int initialCapacity, int segmentFileSize, SegmentFactory segmentFactory,
                                            HashFunction hashFunction, Serializer keySerializer, Serializer valueSerializer) {
        DataStore result = null;
        File homeDir = new File(path);
        homeDir.mkdirs();
        try {
            StoreConfig storeConfig = new StoreConfig(homeDir, initialCapacity);
            storeConfig.setSegmentFactory(segmentFactory);
            storeConfig.setHashFunction(hashFunction);
            storeConfig.setSegmentFileSizeMB(segmentFileSize);
            DataStore dynamicDataStore = new DynamicDataStore(storeConfig);
            result = new SerializableObjectStore(dynamicDataStore, keySerializer, valueSerializer);
        } catch (Exception e) {
            throw new RuntimeCamelException("Failed to create Krati DataStore.", e);
        }
        return result;
View Full Code Here

            registration.unregister();
        }
    }

    public Producer createProducer() throws Exception {
        DataStore dataStore = null;
        KratiDataStoreRegistration registration = dataStoreRegistry.get(path);
        if (registration != null) {
            dataStore = registration.getDataStore();
        }
        if (dataStore == null || !dataStore.isOpen()) {
            dataStore = KratiHelper.createDataStore(path, initialCapacity, segmentFileSize, segmentFactory, hashFunction, keySerializer, valueSerializer);
            dataStoreRegistry.put(path, new KratiDataStoreRegistration(dataStore));
        }
        return new KratiProducer(this, dataStore);
    }
View Full Code Here

        }
        return new KratiProducer(this, dataStore);
    }

    public Consumer createConsumer(Processor processor) throws Exception {
        DataStore dataStore = null;
        KratiDataStoreRegistration registration = dataStoreRegistry.get(path);
        if (registration != null) {
            dataStore = registration.getDataStore();
        }
        if (dataStore == null || !dataStore.isOpen()) {
            dataStore = KratiHelper.createDataStore(path, initialCapacity, segmentFileSize, segmentFactory, hashFunction, keySerializer, valueSerializer);
            dataStoreRegistry.put(path, new KratiDataStoreRegistration(dataStore));
        }
        return new KratiConsumer(this, processor, dataStore);
    }
View Full Code Here

TOP

Related Classes of krati.store.DataStore

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.