private void callback(final int type, final int status, final int event, final String filename) {
        String eventStr = null;
        if (status != 0) {
            eventStr = EventType.UKNOWN.string;
        } else if ((event & EventType.RENAME.value) != 0) {
            eventStr = EventType.RENAME.string;
        } else if ((event & EventType.CHANGE.value) != 0) {
            eventStr = EventType.CHANGE.string;
        }

        switch (type) {
            case 1: if (onEvent != null) {loop.getCallbackHandler().handleFileEventCallback(onEvent, status, eventStr, filename);} break;
            case 2: if (onClose != null) {loop.getCallbackHandler().handleFileEventCallback(onClose, status, eventStr, filename);} break;
            default: assert false : "unsupported callback type " + type;
        }
    }