Search in sources :

Example 86 with VoldemortException

use of voldemort.VoldemortException in project voldemort by voldemort.

the class HttpService method stopInner.

@Override
public void stopInner() {
    try {
        if (httpServer != null) {
            httpServer.stop();
            for (Connector c : httpServer.getConnectors()) {
                c.close();
            }
        }
        if (context != null)
            context.destroy();
    } catch (Exception e) {
        throw new VoldemortException(e);
    }
    this.httpServer = null;
    this.context = null;
}
Also used : Connector(org.mortbay.jetty.Connector) SelectChannelConnector(org.mortbay.jetty.nio.SelectChannelConnector) VoldemortException(voldemort.VoldemortException) VoldemortException(voldemort.VoldemortException)

Example 87 with VoldemortException

use of voldemort.VoldemortException in project voldemort by voldemort.

the class ReadOnlyStoreManagementServlet method setFetcherClass.

private void setFetcherClass(VoldemortServer server) {
    String className = server.getVoldemortConfig().getAllProps().getString("file.fetcher.class", null);
    if (className == null || className.trim().length() == 0) {
        this.fileFetcher = null;
    } else {
        try {
            logger.info("Loading fetcher " + className);
            Class<?> cls = Class.forName(className.trim());
            this.fileFetcher = (FileFetcher) ReflectUtils.callConstructor(cls, new Class<?>[] { VoldemortConfig.class }, new Object[] { server.getVoldemortConfig() });
        } catch (Exception e) {
            throw new VoldemortException("Error loading file fetcher class " + className, e);
        }
    }
}
Also used : VoldemortException(voldemort.VoldemortException) ServletException(javax.servlet.ServletException) VoldemortException(voldemort.VoldemortException) IOException(java.io.IOException)

Example 88 with VoldemortException

use of voldemort.VoldemortException in project voldemort by voldemort.

the class SchemaEvolutionValidator method validateAllAvroSchemas.

/**
     * Given an AVRO serializer definition, validates if all the avro schemas
     * are valid i.e parseable.
     * 
     * @param avroSerDef
     */
public static void validateAllAvroSchemas(SerializerDefinition avroSerDef) {
    Map<Integer, String> schemaVersions = avroSerDef.getAllSchemaInfoVersions();
    if (schemaVersions.size() < 1) {
        throw new VoldemortException("No schema specified");
    }
    for (Map.Entry<Integer, String> entry : schemaVersions.entrySet()) {
        Integer schemaVersionNumber = entry.getKey();
        String schemaStr = entry.getValue();
        try {
            Schema.parse(schemaStr);
        } catch (Exception e) {
            throw new VoldemortException("Unable to parse Avro schema version :" + schemaVersionNumber + ", schema string :" + schemaStr);
        }
    }
}
Also used : VoldemortException(voldemort.VoldemortException) Map(java.util.Map) VoldemortException(voldemort.VoldemortException)

Example 89 with VoldemortException

use of voldemort.VoldemortException in project voldemort by voldemort.

the class StoreRepository method addNodeStore.

public void addNodeStore(int nodeId, Store<ByteArray, byte[], byte[]> store) {
    Pair<String, Integer> key = Pair.create(store.getName(), nodeId);
    Store<ByteArray, byte[], byte[]> found = this.nodeStores.putIfAbsent(key, store);
    if (found != null)
        throw new VoldemortException("Store '" + store.getName() + "' for node " + nodeId + " has already been initialized.");
}
Also used : ByteArray(voldemort.utils.ByteArray) VoldemortException(voldemort.VoldemortException)

Example 90 with VoldemortException

use of voldemort.VoldemortException in project voldemort by voldemort.

the class WriteThroughCache method put.

/**
     * Updates the value in HashMap and writeBack as Atomic step
     */
@Override
public synchronized V put(K key, V value) {
    V oldValue = this.get(key);
    try {
        super.put(key, value);
        writeBack(key, value);
        return oldValue;
    } catch (Exception e) {
        super.put(key, oldValue);
        writeBack(key, oldValue);
        throw new VoldemortException("Failed to put(" + key + ", " + value + ") in write through cache", e);
    }
}
Also used : VoldemortException(voldemort.VoldemortException) VoldemortException(voldemort.VoldemortException)

Aggregations

VoldemortException (voldemort.VoldemortException)247 IOException (java.io.IOException)63 ByteArray (voldemort.utils.ByteArray)52 File (java.io.File)46 Node (voldemort.cluster.Node)42 StoreDefinition (voldemort.store.StoreDefinition)39 Versioned (voldemort.versioning.Versioned)38 ArrayList (java.util.ArrayList)34 Test (org.junit.Test)30 ObsoleteVersionException (voldemort.versioning.ObsoleteVersionException)26 List (java.util.List)21 HashMap (java.util.HashMap)20 Cluster (voldemort.cluster.Cluster)20 VectorClock (voldemort.versioning.VectorClock)16 NoSuchCapabilityException (voldemort.store.NoSuchCapabilityException)15 ReadOnlyStorageEngine (voldemort.store.readonly.ReadOnlyStorageEngine)14 ExecutionException (java.util.concurrent.ExecutionException)13 StoreDefinitionsMapper (voldemort.xml.StoreDefinitionsMapper)13 Map (java.util.Map)12 Path (org.apache.hadoop.fs.Path)12