| Classes in this File | Line Coverage | Branch Coverage | Complexity | ||||
| ActualRetryCountSenseKeySpecificData |
|
| 1.0;1 |
| 1 | package org.jscsi.target.scsi.sense.senseDataDescriptor.senseKeySpecific; | |
| 2 | ||
| 3 | ||
| 4 | import java.nio.ByteBuffer; | |
| 5 | ||
| 6 | import org.jscsi.target.util.ReadWrite; | |
| 7 | ||
| 8 | ||
| 9 | /** | |
| 10 | * Actual retry count sense-key-specific data is used to communicate the number of retries of the recovery algorithm | |
| 11 | * used in attempting to recover an error or exception condition. | |
| 12 | * | |
| 13 | * @author Andreas Ergenzinger | |
| 14 | */ | |
| 15 | public final class ActualRetryCountSenseKeySpecificData extends SenseKeySpecificData { | |
| 16 | ||
| 17 | /** | |
| 18 | * The byte position of the ACTUAL RETRY COUNT field. | |
| 19 | */ | |
| 20 | private static final int ACTUAL_RETRY_COUNT_FIELD_INDEX = 1; | |
| 21 | ||
| 22 | /** | |
| 23 | * The ACTUAL RETRY COUNT field returns vendor specific information on the number of retries of the recovery | |
| 24 | * algorithm used in attempting to recover an error or exception condition. | |
| 25 | * <p> | |
| 26 | * This field should be computed in the same way as the retry count fields within the Read-Write Error Recovery mode | |
| 27 | * page. | |
| 28 | */ | |
| 29 | private final short actualRetryCount; | |
| 30 | ||
| 31 | /** | |
| 32 | * The constructor. | |
| 33 | * | |
| 34 | * @param senseKeySpecificDataValid <code>true</code> if and only if the second <i>actualRetryCount</i> parameter is | |
| 35 | * valid | |
| 36 | * @param actualRetryCount the number of performed recovery attempts | |
| 37 | */ | |
| 38 | public ActualRetryCountSenseKeySpecificData (final boolean senseKeySpecificDataValid, final int actualRetryCount) { | |
| 39 | 0 | super(senseKeySpecificDataValid); |
| 40 | 0 | this.actualRetryCount = (short) actualRetryCount; |
| 41 | 0 | } |
| 42 | ||
| 43 | @Override | |
| 44 | protected void serializeSpecificFields (final ByteBuffer byteBuffer, final int index) { | |
| 45 | 0 | ReadWrite.writeTwoByteInt(byteBuffer, actualRetryCount, index + ACTUAL_RETRY_COUNT_FIELD_INDEX); |
| 46 | 0 | } |
| 47 | ||
| 48 | } |