* @throws InvalidRecordLocationException
* @throws IOException
*/
public byte[] read(final RecordLocationImpl location) throws IOException, InvalidRecordLocationException {
// Run this in the queued executor thread.
final FutureResult result = new FutureResult();
try {
executor.execute(new Runnable() {
public void run() {
try {
result.set( queuedRead(location) );
} catch (Throwable e) {
result.setException(e);
}
}
});
return (byte[])result.get();
} catch (InterruptedException e) {
throw (IOException)new IOException("Interrupted.").initCause(e);
} catch (InvocationTargetException e) {
if( e.getTargetException() instanceof InvalidRecordLocationException)
throw new InvalidRecordLocationException(e.getTargetException().getMessage(),e.getTargetException());