Class EdgeInfo
java.lang.Object
org.apache.felix.scr.impl.manager.EdgeInfo
EdgeInfo holds information about the service event tracking counts for creating (open) and disposing (close)
implementation object instances per dependency manager. These need to be maintained for each implementation object instance
because each instance (for a service factory) will have different sets of service references available. These need to be
maintained for each dependency manager because the open/close tracking counts are obtained when the set of current
service references is obtained, using a lock internal to the service tracker.
The information in the open/close counts is used in the outOfRange method which determines if a service event tracking count
occurred before the "open" event (in which case it is reflected in the open set already and does not need to be processed separately)
or after the "close" event (in which case it is reflected in the close set already).
The open latch is used to make sure that elements in the open set are completely processed before updated or unbind events
are processed
The close latch is used to make sure that unbind events that are out of range wait for the close to complete before returning;
in this case the unbind is happening in the "close" thread rather than the service event thread, so we wait for the close to complete
so that when the service event returns the unbind will actually have been completed.
Related to this functionality is the missing tracking in AbstractComponentManager. This is used on close of an instance to make
sure all service events occuring before close starts complete processing before the close takes action.
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate int
private final CountDownLatch
private int
private final CountDownLatch
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionboolean
afterRange
(int trackingCount) boolean
beforeRange
(int trackingCount) void
ignore()
boolean
outOfRange
(int trackingCount) Returns whether the tracking count is before the open count or after the close count (if set) This must be called from within a block synchronized on m_tracker.tracked().void
setClose
(int close) void
setOpen
(int open) void
waitForClose
(AbstractComponentManager<?> m_componentManager, String componentName, String methodName) private void
waitForLatch
(AbstractComponentManager<?> m_componentManager, CountDownLatch latch, String componentName, String methodName, String latchName) void
waitForOpen
(AbstractComponentManager<?> m_componentManager, String componentName, String methodName)
-
Field Details
-
open
private int open -
close
private int close -
openLatch
-
closeLatch
-
-
Constructor Details
-
EdgeInfo
EdgeInfo()
-
-
Method Details
-
setClose
public void setClose(int close) -
getOpenLatch
-
waitForOpen
public void waitForOpen(AbstractComponentManager<?> m_componentManager, String componentName, String methodName) -
waitForClose
public void waitForClose(AbstractComponentManager<?> m_componentManager, String componentName, String methodName) -
waitForLatch
private void waitForLatch(AbstractComponentManager<?> m_componentManager, CountDownLatch latch, String componentName, String methodName, String latchName) -
getCloseLatch
-
setOpen
public void setOpen(int open) -
ignore
public void ignore() -
outOfRange
public boolean outOfRange(int trackingCount) Returns whether the tracking count is before the open count or after the close count (if set) This must be called from within a block synchronized on m_tracker.tracked(). Setting open occurs in a synchronized block as well, to the tracker's current tracking count. Therefore if this outOfRange call finds open == -1 then open will be set to a tracking count at least as high as the argument tracking count.- Parameters:
trackingCount
- tracking count from tracker to compare with range- Returns:
- true if open not set, tracking count before open, or close set and tracking count after close.
-
beforeRange
public boolean beforeRange(int trackingCount) -
afterRange
public boolean afterRange(int trackingCount)
-