We seem to be stuck with listeners not firing, leaving references
which need to be cleared. Ensure we fire phase listeners as soon
as they are satisfied -- repurposing tryApply() for its logical
purpose.
JIRA: YANGTOOLS-1192
Change-Id: I87d1700e2cc80bfa3fbb5be9a8dc938d6fe55c17
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
(cherry picked from commit
d70f2e9f13755ea7c3aac1f0c8d8a6b0b0861368)
- private void applyAction() {
- checkState(!actionApplied);
- action.apply(ctx);
- actionApplied = true;
- }
-
private <K, C extends StmtContext<?, ?, ?>, N extends StatementNamespace<K, ?, ?>> @NonNull AbstractPrerequisite<C>
requiresCtxImpl(final StmtContext<?, ?, ?> context, final Class<N> namespace, final K key,
final ModelProcessingPhase phase) {
private <K, C extends StmtContext<?, ?, ?>, N extends StatementNamespace<K, ?, ?>> @NonNull AbstractPrerequisite<C>
requiresCtxImpl(final StmtContext<?, ?, ?> context, final Class<N> namespace, final K key,
final ModelProcessingPhase phase) {
checkState(action != null, "Action was not defined yet.");
if (removeSatisfied()) {
checkState(action != null, "Action was not defined yet.");
if (removeSatisfied()) {
+ if (!actionApplied) {
+ action.apply(ctx);
+ actionApplied = true;
+ }
return true;
}
return false;
return true;
}
return false;
@Override
public boolean phaseFinished(final StatementContextBase<?, ?, ?> context,
final ModelProcessingPhase finishedPhase) {
@Override
public boolean phaseFinished(final StatementContextBase<?, ?, ?> context,
final ModelProcessingPhase finishedPhase) {
- return resolvePrereq((C) context);
+ return resolvePrereq((C) context) || tryApply();
@Override
public boolean phaseFinished(final StatementContextBase<?, ?, ?> context,
final ModelProcessingPhase finishedPhase) {
@Override
public boolean phaseFinished(final StatementContextBase<?, ?, ?> context,
final ModelProcessingPhase finishedPhase) {
- return resolvePrereq((C) context);
+ return resolvePrereq((C) context) || tryApply();
if (!it.hasNext()) {
// Last step: we are done
if (!it.hasNext()) {
// Last step: we are done
- resolvePrereq((C) value);
+ if (resolvePrereq((C) value)) {
+ tryApply();
+ }