Choose the decision supported by each API contract. These are local self-check questions.
Read the lessons
- Java FileChannel.write: finish the buffer before reporting success
- Java positioned FileChannel.read: detect a short record without moving the cursor
- Java FileChannel.transferTo: verify the byte count on every pass
- Java FileChannel.force: distinguish written bytes from forced storage
- Java FileLock: coordinate one byte range with a shared protocol
- Java FileChannel.truncate: cut only after validating the recovery offset
- Java AsynchronousFileChannel: own the buffer through completion
- Java ThreadMXBean deadlocks: diagnose platform-thread cycles
- Java ThreadMXBean CPU time: check support and the disabled state
- Java MemoryMXBean: read used, committed, and an optional maximum
- Java ClassLoadingMXBean: separate live classes from lifetime totals
Common Mistakes
Do not mistake a partial I/O result or one runtime sample for a complete system guarantee.
