Skip to content

Commit

Permalink
Added ThreadUtils, Base91 and LargeBitmap.
Browse files Browse the repository at this point in the history
  • Loading branch information
onukristo committed Oct 11, 2024
1 parent 10c21f7 commit f1022d1
Show file tree
Hide file tree
Showing 22 changed files with 1,464 additions and 91 deletions.
8 changes: 8 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,14 @@ All notable changes to this project will be documented in this file.
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).

## [1.14.0] - 2024-10-11

### Added

* Base91 encoder.
* RoaringBitmap based LargeBitmap with better 64 bits support.
* ThreadUtils to take safe-point free thread dumps. Those thread dumps will be inconsistent, but still suitable in many cases.

## [1.13.0] - 2024-09-11

### Changed
Expand Down
29 changes: 6 additions & 23 deletions build.common.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -57,14 +57,8 @@ dependencies {
}

java {
if (springBootVersion.startsWith("3.")) {
sourceCompatibility = JavaVersion.VERSION_17
targetCompatibility = JavaVersion.VERSION_17
}
else{
sourceCompatibility = JavaVersion.VERSION_17
targetCompatibility = JavaVersion.VERSION_17
}
sourceCompatibility = JavaVersion.VERSION_17
targetCompatibility = JavaVersion.VERSION_17
withSourcesJar()
withJavadocJar()
}
Expand All @@ -89,22 +83,13 @@ compileJava {
}

compileTestJava {
sourceCompatibility = JavaVersion.VERSION_17
targetCompatibility = JavaVersion.VERSION_17
javaCompiler = javaToolchains.compilerFor {
languageVersion = JavaLanguageVersion.of(21)
}

options.fork = true
options.forkOptions.jvmArgs << '-Xmx256m'
}

test {
javaLauncher = javaToolchains.launcherFor {
languageVersion = JavaLanguageVersion.of(21)
}

jvmArgs "-Xlog:safepoint=info"
// To test ThreadUtils
// jvmArgs "-Xlog:safepoint=info"

useJUnitPlatform()

Expand All @@ -118,8 +103,6 @@ test {
}

tasks.findAll { it.name.startsWith("spotbugs") }*.configure {
effort = "max"

excludeFilter = file("$rootProject.rootDir/spotbugs-exclude.xml")

reports {
Expand All @@ -129,10 +112,10 @@ tasks.findAll { it.name.startsWith("spotbugs") }*.configure {
}

spotbugs {
spotbugsTest.enabled = false
// spotbugsTest.enabled = false
}

tasks.withType(Checkstyle) {
tasks.withType(Checkstyle).configureEach {
config = resources.text.fromFile(file("$rootProject.rootDir/google_checks.xml"))

// Deprecated, checkstyle does not like the namings.
Expand Down
15 changes: 11 additions & 4 deletions build.gradle
Original file line number Diff line number Diff line change
@@ -1,10 +1,12 @@
import org.eclipse.jgit.api.errors.RefAlreadyExistsException
import com.github.spotbugs.snom.Confidence
import com.github.spotbugs.snom.Effort

plugins {
id "com.github.spotbugs" version "5.0.14"
id "com.github.spotbugs" version "6+"
id "idea"
id 'org.ajoberstar.grgit' version '5.2.0'
id 'io.github.gradle-nexus.publish-plugin' version "1.1.0"
id 'org.ajoberstar.grgit' version '5.3.0'
id 'io.github.gradle-nexus.publish-plugin' version "2.0.0"
}

idea.project {
Expand All @@ -19,7 +21,7 @@ ext.projectArtifactName = "tw-base-utils"

apply from: 'build.common.gradle'

task tagRelease {
tasks.register('tagRelease') {
doLast {
try {
grgit.tag.add {
Expand All @@ -43,4 +45,9 @@ nexusPublishing {
password = System.getenv("SONATYPE_PASSWORD")
}
}
}

spotbugs {
effort = Effort.valueOf('MAX')
reportLevel = Confidence.valueOf('DEFAULT')
}
5 changes: 4 additions & 1 deletion build.libraries.gradle
Original file line number Diff line number Diff line change
@@ -1,17 +1,20 @@
ext {
springBootVersion = "${System.getenv("SPRING_BOOT_VERSION") ?: "2.7.18"}"
springBootVersion = "${System.getenv("SPRING_BOOT_VERSION") ?: "3.2.2"}"

libraries = [
// version defined
awaitility : "org.awaitility:awaitility:4.2.0",
commonsIo : "commons-io:commons-io:2.17.0",
guava : 'com.google.guava:guava:33.0.0-jre',
jakartaValidationApi : 'jakarta.validation:jakarta.validation-api:3.0.2',
javaxValidationApi : "javax.validation:validation-api:2.0.1.Final",
roaringBitmap : 'org.roaringbitmap:RoaringBitmap:1.3.0',
spockCore : "org.spockframework:spock-core:2.3-groovy-4.0",
springBootDependencies: "org.springframework.boot:spring-boot-dependencies:${springBootVersion}",

// versions managed by spring-boot-dependencies platform
commonsLang3 : "org.apache.commons:commons-lang3",

junitJupiter : "org.junit.jupiter:junit-jupiter",
logbackClassic : "ch.qos.logback:logback-classic",
lombok : "org.projectlombok:lombok",
Expand Down
2 changes: 1 addition & 1 deletion gradle.properties
Original file line number Diff line number Diff line change
@@ -1 +1 @@
version=1.13.0
version=1.14.0
3 changes: 3 additions & 0 deletions tw-base-utils/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -12,11 +12,14 @@ dependencies {
compileOnly libraries.javaxValidationApi

implementation libraries.commonsLang3
implementation libraries.commonsIo
implementation libraries.slf4jApi
implementation libraries.jacksonDatabind
implementation libraries.jacksonJsr310
implementation libraries.jacksonJdk8
implementation libraries.guava
implementation libraries.roaringBitmap
implementation libraries.spotbugsAnnotations

testImplementation libraries.awaitility
testImplementation libraries.guava
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
package com.transferwise.common.baseutils.bitmap;

public interface LargeBitmap {

boolean isEmpty();

void set(long bit);

void set(long startBit, long endBit);

boolean checkedSet(long bit);

void clear(long startBit, long endBit);

void clear(long bit);

void clear();

boolean checkedClear(long bit);

boolean isSet(long bit);

long getFirstClearBit(long offset);

long getFirstSetBit(long offset);

long getFirstSetBit();

LargeBitmap copy();
}
Loading

0 comments on commit f1022d1

Please sign in to comment.