- this.filelist = filelist;
- if (!this.filelist.exists())
- this.filelist.createNewFile();
- }
-
- private Lock listlock = null;
-
- /**
- * Get a lock for the ClientsFile
- *
- * @return true if lock was made
- */
- protected boolean lockList() {
- if (listlock != null && listlock.isLocked())
- return true;
- listlock = null;
- if (filelist != null) {
- if (filelist.exists()) {
- // TODO: see if we need to loop-wait for locks or they just block until
- // lock is made...
- do {
- if (listlock!=null)
- listlock.release();
- listlock = new Lock(filelist); // TODO: wait around if we can't get the lock.
- } while (!listlock.isLocked());
- // listlock = new Lock(filelist);
- return listlock.isLocked();
- }
- } else
- throw new Error(
- "org.vamsas.client.simpleclient.ClientsFile.lockList called for non-initialised ClientsFile!");
-
- // no lock possible
- return false;
- }
-
- /**
- * Explicitly release the ClientsFile lock.
- *
- * @return true if lock was released.
- */
- protected void unlockList() {
- if (listlock != null) {
-
- if (listlock.isLocked()) {
- listlock.release();
- }
-
- listlock = null;
- }
+ this.sessionFile = filelist;
+ if (!this.sessionFile.exists())
+ this.sessionFile.createNewFile();