Skip to content
This repository has been archived by the owner on Dec 23, 2023. It is now read-only.

Commit

Permalink
Remove finalize from RecordEventsSpanImpl (#2043)
Browse files Browse the repository at this point in the history
Fixes #2045

This will reduce GC pressure since the VM will not call
Finalizer.register() when creating Span objects.

Since this method is synchronized on a static lock
it can be a source of contention.

It also avoids contention on the same lock when running
runFinalizer() as part of GC
  • Loading branch information
spkrka committed Sep 22, 2020
1 parent 655ca67 commit eab6382
Show file tree
Hide file tree
Showing 2 changed files with 0 additions and 12 deletions.
1 change: 0 additions & 1 deletion buildscripts/checkstyle.xml
Expand Up @@ -173,7 +173,6 @@
<message key="name.invalidPattern"
value="Interface type name ''{0}'' must match pattern ''{1}''."/>
</module>
<module name="NoFinalizer"/>
<module name="GenericWhitespace">
<message key="ws.followed"
value="GenericWhitespace ''{0}'' is followed by whitespace."/>
Expand Down
Expand Up @@ -586,15 +586,4 @@ private RecordEventsSpanImpl(
timestampConverter != null ? timestampConverter : TimestampConverter.now(clock);
startNanoTime = clock.nowNanos();
}

@SuppressWarnings("NoFinalizer")
@Override
protected void finalize() throws Throwable {
synchronized (this) {
if (!hasBeenEnded) {
logger.log(Level.SEVERE, "Span " + name + " is GC'ed without being ended.");
}
}
super.finalize();
}
}

0 comments on commit eab6382

Please sign in to comment.