-
Notifications
You must be signed in to change notification settings - Fork 0
Jogger Lock
hxs edited this page Dec 1, 2019
·
5 revisions
Jogger-Lock is the implementation of java.util.concurrent.locks.ReentrantLock
class,
on the Jogger library.
With this feature you can lock the log file automatically or implement your lock with
the override of methods tryLock()
and tryUnlock()
of Jogger class.
To use this function, just activate the lock with the function setLock(true)
of the class Jogger.
Automatically the write and read methods, check if the log file is
locked, and if the file is free then lock it and start with the operation.
The method tryLock()
throws the LockLogException,
if the timeout expire.
Example:
Jogger jogger = new Jogger(); jogger.setLock(true); // now the writer method use Jogger-Lock jogger.writeLog("YEEEEEAAAAHH!!!");