public class LockServerThread.LockServerRecord extends Object
Modifier and Type | Class and Description |
---|---|
class |
LockServerThread.LockServerRecord.LockEntry |
class |
LockServerThread.LockServerRecord.ReservationEntry |
Constructor and Description |
---|
LockServerRecord(String location) |
Modifier and Type | Method and Description |
---|---|
boolean |
addLockEntry(long lockId,
LockType lockType,
long expirationTime) |
LockResult |
addReservationEntry(LockType lockType,
long reservationExpirationTime,
boolean addFirst) |
boolean |
containsValidOrExpiredLock(long validationTime)
Finds out if entries contains valid lock entry in comparison to time
expiration or if there is any expired write or read lock (that means
thread crashed and index is in incosistent state).
|
boolean |
containsValidReservation(long now)
Checks reservation for a valid one.
|
LockServerThread.LockServerRecord.LockEntry |
getFirstLockEntry(long validationTime)
Either set of read locks is present or one single write lock, so this
method returns a fine representant.
|
LockServerThread.LockServerRecord.LockEntry |
getLockEntryWithId(long lockId) |
long |
getLockExpirationTime() |
int |
indexOfReservation(long reservationId,
LockType lockType) |
boolean |
isWLReservationPreceedingThisOne(int reservationIndex)
Checks if there is a write lock reservation in the reservation list
that precedes the one with input index.
|
void |
removeFirstReservation() |
void |
removeLockEntry(LockServerThread.LockServerRecord.LockEntry lockEntry) |
void |
removeReservation(int index) |
int |
sizeOfReservationList() |
public LockServerRecord(String location)
location
- public boolean addLockEntry(long lockId, LockType lockType, long expirationTime)
lockId
- lockType
- expirationTime
- public void removeLockEntry(LockServerThread.LockServerRecord.LockEntry lockEntry)
lockEntry
- public boolean containsValidOrExpiredLock(long validationTime)
validationTime
- public LockServerThread.LockServerRecord.LockEntry getFirstLockEntry(long validationTime)
validationTime
- public LockServerThread.LockServerRecord.LockEntry getLockEntryWithId(long lockId)
lockId
- public long getLockExpirationTime()
public boolean containsValidReservation(long now)
now
- public LockResult addReservationEntry(LockType lockType, long reservationExpirationTime, boolean addFirst)
lockType
- reservationExpirationTime
- public boolean isWLReservationPreceedingThisOne(int reservationIndex)
reservationIndex
- public int indexOfReservation(long reservationId, LockType lockType)
reservationId
- lockType
- public int sizeOfReservationList()
public void removeFirstReservation()
public void removeReservation(int index)
index
- Copyright © 2016 Egothor. All Rights Reserved.