Files
.circleci
.github
.mvn
abstract-document
abstract-factory
active-object
acyclic-visitor
adapter
aggregator-microservices
ambassador
api-gateway
ar
arrange-act-assert
assets
async-method-invocation
balking
bridge
builder
business-delegate
bytecode
caching
callback
chain
circuit-breaker
cloud-static-content-hosting
collection-pipeline
combinator
command
commander
composite
converter
cqrs
dao
data-bus
data-locality
data-mapper
data-transfer-object
decorator
delegation
dependency-injection
dirty-flag
double-buffer
double-checked-locking
double-dispatch
eip-aggregator
eip-message-channel
eip-publish-subscribe
eip-splitter
eip-wire-tap
etc
event-aggregator
event-asynchronous
event-driven-architecture
event-queue
event-sourcing
execute-around
extension-objects
facade
factory
factory-kit
factory-method
feature-toggle
filterer
fluentinterface
flux
flyweight
fr
front-controller
game-loop
guarded-suspension
half-sync-half-async
hexagonal
intercepting-filter
interpreter
iterator
ko
layers
lazy-loading
leader-election
leader-followers
marker
master-worker-pattern
mediator
memento
model-view-controller
model-view-presenter
module
monad
monostate
multiton
mute-idiom
naked-objects
null-object
object-mother
object-pool
observer
page-object
parameter-object
partial-response
pipeline
poison-pill
priority-queue
private-class-data
producer-consumer
promise
property
prototype
proxy
queue-load-leveling
reactor
reader-writer-lock
registry
repository
resource-acquisition-is-initialization
retry
role-object
saga
separated-interface
servant
serverless
service-layer
service-locator
sharding
singleton
spatial-partition
special-case
specification
state
step-builder
strangler
strategy
subclass-sandbox
template-method
thread-pool
throttling
etc
throttling.urm.puml
throttling_urm.png
src
README.md
pom.xml
tls
tolerant-reader
tr
trampoline
transaction-script
twin
typeobjectpattern
unit-of-work
update-method
value-object
version-number
visitor
zh
.all-contributorsrc
.gitignore
CONTRIBUTING.MD
LICENSE.md
PULL_REQUEST_TEMPLATE.md
README.md
checkstyle-suppressions.xml
license-plugin-header-style.xml
lombok.config
mvnw
mvnw.cmd
pom.xml
java-design-patterns/throttling/etc/throttling.urm.puml

47 lines
1.3 KiB
Plaintext
Raw Permalink Normal View History

2019-12-07 18:03:49 +02:00
@startuml
package com.iluwatar.throttling {
class App {
- LOGGER : Logger {static}
+ App()
+ main(args : String[]) {static}
- makeServiceCalls(tenant : Tenant, callsCount : CallsCount) {static}
}
~class B2BService {
- LOGGER : Logger {static}
- callsCount : CallsCount
+ B2BService(timer : Throttler, callsCount : CallsCount)
+ dummyCustomerApi(tenant : Tenant) : int
- getRandomCustomerId() : int
}
class CallsCount {
- LOGGER : Logger {static}
- tenantCallsCount : Map<String, AtomicLong>
+ CallsCount()
+ addTenant(tenantName : String)
+ getCount(tenantName : String) : long
+ incrementCount(tenantName : String)
+ reset()
}
class Tenant {
- allowedCallsPerSecond : int
- name : String
+ Tenant(name : String, allowedCallsPerSecond : int, callsCount : CallsCount)
+ getAllowedCallsPerSecond() : int
+ getName() : String
}
}
package com.iluwatar.throttling.timer {
class ThrottleTimerImpl {
- callsCount : CallsCount
- throttlePeriod : int
+ ThrottleTimerImpl(throttlePeriod : int, callsCount : CallsCount)
+ start()
}
interface Throttler {
+ start() {abstract}
}
}
B2BService --> "-callsCount" CallsCount
ThrottleTimerImpl --> "-callsCount" CallsCount
ThrottleTimerImpl ..|> Throttler
@enduml