Class PushCallbackTask

java.lang.Object
com.iizix.WorkerTask<String,Void,Void>
com.iizix.server.push.api.PushCallbackTask
All Implemented Interfaces:
Comparable<Object>

public final class PushCallbackTask extends WorkerTask<String,Void,Void>
The worker-posting helper of PUSH-PROPS-DESIGN section 5: a callback or a listener event posted to the session's worker as a WorkerTask with a WorkerTaskEnded callback, never run on the calling thread, with the disposal rule of design section 6.2 applied at every stage - the session disposed before the post, the worker refusing the post, the session disposed before the task ran, the task cancelled by the worker's disposal or abandoned by the API's - and each such case logged ONCE at INFO as "not completed".

The task runs the callback in its own try/catch: a callback that throws is logged SEVERE and neither reaches the worker nor stops the session.

MEASURED (P4-04, PushSessionAPITest): WorkerTask.cancel calls the task-ended callback only while the task is NOT_STARTED, and Worker.post marks a task POSTED before queueing it, so a queued task cancelled by Worker.dispose never informs its callback - contrary to both JavaDocs. The API therefore keeps its own set of pending tasks and abandons them at its disposal (abandon(String)); the task-ended callback is kept as well, so the line is logged whichever path runs first and never twice.

Author:
Christopher Mindus
  • Method Details

    • execute

      public Void execute(String operation, Void param)
      Description copied from class: WorkerTask
      Start execution of the task with the implementation specific task ID and parameter.
      Specified by:
      execute in class WorkerTask<String,Void,Void>
      Parameters:
      operation - The implementation specific task ID.
      param - The implementation specific parameter, or null for none.
      Returns:
      The return code.