Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion ebean-agent/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@

<groupId>io.ebean</groupId>
<artifactId>ebean-agent</artifactId>
<version>14.8.2</version>
<version>14.9.0-RC1</version>
<packaging>jar</packaging>

<name>ebean-agent</name>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,9 @@ interface Jakarta {
String L_STRING = "Ljava/lang/String;";
String L_OBJECT = "Ljava/lang/Object;";
String L_INTERCEPT = "Lio/ebean/bean/EntityBeanIntercept;";
String L_HELPSCOPETRANS = "Lio/ebeaninternal/api/HelpScopeTrans;";
String HELPSCOPETRANS = "io/ebeaninternal/api/HelpScopeTrans";
String AOPTRANSACTIONSCOPE = "io/ebean/plugin/AOPTransactionScope";

String L_DRAFT = "Lio/ebean/annotation/Draft;";
String C_TXSCOPE = "io/ebean/TxScope";
String C_TXTYPE = "io/ebean/annotation/TxType";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -498,6 +498,10 @@ public boolean fluidQueryBuilders() {
return enhancementVersion >= 148;
}

public boolean useAopTransactionScope() {
return enhancementVersion >= 149;
}

public ProfileLineNumberMode profileLineMode() {
return profileLineNumberMode;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -341,6 +341,10 @@ boolean isEnableProfileLocation() {
return enhanceContext.isEnableProfileLocation();
}

boolean useAopTransactionScope() {
return enhanceContext.useAopTransactionScope();
}

int nextQueryProfileLocation() {
return queryProfileCount++;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,17 +25,18 @@ class MethodAdapter extends FinallyAdapter implements EnhanceConstants, Opcodes

private static final String TX_FIELD_PREFIX = ClassAdapterTransactional.TX_FIELD_PREFIX;
private static final Type txScopeType = Type.getType("L" + C_TXSCOPE + ";");
private static final Type helpScopeTrans = Type.getType(L_HELPSCOPETRANS);

private final AnnotationInfo annotationInfo;
private final ClassAdapterTransactional classAdapter;
private final ProfileMethodInstruction profileMethod;
private final String aopTransactionScope;
private boolean transactional;
private int posTxScope;

MethodAdapter(ClassAdapterTransactional classAdapter, final MethodVisitor mv, final int access, final String name, final String desc) {
super(mv, access, name, desc);
this.classAdapter = classAdapter;
this.aopTransactionScope = classAdapter.useAopTransactionScope() ? AOPTRANSACTIONSCOPE : HELPSCOPETRANS;
this.profileMethod = new ProfileMethodInstruction(classAdapter, mv, name);
// inherit from class level Transactional annotation
AnnotationInfo parentInfo = classAdapter.getClassAnnotationInfo();
Expand Down Expand Up @@ -314,11 +315,10 @@ protected void onMethodEnter() {
}

mv.visitVarInsn(ALOAD, posTxScope);
mv.visitMethodInsn(INVOKESTATIC, helpScopeTrans.getInternalName(), "enter", "("
mv.visitMethodInsn(INVOKESTATIC, aopTransactionScope, "enter", "("
+ txScopeType.getDescriptor() + ")V", false);
}


@Override
protected void onFinally(int opcode) {
if (!transactional) {
Expand All @@ -337,7 +337,7 @@ protected void onFinally(int opcode) {
box(getReturnType());
}
visitIntInsn(SIPUSH, opcode);
visitMethodInsn(INVOKESTATIC, helpScopeTrans.getInternalName(), "exit", "(Ljava/lang/Object;I)V", false);
visitMethodInsn(INVOKESTATIC, aopTransactionScope, "exit", "(Ljava/lang/Object;I)V", false);
}

}