Наиболее вероятные причины появления потоков таким образом:
maxThreads
установил необоснованно высокое значение по умолчанию 200. Executors.newCachedThreadPool()
, который испытывает всплеск нити. new Thread()
. Точка 4 маловероятна, так как ваша трассировка стека показывает java.util.concurrent.ThreadPoolExecutor
. Найдите пул, который создает потоки с префиксом pool-
(код приложения grep и конфигурация Tomcat для pool-
). Затем закройте бассейн.
Я использую плагин AppAssembler для получения чего-то подобного. Пример:
...
<build>
<plugins>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>appassembler-maven-plugin</artifactId>
<configuration>
<programs>
<program>
<mainClass>com.acme.MainClass</mainClass>
<name>app</name>
</program>
</programs>
</configuration>
</plugin>
</plugins>
Я использовал плагин блока знатока для достигания чего-то подобного в проекте. Я хотел, чтобы zip-файл был создан во время фазы пакета, вместо того, чтобы вручную назвать assembly:assembly. Вот то, что я придумал:
/src/assemble/distribution.xml:
<assembly>
<id>distribution</id>
<!-- specify the output formats -->
<formats>
<format>zip</format>
</formats>
<!-- include all runtime libraries in the /lib folder of the output file -->
<dependencySets>
<dependencySet>
<outputDirectory>/lib</outputDirectory>
<scope>runtime</scope>
</dependencySet>
</dependencySets>
<fileSets>
<!-- include all *.jar files in the target directory -->
<fileSet>
<directory>target</directory>
<outputDirectory></outputDirectory>
<includes>
<include>*.jar</include>
</includes>
</fileSet>
<!-- include all files in the /conf directory -->
<fileSet>
<outputDirectory></outputDirectory>
<includes>
<include>conf/**</include>
</includes>
</fileSet>
</fileSets>
</assembly>
/pom.xml
...
<plugin>
<artifactId>maven-assembly-plugin</artifactId>
<configuration>
<descriptors>
<descriptor>src/assemble/distribution.xml
</descriptor>
</descriptors>
</configuration>
<!-- append assembly:assembly to the package phase -->
<executions>
<execution>
<phase>package</phase>
<goals>
<goal>assembly</goal>
</goals>
</execution>
</executions>
</plugin>
...
Плагин блока знатока может также скопировать зависимости в Ваш блок включением чего-то как ниже в Вашем файле дескриптора блока:
<dependencySets>
<!-- Copy dependency jar files to 'lib' -->
<dependencySet>
<outputDirectory>lib</outputDirectory>
<includes>
<include>*:jar:*</include>
</includes>
</dependencySet>
</dependencySets>
appassembler генерирует 'run.xx' файлы для Вас.
Если Вы уже создали сценарии оболочки сами, можно использовать плагин блока знатока для создания zip-файла. Для сбора зависимостей, можно использовать плагин зависимости знатока.