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