119120121122123124125126127128129
//Acquire/release the read/write lock based on parameters try{ if(type == 'R'){ if(op == 'A'){ lock.readLock().acquire(); }else{ lock.readLock().release(); } }else{ if(op == 'A'){
121122123124125126127128129130131
try{ if(type == 'R'){ if(op == 'A'){ lock.readLock().acquire(); }else{ lock.readLock().release(); } }else{ if(op == 'A'){ lock.writeLock().acquire(); }else{