mirror of
https://github.com/tiennm99/java-design-patterns.git
synced 2026-05-16 12:59:13 +00:00
fe522fd70d
* feat: Implement Actor Model pattern #3232 * feat: Implement Actor Model pattern #3232 * feat: update Actor Model implementation with multi-actor logic #3251 * feat: update Actor Model implementation with multi-actor logic and loose coupling #3251 * test: add unit test for actor model #3251 * test: add test for App.java to increase coverage * docs: add complete README for Actor Model pattern also implemented changes #3251
36 lines
607 B
Plaintext
36 lines
607 B
Plaintext
@startuml actor-model
|
|
|
|
title Actor Model - UML Class Diagram
|
|
|
|
class ActorSystem {
|
|
+actorOf(actor: Actor): Actor
|
|
+shutdown(): void
|
|
}
|
|
|
|
class Actor {
|
|
-mailbox: BlockingQueue<Message>
|
|
-active: boolean
|
|
+send(message: Message): void
|
|
+stop(): void
|
|
+run(): void
|
|
#onReceive(message: Message): void
|
|
}
|
|
|
|
class ExampleActor {
|
|
+onReceive(message: Message): void
|
|
}
|
|
|
|
class Message {
|
|
-content: String
|
|
-sender: Actor
|
|
+getContent(): String
|
|
+getSender(): Actor
|
|
}
|
|
|
|
ActorSystem --> Actor : creates
|
|
Actor <|-- ExampleActor : extends
|
|
Actor --> Message : processes
|
|
ExampleActor --> Message : uses
|
|
|
|
@enduml
|