Skip to content

Commit

Permalink
Merge pull request #597 from hexagonkt/develop
Browse files Browse the repository at this point in the history
Develop
  • Loading branch information
jaguililla committed Jan 6, 2023
2 parents 217445d + f1c1c2a commit 8e2e43a
Show file tree
Hide file tree
Showing 5 changed files with 31 additions and 29 deletions.
2 changes: 1 addition & 1 deletion gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ org.gradle.warning.mode=all
org.gradle.console=plain

# Gradle
version=2.4.0
version=2.4.1
group=com.hexagonkt
description=The atoms of your platform

Expand Down
12 changes: 12 additions & 0 deletions gradle/application.gradle
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
/*
* Check usage information at: http://hexagonkt.com/gradle/#application
*/
import org.gradle.api.tasks.bundling.Compression

apply(plugin: "application")

Expand Down Expand Up @@ -91,6 +92,17 @@ tasks.register("jpackage") {
}
}

tasks.register("tarJpackage", Tar) {
group = "distribution"
description = "Compress Jpackage distribution in a single file."
dependsOn("jpackage")

from(buildDir.toPath().resolve(project.name).toFile())
compression = Compression.BZIP2
archiveFileName.set("${project.name}-${project.version}.tbz2")
destinationDirectory.set(buildDir.toPath().resolve("distributions").toFile())
}

tasks.register("jre", Exec) {
group = "distribution"
description = "Create an application distribution based on a jlink generated JRE."
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,11 @@ import java.security.KeyStore
import java.util.EnumSet
import jakarta.servlet.DispatcherType
import org.eclipse.jetty.util.VirtualThreads
import org.eclipse.jetty.util.VirtualThreads.getDefaultVirtualThreadsExecutor
import org.eclipse.jetty.util.thread.ExecutorThreadPool
import org.eclipse.jetty.util.thread.ThreadPool
import java.util.concurrent.Executor
import java.util.concurrent.ThreadPoolExecutor
import org.eclipse.jetty.server.Server as JettyServer

/**
Expand Down Expand Up @@ -74,12 +79,20 @@ class JettyServletAdapter(
override fun started() =
jettyServer?.isStarted ?: false

private fun createThreadPool(): ThreadPool =
if (useVirtualThreads) {
val virtualThreadPool = getDefaultVirtualThreadsExecutor()
val threadPool = ExecutorThreadPool(maxThreads, minThreads)
threadPool.virtualThreadsExecutor = virtualThreadPool
threadPool
}
else {
QueuedThreadPool(maxThreads, minThreads)
}

override fun startUp(server: HttpServer) {
val settings = server.settings
val threadPool =
if (useVirtualThreads) VirtualThreadPool()
else QueuedThreadPool(maxThreads, minThreads)
val serverInstance = JettyServer(threadPool)
val serverInstance = JettyServer(createThreadPool())
jettyServer = serverInstance

val pathHandler: PathHandler = path(settings.contextPath, server.handlers)
Expand Down

This file was deleted.

1 change: 1 addition & 0 deletions site/pages/gradle.md
Original file line number Diff line number Diff line change
Expand Up @@ -122,6 +122,7 @@ Gradle's script for a service or application. It adds these extra tasks:
task is an alternative to the Gradle `installDist` task.
* jre: create an application distribution based on a jlink generated JRE.
* jpackage: create a jpackage distribution including a JVM with a subset of the modules.
* tarJpackage: compress Jpackage distribution in a single file.

To use it, apply `$gradleScripts/application.gradle` to your `build.gradle`.

Expand Down

0 comments on commit 8e2e43a

Please sign in to comment.