File tree Expand file tree Collapse file tree 2 files changed +9
-8
lines changed
src/main/java/oracle/kubernetes/operator/work Expand file tree Collapse file tree 2 files changed +9
-8
lines changed Original file line number Diff line number Diff line change @@ -55,17 +55,18 @@ public void onThrowable(Packet packet, Throwable throwable) {
5555
5656 private static class WaitForOldFiberStep extends Step {
5757 private final AtomicReference <Fiber > old ;
58- private WaitForOldFiberStep current ;
58+ private final AtomicReference < WaitForOldFiberStep > current ;
5959
6060 public WaitForOldFiberStep (Fiber old , Step next ) {
6161 super (next );
6262 this .old = new AtomicReference <>(old );
63- current = this ;
63+ current = new AtomicReference <>( this ) ;
6464 }
6565
6666 @ Override
6767 public NextAction apply (Packet packet ) {
68- Fiber o = current != null ? current .old .getAndSet (null ) : null ;
68+ WaitForOldFiberStep c = current .get ();
69+ Fiber o = c != null ? c .old .getAndSet (null ) : null ;
6970 if (o == null ) {
7071 return doNext (packet );
7172 }
@@ -74,13 +75,13 @@ public NextAction apply(Packet packet) {
7475 boolean isWillCall = o .cancelAndExitCallback (true , new ExitCallback () {
7576 @ Override
7677 public void onExit () {
77- current = o .getSPI (WaitForOldFiberStep .class );
78+ current . set ( o .getSPI (WaitForOldFiberStep .class ) );
7879 fiber .resume (packet );
7980 }
8081 });
8182
8283 if (!isWillCall ) {
83- current = o .getSPI (WaitForOldFiberStep .class );
84+ current . set ( o .getSPI (WaitForOldFiberStep .class ) );
8485 fiber .resume (packet );
8586 }
8687 });
Original file line number Diff line number Diff line change 55
66import java .util .AbstractMap ;
77import java .util .Collections ;
8- import java .util .HashMap ;
98import java .util .Map ;
109import java .util .Set ;
10+ import java .util .concurrent .ConcurrentHashMap ;
1111
1212/**
1313 * Context of a single processing flow. Acts as a map and as a registry of components.
1414 *
1515 */
1616public class Packet extends AbstractMap <String , Object > implements ComponentRegistry , ComponentEx {
17- private final Map <String , Component > components = new HashMap <String , Component >();
18- private final Map <String , Object > delegate = new HashMap <String , Object >();
17+ private final Map <String , Component > components = new ConcurrentHashMap <String , Component >();
18+ private final Map <String , Object > delegate = new ConcurrentHashMap <String , Object >();
1919
2020 public Packet () {}
2121
You can’t perform that action at this time.
0 commit comments