regular maintenance

Improve code quality after Codacy.com analysis.

Site: https://app.codacy.com
This commit is contained in:
Fabio Lima 2021-10-02 09:31:19 -03:00
parent 11dd761d76
commit e83a2fcf82
3 changed files with 125 additions and 128 deletions

View File

@ -3,16 +3,16 @@
ARTIFACT_ID=ulid-creator ARTIFACT_ID=ulid-creator
# find the script folder # find the script folder
SCRIPT_DIR=`dirname "$0"` SCRIPT_DIR=$(dirname "$0")
# go to the parent folder # go to the parent folder
cd ${SCRIPT_DIR}/.. cd "${SCRIPT_DIR}/.."
# compile the parent project # compile the parent project
mvn clean install mvn clean install
# create a symbolic link to be imported to the maven repository # create a copy with the expected name
cp ${PWD}/target/${ARTIFACT_ID}-*-SNAPSHOT.jar ${PWD}/target/${ARTIFACT_ID}-0.0.1-BENCHMARK.jar cp "${PWD}/target/${ARTIFACT_ID}"-*-SNAPSHOT.jar "${PWD}/target/${ARTIFACT_ID}"-0.0.1-BENCHMARK.jar
# go to the benchmark folder # go to the benchmark folder
cd benchmark cd benchmark
@ -25,4 +25,3 @@ mvn clean install
# /usr/lib/jvm/java-8-openjdk-amd64/jre/bin/java -jar target/benchmarks.jar # /usr/lib/jvm/java-8-openjdk-amd64/jre/bin/java -jar target/benchmarks.jar
java -jar target/benchmarks.jar java -jar target/benchmarks.jar

View File

@ -92,13 +92,11 @@ public class UniquenessTest {
// Request a ULID // Request a ULID
Ulid ulid = factory.create(time); Ulid ulid = factory.create(time);
if (verbose) { if (verbose && (i % (max / 100) == 0)) {
if (i % (max / 100) == 0) {
// Calculate and show progress // Calculate and show progress
progress = (int) ((i * 1.0 / max) * 100); progress = (int) ((i * 1.0 / max) * 100);
System.out.println(String.format("[Thread %06d] %s %s %s%%", id, ulid, i, (int) progress)); System.out.println(String.format("[Thread %06d] %s %s %s%%", id, ulid, i, (int) progress));
} }
}
synchronized (hashSet) { synchronized (hashSet) {
// Insert the value in cache, if it does not exist in it. // Insert the value in cache, if it does not exist in it.
if (!hashSet.add(ulid)) { if (!hashSet.add(ulid)) {