Skip to content

Commit 9908315

Browse files
ludochgae-java-bot
authored andcommitted
Add initial support for the java25 runtime ID, still defaulting to Jetty12.0 and EE10.
PiperOrigin-RevId: 800083080 Change-Id: I3c83189ae1f366ffc637f66ae62b8f9c74f7713c
1 parent 4451f5b commit 9908315

6 files changed

Lines changed: 17 additions & 288 deletions

File tree

appengine_init/src/main/java/com/google/appengine/init/AppEngineWebXmlInitialParse.java

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -96,10 +96,16 @@ public void handleRuntimeProperties() {
9696
// and only if the setting has not been defined in appengine-web.xml.
9797
if (!settingDoneInAppEngineWebXml && (runtimeId != null)) {
9898
switch (runtimeId) {
99-
case "java21": // Force default to EE10.
99+
case "java21":
100100
System.clearProperty("appengine.use.EE8");
101101
System.setProperty("appengine.use.EE10", "true");
102102
break;
103+
case"java25":
104+
System.clearProperty("appengine.use.EE8");
105+
System.setProperty(
106+
"appengine.use.EE10",
107+
"true"); // Force default to EE10. Replace when jetty12.1 is EE11.
108+
break;
103109
case "java17":
104110
// See if the Mendel experiment to enable Jetty12 for java17 is set
105111
// automatically via env var:

lib/tools_api/src/main/java/com/google/appengine/tools/admin/Application.java

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -132,13 +132,15 @@ public class Application implements GenericApplication {
132132
private static final String JAVA_11_RUNTIME_ID = "java11";
133133
private static final String JAVA_17_RUNTIME_ID = "java17";
134134
private static final String JAVA_21_RUNTIME_ID = "java21";
135+
private static final String JAVA_25_RUNTIME_ID = "java25";
135136

136137
private static final ImmutableSet<String> ALLOWED_RUNTIME_IDS =
137138
ImmutableSet.of(
138139
JAVA_8_RUNTIME_ID,
139140
JAVA_11_RUNTIME_ID,
140141
JAVA_17_RUNTIME_ID,
141142
JAVA_21_RUNTIME_ID,
143+
JAVA_25_RUNTIME_ID,
142144
GOOGLE_RUNTIME_ID,
143145
GOOGLE_LEGACY_RUNTIME_ID);
144146

@@ -892,6 +894,7 @@ private boolean isJava8OrAbove() {
892894
|| appEngineWebXml.getRuntime().equals(JAVA_11_RUNTIME_ID)
893895
|| appEngineWebXml.getRuntime().equals(JAVA_17_RUNTIME_ID)
894896
|| appEngineWebXml.getRuntime().equals(JAVA_21_RUNTIME_ID)
897+
|| appEngineWebXml.getRuntime().equals(JAVA_25_RUNTIME_ID)
895898
|| appEngineWebXml.getRuntime().startsWith(GOOGLE_LEGACY_RUNTIME_ID));
896899
}
897900

@@ -1251,7 +1254,8 @@ private void compileJspJavaFiles(
12511254
} else if (runtime.startsWith(GOOGLE_LEGACY_RUNTIME_ID)
12521255
|| runtime.equals(JAVA_11_RUNTIME_ID)
12531256
|| runtime.equals(JAVA_17_RUNTIME_ID)
1254-
|| runtime.equals(JAVA_21_RUNTIME_ID)) {
1257+
|| runtime.equals(JAVA_21_RUNTIME_ID)
1258+
|| runtime.equals(JAVA_25_RUNTIME_ID)) {
12551259
// TODO(b/115569833): for now, it's still possible to use a JDK8 to compile and deploy Java11
12561260
// apps.
12571261
optionList.addAll(Arrays.asList("-source", "8"));

lib/tools_api/src/test/java/com/google/appengine/tools/admin/AppYamlTranslatorTest.java

Lines changed: 0 additions & 277 deletions
Original file line numberDiff line numberDiff line change
@@ -273,31 +273,6 @@ public void testNoVersion() {
273273
assertEquals(yaml, translator.getYaml());
274274
}
275275

276-
public void testRuntime() {
277-
appEngineWebXml.setRuntime("foo-bar");
278-
AppYamlTranslator translator = createTranslator();
279-
String yaml =
280-
"application: 'app1'\n"
281-
+ "runtime: foo-bar\n"
282-
+ "version: 'ver1'\n"
283-
+ "auto_id_policy: default\n"
284-
+ "api_version: '1.0'\n"
285-
+ "handlers:\n"
286-
+ "- url: /\n"
287-
+ " script: unused\n"
288-
+ " login: optional\n"
289-
+ " secure: optional\n"
290-
+ "- url: /.*/\n"
291-
+ " script: unused\n"
292-
+ " login: optional\n"
293-
+ " secure: optional\n"
294-
+ "- url: /_ah/.*\n"
295-
+ " script: unused\n"
296-
+ " login: optional\n"
297-
+ " secure: optional\n";
298-
assertEquals(yaml, translator.getYaml());
299-
}
300-
301276
public void testAutomaticServer_Minimal() {
302277
appEngineWebXml.setService("stan");
303278
appEngineWebXml.setInstanceClass("F8");
@@ -450,65 +425,6 @@ public void testAutomaticScalingCloneSchedulerSettings() {
450425
assertEquals(yaml, translator.getYaml());
451426
}
452427

453-
public void testAutomaticScalingCustomMetrics() {
454-
appEngineWebXml.setEnv("flex");
455-
AutomaticScaling automaticScaling = appEngineWebXml.getAutomaticScaling();
456-
automaticScaling.setMinInstances(1);
457-
automaticScaling.setMaxInstances(2);
458-
459-
List<CustomMetricUtilization> customMetrics = new ArrayList<>();
460-
CustomMetricUtilization customMetric = new CustomMetricUtilization();
461-
customMetric.setMetricName("foo/metric/name");
462-
customMetric.setTargetType("GAUGE");
463-
customMetric.setTargetUtilization(10.0);
464-
customMetric.setFilter("metric.foo != bar");
465-
customMetrics.add(customMetric);
466-
customMetric = new CustomMetricUtilization();
467-
customMetric.setMetricName("bar/metric/name");
468-
customMetric.setTargetType("DELTA_PER_SECOND");
469-
customMetric.setSingleInstanceAssignment(20.0);
470-
customMetrics.add(customMetric);
471-
automaticScaling.setCustomMetrics(customMetrics);
472-
473-
String yaml =
474-
"application: 'app1'\n"
475-
+ "runtime: java\n"
476-
+ "env: flex\n"
477-
+ "version: 'ver1'\n"
478-
+ "automatic_scaling:\n"
479-
+ " min_instances: 1\n"
480-
+ " max_instances: 2\n"
481-
+ " custom_metrics:\n"
482-
+ " - metric_name: 'foo/metric/name'\n"
483-
+ " target_type: 'GAUGE'\n"
484-
+ " target_utilization: 10.0\n"
485-
+ " filter: 'metric.foo != bar'\n"
486-
+ " - metric_name: 'bar/metric/name'\n"
487-
+ " target_type: 'DELTA_PER_SECOND'\n"
488-
+ " single_instance_assignment: 20.0\n"
489-
+ "auto_id_policy: default\n"
490-
+ "api_version: '1.0'\n"
491-
+ "handlers:\n"
492-
+ "- url: /\n"
493-
+ " script: unused\n"
494-
+ " login: optional\n"
495-
+ " secure: optional\n"
496-
+ "- url: /.*/\n"
497-
+ " script: unused\n"
498-
+ " login: optional\n"
499-
+ " secure: optional\n"
500-
+ "- url: /_ah/.*\n"
501-
+ " script: unused\n"
502-
+ " login: optional\n"
503-
+ " secure: optional\n"
504-
+ "- url: .*\\.jsp\n"
505-
+ " script: unused\n"
506-
+ " login: optional\n"
507-
+ " secure: optional\n";
508-
AppYamlTranslator translator = createTranslator();
509-
assertEquals(yaml, translator.getYaml());
510-
}
511-
512428
public void testManualServer() {
513429
appEngineWebXml.setService("stan");
514430
appEngineWebXml.setInstanceClass("B8");
@@ -1474,38 +1390,6 @@ public void testPrecompilationEnabledVmEnvironment() {
14741390
assertEquals(yaml, translator.getYaml());
14751391
}
14761392

1477-
public void testPrecompilationEnabledFlexEnvironment() {
1478-
appEngineWebXml.setPrecompilationEnabled(true);
1479-
appEngineWebXml.setEnv("flex");
1480-
1481-
AppYamlTranslator translator = createTranslator();
1482-
String yaml =
1483-
"application: 'app1'\n"
1484-
+ "runtime: java\n"
1485-
+ "env: flex\n"
1486-
+ "version: 'ver1'\n"
1487-
+ "auto_id_policy: default\n"
1488-
+ "api_version: '1.0'\n"
1489-
+ "handlers:\n"
1490-
+ "- url: /\n"
1491-
+ " script: unused\n"
1492-
+ " login: optional\n"
1493-
+ " secure: optional\n"
1494-
+ "- url: /.*/\n"
1495-
+ " script: unused\n"
1496-
+ " login: optional\n"
1497-
+ " secure: optional\n"
1498-
+ "- url: /_ah/.*\n"
1499-
+ " script: unused\n"
1500-
+ " login: optional\n"
1501-
+ " secure: optional\n"
1502-
+ "- url: .*\\.jsp\n"
1503-
+ " script: unused\n"
1504-
+ " login: optional\n"
1505-
+ " secure: optional\n";
1506-
assertEquals(yaml, translator.getYaml());
1507-
}
1508-
15091393
public void testThreadsafe() {
15101394
appEngineWebXml.setThreadsafe(true);
15111395

@@ -1772,110 +1656,6 @@ public void testCodeLock() {
17721656
assertEquals(yaml, translator.getYaml());
17731657
}
17741658

1775-
public void testEnv() {
1776-
appEngineWebXml.setEnv("flexible");
1777-
1778-
AppYamlTranslator translator = createTranslator();
1779-
String yaml =
1780-
"application: 'app1'\n"
1781-
+ "runtime: java\n"
1782-
+ "env: flexible\n"
1783-
+ "version: 'ver1'\n"
1784-
+ "auto_id_policy: default\n"
1785-
+ "api_version: '1.0'\n"
1786-
+ "handlers:\n"
1787-
+ "- url: /\n"
1788-
+ " script: unused\n"
1789-
+ " login: optional\n"
1790-
+ " secure: optional\n"
1791-
+ "- url: /.*/\n"
1792-
+ " script: unused\n"
1793-
+ " login: optional\n"
1794-
+ " secure: optional\n"
1795-
+ "- url: /_ah/.*\n"
1796-
+ " script: unused\n"
1797-
+ " login: optional\n"
1798-
+ " secure: optional\n"
1799-
+ "- url: .*\\.jsp\n"
1800-
+ " script: unused\n"
1801-
+ " login: optional\n"
1802-
+ " secure: optional\n";
1803-
assertEquals(yaml, translator.getYaml());
1804-
}
1805-
1806-
public void testEnvFlex() {
1807-
appEngineWebXml.setEnv("flex");
1808-
1809-
AppYamlTranslator translator = createTranslator();
1810-
String yaml =
1811-
"application: 'app1'\n"
1812-
+ "runtime: java\n"
1813-
+ "env: flex\n"
1814-
+ "version: 'ver1'\n"
1815-
+ "auto_id_policy: default\n"
1816-
+ "api_version: '1.0'\n"
1817-
+ "handlers:\n"
1818-
+ "- url: /\n"
1819-
+ " script: unused\n"
1820-
+ " login: optional\n"
1821-
+ " secure: optional\n"
1822-
+ "- url: /.*/\n"
1823-
+ " script: unused\n"
1824-
+ " login: optional\n"
1825-
+ " secure: optional\n"
1826-
+ "- url: /_ah/.*\n"
1827-
+ " script: unused\n"
1828-
+ " login: optional\n"
1829-
+ " secure: optional\n"
1830-
+ "- url: .*\\.jsp\n"
1831-
+ " script: unused\n"
1832-
+ " login: optional\n"
1833-
+ " secure: optional\n";
1834-
assertEquals(yaml, translator.getYaml());
1835-
}
1836-
1837-
public void testEnv2() {
1838-
appEngineWebXml.setEnv("2");
1839-
1840-
AppYamlTranslator translator = createTranslator();
1841-
String yaml =
1842-
"application: 'app1'\n"
1843-
+ "runtime: java\n"
1844-
+ "env: 2\n"
1845-
+ "version: 'ver1'\n"
1846-
+ "auto_id_policy: default\n"
1847-
+ "api_version: '1.0'\n"
1848-
+ "handlers:\n"
1849-
+ "- url: /\n"
1850-
+ " script: unused\n"
1851-
+ " login: optional\n"
1852-
+ " secure: optional\n"
1853-
+ "- url: /.*/\n"
1854-
+ " script: unused\n"
1855-
+ " login: optional\n"
1856-
+ " secure: optional\n"
1857-
+ "- url: /_ah/.*\n"
1858-
+ " script: unused\n"
1859-
+ " login: optional\n"
1860-
+ " secure: optional\n"
1861-
+ "- url: .*\\.jsp\n"
1862-
+ " script: unused\n"
1863-
+ " login: optional\n"
1864-
+ " secure: optional\n";
1865-
assertEquals(yaml, translator.getYaml());
1866-
}
1867-
1868-
public void testValidEnv() {
1869-
appEngineWebXml.setEnv("2");
1870-
assertTrue(appEngineWebXml.isFlexible());
1871-
appEngineWebXml.setEnv("flex");
1872-
assertTrue(appEngineWebXml.isFlexible());
1873-
appEngineWebXml.setEnv("flexible");
1874-
assertTrue(appEngineWebXml.isFlexible());
1875-
appEngineWebXml.setEnv("standard");
1876-
assertFalse(appEngineWebXml.isFlexible());
1877-
}
1878-
18791659
public void testEnvStd() {
18801660
appEngineWebXml.setEnv("standard");
18811661

@@ -1902,63 +1682,6 @@ public void testEnvStd() {
19021682
assertEquals(yaml, translator.getYaml());
19031683
}
19041684

1905-
public void testVmEnabled() {
1906-
appEngineWebXml.setUseVm(true);
1907-
1908-
AppYamlTranslator translator = createTranslator();
1909-
String yaml =
1910-
"application: 'app1'\n"
1911-
+ "runtime: java8\n"
1912-
+ "vm: True\n"
1913-
+ "version: 'ver1'\n"
1914-
+ "auto_id_policy: default\n"
1915-
+ "api_version: '1.0'\n"
1916-
+ "handlers:\n"
1917-
+ "- url: /\n"
1918-
+ " script: unused\n"
1919-
+ " login: optional\n"
1920-
+ " secure: optional\n"
1921-
+ "- url: /.*/\n"
1922-
+ " script: unused\n"
1923-
+ " login: optional\n"
1924-
+ " secure: optional\n"
1925-
+ "- url: /_ah/.*\n"
1926-
+ " script: unused\n"
1927-
+ " login: optional\n"
1928-
+ " secure: optional\n"
1929-
+ "- url: .*\\.jsp\n"
1930-
+ " script: unused\n"
1931-
+ " login: optional\n"
1932-
+ " secure: optional\n";
1933-
assertEquals(yaml, translator.getYaml());
1934-
}
1935-
1936-
public void testVmDisabled() {
1937-
appEngineWebXml.setUseVm(false);
1938-
1939-
AppYamlTranslator translator = createTranslator();
1940-
String yaml =
1941-
"application: 'app1'\n"
1942-
+ "runtime: java8\n"
1943-
+ "version: 'ver1'\n"
1944-
+ "auto_id_policy: default\n"
1945-
+ "api_version: '1.0'\n"
1946-
+ "handlers:\n"
1947-
+ "- url: /\n"
1948-
+ " script: unused\n"
1949-
+ " login: optional\n"
1950-
+ " secure: optional\n"
1951-
+ "- url: /.*/\n"
1952-
+ " script: unused\n"
1953-
+ " login: optional\n"
1954-
+ " secure: optional\n"
1955-
+ "- url: /_ah/.*\n"
1956-
+ " script: unused\n"
1957-
+ " login: optional\n"
1958-
+ " secure: optional\n";
1959-
assertEquals(yaml, translator.getYaml());
1960-
}
1961-
19621685
public void testBetaSettings() {
19631686
appEngineWebXml.setUseVm(true);
19641687
appEngineWebXml.addBetaSetting("machine_type", "n1-standard-1");

runtime/impl/src/main/java/com/google/apphosting/runtime/RequestRunner.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -239,9 +239,9 @@ private void dispatchRequest(RequestManager.RequestToken requestToken) throws Ex
239239

240240
private void dispatchBackgroundRequest() throws InterruptedException, TimeoutException {
241241
String requestId = getBackgroundRequestId(upRequest);
242-
// For java21 runtime, RPC path, do the new background thread handling for now, and keep it for
243-
// other runtimes.
244-
if (!Objects.equals(GAE_RUNTIME, "java21")) {
242+
// For java21/25 runtime, RPC path, do the new background thread handling for now, and keep it
243+
// for other runtimes.
244+
if (!(Objects.equals(GAE_RUNTIME, "java21") || Objects.equals(GAE_RUNTIME, "java25"))) {
245245
// Wait here for synchronization with the ThreadFactory.
246246
CountDownLatch latch = ThreadGroupPool.resetCurrentThread();
247247
Thread thread = new ThreadProxy();

runtime/runtime_impl_jetty12/src/main/java/com/google/apphosting/runtime/jetty/JettyServletEngineAdapter.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -102,7 +102,7 @@ public void start(String serverInfo, ServletEngineAdapter.Config runtimeOptions)
102102
new QueuedThreadPool(MAX_THREAD_POOL_THREADS, MIN_THREAD_POOL_THREADS);
103103
// Try to enable virtual threads if requested and on java21:
104104
if (Boolean.getBoolean("appengine.use.virtualthreads")
105-
&& "java21".equals(GAE_RUNTIME)) {
105+
&& ("java21".equals(GAE_RUNTIME) || "java25".equals(GAE_RUNTIME))) {
106106
threadPool.setVirtualThreadsExecutor(VirtualThreads.getDefaultVirtualThreadsExecutor());
107107
logger.atInfo().log("Configuring Appengine web server virtual threads.");
108108
}

utils/src/main/java/com/google/apphosting/utils/config/AppEngineWebXml.java

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -339,11 +339,7 @@ public boolean isWebXmlRequired() {
339339
* Test if the runtime is at least Java11.
340340
*/
341341
public boolean isJava11OrAbove() {
342-
return getRuntime().equals("google")
343-
|| getRuntime().equals("googlelegacy")
344-
|| getRuntime().equals("java11")
345-
|| getRuntime().equals("java17")
346-
|| getRuntime().equals("java21");
342+
return !getRuntime().equals("java8");
347343
}
348344

349345
public void setRuntime(String runtime) {

0 commit comments

Comments
 (0)