public static EntryInfo getEntryInfo(LeaseContext<?> lease) { return new EntryInfo(lease.getUID(), 1); }
@Override public void setEntryInfo(T target, String uid, int version, long ttl) { target.__setEntryInfo(new EntryInfo(uid, version, ttl)); }
/** * Reads from the ObjectInput stream by optimized way the meta-info of MetaDataEntry. **/ protected void _readExternal(ObjectInput in) throws IOException { if (in.readBoolean()) { String uid = null; if (in.readBoolean()) uid = in.readUTF(); int version = in.readInt(); long ttl = in.readLong(); entryInfo = new EntryInfo(uid, version, ttl); } isFifo = in.readBoolean(); isTransient = in.readBoolean(); m_NOWriteLeaseMode = in.readBoolean(); } }
public FileLock(String indexName, String lockName) { this.indexName = indexName; this.lockName = lockName; String uid = ClientUIDHandler.createUIDFromName(indexName + lockName, CLASS_NAME); __setEntryInfo(new EntryInfo(uid, 0)); }
public void setEntryInfo(T target, String uid, int version, long ttl) { if (_infoSetter != null) { try { _infoSetter.set(target, new EntryInfo(uid, version, ttl)); return; } catch (Exception ex) { throw new InternalSpaceException("Fail to invoke __setEntryInfo() UID: " + uid + " for Entry: " + target.getClass(), ex); } } setUID(target, uid); if (_isVersioned) _versionTable.setEntryVersion(target, new EntryInfo(uid, version, ttl)); }
public boolean setUID(T target, String uid) { if (_uidSetter != null) { try { _uidSetter.set(target, uid); return true; } catch (Exception e) { throw new IllegalArgumentException(e); } } if (_infoGetter != null && _infoSetter != null) { try { EntryInfo info = (EntryInfo) _infoGetter.get(target); if (info != null) info.m_UID = uid; else _infoSetter.set(target, new EntryInfo(uid, 0)); return true; } catch (Exception e) { throw new IllegalArgumentException(e); } } if (_isVersioned) _versionTable.setEntryVersion(target, new EntryInfo(uid, getVersion(target))); return false; }
public boolean setVersion(T target, int version) { if (_infoGetter != null) { try { final EntryInfo entryInfo = (EntryInfo) _infoGetter.get(target); if (entryInfo == null) { EntryInfo newEntryInfo = new EntryInfo(null, version); _infoSetter.set(target, newEntryInfo); } else { entryInfo.m_VersionID = version; } return true; } catch (Exception e) { throw new ConversionException(e); } } if (_isVersioned) _versionTable.setEntryVersion(target, new EntryInfo(getUID(target), version)); return false; }