public void disconnect(Object entity) throws OPMException {
        // Check if this is an entity
        PlcEntity annotation = entity.getClass().getSuperclass().getAnnotation(PlcEntity.class);
        if (annotation == null) {
            throw new OPMException("Unable to disconnect Object, is no entity!");
        }
        try {
            Object manager = FieldUtils.readDeclaredField(entity, CONNECTION_MANAGER_FIELD_NAME, true);
            if (manager == null) {
                throw new OPMException("Instance is already disconnected!");
            }
            FieldUtils.writeDeclaredField(entity, CONNECTION_MANAGER_FIELD_NAME, null, true);
        } catch (IllegalAccessException e) {
            throw new OPMException("Unable to fetch driverManager instance on entity instance", e);
        }
    }
Disconnects the given instance.

@param entity Instance of a PlcEntity.
@throws OPMException Is thrown when the plc is already disconnected or no entity.
plc4j/tools/opm/src/main/java/org/apache/plc4x/java/opm/PlcEntityManager.java