public class ResourceLock extends TransferableObject implements Renderable
ResourceLockedException if he tries to access it exclusively too.
Note that the lock has a dispose timer for protection against too long blocking of the resource.
When the dispose timeout exceeds, the resource is released automatically by the server and the
client will receive an appropriate warning. The client needs to retrigger the lock periodically
as long as he wants to hold it.
Retriggering the lock is automatically enabled when the lock is sent to the client.
LockType,
Serialized Form| Constructor and Description |
|---|
ResourceLock(ResourceLockManager rscList,
ResourceLock lock)
This is a copy-constructor to create an EXCLUSIVE version of a SHARED lock
|
ResourceLock(ResourceLockManager rscList,
SessionId sessId,
LockType lockType,
ResourceType rscType,
java.lang.String rscName) |
ResourceLock(ResourceLockManager lockMgr,
SessionId sessId,
LockType lockType,
ResourceType rscType,
java.lang.String rscName,
java.lang.String reason) |
| Modifier and Type | Method and Description |
|---|---|
void |
dispose() |
boolean |
equals(java.lang.Object obj)
Note that it is not sufficient to compare by lockId, instead we must
compare four parameters.
|
long |
getFetchTime() |
long |
getLockDuration() |
int |
getLockId() |
int |
getLockTimeout() |
LockType |
getLockType() |
java.lang.String |
getReason() |
java.awt.Color |
getRenderColor() |
javax.swing.Icon |
getRenderIcon() |
java.lang.String |
getRenderText() |
java.lang.String |
getResourceName() |
ResourceType |
getResourceType() |
SessionId |
getSessionId() |
java.lang.String |
getShortInfo() |
java.lang.String |
getUserName() |
int |
hashCode() |
boolean |
isExclusive() |
boolean |
isShared() |
boolean |
isStale()
Note that a lock is made stale, when the client wants to access it but
cannot find it in the ResourceLockList
|
boolean |
isTimedOut()
A lock is timed out if it has not been retriggered within a certain time frame.
|
void |
retrigger() |
void |
setLockTimeout(int seconds) |
void |
setLockType(LockType type) |
void |
setReason(java.lang.String reason) |
void |
setRetriggerEnabled(boolean isRetriggerEnabled) |
void |
setStale()
Note that a lock is made stale, when the client wants to access it but
cannot find it in the ResourceLockList
|
void |
startDisposeTimer() |
DumpString |
toDumpString(DumpString s)
Same content as toString, just in a different dump format
|
ToString |
toString(ToString s)
This method allows subclasses to add values to the existing ToString of the superclass.
|
clone, deepCloneconfigureDumpHeadlineLength, configureDumpMaxElementsPrinted, copyDumpStringValues, copyToStringValues, createDumpHeader, toDumpString, toStringpublic ResourceLock(ResourceLockManager lockMgr, SessionId sessId, LockType lockType, ResourceType rscType, java.lang.String rscName, java.lang.String reason)
sessId - the SessionId of the user who requires the locklockType - the type of the lock, SHARED or EXCLUSIVErscType - the type of a resourcerscName - the unique name of a resourcereason - optional string describing the reason why the lock was fetchedpublic ResourceLock(ResourceLockManager rscList, SessionId sessId, LockType lockType, ResourceType rscType, java.lang.String rscName)
public ResourceLock(ResourceLockManager rscList, ResourceLock lock)
public void setRetriggerEnabled(boolean isRetriggerEnabled)
public void startDisposeTimer()
public java.lang.String getReason()
public void setReason(java.lang.String reason)
public java.lang.String getShortInfo()
public int getLockTimeout()
public void setLockTimeout(int seconds)
public void retrigger()
public ResourceType getResourceType()
public java.lang.String getResourceName()
public int getLockId()
public SessionId getSessionId()
public boolean isTimedOut()
public boolean isStale()
public void setStale()
public boolean isShared()
public boolean isExclusive()
public LockType getLockType()
public void setLockType(LockType type)
public java.lang.String getUserName()
public long getFetchTime()
public long getLockDuration()
public void dispose()
public boolean equals(java.lang.Object obj)
equals in class java.lang.Objectpublic int hashCode()
hashCode in class java.lang.Objectpublic javax.swing.Icon getRenderIcon()
getRenderIcon in interface Renderablepublic java.lang.String getRenderText()
getRenderText in interface Renderablepublic java.awt.Color getRenderColor()
getRenderColor in interface Renderablepublic ToString toString(ToString s)
DumpabletoString in interface DumpabletoString in class DumpableObjectpublic DumpString toDumpString(DumpString s)
toDumpString in interface DumpabletoDumpString in class DumpableObjectCopyright © 2014 EsprIT-Systems. All Rights Reserved.