dotCMS / dotCMS/core

AsciiArt startup banner: drop the 1s sleep, fix the once-only race, rotate banners

Open Beginner friendly
#36,887 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Type : Task
Dominant language
Java
Stars
970
Forks
486
Avg merge
3d 33m
Merged PRs (30d)
170

Description

Problem

com.dotcms.util.AsciiArt prints a single hardcoded startup banner and blocks the startup thread for a full second doing it:

private static boolean artDone = false;   // not thread-safe
...
if (artDone) return;                       // check-then-set race
...
Thread.sleep(1000);                        // 1s added to every boot

Three things worth fixing:

  1. Thread.sleep(1000) — a full second of dead time on every startup, purely so the banner lingers. Nothing reads it that fast; the log keeps it.
  2. artDone is a plain boolean with a check-then-set — two threads racing doArt() can both print.
  3. One banner, hardcoded. A small rotating set is nicer and costs nothing.
Proposal
  • Replace the single banner with a String[] of banners, pick one per boot.
  • AtomicBoolean.compareAndSet for the once-only guard.
  • Drop the Thread.sleep(1000).
Notes

Java text blocks still process escape sequences, so any ASCII art containing \ must escape it as \\ or the file will not compile (error: illegal escape character). Use \s to preserve a trailing space, since text blocks strip incidental trailing whitespace.

Acceptance criteria
  • Startup banner still prints exactly once
  • No Thread.sleep in the startup path
  • dotcms-core compiles

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start at com.dotcms.util.AsciiArt and inspect the doArt() entry point, including the current banner text, guard, and sleep. Replace the single-banner behavior as proposed, preserve valid Java text-block escaping, and compile dotcms-core to verify that the startup banner prints exactly once without Thread.sleep.

Written by the indexing model from the issue text.

Assessment

Tech stack
java
Domain
backend
Issue type
Refactor
Difficulty
2/5
Estimated time
1-3 hours
Activity status
Quiet
Clarity
Clearly specified
Newbie friendliness
72/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.