for future note  this should probably be workitem item myworkqueue take if  mycancelallflag myworkqueue clear mycancelqueue clear myidgenerator mycancelallflag false else if  mycancelqueue size for  handle handle mycancelqueue noinspection suspiciousmethodcalls myworkqueue remove handle mycancelqueue remove handle if  handle id item myhandle id item null if  item null callbackhelper item but i am removing this functionality for now 