All Downloads are FREE. Search and download functionalities are using the official Maven repository.

org.dellroad.stuff.pobj.TxInfo Maven / Gradle / Ivy


/*
 * Copyright (C) 2012 Archie L. Cobbs. All rights reserved.
 */

package org.dellroad.stuff.pobj;

final class TxInfo {

    private final boolean readOnly;
    private PersistentObject.Snapshot snapshot;
    private boolean rollbackOnly;
    private boolean xaCleanup;

    TxInfo(PersistentObject.Snapshot snapshot, boolean readOnly) {
        this.readOnly = readOnly;
        this.setSnapshot(snapshot);
    }

    public boolean isReadOnly() {
        return this.readOnly;
    }

    public PersistentObject.Snapshot getSnapshot() {
        return this.snapshot;
    }
    public void setSnapshot(PersistentObject.Snapshot snapshot) {
        if (snapshot == null)
            throw new IllegalArgumentException("null snapshot");
        this.snapshot = snapshot;
    }

    public boolean isRollbackOnly() {
        return this.rollbackOnly;
    }
    public void setRollbackOnly(boolean rollbackOnly) {
        this.rollbackOnly = rollbackOnly;
    }

    public boolean isXACleanup() {
        return this.xaCleanup;
    }
    public void setXACleanup(boolean xaCleanup) {
        this.xaCleanup = xaCleanup;
    }

    @Override
    public String toString() {
        return "TxInfo[root=" + this.snapshot.getRoot() + ",version=" + this.snapshot.getVersion()
          + (this.readOnly ? ",readOnly" : "")
          + (this.rollbackOnly ? ",rollbackOnly" : "")
          + (this.xaCleanup ? ",xaCleanup" : "")
          + "]";
    }
}





© 2015 - 2025 Weber Informatics LLC | Privacy Policy