How do I make batch callbacks as class methods? This is the code I am using.

$serviceClass = \Drupal::service('abcclass.service');
$batch = array(
  'title' =&gt; t('Pushing updated.'),
  'init_message' =&gt; t('Start Pushing.'),
  'progress_message' =&gt; t('Completed @current step of @total.'),
  'error_message' =&gt; t('Pushing has encountered an error.'),
  'operations' =&gt; array(
    array(array($serviceClass , 'ebook_push_single_pdf'), $node-&gt;id()),
  ),
  'finished' =&gt; array($serviceClass , 'ebook_push_finished'),
);
batch_set($batch);


But it doesn't work. I checked log file and I get:


  Settings can not be serialized. This probably means you are serializing an object that has an indirect reference to the Settings object. Adjust your code so that is not necessary.


Note that if I implement batch callbacks in same file, it works.

How can I fix the code?
When I use a callback function what live in a class I use, for example:

'finished' =&gt; array('\Drupal\my_batch\Form\MyBatchForm', 'finish_function'),


The same with 'operations':

'operations' =&gt; array(array('\Drupal\my_batch\Form\MyBatchForm', 'operation_function'), array($node-&gt;id())),