Schedulable asynchronous methods with semi-reactive completion stages
AssigneeInternational Business Machines Corporation
InventorsNathan Jon Rauh, Alex Seitzinger Motley, James Stephens, Mark Swatosh
Life of this patent
Estimating the term…
Abstract
Processing methods is provided. A method is designated as schedulable. A completion stage is generated for the method. A return of the completion stage corresponding to the method is received. It is determined whether a state of the completion stage indicates continued execution of the method. In response to determining that the state of the completion stage does indicate continued execution of the method, a set of executions of the method is continued based on an execution return of the method being a null return.
Claims20
A computer-implemented method for processing methods, the computer-implemented method comprising:
- designating, by a computer, a method as schedulable;
- generating, by the computer, a container-generated completion stage corresponding to the method, wherein the container-generated completion stage represents an entire set of scheduled executions of the method and remains incomplete across multiple scheduled executions of the method until a final termination condition occurs;
- sending, by the computer, the container-generated completion stage to an invoking program context of the method;
- scheduling, by the computer, a callback for an execution time of the method;
- determining, by the computer, whether the container-generated completion stage has completed;
- responsive to the computer determining that the container-generated completion stage has not completed, executing, by the computer, the method on a pooled thread;
- receiving, by the computer, a return corresponding to an execution of the method;
- determining, by the computer, whether the method returned null while the container-generated completion stage remains incomplete;
- and
- responsive to determining that the method has returned null, continuing, by the computer, to schedule the method for a subsequent execution time.
A computer system for processing methods, the computer system comprising:
- a communication fabric;
- a storage device connected to the communication fabric, wherein the storage device stores program instructions;
- and
- a processor connected to the communication fabric, wherein the processor executes the program instructions to:
- designate a method as schedulable;
- generate a container-generated completion stage corresponding to the method, wherein the container-generated completion stage represents an entire set of scheduled executions of the method and remains incomplete across multiple scheduled executions of the method until a final termination condition occurs;
- send the container-generated completion stage to an invoking program context of the method;
- schedule a callback for an execution time of the method;
- determine whether the container-generated completion stage has completed;
- responsive to determining that the container-generated completion stage has not completed, execute the method on a pooled thread;
- receive a return corresponding to an execution of the method;
- determine whether the method returned null while the container-generated completion stage remains incomplete;
- and
- responsive to determining that the method returned null, continue to schedule the method for a subsequent execution time.
A computer program product for processing methods, the computer program product comprising a computer-readable storage medium having program instructions embodied therewith, the program instructions executable by a computer to cause the computer to perform a method of:
- designating, by the computer, a method as schedulable;
- generating, by the computer, a container-generated completion stage corresponding to the method, wherein the container-generated completion stage represents an entire set of scheduled executions of the method and remains incomplete across multiple scheduled executions of the method until a final termination condition occurs;
- sending, by the computer, the container-generated completion stage to an invoking program context of the method;
- scheduling, by the computer, a callback for an execution time of the method;
- determining, by the computer, whether the container-generated completion stage has completed;
- responsive to the computer determining that the container-generated completion stage has not completed, executing, by the computer, the method on a pooled thread;
- receiving, by the computer, a return corresponding to an execution the method;
- determining, by the computer, whether the method returned null while the container-generated completion stage remains incomplete;
- and
- responsive to determining that the method has returned null, continuing, by the computer, to schedule the method for a subsequent execution time.
Dependencies are inferred from the claim text.