Event Based Asynchronous pattern: Add missing license header and puml diagram

This commit is contained in:
Ilkka Seppälä
2016-10-18 07:51:37 +03:00
parent 0f7b44c3b1
commit 99677867c6
2 changed files with 88 additions and 0 deletions

View File

@ -0,0 +1,65 @@
@startuml
package com.iluwatar.event.asynchronous {
class Event {
- eventId : int
- eventListener : ThreadCompleteListener
- eventTime : int
- isComplete : boolean
- isSynchronous : boolean
- thread : Thread
+ Event(eventId : int, eventTime : int, isSynchronous : boolean)
+ addListener(listener : ThreadCompleteListener)
- completed()
+ isSynchronous() : boolean
+ removeListener(listener : ThreadCompleteListener)
+ run()
+ start()
+ status()
+ stop()
}
interface ThreadCompleteListener {
+ completedEventHandler(int) {abstract}
}
class EventManager {
+ MAX_EVENT_TIME : int {static}
+ MAX_ID : int {static}
+ MAX_RUNNING_EVENTS : int {static}
+ MIN_ID : int {static}
- currentlyRunningSyncEvent : int
- eventPool : Map<Integer, Event>
- rand : Random
+ EventManager()
+ cancel(eventId : int)
+ completedEventHandler(eventId : int)
+ create(eventTime : int) : int
+ createAsync(eventTime : int) : int
- createEvent(eventTime : int, isSynchronous : boolean) : int
- generateId() : int
+ getEventPool() : Map<Integer, Event>
+ numOfCurrentlyRunningSyncEvent() : int
+ shutdown()
+ start(eventId : int)
+ status(eventId : int)
+ statusOfAllEvents()
}
class App {
+ PROP_FILE_NAME : String {static}
~ interactiveMode : boolean
+ App()
+ main(args : String[]) {static}
+ quickRun()
+ run()
+ runInteractiveMode()
+ setUp()
}
interface IEvent {
+ start() {abstract}
+ status() {abstract}
+ stop() {abstract}
}
}
Event --> "-eventListener" ThreadCompleteListener
EventManager --+ Map
Event ..|> IEvent
EventManager ..|> ThreadCompleteListener
@enduml

View File

@ -1 +1,24 @@
#
# The MIT License
# Copyright (c) 2014 Ilkka Seppälä
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limitation the rights
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
# copies of the Software, and to permit persons to whom the Software is
# furnished to do so, subject to the following conditions:
#
# The above copyright notice and this permission notice shall be included in
# all copies or substantial portions of the Software.
#
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
# THE SOFTWARE.
#
INTERACTIVE_MODE=NO