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
33 changes: 31 additions & 2 deletions metadata/src/main/java/org/apache/kafka/image/RegistryRef.java
Original file line number Diff line number Diff line change
Expand Up @@ -54,10 +54,39 @@ public RegistryRef next() {
}

@Override
protected void deallocate() {
public ReferenceCounted retain(int increment) {
if (this == NOOP) {
return;
throw new UnsupportedOperationException("retain is not supported for NOOP");
}
return super.retain(increment);
}

@Override
public ReferenceCounted retain() {
if (this == NOOP) {
throw new UnsupportedOperationException("retain is not supported for NOOP");
}
return super.retain();
}

@Override
public boolean release() {
if (this == NOOP) {
throw new UnsupportedOperationException("release is not supported for NOOP");
}
return super.release();
}

@Override
public boolean release(int decrement) {
if (this == NOOP) {
throw new UnsupportedOperationException("release is not supported for NOOP");
}
return super.release(decrement);
}

@Override
protected void deallocate() {
inLock(() -> {
if (liveEpochs.isEmpty()) {
throw new IllegalStateException("liveEpochs is empty");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -139,6 +139,9 @@ RegistryRef registryRef() {

@Override
protected void deallocate() {
if (registryRef == RegistryRef.NOOP) {
return;
}
registryRef.release();
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -408,6 +408,9 @@ public String toString() {

@Override
protected void deallocate() {
if (registryRef == RegistryRef.NOOP) {
return;
}
registryRef.release();
}

Expand Down