@SuppressWarnings("deprecation") protected void marshallDefaultDataVersion(DefaultDataVersion ddv, ObjectOutputStream out) throws Exception { writeUnsignedLong(out, ddv.getRawVersion()); }
/** * Returns a new DataVersion with a newer version number. */ public DataVersion increment() { if (this == ZERO) { return ONE; } if (this == ONE) { return TWO; } return new DefaultDataVersion(version + 1); }
protected DataVersion getNodeVersion(TransactionWorkspace w, Fqn f) { if (w == null) return null; WorkspaceNode wn = w.getNode(f); if (wn == null) return null; // JBCACHE-1297 DataVersion v = wn.getVersion(); if (wn.isVersioningImplicit()) { // then send back an incremented version v = ((DefaultDataVersion) v).increment(); } return v; }
/** * Digs out the DataVersion for a given Fqn. If the versioning is explicit, it is passed as-is. If implicit, it is * cloned and then incremented, and the clone is returned. */ private DataVersion getVersionToBroadcast(TransactionWorkspace w, Fqn f) { WorkspaceNode n = w.getNode(f); if (n == null) { if (trace) log.trace("Fqn " + f + " not found in workspace; not using a data version."); return null; } if (n.isVersioningImplicit()) { DefaultDataVersion v = (DefaultDataVersion) n.getVersion(); if (trace) log.trace("Fqn " + f + " has implicit versioning. Broadcasting an incremented version."); // potential bug here - need to check if we *need* to increment at all, because of Configuration.isLockParentForChildInsertRemove() return v.increment(); } else { if (trace) log.trace("Fqn " + f + " has explicit versioning. Broadcasting the version as-is."); return n.getVersion(); } }
if (((DefaultDataVersion) dataVersion).getRawVersion() > 1) { log.warn("Unexpected comparison to " + dataVersion + " -- we are " + toString());
private void performVersionUpdate(NodeSPI underlyingNode, WorkspaceNode workspaceNode) { if (workspaceNode.isVersioningImplicit()) { if (trace) log.trace("Versioning is implicit; incrementing."); underlyingNode.setVersion(((DefaultDataVersion) workspaceNode.getVersion()).increment()); } else { if (trace) log.trace("Versioning is explicit; not attempting an increment."); underlyingNode.setVersion(workspaceNode.getVersion()); } if (trace) log.trace("Setting version of node " + underlyingNode.getFqn() + " from " + workspaceNode.getVersion() + " to " + underlyingNode.getVersion()); }
@SuppressWarnings("deprecation") protected DefaultDataVersion unmarshallDefaultDataVersion(ObjectInputStream in) throws Exception { return new DefaultDataVersion(readUnsignedLong(in)); }
if (((DefaultDataVersion) dataVersion).getRawVersion() > 1) { log.warn("Unexpected comparison to " + dataVersion + " -- we are " + toString());