Skip to content

Commit 5cf93fb

Browse files
authored
Merge pull request #372 from Red5/bug/startup
Startup bugs and daemon update
2 parents 9b5365a + 7643ee0 commit 5cf93fb

File tree

16 files changed

+46
-34
lines changed

16 files changed

+46
-34
lines changed

client/pom.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
<parent>
44
<groupId>org.red5</groupId>
55
<artifactId>red5-parent</artifactId>
6-
<version>2.0.17</version>
6+
<version>2.0.18</version>
77
</parent>
88
<modelVersion>4.0.0</modelVersion>
99
<artifactId>red5-client</artifactId>

client/src/main/java/org/red5/client/Red5Client.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ public final class Red5Client {
1818
/**
1919
* Current server version with revision
2020
*/
21-
public static final String VERSION = "Red5 Client 2.0.17";
21+
public static final String VERSION = "Red5 Client 2.0.18";
2222

2323
/**
2424
* Create a new Red5Client object using the connection local to the current thread A bit of magic that lets you access the red5 scope

common/pom.xml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
<parent>
44
<groupId>org.red5</groupId>
55
<artifactId>red5-parent</artifactId>
6-
<version>2.0.17</version>
6+
<version>2.0.18</version>
77
</parent>
88
<modelVersion>4.0.0</modelVersion>
99
<artifactId>red5-server-common</artifactId>
@@ -105,7 +105,7 @@
105105
<dependency>
106106
<groupId>net.engio</groupId>
107107
<artifactId>mbassador</artifactId>
108-
<version>2.0.17</version>
108+
<version>2.0.18</version>
109109
</dependency> -->
110110
<dependency>
111111
<groupId>junit</groupId>

common/src/main/java/org/red5/server/api/Red5.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -57,12 +57,12 @@ public final class Red5 {
5757
/**
5858
* Server version with revision
5959
*/
60-
public static final String VERSION = "Red5 Server 2.0.17";
60+
public static final String VERSION = "Red5 Server 2.0.18";
6161

6262
/**
6363
* Server version for fmsVer requests
6464
*/
65-
public static final String FMS_VERSION = "RED5/2,0,17,0";
65+
public static final String FMS_VERSION = "RED5/2,0,18,0";
6666

6767
/**
6868
* Server capabilities

io/pom.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
<parent>
44
<groupId>org.red5</groupId>
55
<artifactId>red5-parent</artifactId>
6-
<version>2.0.17</version>
6+
<version>2.0.18</version>
77
</parent>
88
<modelVersion>4.0.0</modelVersion>
99
<artifactId>red5-io</artifactId>

io/src/main/java/org/red5/codec/HEVCVideo.java

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,6 @@
1010
import java.util.concurrent.CopyOnWriteArrayList;
1111

1212
import org.apache.mina.core.buffer.IoBuffer;
13-
import org.red5.io.IoConstants;
14-
import org.red5.util.ByteNibbler;
1513

1614
/**
1715
* Red5 video codec for the HEVC (h265) video format. Stores DecoderConfigurationRecord and last keyframe.

pom.xml

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@
2424
<name>Red5</name>
2525
<description>The Red5 server</description>
2626
<groupId>org.red5</groupId>
27-
<version>2.0.17</version>
27+
<version>2.0.18</version>
2828
<url>https://github.com/Red5/red5-server</url>
2929
<inceptionYear>2005</inceptionYear>
3030
<organization>
@@ -100,18 +100,18 @@
100100
<red5-server-common.version>${project.version}</red5-server-common.version>
101101
<red5-service.version>${project.version}</red5-service.version>
102102
<slf4j.version>2.0.17</slf4j.version>
103-
<logback.version>1.5.6</logback.version>
103+
<logback.version>1.5.18</logback.version>
104104
<bc.version>1.79</bc.version>
105105
<mina.version>2.0.23</mina.version>
106106
<spring.version>6.2.7</spring.version>
107107
<tomcat.version>11.0.7</tomcat.version>
108108
<junit.version>[4.13.1,)</junit.version>
109109
<isoparser.version>1.9.59</isoparser.version>
110110
<ehcache.version>2.10.6</ehcache.version>
111-
<commons-beanutils.version>1.10.0</commons-beanutils.version>
112-
<commons-codec.version>1.17.2</commons-codec.version>
111+
<commons-beanutils.version>1.10.1</commons-beanutils.version>
112+
<commons-codec.version>1.18.0</commons-codec.version>
113113
<commons-collections.version>4.4</commons-collections.version>
114-
<commons-io.version>2.18.0</commons-io.version>
114+
<commons-io.version>2.19.0</commons-io.version>
115115
<commons-lang3.version>3.17.0</commons-lang3.version>
116116
<httpcore.version>[4.4.11,)</httpcore.version>
117117
<httpclient.version>[4.5.13,)</httpclient.version>

server/pom.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
<parent>
44
<groupId>org.red5</groupId>
55
<artifactId>red5-parent</artifactId>
6-
<version>2.0.17</version>
6+
<version>2.0.18</version>
77
</parent>
88
<modelVersion>4.0.0</modelVersion>
99
<artifactId>red5-server</artifactId>

server/src/main/java/org/red5/server/tomcat/TomcatLoader.java

Lines changed: 23 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -180,26 +180,42 @@ public boolean accept(File dir, String name) {
180180
/**
181181
* Flag to indicate if we should await plugin loading
182182
*/
183-
protected boolean awaitPlugins = true;
184-
185-
private static ExecutorService executor;
183+
protected boolean awaitPlugins;
186184

187185
/**
188186
* War deployer
189187
*/
190188
private WarDeployer deployer;
191189

190+
{
191+
// allow setting to true if we're running in Red5 Pro
192+
if (!awaitPlugins) {
193+
try {
194+
awaitPlugins = Class.forName("com.red5pro.plugin.Red5ProPlugin") != null;
195+
log.debug("Red5ProPlugin found, awaiting plugins");
196+
} catch (ClassNotFoundException e) {
197+
log.debug("Red5ProPlugin not found, not awaiting plugins");
198+
}
199+
}
200+
}
201+
202+
// TODO(paul) decouple this from Spring init bean use start method
192203
@Override
193204
public void afterPropertiesSet() throws Exception {
194205
// if we are not awaiting plugins, start immediately
195206
if (awaitPlugins) {
196207
log.info("Awaiting plugin loading");
197-
executor = Executors.newSingleThreadExecutor();
198-
executor.submit(() -> {
199-
final String oldName = Thread.currentThread().getName();
208+
Executors.newVirtualThreadPerTaskExecutor().submit(() -> {
200209
Thread.currentThread().setName("TomcatLoader-delayed-start");
201210
try {
202-
while (!Red5.isPluginsReady()) {
211+
// wait for plugins to load but only up to 60 seconds
212+
long startTime = System.currentTimeMillis();
213+
while (System.currentTimeMillis() - startTime < 60000L) {
214+
// check if plugins are ready
215+
if (Red5.isPluginsReady()) {
216+
log.info("Plugins are ready");
217+
break;
218+
}
203219
log.trace("Waiting for plugins to load");
204220
Thread.sleep(2000L);
205221
}
@@ -208,8 +224,6 @@ public void afterPropertiesSet() throws Exception {
208224
log.error("Error starting Tomcat", e);
209225
} catch (InterruptedException e) {
210226
log.error("Error waiting for plugins", e);
211-
} finally {
212-
Thread.currentThread().setName(oldName);
213227
}
214228
});
215229
} else {
@@ -940,9 +954,6 @@ public void destroy() throws Exception {
940954
deployer.stop();
941955
deployer = null;
942956
}
943-
if (executor != null) {
944-
executor.shutdown();
945-
}
946957
// run through the applications and ensure that spring is told to commence shutdown / disposal
947958
AbstractApplicationContext absCtx = (AbstractApplicationContext) LoaderBase.getApplicationContext();
948959
if (absCtx != null) {

server/src/main/server/conf/jee-container.xml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,8 @@
2020
<property name="secureEnabled" value="${secure.enabled}" />
2121
<property name="websocketEnabled" value="${websocket.enabled}" />
2222
<property name="webappFolder" value="${red5.root}/webapps" />
23+
<!-- Allows a wait period to allow plugins to start before starting Tomcat -->
24+
<property name="awaitPlugins" value="${await.plugins}" />
2325
<property name="connectors">
2426
<list>
2527
<bean name="httpConnector" class="org.red5.server.tomcat.TomcatConnector">

0 commit comments

Comments
 (0)