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);
}
}
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);
}
}
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;
}
}
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);
}
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);
}
Aggregations