Skip to content

Commit 4b052a9

Browse files
authored
Merge pull request #13 from brand-dot-dev/release-please--branches--main--changes--next
release: 0.1.0-alpha.11
2 parents 1677419 + 3de7545 commit 4b052a9

14 files changed

Lines changed: 141 additions & 14 deletions

File tree

.release-please-manifest.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
{
2-
".": "0.1.0-alpha.10"
2+
".": "0.1.0-alpha.11"
33
}

CHANGELOG.md

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,15 @@
11
# Changelog
22

3+
## 0.1.0-alpha.11 (2025-08-22)
4+
5+
Full Changelog: [v0.1.0-alpha.10...v0.1.0-alpha.11](https://github.com/brand-dot-dev/java-sdk/compare/v0.1.0-alpha.10...v0.1.0-alpha.11)
6+
7+
### Chores
8+
9+
* **ci:** reduce log noise ([eb9227f](https://github.com/brand-dot-dev/java-sdk/commit/eb9227ff7ecdae92f43c1a8d34d007a477a21f99))
10+
* **client:** refactor closing / shutdown ([3f74b69](https://github.com/brand-dot-dev/java-sdk/commit/3f74b69cb06384847f666e20e9e6ef62da9fad3d))
11+
* **internal:** support running formatters directly ([f40c6fd](https://github.com/brand-dot-dev/java-sdk/commit/f40c6fd07c9e9b4cb1b94e9dbaa379d7b1d96195))
12+
313
## 0.1.0-alpha.10 (2025-08-19)
414

515
Full Changelog: [v0.1.0-alpha.9...v0.1.0-alpha.10](https://github.com/brand-dot-dev/java-sdk/compare/v0.1.0-alpha.9...v0.1.0-alpha.10)

README.md

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,8 @@
22

33
<!-- x-release-please-start-version -->
44

5-
[![Maven Central](https://img.shields.io/maven-central/v/com.branddev.api/brand-dev-java)](https://central.sonatype.com/artifact/com.branddev.api/brand-dev-java/0.1.0-alpha.10)
6-
[![javadoc](https://javadoc.io/badge2/com.branddev.api/brand-dev-java/0.1.0-alpha.10/javadoc.svg)](https://javadoc.io/doc/com.branddev.api/brand-dev-java/0.1.0-alpha.10)
5+
[![Maven Central](https://img.shields.io/maven-central/v/com.branddev.api/brand-dev-java)](https://central.sonatype.com/artifact/com.branddev.api/brand-dev-java/0.1.0-alpha.11)
6+
[![javadoc](https://javadoc.io/badge2/com.branddev.api/brand-dev-java/0.1.0-alpha.11/javadoc.svg)](https://javadoc.io/doc/com.branddev.api/brand-dev-java/0.1.0-alpha.11)
77

88
<!-- x-release-please-end -->
99

@@ -13,7 +13,7 @@ It is generated with [Stainless](https://www.stainless.com/).
1313

1414
<!-- x-release-please-start-version -->
1515

16-
Javadocs are available on [javadoc.io](https://javadoc.io/doc/com.branddev.api/brand-dev-java/0.1.0-alpha.10).
16+
Javadocs are available on [javadoc.io](https://javadoc.io/doc/com.branddev.api/brand-dev-java/0.1.0-alpha.11).
1717

1818
<!-- x-release-please-end -->
1919

@@ -24,7 +24,7 @@ Javadocs are available on [javadoc.io](https://javadoc.io/doc/com.branddev.api/b
2424
### Gradle
2525

2626
```kotlin
27-
implementation("com.branddev.api:brand-dev-java:0.1.0-alpha.10")
27+
implementation("com.branddev.api:brand-dev-java:0.1.0-alpha.11")
2828
```
2929

3030
### Maven
@@ -33,7 +33,7 @@ implementation("com.branddev.api:brand-dev-java:0.1.0-alpha.10")
3333
<dependency>
3434
<groupId>com.branddev.api</groupId>
3535
<artifactId>brand-dev-java</artifactId>
36-
<version>0.1.0-alpha.10</version>
36+
<version>0.1.0-alpha.11</version>
3737
</dependency>
3838
```
3939

brand-dev-java-core/src/main/kotlin/com/branddev/api/client/BrandDevClientAsyncImpl.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ class BrandDevClientAsyncImpl(private val clientOptions: ClientOptions) : BrandD
3838

3939
override fun brand(): BrandServiceAsync = brand
4040

41-
override fun close() = clientOptions.httpClient.close()
41+
override fun close() = clientOptions.close()
4242

4343
class WithRawResponseImpl internal constructor(private val clientOptions: ClientOptions) :
4444
BrandDevClientAsync.WithRawResponse {

brand-dev-java-core/src/main/kotlin/com/branddev/api/client/BrandDevClientImpl.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ class BrandDevClientImpl(private val clientOptions: ClientOptions) : BrandDevCli
3636

3737
override fun brand(): BrandService = brand
3838

39-
override fun close() = clientOptions.httpClient.close()
39+
override fun close() = clientOptions.close()
4040

4141
class WithRawResponseImpl internal constructor(private val clientOptions: ClientOptions) :
4242
BrandDevClient.WithRawResponse {

brand-dev-java-core/src/main/kotlin/com/branddev/api/core/ClientOptions.kt

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,8 @@ private constructor(
2121
* The HTTP client to use in the SDK.
2222
*
2323
* Use the one published in `brand-dev-java-client-okhttp` or implement your own.
24+
*
25+
* This class takes ownership of the client and closes it when closed.
2426
*/
2527
@get:JvmName("httpClient") val httpClient: HttpClient,
2628
/**
@@ -156,6 +158,8 @@ private constructor(
156158
* The HTTP client to use in the SDK.
157159
*
158160
* Use the one published in `brand-dev-java-client-okhttp` or implement your own.
161+
*
162+
* This class takes ownership of the client and closes it when closed.
159163
*/
160164
fun httpClient(httpClient: HttpClient) = apply {
161165
this.httpClient = PhantomReachableClosingHttpClient(httpClient)
@@ -402,4 +406,18 @@ private constructor(
402406
)
403407
}
404408
}
409+
410+
/**
411+
* Closes these client options, relinquishing any underlying resources.
412+
*
413+
* This is purposefully not inherited from [AutoCloseable] because the client options are
414+
* long-lived and usually should not be synchronously closed via try-with-resources.
415+
*
416+
* It's also usually not necessary to call this method at all. the default client automatically
417+
* releases threads and connections if they remain idle, but if you are writing an application
418+
* that needs to aggressively release unused resources, then you may call this method.
419+
*/
420+
fun close() {
421+
httpClient.close()
422+
}
405423
}
Lines changed: 58 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,58 @@
1+
package com.branddev.api.core
2+
3+
import java.util.concurrent.Callable
4+
import java.util.concurrent.ExecutorService
5+
import java.util.concurrent.Future
6+
import java.util.concurrent.TimeUnit
7+
8+
/**
9+
* A delegating wrapper around an [ExecutorService] that shuts it down once it's only phantom
10+
* reachable.
11+
*
12+
* This class ensures the [ExecutorService] is shut down even if the user forgets to do it.
13+
*/
14+
internal class PhantomReachableExecutorService(private val executorService: ExecutorService) :
15+
ExecutorService {
16+
init {
17+
closeWhenPhantomReachable(this) { executorService.shutdown() }
18+
}
19+
20+
override fun execute(command: Runnable) = executorService.execute(command)
21+
22+
override fun shutdown() = executorService.shutdown()
23+
24+
override fun shutdownNow(): MutableList<Runnable> = executorService.shutdownNow()
25+
26+
override fun isShutdown(): Boolean = executorService.isShutdown
27+
28+
override fun isTerminated(): Boolean = executorService.isTerminated
29+
30+
override fun awaitTermination(timeout: Long, unit: TimeUnit): Boolean =
31+
executorService.awaitTermination(timeout, unit)
32+
33+
override fun <T : Any?> submit(task: Callable<T>): Future<T> = executorService.submit(task)
34+
35+
override fun <T : Any?> submit(task: Runnable, result: T): Future<T> =
36+
executorService.submit(task, result)
37+
38+
override fun submit(task: Runnable): Future<*> = executorService.submit(task)
39+
40+
override fun <T : Any?> invokeAll(
41+
tasks: MutableCollection<out Callable<T>>
42+
): MutableList<Future<T>> = executorService.invokeAll(tasks)
43+
44+
override fun <T : Any?> invokeAll(
45+
tasks: MutableCollection<out Callable<T>>,
46+
timeout: Long,
47+
unit: TimeUnit,
48+
): MutableList<Future<T>> = executorService.invokeAll(tasks, timeout, unit)
49+
50+
override fun <T : Any?> invokeAny(tasks: MutableCollection<out Callable<T>>): T =
51+
executorService.invokeAny(tasks)
52+
53+
override fun <T : Any?> invokeAny(
54+
tasks: MutableCollection<out Callable<T>>,
55+
timeout: Long,
56+
unit: TimeUnit,
57+
): T = executorService.invokeAny(tasks, timeout, unit)
58+
}

brand-dev-java-proguard-test/build.gradle.kts

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -37,8 +37,6 @@ val proguardJar by tasks.registering(proguard.gradle.ProGuardTask::class) {
3737
outjars(proguardJarPath)
3838
printmapping("${layout.buildDirectory.get()}/proguard-mapping.txt")
3939

40-
dontwarn()
41-
4240
val javaHome = System.getProperty("java.home")
4341
if (System.getProperty("java.version").startsWith("1.")) {
4442
// Before Java 9, the runtime classes were packaged in a single jar file.

brand-dev-java-proguard-test/test.pro

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,4 +5,5 @@
55
-keep class org.junit.** { *; }
66

77
# Many warnings don't apply for our testing purposes.
8+
-dontnote
89
-dontwarn

build.gradle.kts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ repositories {
99

1010
allprojects {
1111
group = "com.branddev.api"
12-
version = "0.1.0-alpha.10" // x-release-please-version
12+
version = "0.1.0-alpha.11" // x-release-please-version
1313
}
1414

1515
subprojects {

0 commit comments

Comments
 (0)