Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: #565 batch requests issue #587

Draft
wants to merge 5 commits into
base: main
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@
import java.util.List;
import java.util.Objects;

import org.apache.olingo.server.api.OData;
import org.apache.olingo.server.api.ServiceMetadata;
import org.apache.olingo.server.api.processor.Processor;

import io.vertx.core.Context;
Expand All @@ -19,6 +21,8 @@
public abstract class AsynchronousProcessor implements Processor {
private static final String PROCESSING_STACK = "processingStack";

private static final Promise<Void> INITIAL_STATE = null;

protected Vertx vertx;

protected RoutingContext routingContext;
Expand Down Expand Up @@ -90,4 +94,29 @@ private static Deque<List<Future<Void>>> processingStack() {
}
return processingStack;
}

/**
* Resets the {@code subProcessPromise} to {@code null}.
* <p>
* This method is used to release any references held by the {@code subProcessPromise}, ensuring that the processor
* starts with a clean state. It is intentionally set to {@code null} as part of the processor's lifecycle
* management.
*/
private void resetSubProcessPromise() {
subProcessPromise = INITIAL_STATE; // Intentional reset to null
}

/**
* Initializes the processor by resetting its internal state.
* <p>
* This method is called during the processor's initialization phase. It uses {@link #resetSubProcessPromise()} to
* ensure the {@code subProcessPromise} is cleared, preparing the processor for a new lifecycle.
*
* @param odata the OData instance for this processor
* @param serviceMetadata the metadata for the OData service
*/
@Override
public void init(OData odata, ServiceMetadata serviceMetadata) {
resetSubProcessPromise();
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@ public BatchProcessor(Vertx vertx, RoutingContext routingContext, Promise<Void>

@Override
public void init(OData odata, ServiceMetadata serviceMetadata) {
super.init(odata, serviceMetadata);
this.odata = odata;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,7 @@ public CountEntityCollectionProcessor(Vertx vertx, RoutingContext routingContext

@Override
public void init(OData odata, ServiceMetadata serviceMetadata) {
super.init(odata, serviceMetadata);
this.odata = odata;
this.serviceMetadata = serviceMetadata;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -151,6 +151,7 @@ static Entity findEntityByKeyPredicates(RoutingContext routingContext, UriResour

@Override
public void init(OData odata, ServiceMetadata serviceMetadata) {
super.init(odata, serviceMetadata);
this.odata = odata;
this.serviceMetadata = serviceMetadata;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,7 @@ public PrimitiveProcessor(Vertx vertx, RoutingContext routingContext, Promise<Vo

@Override
public void init(OData odata, ServiceMetadata serviceMetadata) {
super.init(odata, serviceMetadata);
this.odata = odata;
this.serviceMetadata = serviceMetadata;
}
Expand Down
Loading