@Override
    public DefaultNodeConfiguration loadDefaultConfiguration(PubSubService.UniqueIdentifier serviceIdentifier, boolean isLeafType)
    {
        final String key = getDefaultNodeConfigurationCacheKey( serviceIdentifier, isLeafType );
        DefaultNodeConfiguration result = defaultNodeConfigurationCache.get( key );
        if ( result == null )
        {
            final Lock lock = defaultNodeConfigurationCache.getLock( DEFAULT_CONF_CACHE );
            lock.lock();
            try
            {
                result = defaultNodeConfigurationCache.get( key );
                if ( result == null )
                {
                    Connection con = null;
                    PreparedStatement pstmt = null;
                    ResultSet rs = null;
                    DefaultNodeConfiguration config = null;
                    try {
                        con = DbConnectionManager.getConnection();
                        // Get default node configuration for the specified service
                        pstmt = con.prepareStatement(LOAD_DEFAULT_CONF);
                        pstmt.setString(1, serviceIdentifier.getServiceId());
                        pstmt.setInt(2, (isLeafType ? 1 : 0));
                        rs = pstmt.executeQuery();
                        if (rs.next()) {
                            config = new DefaultNodeConfiguration(isLeafType);
                            // Rebuild loaded default node configuration
                            config.setDeliverPayloads(rs.getInt(1) == 1);
                            config.setMaxPayloadSize(rs.getInt(2));
                            config.setPersistPublishedItems(rs.getInt(3) == 1);
                            config.setMaxPublishedItems(rs.getInt(4));
                            config.setNotifyConfigChanges(rs.getInt(5) == 1);
                            config.setNotifyDelete(rs.getInt(6) == 1);
                            config.setNotifyRetract(rs.getInt(7) == 1);
                            config.setPresenceBasedDelivery(rs.getInt(8) == 1);
                            config.setSendItemSubscribe(rs.getInt(9) == 1);
                            config.setPublisherModel(PublisherModel.valueOf(rs.getString(10)));
                            config.setSubscriptionEnabled(rs.getInt(11) == 1);
                            config.setAccessModel(AccessModel.valueOf(rs.getString(12)));
                            config.setLanguage(rs.getString(13));
                            if (rs.getString(14) != null) {
                                config.setReplyPolicy(Node.ItemReplyPolicy.valueOf(rs.getString(14)));
                            }
                            config.setAssociationPolicy(
                                    CollectionNode.LeafNodeAssociationPolicy.valueOf(rs.getString(15)));
                            config.setMaxLeafNodes(rs.getInt(16));
                        }
                        if ( config != null ) {
                            defaultNodeConfigurationCache.put( key, config );
                        }
                        result = config;
                    }
                    catch (Exception sqle) {
                        log.error("An exception occurred while trying to load default configuration from the database for service {} (is leaf type: {})", serviceIdentifier, isLeafType, sqle);
                    }
                    finally {
                        DbConnectionManager.closeConnection(rs, pstmt, con);
                    }
                }
            }
            finally
            {
                lock.unlock();
            }
        }
        return result;
    }
Writes large changesets to the database, using batches and transactions when
available.

The 'delete' list takes precedence over the 'add' list: when an item exists
on both lists, it is removed (and not re-added) to the database.

To prevent duplicates to exist in the database, this method will attempt to
remove all items to-be-added from the database, before re-adding them.

Note that multiple attempts to write items to the DB are made:
1) insert all pending items in a single batch
2) if the batch insert fails, retry by inserting each item separately

@param addList A list of items to be added to the database.
@param delList A list of items to be removed from the database.
xmppserver/src/main/java/org/jivesoftware/openfire/pubsub/DefaultPubSubPersistenceProvider.java