Search in sources :

Example 1 with IndexException

use of com.b2international.index.IndexException in project snow-owl by b2ihealthcare.

the class EsClientBase method checkClusterHealth.

private ClusterHealthResponse checkClusterHealth(ClusterHealthResponse previousHealth) {
    try {
        log.info("Checking cluster health at '{}'...", host.toURI());
        ClusterHealthRequest req = new ClusterHealthRequest();
        req.level(Level.INDICES);
        // The default indices options (IndicesOptions.lenientExpandHidden()) returns all indices including system or hidden.
        // It is not possible to determine if a hidden index is read only or not.
        // This leads to the isIndexReadOnly() method waiting 60 seconds for each hidden index, eventually causing requests to be stalled.
        req.indicesOptions(IndicesOptions.lenientExpand());
        return cluster().health(req);
    } catch (IOException e) {
        throw new IndexException("Failed to get cluster health", e);
    }
}
Also used : IndexException(com.b2international.index.IndexException) ClusterHealthRequest(org.elasticsearch.action.admin.cluster.health.ClusterHealthRequest) IOException(java.io.IOException)

Example 2 with IndexException

use of com.b2international.index.IndexException in project snow-owl by b2ihealthcare.

the class DecimalUtils method encode.

// Convert to keyword-safe representation that preserves ordering
public static String encode(BigDecimal val) {
    if (val == null) {
        return null;
    }
    final SimplePositionedMutableByteRange dst = new SimplePositionedMutableByteRange(PRECISION);
    final int writtenBytes = OrderedBytes.encodeNumeric(dst, val, Order.ASCENDING);
    try {
        return Base64.encodeBytes(dst.getBytes(), 0, writtenBytes, Base64.ORDERED);
    } catch (IOException e) {
        throw new IndexException("Couldn't convert ordered binary representation of BigDecimal value to Base64.", e);
    }
}
Also used : IndexException(com.b2international.index.IndexException) SimplePositionedMutableByteRange(org.apache.hadoop.hbase.util.SimplePositionedMutableByteRange) IOException(java.io.IOException)

Example 3 with IndexException

use of com.b2international.index.IndexException in project snow-owl by b2ihealthcare.

the class OntologyChangeWriter method indexChange.

protected void indexChange(final Object doc) {
    writer.put(doc);
    writeOps++;
    if (writeOps > WRITES_PER_COMMIT) {
        try {
            writer.commit();
        } catch (final IOException e) {
            throw new IndexException(String.format("Failed to index classification changes for ID '%s'.", classificationId), e);
        }
        writeOps = 0;
    }
}
Also used : IndexException(com.b2international.index.IndexException) IOException(java.io.IOException)

Example 4 with IndexException

use of com.b2international.index.IndexException in project snow-owl by b2ihealthcare.

the class DecimalUtils method decode.

public static BigDecimal decode(String val) {
    if (val == null) {
        return null;
    }
    final byte[] rawBytes;
    try {
        // Convert from keyword-safe representation to raw bytes
        rawBytes = Base64.decode(val, Base64.ORDERED);
    } catch (IOException e) {
        throw new IndexException("Couldn't convert Base64 representation of BigDecimal value to raw bytes.", e);
    }
    SimplePositionedMutableByteRange src = new SimplePositionedMutableByteRange(rawBytes);
    return OrderedBytes.decodeNumericAsBigDecimal(src);
}
Also used : IndexException(com.b2international.index.IndexException) SimplePositionedMutableByteRange(org.apache.hadoop.hbase.util.SimplePositionedMutableByteRange) IOException(java.io.IOException)

Example 5 with IndexException

use of com.b2international.index.IndexException in project snow-owl by b2ihealthcare.

the class DecimalUtils method decode.

public static BigDecimal decode(byte[] bytes, int offset, int length) {
    final byte[] rawBytes;
    try {
        // Convert from keyword-safe representation to raw bytes
        rawBytes = Base64.decode(bytes, offset, length, Base64.ORDERED);
    } catch (IOException e) {
        throw new IndexException("Couldn't convert Base64 representation of BigDecimal value to raw bytes.", e);
    }
    SimplePositionedMutableByteRange src = new SimplePositionedMutableByteRange(rawBytes);
    return OrderedBytes.decodeNumericAsBigDecimal(src);
}
Also used : IndexException(com.b2international.index.IndexException) SimplePositionedMutableByteRange(org.apache.hadoop.hbase.util.SimplePositionedMutableByteRange) IOException(java.io.IOException)

Aggregations

IndexException (com.b2international.index.IndexException)6 IOException (java.io.IOException)5 SimplePositionedMutableByteRange (org.apache.hadoop.hbase.util.SimplePositionedMutableByteRange)3 CycleDetectedException (com.b2international.commons.exceptions.CycleDetectedException)1 SnowowlRuntimeException (com.b2international.snowowl.core.api.SnowowlRuntimeException)1 DatastoreLockContext (com.b2international.snowowl.core.internal.locks.DatastoreLockContext)1 DatastoreLockTarget (com.b2international.snowowl.core.internal.locks.DatastoreLockTarget)1 IOperationLockManager (com.b2international.snowowl.core.locks.IOperationLockManager)1 Locks (com.b2international.snowowl.core.locks.Locks)1 ClusterHealthRequest (org.elasticsearch.action.admin.cluster.health.ClusterHealthRequest)1