public class CleanUpUtil
extends java.lang.Object
This class is used to do clean-up work after BDD is restarted. It currently handles the following cases (mostly for issues that occur after
graceful shutdown): (1) For Upload: if a graceful shutdown happens after the Hive table is created but before Studio invokes the provision
workflow, an orphan Hive table and avro/schema files would be left behind. These files would be removed here. (2) For BulkExport to Computer:
if a graceful shutdown happens after the temporary file is created in HDFS but before it is downloaded and removed. The temporary file would
be left behind. That file would also be removed here. (3) For DP workflows: if Studio crashes, is shut down, or is completely stopped when
a DP workflow is being run by the Workflow Manager, studio asks for any notifications it missed the next time it starts back up. During
portal startup, we find the timestamp of the most recent received notification. During the first request to the portal we ask Workflow Manager
to resend any notifications since that timestamp. This will let Studio see and react to success or failure notifications for any workflows
that ran while it was down.
Studio now ignores any re-sent notification for an ECID for which it already has a more recent notification. So it's okay if this approach
results in resending notifications that Studio may have already received.
We snapshot the most recent notification during portal startup since in the startup phase, Studio has not yet started accepting traffic
(like new notification messages). Hence we know the notification timestamp we find during portal startup must correspond to the last
time Studio was running. But of course we cannot request re-sent notification during portal startup since we are not yet able to receive
them. So instead we defer the notification re-send request until first portal request.