Are you trying to end a taskInstance? If it is the case, call: myTaskInstance.end(). This method sets end date for current taskInstance and taskMgmtSession sees this task as ended and consequently won't bring this task as return value of tasMgmtSession.findTaskInsXXXX.
If you want not to end the task just to set a flag indicating that the task has been viewed, set a localVariable on the task e.g. taskInstance.setVariableLocally(variableName, new Boolean(true)); For the next time you retrieve that task using taskMgmtSession.findTaskXXXX check whether it has been seen before or not using taskInstance.getVariableLocally(variableName);
If this post couldn't help you please let me know what you are exactly looking for.
With kind regards,