Skip to content

Commit

Permalink
feature:seata-common
Browse files Browse the repository at this point in the history
  • Loading branch information
lightClouds917 committed Dec 28, 2024
1 parent e8da3a1 commit 8f86af1
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,8 @@
*/
package org.apache.seata.common.exception;

import org.apache.seata.common.lock.ResourceLock;

/**
* Skip Callback Wrapper Exception.
* This exception class will make the semantics clearer.
Expand All @@ -24,13 +26,17 @@
*/
public class SkipCallbackWrapperException extends RuntimeException {

private final ResourceLock stackTraceLock = new ResourceLock();

public SkipCallbackWrapperException(Throwable cause) {
super(cause);
}

@Override
public synchronized Throwable fillInStackTrace() {
// do nothing
return null;
public Throwable fillInStackTrace() {
try (ResourceLock ignored = stackTraceLock.obtain()) {
// do nothing
return null;
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
package org.apache.seata.common.loader;

import org.apache.commons.lang.exception.NestableRuntimeException;
import org.apache.seata.common.lock.ResourceLock;

/**
* The type Enhanced service not found exception.
Expand All @@ -25,6 +26,8 @@
public class EnhancedServiceNotFoundException extends NestableRuntimeException {
private static final long serialVersionUID = 7748438218914409019L;

private final ResourceLock stackTraceLock = new ResourceLock();

/**
* Instantiates a new Enhanced service not found exception.
*
Expand Down Expand Up @@ -75,7 +78,9 @@ public EnhancedServiceNotFoundException(Throwable cause) {
}

@Override
public synchronized Throwable fillInStackTrace() {
return this;
public Throwable fillInStackTrace() {
try (ResourceLock ignored = stackTraceLock.obtain()) {
return this;
}
}
}

0 comments on commit 8f86af1

Please sign in to comment.