GammaStmConfig { public void validate() { if (timeoutNs < 0) { throw new IllegalStateException( "[GammaStmConfig] timeoutNs can't be smaller than 0, " + "timeoutNs was " + timeoutNs); } if (readBiasedThreshold < 0) { throw new IllegalStateException( "[GammaStmConfig] readBiasedThreshold can't be smaller than 0, " + "readBiasedThreshold was " + readBiasedThreshold); } if (readBiasedThreshold > 1023) { throw new IllegalStateException( "[GammaStmConfig] readBiasedThreshold can't be larger than 1023, " + "readBiasedThreshold was " + readBiasedThreshold); } if (maximumPoorMansConflictScanLength < 0) { throw new IllegalStateException( "[GammaStmConfig] maximumFullConflictScanSize can't be smaller than 0, " + "maximumFullConflictScanSize was " + maxFixedLengthTransactionSize); } if (readLockMode == null) { throw new IllegalStateException( "[GammaStmConfig] readLockMode can't be null"); } if (writeLockMode == null) { throw new IllegalStateException( "[GammaStmConfig] writeLockMode can't be null"); } if (writeLockMode.asInt() < readLockMode.asInt()) { throw new IllegalStateException( format("[GammaStmConfig] writeLockMode [%s] can't be lower than readLockMode [%s]", writeLockMode, readLockMode)); } if (isolationLevel == null) { throw new IllegalStateException("[GammaStmConfig] isolationLevel can't be null"); } if (isolationLevel.doesAllowWriteSkew() && !trackReads) { throw new IllegalStateException( format("[GammaStmConfig] isolation level '%s' can't be combined with readtracking" + "is false since it is needed to prevent the writeskew problem", isolationLevel)); } if (blockingAllowed && !trackReads) { throw new IllegalStateException( "[GammaStmConfig] blockingAllowed can't be true if trackReads is false"); } if (spinCount < 0) { throw new IllegalStateException( "[GammaStmConfig] spinCount can't be smaller than 0, but was " + spinCount); } if (minimalVariableLengthTransactionSize < 1) { throw new IllegalStateException( "[GammaStmConfig] minimalVariableLengthTransactionSize can't be smaller than 1, but was " + minimalVariableLengthTransactionSize); } if (maxRetries < 0) { throw new IllegalStateException( "[GammaStmConfig] maxRetries can't be smaller than 0, but was " + maxRetries); } if (maxFixedLengthTransactionSize < 2) { throw new IllegalStateException( "[GammaStmConfig] maxFixedLengthTransactionSize can't be smaller than 2, but was " + maxFixedLengthTransactionSize); } if (backoffPolicy == null) { throw new IllegalStateException("[GammaStmConfig] backoffPolicy can't be null"); } if (traceLevel == null) { throw new IllegalStateException("[GammaStmConfig] traceLevel can't be null"); } if (propagationLevel == null) { throw new IllegalStateException("[GammaStmConfig] propagationLevel can't be null"); } if (permanentListeners == null) { throw new IllegalStateException("[GammaStmConfig] permanentListeners can't be null"); } for (int k = 0; k < permanentListeners.size(); k++) { TxnListener listener = permanentListeners.get(k); if (listener == null) { throw new IllegalStateException( format("[GammaStmConfig] permanentListener at index %s can't be null", k)); } } }  void validate(); public List<TxnListener> permanentListeners; public PropagationLevel propagationLevel; public IsolationLevel isolationLevel; public LockMode readLockMode; public LockMode writeLockMode; public boolean blockingAllowed; public boolean interruptible; public long timeoutNs; public boolean readonly; public int spinCount; public boolean dirtyCheck; public int minimalVariableLengthTransactionSize; public boolean trackReads; public int maxRetries; public boolean speculativeConfigEnabled; public int maxFixedLengthTransactionSize; public BackoffPolicy backoffPolicy; public TraceLevel traceLevel; public boolean controlFlowErrorsReused; public boolean isFat; public int maximumPoorMansConflictScanLength; public int readBiasedThreshold; }
@Test(expected = IllegalStateException.class) public void traceLevel_whenNull() { GammaStmConfig config = new GammaStmConfig(); config.traceLevel = null; config.validate(); }
@Test(expected = IllegalStateException.class) public void maximumPoorMansConflictScanLength_whenNegative() { GammaStmConfig config = new GammaStmConfig(); config.maximumPoorMansConflictScanLength = -1; config.validate(); }
@Test(expected = IllegalStateException.class) public void maximumFixedLengthTransactionSize_whenSmallerThan1() { GammaStmConfig config = new GammaStmConfig(); config.maxFixedLengthTransactionSize = 0; config.validate(); }
@Test(expected = IllegalStateException.class) public void spinCount_whenSmallerThanZero() { GammaStmConfig config = new GammaStmConfig(); config.spinCount = -1; config.validate(); }
@Test(expected = IllegalStateException.class) public void maxRetries_whenSmallerThanZero() { GammaStmConfig config = new GammaStmConfig(); config.maxRetries = -1; config.validate(); }
@Test(expected = IllegalStateException.class) public void minimalVariableLengthTransactionSize_whenSmallerThan1() { GammaStmConfig config = new GammaStmConfig(); config.minimalVariableLengthTransactionSize = 0; config.validate(); }
@Test(expected = IllegalStateException.class) public void blockingAllowed_whenNoReadTracking() { GammaStmConfig config = new GammaStmConfig(); config.blockingAllowed = true; config.trackReads = false; config.validate(); }
@Test(expected = IllegalStateException.class) public void timeout_whenSmallerThanZero() { GammaStmConfig config = new GammaStmConfig(); config.timeoutNs = -1; config.validate(); }
@Test(expected = IllegalStateException.class) public void readBiasedThreshold_whenNegative() { GammaStmConfig config = new GammaStmConfig(); config.readBiasedThreshold = -1; config.validate(); }
@Test(expected = IllegalStateException.class) public void readBiasedThreshold_whenTooBig() { GammaStmConfig config = new GammaStmConfig(); config.readBiasedThreshold = 1024; config.validate(); }
@Test(expected = IllegalStateException.class) public void propagationLevel_whenNull() { GammaStmConfig config = new GammaStmConfig(); config.propagationLevel = null; config.validate(); }
@Test(expected = IllegalStateException.class) public void isolationLevel_whenNull() { GammaStmConfig config = new GammaStmConfig(); config.isolationLevel = null; config.validate(); }
@Test(expected = IllegalStateException.class) public void readLockMode_whenNull() { GammaStmConfig config = new GammaStmConfig(); config.readLockMode = null; config.validate(); }
@Test(expected = IllegalStateException.class) public void writeLockMode_whenNull() { GammaStmConfig config = new GammaStmConfig(); config.writeLockMode = null; config.validate(); }
@Test(expected = IllegalStateException.class) public void writeLockMode_whenSmallerThanReadLockMode() { GammaStmConfig config = new GammaStmConfig(); config.writeLockMode = LockMode.None; config.readLockMode = LockMode.Exclusive; config.validate(); }
@Test(expected = IllegalStateException.class) public void backoffPolicy_whenNull() { GammaStmConfig config = new GammaStmConfig(); config.backoffPolicy = null; config.validate(); }