forked from quarkusio/quarkus
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Use the new Vertx local context storage
- Loading branch information
Showing
5 changed files
with
130 additions
and
47 deletions.
There are no files selected for viewing
32 changes: 32 additions & 0 deletions
32
extensions/vertx/runtime/src/main/java/io/quarkus/vertx/core/runtime/QuarkusAccessModes.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
package io.quarkus.vertx.core.runtime; | ||
|
||
import java.util.concurrent.atomic.AtomicReferenceArray; | ||
import java.util.function.Supplier; | ||
|
||
import io.vertx.core.spi.context.storage.AccessMode; | ||
|
||
final class QuarkusAccessModes { | ||
|
||
public static final AccessMode ACQUIRE_RELEASE = new AccessMode() { | ||
@Override | ||
public Object get(AtomicReferenceArray<Object> locals, int idx) { | ||
return locals.get(idx); | ||
} | ||
|
||
@Override | ||
public void put(AtomicReferenceArray<Object> locals, int idx, Object value) { | ||
locals.lazySet(idx, value); | ||
} | ||
|
||
@Override | ||
public Object getOrCreate(AtomicReferenceArray<Object> locals, int idx, Supplier<Object> initialValueSupplier) { | ||
Object value = locals.get(idx); | ||
if (value == null) { | ||
value = initialValueSupplier.get(); | ||
locals.lazySet(idx, value); | ||
} | ||
return value; | ||
} | ||
}; | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters