Package Functions | |
ComponentMap (Logger logger) | |
synchronized boolean | reserveComponent (int compHandle) |
synchronized ComponentAdapter | put (int compHandle, ComponentAdapter compAdapter) |
synchronized void | sort (int[] sortedHandles) |
synchronized ComponentAdapter | remove (int compHandle) |
synchronized ComponentAdapter | get (int compHandle) |
synchronized ComponentAdapter[] | getComponentAdapters (int[] compHandles) |
ComponentAdapter | getComponentByNameAndType (String name, String type) |
synchronized ComponentAdapter[] | getAllComponentAdapters () |
synchronized int[] | getAllHandles () |
Synchronized type-safe map for loaded components. Keys are component handles, values are ComponentAdapter
s. The map entries are sorted by insertion order, or by the handle sequence given to sort(int[]).
Note that it is not sufficient to use something like Collections.synchronizedMap(new HashMap())
, since reading out the keys or values of such a map with an iterator is still backed by the original instance and therefore not thread-safe. See Collections#synchronizedMap(java.util.Map).
alma.acs.container.ComponentMap.ComponentMap | ( | Logger | logger | ) | [package] |
synchronized ComponentAdapter alma.acs.container.ComponentMap.get | ( | int | compHandle | ) | [package] |
Returns the component adapter for a given component handle, or null
if either the component handle is unknown, or if the corresponding component is still under construction (which means that the handle is just for a 'reservation'.
compHandle |
Referenced by alma.acs.container.AcsContainer.restart_component().
synchronized ComponentAdapter [] alma.acs.container.ComponentMap.getAllComponentAdapters | ( | ) | [package] |
Gets all component adapters stored in the map. Unlike Map#values(), the returned array contains a snapshot of the map contents, rather than a live view backed by the map.
Notice that null
adapters for reserved components are not included in the returned array of adapters.
Referenced by alma.acs.container.AcsContainer.components_available(), alma.acs.container.AcsContainer.components_unavailable(), alma.acs.container.AcsContainer.get_component_info(), and alma.acs.container.ComponentMap.getComponentByNameAndType().
synchronized int [] alma.acs.container.ComponentMap.getAllHandles | ( | ) | [package] |
Gets all component handles, which are the keys of the map. Unlike Map#keySet(), the returned array contains a snapshot of the map contents, rather than a view backed by the map.
TODO: check if it's ok to include handles for reserved component adapters (value still null)
synchronized ComponentAdapter [] alma.acs.container.ComponentMap.getComponentAdapters | ( | int[] | compHandles | ) | [package] |
Gets component adapters with the specified handles out of the map. Ignores handles for which no components are stored. The order of the returned component adapters matches the order of the handles.
Unlike Map#values(), the returned array contains a snapshot of the map contents, rather than a view backed by the map.
compHandles | handles of those components whose adapters should be returned. |
compHandles
. Possibly an empty array (if compHandles is null or empty or contains wrong handles), but never null. Referenced by alma.acs.container.AcsContainer.deactivate_component(), and alma.acs.container.AcsContainer.get_component_info().
ComponentAdapter alma.acs.container.ComponentMap.getComponentByNameAndType | ( | String | name, | |
String | type | |||
) | [package] |
Tries to find a component with the given name and type, regardless of the handle which is the "primary key".
name | component instance name (curl) | |
type | IDL type name |
References alma.acs.container.ComponentMap.getAllComponentAdapters(), alma.acs.container.ComponentAdapter.getName(), and alma.acs.container.ComponentAdapter.getType().
synchronized ComponentAdapter alma.acs.container.ComponentMap.put | ( | int | compHandle, | |
ComponentAdapter | compAdapter | |||
) | [package] |
compHandle | ||
compAdapter |
Referenced by alma.acs.container.AcsContainer.activate_component().
synchronized ComponentAdapter alma.acs.container.ComponentMap.remove | ( | int | compHandle | ) | [package] |
Removes a component adapter from the map.
compHandle | handle of component (adapter) to be removed |
ComponentAdapter
with that handle, or null Referenced by alma.acs.container.AcsContainer.activate_component().
synchronized boolean alma.acs.container.ComponentMap.reserveComponent | ( | int | compHandle | ) | [package] |
Makes a reservation for a ComponentAdapter
based on the component handle. Can be used to avoid concurrent multiple activation of the same component (which also manager should prevent).
compHandle |
Referenced by alma.acs.container.AcsContainer.activate_component().
synchronized void alma.acs.container.ComponentMap.sort | ( | int[] | sortedHandles | ) | [package] |
Sorts the entries in the order given by sortedHandles
. The sorted component handles will be received from the manager. Before this method is called, the iteration order is that of insertion order.
sortedHandles |
Referenced by alma.acs.container.AcsContainer.set_component_shutdown_order().