Skip to content
This repository has been archived by the owner on Nov 14, 2024. It is now read-only.

Commit

Permalink
Fix ClassInitializationDeadlock error and bump gradle-baseline-java (#…
Browse files Browse the repository at this point in the history
  • Loading branch information
tillyow authored Oct 9, 2024
1 parent ca25f3c commit 16e7592
Show file tree
Hide file tree
Showing 5 changed files with 37 additions and 16 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -69,14 +69,18 @@ void checkDefaultsForNonSweepableTransaction() {
}
}

public static final Hydrator<TargetedSweepMetadata> BYTES_HYDRATOR =
input -> ImmutableTargetedSweepMetadata.builder()
public static final Hydrator<TargetedSweepMetadata> BYTES_HYDRATOR = new Hydrator<TargetedSweepMetadata>() {
@Override
public TargetedSweepMetadata hydrateFromBytes(byte[] input) {
return ImmutableTargetedSweepMetadata.builder()
.conservative((input[0] & SWEEP_STRATEGY_MASK) != 0)
.dedicatedRow((input[0] & USE_DEDICATED_ROWS_MASK) != 0)
.shard((input[0] << 2 | (input[1] & BYTE_MASK) >> 6) & BYTE_MASK)
.dedicatedRowNumber(input[1] & DEDICATED_ROW_NUMBER_MASK)
.nonSweepableTransaction((input[2] & SWEEP_STRATEGY_MASK) != 0)
.build();
}
};

@Override
public byte[] persistToBytes() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,12 @@

@Immutable
public interface StoredWriteReference extends Persistable {
Hydrator<StoredWriteReference> BYTES_HYDRATOR = ImmutableStoredWriteReference::of;
Hydrator<StoredWriteReference> BYTES_HYDRATOR = new Hydrator<StoredWriteReference>() {
@Override
public StoredWriteReference hydrateFromBytes(byte[] input) {
return ImmutableStoredWriteReference.of(input);
}
};

default <T> T accept(Visitor<T> visitor) {
byte[] data = data();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,18 +24,21 @@

@Value.Immutable
public interface SweepTableIdentifier extends Persistable {
Hydrator<SweepTableIdentifier> BYTES_HYDRATOR = input -> {
int identifier = Ints.checkedCast(EncodingUtils.decodeSignedVarLong(input));
if (identifier < 0) {
return ImmutableSweepTableIdentifier.builder()
.isPending(true)
.identifier(-identifier)
.build();
} else {
return ImmutableSweepTableIdentifier.builder()
.isPending(false)
.identifier(identifier)
.build();
Hydrator<SweepTableIdentifier> BYTES_HYDRATOR = new Hydrator<SweepTableIdentifier>() {
@Override
public SweepTableIdentifier hydrateFromBytes(byte[] input) {
int identifier = Ints.checkedCast(EncodingUtils.decodeSignedVarLong(input));
if (identifier < 0) {
return ImmutableSweepTableIdentifier.builder()
.isPending(true)
.identifier(-identifier)
.build();
} else {
return ImmutableSweepTableIdentifier.builder()
.isPending(false)
.identifier(identifier)
.build();
}
}
};

Expand Down
2 changes: 1 addition & 1 deletion build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ buildscript {
classpath 'com.palantir.jakartapackagealignment:jakarta-package-alignment:0.6.0'
classpath 'com.netflix.nebula:gradle-info-plugin:13.1.2'
classpath 'com.netflix.nebula:nebula-publishing-plugin:21.1.0'
classpath 'com.palantir.baseline:gradle-baseline-java:5.61.0'
classpath 'com.palantir.baseline:gradle-baseline-java:5.69.0'
classpath 'com.palantir.gradle.conjure:gradle-conjure:5.51.0'
classpath 'com.palantir.gradle.consistentversions:gradle-consistent-versions:2.25.0'
classpath 'com.palantir.gradle.docker:gradle-docker:0.35.0'
Expand Down
9 changes: 9 additions & 0 deletions changelog/@unreleased/pr-7326.v2.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
type: fix
fix:
description: |-
- Bump for gradle-baseline-java
- Fixed the ClassInitializationDeadlock error caused by the gradle-baseline-java version bump. The fix uses an anonymous class interface, which will delay the instantiation until required, and therefore reducing the risk of a jvm loop leading to ClassInitializationDeadlock.
Excavator: Upgrades Baseline to the latest version
links:
- https://github.com/palantir/atlasdb/pull/7326

0 comments on commit 16e7592

Please sign in to comment.