Skip to content

Commit e369856

Browse files
committed
Fix busy-waiting by switching to virtual threads
1 parent 2d39fe7 commit e369856

33 files changed

Lines changed: 609 additions & 68 deletions

File tree

combinator/src/test/java/com/iluwatar/combinator/FinderTest.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,8 @@ class FinderTest {
3333

3434
@Test
3535
void contains() {
36-
var example = """
36+
var example =
37+
"""
3738
the first one
3839
the second one\s
3940
""";

microservices-self-registration/contextservice/pom.xml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -67,6 +67,10 @@
6767
<groupId>org.apache.maven.plugins</groupId>
6868
<artifactId>maven-compiler-plugin</artifactId>
6969
</plugin>
70+
<plugin>
71+
<groupId>com.diffplug.spotless</groupId>
72+
<artifactId>spotless-maven-plugin</artifactId>
73+
</plugin>
7074
</plugins>
7175
</build>
7276

microservices-self-registration/eurekaserver/pom.xml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,10 @@
4949
<groupId>org.apache.maven.plugins</groupId>
5050
<artifactId>maven-compiler-plugin</artifactId>
5151
</plugin>
52+
<plugin>
53+
<groupId>com.diffplug.spotless</groupId>
54+
<artifactId>spotless-maven-plugin</artifactId>
55+
</plugin>
5256
</plugins>
5357
</build>
5458

microservices-self-registration/eurekaserver/src/main/java/com/learning/eurekaserver/EurekaserverApplication.java

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,7 @@
88
@EnableEurekaServer
99
public class EurekaserverApplication {
1010

11-
public static void main(String[] args) {
12-
SpringApplication.run(EurekaserverApplication.class, args);
13-
}
14-
11+
public static void main(String[] args) {
12+
SpringApplication.run(EurekaserverApplication.class, args);
13+
}
1514
}

microservices-self-registration/eurekaserver/src/test/java/com/learning/eurekaserver/EurekaserverApplicationTests.java

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -6,12 +6,13 @@
66
@SpringBootTest
77
class EurekaserverApplicationTests {
88

9-
@Test
10-
void contextLoads() {
11-
// This is a basic integration test that checks if the Spring Application Context loads successfully.
9+
@Test
10+
void contextLoads() {
11+
// This is a basic integration test that checks if the Spring Application Context loads
12+
// successfully.
1213
// If the context loads without any exceptions, the test is considered passing.
1314
// It is often left empty as the act of loading the context is the primary verification.
14-
// You can add specific assertions here if you want to verify the presence or state of certain beans.
15-
}
16-
15+
// You can add specific assertions here if you want to verify the presence or state of certain
16+
// beans.
17+
}
1718
}

microservices-self-registration/greetingservice/pom.xml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -63,6 +63,10 @@
6363
<groupId>org.apache.maven.plugins</groupId>
6464
<artifactId>maven-compiler-plugin</artifactId>
6565
</plugin>
66+
<plugin>
67+
<groupId>com.diffplug.spotless</groupId>
68+
<artifactId>spotless-maven-plugin</artifactId>
69+
</plugin>
6670
</plugins>
6771
</build>
6872

microservices-self-registration/pom.xml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,10 @@
5757
<target>${maven.compiler.target}</target>
5858
</configuration>
5959
</plugin>
60+
<plugin>
61+
<groupId>com.diffplug.spotless</groupId>
62+
<artifactId>spotless-maven-plugin</artifactId>
63+
</plugin>
6064
</plugins>
6165
</pluginManagement>
6266
</build>

pom.xml

Lines changed: 1 addition & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -482,19 +482,9 @@
482482
<groupId>com.diffplug.spotless</groupId>
483483
<artifactId>spotless-maven-plugin</artifactId>
484484
<version>2.44.4</version> <!-- Use latest version -->
485-
<executions>
486-
<execution>
487-
<goals>
488-
<goal>check</goal> <!-- Run to check formatting -->
489-
<goal>apply</goal> <!-- Run to format automatically -->
490-
</goals>
491-
</execution>
492-
</executions>
493485
<configuration>
494486
<java>
495-
<googleJavaFormat>
496-
<version>1.17.0</version> <!-- Optional: choose the GJF version -->
497-
</googleJavaFormat>
487+
<googleJavaFormat/>
498488
</java>
499489
</configuration>
500490
</plugin>

rate-limiting-pattern/pom.xml

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,30 @@
11
<?xml version="1.0" encoding="UTF-8"?>
2+
<!--
3+
4+
This project is licensed under the MIT license. Module model-view-viewmodel is using ZK framework licensed under LGPL (see lgpl-3.0.txt).
5+
6+
The MIT License
7+
Copyright © 2014-2022 Ilkka Seppälä
8+
9+
Permission is hereby granted, free of charge, to any person obtaining a copy
10+
of this software and associated documentation files (the "Software"), to deal
11+
in the Software without restriction, including without limitation the rights
12+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
13+
copies of the Software, and to permit persons to whom the Software is
14+
furnished to do so, subject to the following conditions:
15+
16+
The above copyright notice and this permission notice shall be included in
17+
all copies or substantial portions of the Software.
18+
19+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
20+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
21+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
22+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
23+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
24+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
25+
THE SOFTWARE.
26+
27+
-->
228
<project xmlns="http://maven.apache.org/POM/4.0.0"
329
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
430
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">

rate-limiting-pattern/src/main/java/com/iluwatar/rate/limiting/pattern/AdaptiveRateLimiter.java

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,27 @@
1+
/*
2+
* This project is licensed under the MIT license. Module model-view-viewmodel is using ZK framework licensed under LGPL (see lgpl-3.0.txt).
3+
*
4+
* The MIT License
5+
* Copyright © 2014-2022 Ilkka Seppälä
6+
*
7+
* Permission is hereby granted, free of charge, to any person obtaining a copy
8+
* of this software and associated documentation files (the "Software"), to deal
9+
* in the Software without restriction, including without limitation the rights
10+
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
11+
* copies of the Software, and to permit persons to whom the Software is
12+
* furnished to do so, subject to the following conditions:
13+
*
14+
* The above copyright notice and this permission notice shall be included in
15+
* all copies or substantial portions of the Software.
16+
*
17+
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
18+
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
19+
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
20+
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
21+
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
22+
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
23+
* THE SOFTWARE.
24+
*/
125
package com.iluwatar.rate.limiting.pattern;
226

327
import java.util.concurrent.*;

0 commit comments

Comments
 (0)