Skip to content

Remove Java 21-related warnings#6191

Open
ctubbsii wants to merge 1 commit intoapache:2.1from
ctubbsii:java21-improvements
Open

Remove Java 21-related warnings#6191
ctubbsii wants to merge 1 commit intoapache:2.1from
ctubbsii:java21-improvements

Conversation

@ctubbsii
Copy link
Member

@ctubbsii ctubbsii commented Mar 5, 2026

This commit addresses things that are problems in newer Java versions, but attempts to get ahead of the issues, to ease the migration to newer versions. The logging changes are done here at low risk for Accumulo 2.1, since the default logging configuration can be easily changed by users, and the only affected log messages are trace level and not typically seen by most users.

  • Remove logging uses of Thread.getId() in code (deprecated in 21) and replace with logging config that shows the thread information
  • Additional minor changes to log4j2-test.properties files to make it easier to compare them and keep them in sync
  • Add Threads.toString(Thread) method for one case where logging more information about the thread than just the Thread ID would be useful (in TabletServerBatchWriter.java)
  • Replace use of new URL(String) (deprecated in 21) with URI.create(String).toURL()
  • Remove unneeded MiniDFSUtil that was using a deprecated exec method; this code is not needed because Hadoop already sets a suitable default value for the dfs.datanode.data.dir.perm and we don't need to compute a different one using this code; similarly remove the unnecessary hadoop.security.token.service.use_ip property which was just setting the default value.
  • Remove unused CollectTabletStats test-only class and its corresponding test case, since it is not used by any test code (this removes another case where the deprecated Thread.getId() was being called.

This commit addresses things that are problems in newer Java versions,
but attempts to get ahead of the issues, to ease the migration to newer
versions. The logging changes are done here at low risk for Accumulo
2.1, since the default logging configuration can be easily changed by
users, and the only affected log messages are trace level and not
typically seen by most users.

* Remove logging uses of `Thread.getId()` in code (deprecated in 21) and
  replace with logging config that shows the thread information
* Additional minor changes to `log4j2-test.properties` files to make it
  easier to compare them and keep them in sync
* Add Threads.toString(Thread) method for one case where logging more
  information about the thread than just the Thread ID would be useful
  (in TabletServerBatchWriter.java)
* Replace use of `new URL(String)` (deprecated in 21) with
  `URI.create(String).toURL()`
* Remove unneeded MiniDFSUtil that was using a deprecated exec method;
  this code is not needed because Hadoop already sets a suitable default
  value for the `dfs.datanode.data.dir.perm` and we don't need to
  compute a different one using this code; similarly remove the
  unnecessary `hadoop.security.token.service.use_ip` property which was
  just setting the default value.
* Remove unused `CollectTabletStats` test-only class and its
  corresponding test case, since it is not used by any test code (this
  removes another case where the deprecated `Thread.getId()` was being
  called.
@ctubbsii ctubbsii added this to the 2.1.5 milestone Mar 5, 2026
@ctubbsii ctubbsii requested a review from keith-turner March 5, 2026 23:02
@ctubbsii ctubbsii self-assigned this Mar 5, 2026
Copy link
Contributor

@keith-turner keith-turner left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Everything looks good, bit worried about the thread names in each log message though. Have not looked at it what it looks like though.

appender.console.target = SYSTEM_ERR
appender.console.layout.type = PatternLayout
appender.console.layout.pattern = %d{ISO8601} [%-8c{2}] %-5p: %m%n
appender.console.layout.pattern = %d{ISO8601} [%T;%t] [%-8c{2}] %-5p: %m%n
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Some code sets thread names to make jstacks more informative like here. Including the thread name on each log message could be a lot for those cases.

Have you run ITs w/ these configs? Wonder what that looks like.

return instanceId;
}

@Deprecated
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why did this annotation need to be added?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants