
Public Member Functions | |
| ComponentInfoTopologicalSortManager (HandleDataStore components, HandleDataStore containers, ReaderPreferenceReadWriteLock activationPendingRWLock, Set pendingContainerShutdown, ThreadPoolExecutor threadPool, Logger logger) | |
| void | run () |
| void | requestTopologicalSort () |
| synchronized void | notifyTopologyChange (int containerHandleToNotify) |
| ComponentInfo[] | getComponentShutdownOrder (ContainerInfo containerInfo) |
| synchronized void | destroy () |
Private Member Functions | |
| void | notifyContainerShutdownOrder (ContainerInfo containerInfo, int[] handles) |
Private Attributes | |
| HandleDataStore | components |
| HandleDataStore | containers |
| volatile boolean | destroyed = false |
| ReaderPreferenceReadWriteLock | activationPendingRWLock |
| HashSet | dirtyContainerMap = new HashSet() |
| Object | listLock = new Object() |
| ComponentInfo[] | currentTSList = new ComponentInfo[0] |
| Set | pendingContainerShutdown |
| ThreadPoolExecutor | threadPool |
| Logger | logger |
| Map | pendingContainerNotifications = new HashMap() |
Manages TS.
| com::cosylab::acs::maci::manager::ComponentInfoTopologicalSortManager::ComponentInfoTopologicalSortManager | ( | HandleDataStore | components, | |
| HandleDataStore | containers, | |||
| ReaderPreferenceReadWriteLock | activationPendingRWLock, | |||
| Set | pendingContainerShutdown, | |||
| ThreadPoolExecutor | threadPool, | |||
| Logger | logger | |||
| ) | [inline] |
| components | ||
| containers |
References dirtyContainerMap, com::cosylab::acs::maci::manager::HandleDataStore::first, com::cosylab::acs::maci::manager::HandleDataStore::get(), and com::cosylab::acs::maci::manager::HandleDataStore::next().
| synchronized void com::cosylab::acs::maci::manager::ComponentInfoTopologicalSortManager::destroy | ( | ) | [inline] |
Destroy (terminate thread).
References destroyed.
Referenced by com::cosylab::acs::maci::manager::ManagerImpl::shutdown().
| ComponentInfo [] com::cosylab::acs::maci::manager::ComponentInfoTopologicalSortManager::getComponentShutdownOrder | ( | ContainerInfo | containerInfo | ) | [inline] |
Get component shutdown order for container.
| containerInfo | valid container's info, if null complete TS is returned. |
References currentTSList, com::cosylab::acs::maci::ComponentInfo::getContainerName(), com::cosylab::acs::maci::ContainerInfo::getName(), and listLock.
Referenced by com::cosylab::acs::maci::manager::ManagerImpl::shutdown(), and com::cosylab::acs::maci::manager::ManagerImpl::shutdownContainer().
| void com::cosylab::acs::maci::manager::ComponentInfoTopologicalSortManager::notifyContainerShutdownOrder | ( | ContainerInfo | containerInfo, | |
| int[] | handles | |||
| ) | [inline, private] |
Task thats invokes Container::shutdown method.
Add new notification. This will keep only the latest one.
| handles |
true if notification is being acceptedReferences com::cosylab::acs::maci::ContainerInfo::getContainer(), logger, pendingContainerNotifications, run(), and threadPool.
Referenced by run().
| synchronized void com::cosylab::acs::maci::manager::ComponentInfoTopologicalSortManager::notifyTopologyChange | ( | int | containerHandleToNotify | ) | [inline] |
Notify about (possible) topology change and initiates sorting.
| containerHandleToNotify | container handle to notify. |
References dirtyContainerMap.
Referenced by com::cosylab::acs::maci::manager::ManagerImpl::containerInternalStateMerge(), com::cosylab::acs::maci::manager::ManagerImpl::internalNoSyncReleaseComponent(), and com::cosylab::acs::maci::manager::ManagerImpl::internalNoSyncRequestComponent().
| void com::cosylab::acs::maci::manager::ComponentInfoTopologicalSortManager::requestTopologicalSort | ( | ) | [inline] |
Request topological sort.
References activationPendingRWLock, components, currentTSList, listLock, and com::cosylab::acs::maci::manager::ReaderPreferenceReadWriteLock::writeLock().
Referenced by com::cosylab::acs::maci::manager::ManagerImpl::shutdown().
| void com::cosylab::acs::maci::manager::ComponentInfoTopologicalSortManager::run | ( | ) | [inline] |
(Sync is clean since activationPendingRWLock is acquired and all notify request is issued only from its reader lock).
References activationPendingRWLock, com::cosylab::acs::maci::IntArray::add(), components, containers, currentTSList, destroyed, dirtyContainerMap, com::cosylab::acs::maci::manager::HandleDataStore::get(), com::cosylab::acs::maci::ComponentInfo::getContainerName(), com::cosylab::acs::maci::ContainerInfo::getName(), com::cosylab::acs::maci::manager::HandleDataStore::isAllocated(), listLock, notifyContainerShutdownOrder(), pendingContainerShutdown, com::cosylab::acs::maci::IntArray::size(), com::cosylab::acs::maci::IntArray::toArray(), and com::cosylab::acs::maci::manager::ReaderPreferenceReadWriteLock::writeLock().
Referenced by notifyContainerShutdownOrder().
ReaderPreferenceReadWriteLock com::cosylab::acs::maci::manager::ComponentInfoTopologicalSortManager::activationPendingRWLock [private] |
Lock.
Referenced by requestTopologicalSort(), and run().
HandleDataStore com::cosylab::acs::maci::manager::ComponentInfoTopologicalSortManager::components [private] |
Components data store.
Referenced by requestTopologicalSort(), and run().
HandleDataStore com::cosylab::acs::maci::manager::ComponentInfoTopologicalSortManager::containers [private] |
Containers data store.
Referenced by run().
ComponentInfo [] com::cosylab::acs::maci::manager::ComponentInfoTopologicalSortManager::currentTSList = new ComponentInfo[0] [private] |
Current ordered TS list.
Referenced by getComponentShutdownOrder(), requestTopologicalSort(), and run().
volatile boolean com::cosylab::acs::maci::manager::ComponentInfoTopologicalSortManager::destroyed = false [private] |
HashSet com::cosylab::acs::maci::manager::ComponentInfoTopologicalSortManager::dirtyContainerMap = new HashSet() [private] |
Dirty map.
Referenced by ComponentInfoTopologicalSortManager(), notifyTopologyChange(), and run().
Object com::cosylab::acs::maci::manager::ComponentInfoTopologicalSortManager::listLock = new Object() [private] |
Lock.
Referenced by getComponentShutdownOrder(), requestTopologicalSort(), and run().
Logger.
Referenced by notifyContainerShutdownOrder().
Map com::cosylab::acs::maci::manager::ComponentInfoTopologicalSortManager::pendingContainerNotifications = new HashMap() [private] |
Informs containers abouts its component shutdown order.
| containerInfo | container to inform | |
| handles | ordered list of component handles |
Referenced by notifyContainerShutdownOrder().
Set com::cosylab::acs::maci::manager::ComponentInfoTopologicalSortManager::pendingContainerShutdown [private] |
List of all pending container shutdowns.
Referenced by run().
ThreadPoolExecutor com::cosylab::acs::maci::manager::ComponentInfoTopologicalSortManager::threadPool [private] |
Thread pool (guarantees order of execution).
Referenced by notifyContainerShutdownOrder().
1.6.2