private URI createURI(String str) { try { return new URI(str); } catch (URISyntaxException e) { throw new FlinkRuntimeException("Error in s3 aws URI - " + str, e); } } }
@Override public void status() { try { iterator.status(); } catch (RocksDBException ex) { throw new FlinkRuntimeException("Internal exception found in RocksDB", ex); } }
private void addToRocksDB(@Nonnull byte[] toAddBytes) { try { batchWrapper.put(columnFamilyHandle, toAddBytes, DUMMY_BYTES); } catch (RocksDBException e) { throw new FlinkRuntimeException(e); } }
/** * Creates a hint for the generic type in the class signature. */ public TypeHint() { try { this.typeInfo = TypeExtractor.createTypeInfo( this, TypeHint.class, getClass(), 0); } catch (InvalidTypesException e) { throw new FlinkRuntimeException("The TypeHint is using a generic variable." + "This is not supported, generic types must be fully specified for the TypeHint."); } }
/** * @return same as {@link #get()} but throws a {@link FlinkRuntimeException}. */ public T getUnchecked() throws FlinkRuntimeException { if (value != null) { return value; } checkNotNull(failureCause); throw new FlinkRuntimeException(failureCause); }
/** * Ensures that recent writes are flushed and reflect in the RocksDB instance. */ private void flushWriteBatch() { try { batchWrapper.flush(); } catch (RocksDBException e) { throw new FlinkRuntimeException(e); } }
@Nonnull private E deserializeElement(@Nonnull byte[] bytes) { try { final int numPrefixBytes = groupPrefixBytes.length; inputView.setBuffer(bytes, numPrefixBytes, bytes.length - numPrefixBytes); return byteOrderProducingSerializer.deserialize(inputView); } catch (IOException e) { throw new FlinkRuntimeException("Error while deserializing the element.", e); } }
@Override protected Object getField(@Nonnull ValueWithTs<?> value, int index) { switch (index) { case 0: return value.getValue(); case 1: return value.getTimestamp(); default: throw new FlinkRuntimeException("Unexpected field index for ValueWithTs"); } }
@Override public void clear() { try { backend.db.delete(columnFamily, writeOptions, serializeCurrentKeyWithGroupAndNamespace()); } catch (RocksDBException e) { throw new FlinkRuntimeException("Error while removing entry from RocksDB", e); } }
void updateInternal(byte[] key, SV valueToStore) { try { // write the new value to RocksDB backend.db.put(columnFamily, writeOptions, key, getValueBytes(valueToStore)); } catch (RocksDBException e) { throw new FlinkRuntimeException("Error while adding value to RocksDB", e); } } }
private boolean isNull(byte[] value) { try { div.setBuffer(value, 0, 1); return div.readBoolean(); } catch (IOException e) { throw new FlinkRuntimeException("Failed to deserialize boolean flag of map user null value", e); } }
@Override @SuppressWarnings("unchecked") public byte[] serialize(PyObject element) { if (this.schema == null) { try { this.schema = SerializationUtils.deserializeObject(this.serSchema); } catch (Exception e) { throw new FlinkRuntimeException("Schema could not be deserialized.", e); } } return this.schema.serialize(element); } }
private boolean isStartState(ComputationState state) { State<T> stateObject = getState(state); if (stateObject == null) { throw new FlinkRuntimeException("State " + state.getCurrentStateName() + " does not exist in the NFA. NFA has states " + states.values()); } return stateObject.isStart(); }
private boolean isFinalState(ComputationState state) { State<T> stateObject = getState(state); if (stateObject == null) { throw new FlinkRuntimeException("State " + state.getCurrentStateName() + " does not exist in the NFA. NFA has states " + states.values()); } return stateObject.isFinal(); }
@Nonnull private byte[] createKeyGroupBytes(int keyGroupId, int numPrefixBytes) { outputView.clear(); try { RocksDBKeySerializationUtils.writeKeyGroup(keyGroupId, numPrefixBytes, outputView); } catch (IOException e) { throw new FlinkRuntimeException("Could not write key-group bytes.", e); } return outputView.getCopyOfBuffer(); }
private boolean isStopState(ComputationState state) { State<T> stateObject = getState(state); if (stateObject == null) { throw new FlinkRuntimeException("State " + state.getCurrentStateName() + " does not exist in the NFA. NFA has states " + states.values()); } return stateObject.isStop(); }
@Nonnull private byte[] serializeElement(@Nonnull E element) { try { outputView.clear(); outputView.write(groupPrefixBytes); byteOrderProducingSerializer.serialize(element, outputView); return outputView.getCopyOfBuffer(); } catch (IOException e) { throw new FlinkRuntimeException("Error while serializing the element.", e); } }
SV getInternal(byte[] key) { try { byte[] valueBytes = backend.db.get(columnFamily, key); if (valueBytes == null) { return null; } dataInputView.setBuffer(valueBytes); return valueSerializer.deserialize(dataInputView); } catch (IOException | RocksDBException e) { throw new FlinkRuntimeException("Error while retrieving data from RocksDB", e); } }
@Override public List<V> getInternal() { try { byte[] key = serializeCurrentKeyWithGroupAndNamespace(); byte[] valueBytes = backend.db.get(columnFamily, key); return deserializeList(valueBytes); } catch (RocksDBException e) { throw new FlinkRuntimeException("Error while retrieving data from RocksDB", e); } }
private void checkRefillCacheFromStore() { if (!allElementsInCache && orderedCache.isEmpty()) { try (final RocksBytesIterator iterator = orderedBytesIterator()) { orderedCache.bulkLoadFromOrderedIterator(iterator); allElementsInCache = !iterator.hasNext(); } catch (Exception e) { throw new FlinkRuntimeException("Exception while refilling store from iterator.", e); } } }