Drop LockBasedStorageManager.defaultDebugName, use meaningful name everywhere

Also, drop `createDelegatingWithSameLock` as it was unused
This commit is contained in:
Dmitry Savvinov
2018-05-30 14:03:35 +03:00
committed by Dmitry Savvinov
parent 893479bd5e
commit 69fff12384
15 changed files with 24 additions and 37 deletions
@@ -64,8 +64,8 @@ public class LockBasedStorageManager implements StorageManager {
};
@NotNull
public static LockBasedStorageManager createWithExceptionHandling(@NotNull ExceptionHandlingStrategy exceptionHandlingStrategy) {
return new LockBasedStorageManager(exceptionHandlingStrategy);
public static LockBasedStorageManager createWithExceptionHandling(@NotNull String debugText, @NotNull ExceptionHandlingStrategy exceptionHandlingStrategy) {
return new LockBasedStorageManager(debugText, exceptionHandlingStrategy, new ReentrantLock());
}
protected final Lock lock;
@@ -82,16 +82,8 @@ public class LockBasedStorageManager implements StorageManager {
this.debugText = debugText;
}
public LockBasedStorageManager() {
this(defaultDebugName(), ExceptionHandlingStrategy.THROW, new ReentrantLock());
}
protected LockBasedStorageManager(@NotNull ExceptionHandlingStrategy exceptionHandlingStrategy) {
this(defaultDebugName(), exceptionHandlingStrategy, new ReentrantLock());
}
private static String defaultDebugName() {
return "<unknown creating class>";
public LockBasedStorageManager(String debugText) {
this(debugText, ExceptionHandlingStrategy.THROW, new ReentrantLock());
}
@Override
@@ -526,14 +518,6 @@ public class LockBasedStorageManager implements StorageManager {
}
}
@NotNull
public static LockBasedStorageManager createDelegatingWithSameLock(
@NotNull LockBasedStorageManager base,
@NotNull ExceptionHandlingStrategy newStrategy
) {
return new LockBasedStorageManager(defaultDebugName(), newStrategy, base.lock);
}
@NotNull
private static <T extends Throwable> T sanitizeStackTrace(@NotNull T throwable) {
StackTraceElement[] stackTrace = throwable.getStackTrace();