Patent ID: 9665626
Date: 2017-05-30
CPC Classifications: G06F,H04L

Claim:
1. A computer program product for sorting and merging data from at least two sources, the computer program product comprising a non-transitory computer readable storage medium having program instructions embodied therewith, the program instructions executable by a computer to cause the computer to: timestamp the data from the at least two sources; enter the timestamped data into at least one of a first input queue, a second input queue, a third input queue, and a fourth input queue; provide a multi-state merge of queues from the first input queue and the second input queue to a merged output, wherein each of the first input queue and the second input queue has a state from a group including empty waiting, active, and ignore, wherein the empty waiting state has a wait duration time; initialize each of the first input queue and the second input queue to active; responsive to detecting an empty first input queue to be merged with a non-empty second input queue and the state of the first input queue is active, set the state of the first input queue to empty waiting with a time out; responsive to receiving an entry describing the state of the first input queue when the state of the first input queue is empty waiting, and prior to the time out, set the state of the first input queue to active; responsive to detecting the time out and state of the first input queue equal to empty waiting, set the state of the first input queue to ignore; prevent merging of the first input queue with the non-empty second input queue while the state of the first input queue is empty waiting; merge the first input queue with the non-empty second input queue responsive to the state of the first input queue being active; merge the first input queue with the non-empty second input queue responsive to the state of the first input queue being ignore; merge the first input queue with the non-empty second input queue responsive to the wait duration time being exceeded; and merge the first input queue with the non-empty second input queue responsive to a startup command; begin a sorting of data combined from the first input queue, the second input queue, the third input queue, and the fourth input queue, wherein the sorting of the data combined from the first input queue, the second input queue, the third input queue, and the fourth input queue is executed after casting the combined data to a common data type; receive a notice that the fourth input queue is newly empty; pause the sorting of the combined data until after a waiting period for the newly empty fourth input queue has passed; determine whether to sort the first input queue together with the second input queue or the third input queue based on first input queue timestamp data, second input queue timestamp data, and third input queue timestamp data; responsive to a timestamp of datum from at least one of the first input queue, the second input queue, the third input queue, and the fourth input queue being dated after the beginning of the sorting of the combined data, remove the respective datum to an output queue, restart and complete the sorting of the combined data of the first input queue, the second input queue, and the third input queue based on the determining of whether to sort the first input queue together with the second input queue or the third input queue, wherein the restarting of the sorting proceeds without the removed datum, and wherein the multi-stage merge is for a streaming application.