001/* 002 * Copyright (c) 2006-2014 Nuxeo SA (http://nuxeo.com/) and others. 003 * 004 * All rights reserved. This program and the accompanying materials 005 * are made available under the terms of the Eclipse Public License v1.0 006 * which accompanies this distribution, and is available at 007 * http://www.eclipse.org/legal/epl-v10.html 008 * 009 * Contributors: 010 * Nuxeo - initial API and implementation 011 * 012 */ 013 014package org.nuxeo.ecm.core.io.impl; 015 016import org.nuxeo.ecm.core.io.DocumentPipe; 017import org.nuxeo.runtime.transaction.TransactionHelper; 018 019/** 020 * Alternative to the default {@link DocumentPipe} that handles Transactions demarcation aligned with the Pipe batch 021 * size 022 * 023 * @author <a href="mailto:tdelprat@nuxeo.com">Tiry</a> 024 */ 025public class TransactionBatchingDocumentPipeImpl extends DocumentPipeImpl { 026 027 public TransactionBatchingDocumentPipeImpl(int pageSize) { 028 super(pageSize); 029 } 030 031 @Override 032 protected void handleBatchEnd() { 033 TransactionHelper.commitOrRollbackTransaction(); 034 TransactionHelper.startTransaction(); 035 } 036}