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 FormConstructor 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, deepClone
configureDumpHeadlineLength, configureDumpMaxElementsPrinted, copyDumpStringValues, copyToStringValues, createDumpHeader, toDumpString, toString
public 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.Object
public int hashCode()
hashCode
in class java.lang.Object
public javax.swing.Icon getRenderIcon()
getRenderIcon
in interface Renderable
public java.lang.String getRenderText()
getRenderText
in interface Renderable
public java.awt.Color getRenderColor()
getRenderColor
in interface Renderable
public ToString toString(ToString s)
Dumpable
toString
in interface Dumpable
toString
in class DumpableObject
public DumpString toDumpString(DumpString s)
toDumpString
in interface Dumpable
toDumpString
in class DumpableObject
Copyright © 2014 EsprIT-Systems. All Rights Reserved.