+ list.add(op);
+ }
+ apply(session, list, vg);
+ }
+
+ protected void apply(WriteGraph graph, List<UpdateOp> list) throws DatabaseException {
+ for (UpdateOp op : list) {
+ apply(graph, op);
+ }
+ }
+
+ protected void apply(Session session, List<UpdateOp> list, VirtualGraph vg) throws DatabaseException {
+ if (getChunkSize() > 0) {
+ for (int s = 0; s < list.size(); ) {
+ int e = s + getChunkSize();
+ if (e > list.size())
+ e = list.size();
+ List<UpdateOp> subList = list.subList(s, e);
+ session.syncRequest(new WriteRequest(vg) {
+
+ @Override
+ public void perform(WriteGraph graph) throws DatabaseException {
+
+ for (UpdateOp op : subList) {
+ apply(graph, op);
+ }
+ }
+ });
+ s = e;
+ }
+ } else {
+ session.syncRequest(new WriteRequest(vg) {
+
+ @Override
+ public void perform(WriteGraph graph) throws DatabaseException {
+
+ for (UpdateOp op : list) {
+ apply(graph, op);
+ }
+ }
+ });