1 21 22 package org.apache.derby.iapi.store.raw; 23 24 34 35 public final class RowLock { 36 37 private final int type; 38 39 private static String [] shortnames = { "S", "S", "U", "U", "X", "X", "X", "X" }; 41 42 43 public static final RowLock RS2 = new RowLock(0); 44 45 public static final RowLock RS3 = new RowLock(1); 46 47 public static final RowLock RU2 = new RowLock(2); 48 49 public static final RowLock RU3 = new RowLock(3); 50 51 public static final RowLock RIP = new RowLock(4); 52 53 public static final RowLock RI = new RowLock(5); 54 55 public static final RowLock RX2 = new RowLock(6); 56 57 public static final RowLock RX3 = new RowLock(7); 58 59 60 public static final int R_NUMBER = 8; 61 62 63 public static final boolean[][] R_COMPAT = { 64 {true, true, true, true, true, false, false, false }, 68 {true, true, true, true, false, false, false, false }, 69 {true, true, false, false, true, false, false, false }, 70 {true, true, false, false, false, false, false, false }, 71 {true, false, true, false, true, true , true, false }, 72 {false, false, false, false, true, false, false, false }, 73 {false, false, false, false, true, false, false, false }, 74 {false, false, false, false, false, false, false, false } 75 }; 76 77 78 public static final String DIAG_INDEX = "index"; 79 public static final String DIAG_XACTID = "xactid"; 80 public static final String DIAG_LOCKTYPE = "locktype"; 81 public static final String DIAG_LOCKMODE = "lockmode"; 82 public static final String DIAG_CONGLOMID = "conglomId"; 83 public static final String DIAG_CONTAINERID = "containerId"; 84 public static final String DIAG_SEGMENTID = "segmentId"; 85 public static final String DIAG_PAGENUM = "pageNum"; 86 public static final String DIAG_RECID = "RecId"; 87 public static final String DIAG_COUNT = "count"; 88 public static final String DIAG_GROUP = "group"; 89 public static final String DIAG_STATE = "state"; 90 91 private RowLock(int type) { 92 this.type = type; 93 } 94 95 101 public int getType() { 102 return type; 103 } 104 105 public boolean isCompatible(RowLock granted) { 106 107 return isCompatible(granted.getType()); 108 } 109 110 public boolean isCompatible(int granted) { 111 112 return R_COMPAT[getType()][granted]; 113 } 114 115 public String toString() 116 { 117 return shortnames[getType()]; 118 } 119 } 120 | Popular Tags |