/*
     * Multi-partition/non-replicated custom fragment with collector and aggregator.
     */
    void addCustomFragmentPair(
        int index, byte[] collectorFragment, byte[] aggregatorFragment, ByteBuffer params) {
      assert (index >= 0);
      assert (index < m_batchSize);
      assert (collectorFragment != null);
      assert (aggregatorFragment != null);

      int outputDepId = m_txnState.getNextDependencyId() | DtxnConstants.MULTIPARTITION_DEPENDENCY;
      m_depsForLocalTask[index] = outputDepId;
      // Add the aggegator and collector fragments.
      m_localTask.addCustomFragment(m_depsToResume[index], params, aggregatorFragment);
      m_distributedTask.addCustomFragment(outputDepId, params, collectorFragment);
    }
    /*
     * Replicated custom fragment.
     */
    void addCustomFragment(int index, byte[] aggregatorFragment, ByteBuffer params) {
      assert (index >= 0);
      assert (index < m_batchSize);
      assert (aggregatorFragment != null);

      m_depsForLocalTask[index] = -1;
      m_localTask.addCustomFragment(m_depsToResume[index], params, aggregatorFragment);
    }