1 13 package org.jahia.registries.locks; 14 15 import java.util.Date ; 16 import java.util.Hashtable ; 17 18 19 23 class JahiaLock 24 { 25 private String mLockName; 26 private Hashtable mLockData; 27 private int mTimeout; 28 private long mExpirationTime; 29 30 31 public JahiaLock (String name, Hashtable data, int timeout) { 33 mLockName = name; 34 mLockData = data; 35 36 mTimeout = timeout * 1000; 37 39 resetTimeout(); 40 } 41 42 43 public final String getLockName () { 45 return mLockName; 46 } 47 48 public final Hashtable getLockData () { 50 return mLockData; 51 } 52 53 public final void setLockData (Hashtable data) { 55 mLockData = data; 56 } 57 58 public final void resetTimeout () { 60 Date date = new Date (); 61 mExpirationTime = date.getTime() + mTimeout; 62 } 63 64 public boolean isValid () { 66 Date date = new Date (); 67 return (date.getTime() < mExpirationTime); 68 } 69 } 70 | Popular Tags |