| | |
| | | * |
| | | * |
| | | * Copyright 2006-2010 Sun Microsystems, Inc. |
| | | * Portions Copyright 2011-2013 ForgeRock AS |
| | | * Portions Copyright 2011-2014 ForgeRock AS |
| | | */ |
| | | package org.opends.server.replication.server.changelog.je; |
| | | |
| | |
| | | * |
| | | * @param changes |
| | | * The list of changes to add to the underlying db. |
| | | * @return the total size of all the changes |
| | | * @throws ChangelogException |
| | | * If a database problem happened |
| | | */ |
| | | public void addEntries(List<UpdateMsg> changes) throws ChangelogException |
| | | public int addEntries(List<UpdateMsg> changes) throws ChangelogException |
| | | { |
| | | dbCloseLock.readLock().lock(); |
| | | try |
| | |
| | | // If the DB has been closed then return immediately. |
| | | if (isDBClosed()) |
| | | { |
| | | return; |
| | | return 0; |
| | | } |
| | | |
| | | int totalSize = 0; |
| | | for (UpdateMsg change : changes) |
| | | { |
| | | final DatabaseEntry key = createReplicationKey(change.getCSN()); |
| | |
| | | insertCounterRecordIfNeeded(change.getCSN()); |
| | | db.put(null, key, data); |
| | | counterCurrValue++; |
| | | |
| | | totalSize += change.size(); |
| | | } |
| | | return totalSize; |
| | | } |
| | | catch (DatabaseException e) |
| | | { |