public synchronized void updateMetadata(int tableId, ByteBuffer metadata)
throws TachyonException {
Pair<Integer, ByteBuffer> data = mData.get(tableId);
if (null == data) {
throw new TachyonException("The raw table " + tableId + " does not exist.");
}
if (metadata == null) {
data.setSecond(ByteBuffer.allocate(0));
} else {
if (metadata.limit() - metadata.position() >= CommonConf.get().MAX_TABLE_METADATA_BYTE) {
throw new TachyonException("Too big table metadata: " + metadata.toString());
}
ByteBuffer tMetadata = ByteBuffer.allocate(metadata.limit() - metadata.position());
tMetadata.put(metadata.array(), metadata.position(), metadata.limit() - metadata.position());
tMetadata.flip();
data.setSecond(tMetadata);