Class EdgeInfo
- java.lang.Object
-
- org.apache.felix.scr.impl.manager.EdgeInfo
-
class EdgeInfo extends java.lang.Object
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
Fields Modifier and Type Field Description private int
close
private java.util.concurrent.CountDownLatch
closeLatch
private int
open
private java.util.concurrent.CountDownLatch
openLatch
-
Constructor Summary
Constructors Constructor Description EdgeInfo()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description boolean
afterRange(int trackingCount)
boolean
beforeRange(int trackingCount)
java.util.concurrent.CountDownLatch
getCloseLatch()
java.util.concurrent.CountDownLatch
getOpenLatch()
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, java.lang.String componentName, java.lang.String methodName)
private void
waitForLatch(AbstractComponentManager<?> m_componentManager, java.util.concurrent.CountDownLatch latch, java.lang.String componentName, java.lang.String methodName, java.lang.String latchName)
void
waitForOpen(AbstractComponentManager<?> m_componentManager, java.lang.String componentName, java.lang.String methodName)
-
-
-
Method Detail
-
setClose
public void setClose(int close)
-
getOpenLatch
public java.util.concurrent.CountDownLatch getOpenLatch()
-
waitForOpen
public void waitForOpen(AbstractComponentManager<?> m_componentManager, java.lang.String componentName, java.lang.String methodName)
-
waitForClose
public void waitForClose(AbstractComponentManager<?> m_componentManager, java.lang.String componentName, java.lang.String methodName)
-
waitForLatch
private void waitForLatch(AbstractComponentManager<?> m_componentManager, java.util.concurrent.CountDownLatch latch, java.lang.String componentName, java.lang.String methodName, java.lang.String latchName)
-
getCloseLatch
public java.util.concurrent.CountDownLatch 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)
-
-