4A Server -  2.0
 All Classes Namespaces Files Functions Variables Enumerator
cz.vutbr.fit.knot.annotations.comet.documentLock.Padlock Class Reference

Class represents the document protection, and provides methods to lock. More...

Collaboration diagram for cz.vutbr.fit.knot.annotations.comet.documentLock.Padlock:
Collaboration graph

Public Member Functions

 Padlock (Integer documentId)
 
Integer getDocumentId ()
 
synchronized boolean lockForRead ()
 
synchronized void unlockForRead ()
 
synchronized boolean lockForChange ()
 
synchronized void unlockForChange ()
 

Package Attributes

Integer documentId
 
boolean isLocked
 
boolean waitForUpdate
 
int readersCount
 

Detailed Description

Class represents the document protection, and provides methods to lock.

Class represents the document protection, and provides methods to lock.

Author
Martin Petr (xpetrm05)

Definition at line 22 of file Padlock.java.

Constructor & Destructor Documentation

cz.vutbr.fit.knot.annotations.comet.documentLock.Padlock.Padlock ( Integer  documentId)

Constructor

Parameters
documentIdid of document that lock belongs

Definition at line 40 of file Padlock.java.

Member Function Documentation

Integer cz.vutbr.fit.knot.annotations.comet.documentLock.Padlock.getDocumentId ( )

Gets id of document that is locked.

Returns
id of document that is locked

Definition at line 52 of file Padlock.java.

Here is the caller graph for this function:

synchronized boolean cz.vutbr.fit.knot.annotations.comet.documentLock.Padlock.lockForChange ( )

Method try to lock document for change, if there some other thread that locks document before, current thread will be suspended.

Returns
returns true if current thread have lock or false if not

Definition at line 94 of file Padlock.java.

synchronized boolean cz.vutbr.fit.knot.annotations.comet.documentLock.Padlock.lockForRead ( )

Method try to lock document for read, if there some other thread that locks document before, current thread will be suspended.

Returns
returns true if current thread have lock or false if not

Definition at line 62 of file Padlock.java.

synchronized void cz.vutbr.fit.knot.annotations.comet.documentLock.Padlock.unlockForChange ( )

Method unlocks document for read operations, all suspended threads will be make runable.

Definition at line 123 of file Padlock.java.

synchronized void cz.vutbr.fit.knot.annotations.comet.documentLock.Padlock.unlockForRead ( )

Method unlocks document for read operations, all suspended threads will be make runable.

Definition at line 81 of file Padlock.java.

Member Data Documentation

Integer cz.vutbr.fit.knot.annotations.comet.documentLock.Padlock.documentId
package

id of document that lock belongs

Definition at line 24 of file Padlock.java.

boolean cz.vutbr.fit.knot.annotations.comet.documentLock.Padlock.isLocked
package

paramether indicate locked document

Definition at line 27 of file Padlock.java.

int cz.vutbr.fit.knot.annotations.comet.documentLock.Padlock.readersCount
package

count of readers of document

Definition at line 33 of file Padlock.java.

boolean cz.vutbr.fit.knot.annotations.comet.documentLock.Padlock.waitForUpdate
package

paramether indicate that some thread waits for change

Definition at line 30 of file Padlock.java.


The documentation for this class was generated from the following file: