mirror of
https://github.com/tiennm99/java-design-patterns.git
synced 2026-05-14 20:58:35 +00:00
52 lines
1.0 KiB
Plaintext
52 lines
1.0 KiB
Plaintext
@startuml
|
|
|
|
package com.iluwatar.logaggregation {
|
|
|
|
class App {
|
|
+ main(args: String[]) {static}
|
|
}
|
|
|
|
class CentralLogStore {
|
|
- logs: ConcurrentLinkedQueue<LogEntry>
|
|
+ storeLog(logEntry: LogEntry)
|
|
+ displayLogs()
|
|
}
|
|
|
|
class LogAggregator {
|
|
- BUFFER_THRESHOLD: int {static}
|
|
- centralLogStore: CentralLogStore
|
|
- buffer: ConcurrentLinkedQueue<LogEntry>
|
|
- minLogLevel: LogLevel
|
|
- executorService: ExecutorService
|
|
- logCount: AtomicInteger
|
|
+ collectLog(logEntry: LogEntry)
|
|
+ stop()
|
|
}
|
|
|
|
class LogEntry {
|
|
- serviceName: String
|
|
- level: LogLevel
|
|
- message: String
|
|
- timestamp: LocalDateTime
|
|
}
|
|
|
|
enum LogLevel {
|
|
DEBUG
|
|
INFO
|
|
ERROR
|
|
}
|
|
|
|
class LogProducer {
|
|
- serviceName: String
|
|
- aggregator: LogAggregator
|
|
+ generateLog(level: LogLevel, message: String)
|
|
}
|
|
}
|
|
|
|
LogProducer --> "-aggregator" LogAggregator
|
|
LogAggregator --> "-centralLogStore" CentralLogStore
|
|
LogAggregator --> "-buffer" LogEntry
|
|
CentralLogStore --> "-logs" LogEntry
|
|
|
|
@enduml
|