title: Batching operations in Google Apps Admin Java API
body: <p>I have written a Java app that synchronises Google Groups on our Google Apps for Education domain (similar in function to <a href="https://support.google.com/a/answer/6027781?hl=en">Google Apps School Directory Sync</a>, but customised for some of our specific needs).</p>
  
  <p>The synchronisation works, but it is slow because it is performing each task individually. I know that there are API interfaces for <a href="https://developers.google.com/admin-sdk/directory/v1/guides/batch">batching operations</a>, but I can't find any examples of how this is implemented with the Java API.</p>
  
  <p>The code I'm using looks similar to this (authentication and other setup is taken care of elsewhere):</p>
  
  <pre><code>try
  {
      Member m = new Member ();
      m.setEmail (member);
      m.setRole ("MEMBER");
      service.members ().insert (group, m).execute ();
  }
  catch (Exception e)
  {
      // ERROR handling
  }
  </code></pre>
  
  <p>Instead of executing these operations one-by-one, I would like to batch them instead. Can anyone tell me how?</p>