public class JustNotFLock extends Object implements PiUtil
On a Raspberry with a Raspian lite (Linux) this program may demonstrate that it won't respect a lock on the same file by the little C program JustLock e.g. — and vice versa. The reason is the Java'a FileLock not using the operating system's first (historic standard) file lock mechanism.java de.weAut.demos.JustNotFLock [filePath]default filePath] isPiUtil.lckPiGpioPthorPiUtil.lckWinGpioPth(on Windows)
PiUtil.openLock(String, boolean) and
PiUtil.closeLock() instead of overriding them here.PiUtil.Impl, PiUtil.LeTickERR_ASSIGN_PIN, ERR_CLOSE_WDOG, ERR_NoGPIOLOCK, ERR_NoLOCKFILE, ERR_NoLOCKPROC, ERR_NOT_LOCKED, ERR_OPEN_W_DOG, ERR_PIGPIOD_CON, lckPiGpioPth, lckWinGpioPthGPIO_INP, GPIO_OUT, GPIOmax, GPIOmin, GPIOutM, H1, HI, L0, LO, PI_PUD_DOWN, PI_PUD_DT, PI_PUD_KP, PI_PUD_OFF, PI_PUD_UP, PIN0, PIN00, PIN01, PIN02, PIN04, PIN06, PIN09, PIN0V, PIN1, PIN14, PIN17, PIN2, PIN20, PIN25, PIN3V, PIN4, PIN5V, PIN6, PIN9, PINig, PINix, PIO_ALT0, PIO_ALT1, PIO_ALT2, PIO_ALT3, PIO_ALT4, PIO_ALT5AUTHOR, BLANK_STRING, cons, CONSOL_ENCODING, COPYRIGHT, D, D_NaN, D_NegInf, D_PosInf, EMPTY_INT_A, EMPTY_STRING, FILE_ENCODING, FRW_CLLD, FS, FSS, H, hasCons, HOST_IP, HOST_IPv4, HOST_NAME, INIT_ERROR, JAR_ENCODING, JH, JOB_DONE_OK, JRL, LOG_OUT_ERROR, M, MAIN_THREAD_EXC, NO_BYTES, NO_CLASSES, NO_DOUBLES, NO_OBJECTS, NO_PARS_ERROR, NO_STRINGS, NOT_WINDOWS, ON_PI, ONE_DAY, ONE_HOUR, ONE_LEAP_YEAR, ONE_MINUTE, ONE_SECOND, ONE_WEEK, ONE_YEAR, OS, PROG_NAME, PROG_SHORT, PS, RUNTIME, S, SHY, UD, UL, UL_UR_da, UR| Constructor and Description |
|---|
JustNotFLock() |
| Modifier and Type | Method and Description |
|---|---|
void |
closeLock()
Unlock the lock file.
|
void |
doIt(String[] args)
The application's work.
|
static void |
main(String[] args)
The application start.
|
int |
openLock(String lckPiGpioFil,
boolean verbose)
Open and lock lock file.
|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitargHost, argPiType, argPort, argTimeout, closeWatchdog, eightDigitHex, errorText, getDelCnt, getLastExcept, getLastExcMess, getLastLockFN, getOut, getOvrCnt, getUseLock, openLockPi, openWatchdog, regAsStdMBean, repExc, setArgHost, setArgPiType, setArgPort, setArgTimeout, setUseLock, systemExit, thrDelay, triggerWatchdog, twoDigitDecpublic int openLock(String lckPiGpioFil, boolean verbose)
openLock in interface PiUtillckPiGpioFil - if not null or empty use this path instead of the
default one (lckPiGpioPth)verbose - true: make the lock process verbose (by option -v) on
standard outputPiUtil.ERR_NoLOCKFILE,
PiUtil.ERR_NOT_LOCKEDpublic static void main(String[] args)
args - start parameterspublic void doIt(String[] args)