CleanupContext Event

Fires when the application-defined data stored in one or more contexts needs to be cleaned up.

Syntax

public class DefaultCbfilterEventListener implements CbfilterEventListener {
  ...
  public void cleanupContext(CbfilterCleanupContextEvent e) {}
  ...
}

public class CbfilterCleanupContextEvent {
  public long fileContext;
  public long handleContext;
  public int resultCode;
}

Remarks

This event fires after a file or directory is closed, just before any contexts related to it are discarded, giving applications a chance to clean up any information stored in them.

The FileContext and HandleContext parameters are placeholders for application-defined data associated with the file and specific handle, respectively. Please refer to the Contexts topic for more information.

When a handle to some file or directory is closed, this event will fire if the HandleContext associated with that handle is not 0. When the last handle to the file or directory is closed, this event will fire if the HandleContext associated with that handle and/or the FileContext associated with that file or directory is not 0. After this event fires, the applicable contexts are set back to 0 automatically.

Applications that need to know the name of the file or directory this event is firing for should store a copy of said name in the context itself during an earlier event.

This event is optional; it will fire regardless of whether any filter rules are present, but only if FileContext, HandleContext, or both, are not already 0. Applications that clean up their contexts (and set them back to 0) when a file is being closed, or earlier, do not need to handle this event.

The ResultCode parameter will always be 0 when the event is fired. If the event cannot be handled in a "successful" manner for some reason (e.g., a resource isn't available, security checks failed, etc.), set it to a non-zero value to report an appropriate error. Please refer to the Error Reporting and Handling topic for more information.

This event is fired synchronously; please refer to the Event Types topic for more information.

Copyright (c) 2022 Callback Technologies, Inc. - All rights reserved.
CBFS Filter 2020 Java Edition - Version 20.0 [Build 8317]