-
Notifications
You must be signed in to change notification settings - Fork 157
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
chore: Move java 21 code to a dedicated folder and including code sni… (
#1023) * chore: Move java 21 code to a dedicated folder and including code snippe with tab. * chore: Update OptimizedActorWithJava21.java with new line.
- Loading branch information
Showing
2 changed files
with
39 additions
and
34 deletions.
There are no files selected for viewing
33 changes: 33 additions & 0 deletions
33
docs/src/main/java-jdk-21/docs/actors/classical/OptimizedActorWithJava21.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
|
||
// #pattern-matching | ||
|
||
static class OptimizedActorWithJava21 extends UntypedAbstractActor { | ||
public static class Msg1 {} | ||
|
||
public static class Msg2 {} | ||
|
||
public static class Msg3 {} | ||
|
||
@Override | ||
public void onReceive(Object msg) throws Exception { | ||
switch(msg) { | ||
case Msg1 msg -> receiveMsg1((Msg1) msg); | ||
case Msg2 msg -> receiveMsg2((Msg2) msg); | ||
case Msg3 msg -> receiveMsg3((Msg3) msg); | ||
default _ -> unhandled(msg); | ||
} | ||
} | ||
|
||
private void receiveMsg1(Msg1 msg) { | ||
// actual work | ||
} | ||
|
||
private void receiveMsg2(Msg2 msg) { | ||
// actual work | ||
} | ||
|
||
private void receiveMsg3(Msg3 msg) { | ||
// actual work | ||
} | ||
} | ||
// #pattern-matching |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters