Skip to content

Commit eb9effc

Browse files
committed
Rename previous to beforeAttach / beforeSwap
1 parent 4d41075 commit eb9effc

1 file changed

Lines changed: 17 additions & 17 deletions

File tree

components/context/src/main/java/datadog/context/ThreadLocalContextManager.java

Lines changed: 17 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -30,8 +30,8 @@ public ContextScope attach(Context context) {
3030
ContextScope doAttach(Context context, @Nullable ContextContinuationImpl continuation) {
3131
ContextHolder holder = CONTEXT_HOLDER.get();
3232

33-
Context previous = holder.current;
34-
if (context == previous) {
33+
Context beforeAttach = holder.current;
34+
if (context == beforeAttach) {
3535
if (continuation != null) {
3636
// already attached, safe to release early to avoid resource leak
3737
continuation.releaseOnScopeClose();
@@ -41,32 +41,32 @@ ContextScope doAttach(Context context, @Nullable ContextContinuationImpl continu
4141
}
4242

4343
ContextListener[] ls = listeners;
44-
notifyDetach(previous, ls);
44+
notifyDetach(beforeAttach, ls);
4545
holder.current = context;
4646
notifyAttach(context, ls);
4747

4848
if (continuation == null) {
49-
return new ContextScopeImpl(context, holder, previous);
49+
return new ContextScopeImpl(context, holder, beforeAttach);
5050
} else {
51-
return new ResumedScopeImpl(context, holder, previous, continuation);
51+
return new ResumedScopeImpl(context, holder, beforeAttach, continuation);
5252
}
5353
}
5454

5555
@Override
5656
public Context swap(Context context) {
5757
ContextHolder holder = CONTEXT_HOLDER.get();
5858

59-
Context previous = holder.current;
60-
if (context == previous) {
61-
return previous;
59+
Context beforeSwap = holder.current;
60+
if (context == beforeSwap) {
61+
return beforeSwap;
6262
}
6363

6464
ContextListener[] ls = listeners;
65-
notifyDetach(previous, ls);
65+
notifyDetach(beforeSwap, ls);
6666
holder.current = context;
6767
notifyAttach(context, ls);
6868

69-
return previous;
69+
return beforeSwap;
7070
}
7171

7272
@Override
@@ -147,14 +147,14 @@ private static class ContextScopeImpl implements ContextScope {
147147

148148
private final Context context;
149149
private final ContextHolder holder;
150-
private final Context previous;
150+
private final Context beforeAttach;
151151

152152
private boolean closed;
153153

154-
ContextScopeImpl(Context context, ContextHolder holder, Context previous) {
154+
ContextScopeImpl(Context context, ContextHolder holder, Context beforeAttach) {
155155
this.context = context;
156156
this.holder = holder;
157-
this.previous = previous;
157+
this.beforeAttach = beforeAttach;
158158
}
159159

160160
@Override
@@ -168,8 +168,8 @@ public void close() {
168168
if (!closed && context == holder.current) {
169169
ContextListener[] ls = INSTANCE.listeners;
170170
notifyDetach(context, ls);
171-
holder.current = previous;
172-
notifyAttach(previous, ls);
171+
holder.current = beforeAttach;
172+
notifyAttach(beforeAttach, ls);
173173
closed = true;
174174
}
175175
}
@@ -181,9 +181,9 @@ private static final class ResumedScopeImpl extends ContextScopeImpl {
181181
ResumedScopeImpl(
182182
Context context,
183183
ContextHolder holder,
184-
Context previous,
184+
Context beforeAttach,
185185
@Nullable ContextContinuationImpl continuation) {
186-
super(context, holder, previous);
186+
super(context, holder, beforeAttach);
187187
this.continuation = continuation;
188188
}
189189

0 commit comments

Comments
 (0)