private boolean performOperation(AsynchronousFileChannel fileChannel, ByteBuffer buffer,
        DiskHealthStatus timeoutStatus, DiskHealthStatus exceptionStatus, boolean isWriting) {
      Future<Integer> result = null;
      try {
        if (isWriting) {
          result = fileChannel.write(buffer, 0);
        } else {
          result = fileChannel.read(buffer, 0);
        }
        result.get(operationTimeoutSeconds, TimeUnit.SECONDS);
        return true;
      } catch (TimeoutException e) {
        diskHealthStatus = timeoutStatus;
        logger.error("Timeout Exception occurred when operating on a file for disk healthcheck {}", disk.getMountPath(),
            e);
      } catch (Exception e) {
        diskHealthStatus = exceptionStatus;
        logger.error("Exception occurred when operating on a file for disk healthcheck {}", disk.getMountPath(), e);
      }
      if (result != null) {
        result.cancel(true);
      }
      return false;
    }
Will perform either a read or write operation on the disk while checking for exceptions and canceling the
operation if there was an exception
@param fileChannel used to perform the read/write operation
@param buffer either used to write from or read to the buffer in the respective operation
@param timeoutStatus indicate if the timeout is from reading or writing
@param exceptionStatus indicate if the other exceptions are from reading or writing
@param isWriting inform the function to either write or read with the buffer and filechannel
@return True/False to indicate if the operation completed with no issues or not
ambry-store/src/main/java/com/github/ambry/store/DiskManager.java