Actually, the legislation stipulates that the judge is required to hold a hearing in private. It is not left to the judge's discretion. It's at the government's request.
However, once the judge is aware of the government's position and has determined why the government has asked for such a hearing, the judge may decide whether the information is sensitive and needs to be protected.
A private hearing is held, but it is used to determine what the government wants to propose or is trying to protect. The judge then renders a decision. A series of private hearings are then held to protect the information. In cases like that, a summary of the information is provided to the individual and the individual's counsel. However, the judge may consider that the information is not sensitive and does not necessarily need to be protected, in which case, things proceed in the customary way.