code: @Override
    public void recordVariableUpdate(VariableInstanceEntity variable) {
      if (isHistoryLevelAtLeast(HistoryLevel.ACTIVITY)) {
        HistoricVariableInstanceEntity historicProcessVariable = getEntityCache().findInCache(HistoricVariableInstanceEntity.class, variable.getId());
        if (historicProcessVariable == null) {
          historicProcessVariable = getHistoricVariableInstanceEntityManager().findHistoricVariableInstanceByVariableInstanceId(variable.getId());
        }
  
        if (historicProcessVariable != null) {
          getHistoricVariableInstanceEntityManager().copyVariableValue(historicProcessVariable, variable);
        } else {
          getHistoricVariableInstanceEntityManager().copyAndInsert(variable);
        }
      }
    }
docs: /*
  (non-Javadoc)
  
  @see org.activiti.engine.impl.history.HistoryManagerInterface#recordVariableUpdate (org.activiti.engine.impl.persistence.entity.VariableInstanceEntity)