ACS-1112 Upgrade the BatchProcessor counting mechanism to work with "long" Java type (#706)

* ACS-1112 update to long data type
This commit is contained in:
Nithin Nambiar
2021-10-12 17:04:31 +01:00
committed by GitHub
parent 806880a86b
commit bb8d10074e
21 changed files with 655 additions and 432 deletions

View File

@@ -1,28 +1,28 @@
/* /*
* #%L * #%L
* Alfresco Repository * Alfresco Repository
* %% * %%
* Copyright (C) 2005 - 2016 Alfresco Software Limited * Copyright (C) 2005 - 2016 Alfresco Software Limited
* %% * %%
* This file is part of the Alfresco software. * This file is part of the Alfresco software.
* If the software was purchased under a paid Alfresco license, the terms of * If the software was purchased under a paid Alfresco license, the terms of
* the paid license agreement will prevail. Otherwise, the software is * the paid license agreement will prevail. Otherwise, the software is
* provided under the following open source license terms: * provided under the following open source license terms:
* *
* Alfresco is free software: you can redistribute it and/or modify * Alfresco is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as published by * it under the terms of the GNU Lesser General Public License as published by
* the Free Software Foundation, either version 3 of the License, or * the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version. * (at your option) any later version.
* *
* Alfresco is distributed in the hope that it will be useful, * Alfresco is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of * but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License for more details. * GNU Lesser General Public License for more details.
* *
* You should have received a copy of the GNU Lesser General Public License * You should have received a copy of the GNU Lesser General Public License
* along with Alfresco. If not, see <http://www.gnu.org/licenses/>. * along with Alfresco. If not, see <http://www.gnu.org/licenses/>.
* #L% * #L%
*/ */
package org.alfresco.encryption; package org.alfresco.encryption;
import java.io.Serializable; import java.io.Serializable;
@@ -241,6 +241,12 @@ public class ReEncryptor implements ApplicationContextAware
return properties.size(); return properties.size();
} }
@Override
public long getTotalEstimatedWorkSizeLong()
{
return properties.size();
}
@Override @Override
public Collection<NodePropertyEntity> getNextWork() public Collection<NodePropertyEntity> getNextWork()
{ {

View File

@@ -1959,6 +1959,12 @@ public class AlfrescoCmisServiceImpl extends AbstractCmisService implements Alfr
return size; return size;
} }
@Override
public synchronized long getTotalEstimatedWorkSizeLong()
{
return size;
}
@Override @Override
public synchronized Collection<BulkEntry> getNextWork() public synchronized Collection<BulkEntry> getNextWork()
{ {

View File

@@ -1,28 +1,28 @@
/* /*
* #%L * #%L
* Alfresco Repository * Alfresco Repository
* %% * %%
* Copyright (C) 2005 - 2016 Alfresco Software Limited * Copyright (C) 2005 - 2016 Alfresco Software Limited
* %% * %%
* This file is part of the Alfresco software. * This file is part of the Alfresco software.
* If the software was purchased under a paid Alfresco license, the terms of * If the software was purchased under a paid Alfresco license, the terms of
* the paid license agreement will prevail. Otherwise, the software is * the paid license agreement will prevail. Otherwise, the software is
* provided under the following open source license terms: * provided under the following open source license terms:
* *
* Alfresco is free software: you can redistribute it and/or modify * Alfresco is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as published by * it under the terms of the GNU Lesser General Public License as published by
* the Free Software Foundation, either version 3 of the License, or * the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version. * (at your option) any later version.
* *
* Alfresco is distributed in the hope that it will be useful, * Alfresco is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of * but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License for more details. * GNU Lesser General Public License for more details.
* *
* You should have received a copy of the GNU Lesser General Public License * You should have received a copy of the GNU Lesser General Public License
* along with Alfresco. If not, see <http://www.gnu.org/licenses/>. * along with Alfresco. If not, see <http://www.gnu.org/licenses/>.
* #L% * #L%
*/ */
package org.alfresco.repo.activities.feed; package org.alfresco.repo.activities.feed;
import java.util.Collection; import java.util.Collection;
@@ -427,6 +427,12 @@ public class FeedNotifierImpl implements FeedNotifier, ApplicationContextAware
return personService.countPeople(); return personService.countPeople();
} }
@Override
public long getTotalEstimatedWorkSizeLong()
{
return personService.countPeople();
}
@Override @Override
public Collection<PersonInfo> getNextWork() public Collection<PersonInfo> getNextWork()
{ {

View File

@@ -1,28 +1,28 @@
/* /*
* #%L * #%L
* Alfresco Repository * Alfresco Repository
* %% * %%
* Copyright (C) 2005 - 2016 Alfresco Software Limited * Copyright (C) 2005 - 2016 Alfresco Software Limited
* %% * %%
* This file is part of the Alfresco software. * This file is part of the Alfresco software.
* If the software was purchased under a paid Alfresco license, the terms of * If the software was purchased under a paid Alfresco license, the terms of
* the paid license agreement will prevail. Otherwise, the software is * the paid license agreement will prevail. Otherwise, the software is
* provided under the following open source license terms: * provided under the following open source license terms:
* *
* Alfresco is free software: you can redistribute it and/or modify * Alfresco is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as published by * it under the terms of the GNU Lesser General Public License as published by
* the Free Software Foundation, either version 3 of the License, or * the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version. * (at your option) any later version.
* *
* Alfresco is distributed in the hope that it will be useful, * Alfresco is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of * but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License for more details. * GNU Lesser General Public License for more details.
* *
* You should have received a copy of the GNU Lesser General Public License * You should have received a copy of the GNU Lesser General Public License
* along with Alfresco. If not, see <http://www.gnu.org/licenses/>. * along with Alfresco. If not, see <http://www.gnu.org/licenses/>.
* #L% * #L%
*/ */
package org.alfresco.repo.activities.feed.local; package org.alfresco.repo.activities.feed.local;
import java.util.ArrayList; import java.util.ArrayList;
@@ -155,13 +155,25 @@ public class LocalFeedGenerator extends AbstractFeedGenerator
@Override @Override
public int getTotalEstimatedWorkSize() public int getTotalEstimatedWorkSize()
{
return (int) calculateEstimatedWorkSize();
}
@Override
public long getTotalEstimatedWorkSizeLong()
{
return calculateEstimatedWorkSize();
}
private long calculateEstimatedWorkSize()
{ {
long size = maxSequence - minSequence + 1; long size = maxSequence - minSequence + 1;
long remain = size % batchSize; long remain = size % batchSize;
long workSize = (remain == 0) ? (size / batchSize) : (size / batchSize + 1); long workSize = (remain == 0) ? (size / batchSize) : (size / batchSize + 1);
return (int) workSize; return workSize;
} }
@Override @Override
public Collection<JobSettings> getNextWork() public Collection<JobSettings> getNextWork()
{ {

View File

@@ -1,28 +1,28 @@
/* /*
* #%L * #%L
* Alfresco Repository * Alfresco Repository
* %% * %%
* Copyright (C) 2005 - 2016 Alfresco Software Limited * Copyright (C) 2005 - 2016 Alfresco Software Limited
* %% * %%
* This file is part of the Alfresco software. * This file is part of the Alfresco software.
* If the software was purchased under a paid Alfresco license, the terms of * If the software was purchased under a paid Alfresco license, the terms of
* the paid license agreement will prevail. Otherwise, the software is * the paid license agreement will prevail. Otherwise, the software is
* provided under the following open source license terms: * provided under the following open source license terms:
* *
* Alfresco is free software: you can redistribute it and/or modify * Alfresco is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as published by * it under the terms of the GNU Lesser General Public License as published by
* the Free Software Foundation, either version 3 of the License, or * the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version. * (at your option) any later version.
* *
* Alfresco is distributed in the hope that it will be useful, * Alfresco is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of * but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License for more details. * GNU Lesser General Public License for more details.
* *
* You should have received a copy of the GNU Lesser General Public License * You should have received a copy of the GNU Lesser General Public License
* along with Alfresco. If not, see <http://www.gnu.org/licenses/>. * along with Alfresco. If not, see <http://www.gnu.org/licenses/>.
* #L% * #L%
*/ */
package org.alfresco.repo.admin.patch; package org.alfresco.repo.admin.patch;
import java.io.PrintWriter; import java.io.PrintWriter;
@@ -486,6 +486,11 @@ public abstract class AbstractPatch implements Patch, ApplicationEventPublisher
return tenants.size(); return tenants.size();
} }
public long getTotalEstimatedWorkSizeLong()
{
return tenants.size();
}
@Override @Override
public Collection<Tenant> getNextWork() public Collection<Tenant> getNextWork()
{ {
@@ -554,13 +559,13 @@ public abstract class AbstractPatch implements Patch, ApplicationEventPublisher
logger.debug("batch worker finished processing id:" + id); logger.debug("batch worker finished processing id:" + id);
} }
if (batchProcessor.getTotalErrors() > 0) if (batchProcessor.getTotalErrorsLong() > 0)
{ {
sb.append("\n" + " and failure during update of tennants total success: " + batchProcessor.getSuccessfullyProcessedEntries() + " number of errors: " +batchProcessor.getTotalErrors() + " lastError" + batchProcessor.getLastError()); sb.append("\n" + " and failure during update of tennants total success: " + batchProcessor.getSuccessfullyProcessedEntriesLong() + " number of errors: " +batchProcessor.getTotalErrorsLong() + " lastError" + batchProcessor.getLastError());
} }
else else
{ {
sb.append("\n" + " and successful batch update of " + batchProcessor.getTotalResults() + "tennants"); sb.append("\n" + " and successful batch update of " + batchProcessor.getTotalResultsLong() + "tennants");
} }
} }

View File

@@ -1,28 +1,28 @@
/* /*
* #%L * #%L
* Alfresco Repository * Alfresco Repository
* %% * %%
* Copyright (C) 2005 - 2016 Alfresco Software Limited * Copyright (C) 2005 - 2016 Alfresco Software Limited
* %% * %%
* This file is part of the Alfresco software. * This file is part of the Alfresco software.
* If the software was purchased under a paid Alfresco license, the terms of * If the software was purchased under a paid Alfresco license, the terms of
* the paid license agreement will prevail. Otherwise, the software is * the paid license agreement will prevail. Otherwise, the software is
* provided under the following open source license terms: * provided under the following open source license terms:
* *
* Alfresco is free software: you can redistribute it and/or modify * Alfresco is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as published by * it under the terms of the GNU Lesser General Public License as published by
* the Free Software Foundation, either version 3 of the License, or * the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version. * (at your option) any later version.
* *
* Alfresco is distributed in the hope that it will be useful, * Alfresco is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of * but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License for more details. * GNU Lesser General Public License for more details.
* *
* You should have received a copy of the GNU Lesser General Public License * You should have received a copy of the GNU Lesser General Public License
* along with Alfresco. If not, see <http://www.gnu.org/licenses/>. * along with Alfresco. If not, see <http://www.gnu.org/licenses/>.
* #L% * #L%
*/ */
package org.alfresco.repo.admin.patch.impl; package org.alfresco.repo.admin.patch.impl;
import java.util.ArrayList; import java.util.ArrayList;
@@ -90,6 +90,12 @@ public class AddUnmovableAspectToSitesPatch extends AsynchronousPatch
return sites.size(); return sites.size();
} }
@Override
public long getTotalEstimatedWorkSizeLong()
{
return sites.size();
}
@Override @Override
public Collection<ChildAssociationRef> getNextWork() public Collection<ChildAssociationRef> getNextWork()
{ {

View File

@@ -1,28 +1,28 @@
/* /*
* #%L * #%L
* Alfresco Repository * Alfresco Repository
* %% * %%
* Copyright (C) 2005 - 2016 Alfresco Software Limited * Copyright (C) 2005 - 2016 Alfresco Software Limited
* %% * %%
* This file is part of the Alfresco software. * This file is part of the Alfresco software.
* If the software was purchased under a paid Alfresco license, the terms of * If the software was purchased under a paid Alfresco license, the terms of
* the paid license agreement will prevail. Otherwise, the software is * the paid license agreement will prevail. Otherwise, the software is
* provided under the following open source license terms: * provided under the following open source license terms:
* *
* Alfresco is free software: you can redistribute it and/or modify * Alfresco is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as published by * it under the terms of the GNU Lesser General Public License as published by
* the Free Software Foundation, either version 3 of the License, or * the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version. * (at your option) any later version.
* *
* Alfresco is distributed in the hope that it will be useful, * Alfresco is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of * but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License for more details. * GNU Lesser General Public License for more details.
* *
* You should have received a copy of the GNU Lesser General Public License * You should have received a copy of the GNU Lesser General Public License
* along with Alfresco. If not, see <http://www.gnu.org/licenses/>. * along with Alfresco. If not, see <http://www.gnu.org/licenses/>.
* #L% * #L%
*/ */
package org.alfresco.repo.admin.patch.impl; package org.alfresco.repo.admin.patch.impl;
import java.util.ArrayList; import java.util.ArrayList;
@@ -93,6 +93,11 @@ public class AliasableAspectPatch extends AbstractPatch
return result.size(); return result.size();
} }
public long getTotalEstimatedWorkSizeLong()
{
return result.size();
}
public Collection<NodeRef> getNextWork() public Collection<NodeRef> getNextWork()
{ {
if(val != null) if(val != null)

View File

@@ -237,6 +237,12 @@ public class FixBpmPackagesPatch extends AbstractPatch
return assocCount; return assocCount;
} }
@Override
public synchronized long getTotalEstimatedWorkSizeLong()
{
return assocCount;
}
@Override @Override
public synchronized Collection<ChildAssociationRef> getNextWork() public synchronized Collection<ChildAssociationRef> getNextWork()
{ {

View File

@@ -1,28 +1,28 @@
/* /*
* #%L * #%L
* Alfresco Repository * Alfresco Repository
* %% * %%
* Copyright (C) 2005 - 2016 Alfresco Software Limited * Copyright (C) 2005 - 2016 Alfresco Software Limited
* %% * %%
* This file is part of the Alfresco software. * This file is part of the Alfresco software.
* If the software was purchased under a paid Alfresco license, the terms of * If the software was purchased under a paid Alfresco license, the terms of
* the paid license agreement will prevail. Otherwise, the software is * the paid license agreement will prevail. Otherwise, the software is
* provided under the following open source license terms: * provided under the following open source license terms:
* *
* Alfresco is free software: you can redistribute it and/or modify * Alfresco is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as published by * it under the terms of the GNU Lesser General Public License as published by
* the Free Software Foundation, either version 3 of the License, or * the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version. * (at your option) any later version.
* *
* Alfresco is distributed in the hope that it will be useful, * Alfresco is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of * but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License for more details. * GNU Lesser General Public License for more details.
* *
* You should have received a copy of the GNU Lesser General Public License * You should have received a copy of the GNU Lesser General Public License
* along with Alfresco. If not, see <http://www.gnu.org/licenses/>. * along with Alfresco. If not, see <http://www.gnu.org/licenses/>.
* #L% * #L%
*/ */
package org.alfresco.repo.admin.patch.impl; package org.alfresco.repo.admin.patch.impl;
import java.util.ArrayList; import java.util.ArrayList;
@@ -76,6 +76,11 @@ public class ImapUnsubscribedAspectPatch extends AbstractPatch
return result.size(); return result.size();
} }
public long getTotalEstimatedWorkSizeLong()
{
return result.size();
}
public Collection<NodeRef> getNextWork() public Collection<NodeRef> getNextWork()
{ {
result.clear(); result.clear();

View File

@@ -1,28 +1,28 @@
/* /*
* #%L * #%L
* Alfresco Repository * Alfresco Repository
* %% * %%
* Copyright (C) 2005 - 2016 Alfresco Software Limited * Copyright (C) 2005 - 2016 Alfresco Software Limited
* %% * %%
* This file is part of the Alfresco software. * This file is part of the Alfresco software.
* If the software was purchased under a paid Alfresco license, the terms of * If the software was purchased under a paid Alfresco license, the terms of
* the paid license agreement will prevail. Otherwise, the software is * the paid license agreement will prevail. Otherwise, the software is
* provided under the following open source license terms: * provided under the following open source license terms:
* *
* Alfresco is free software: you can redistribute it and/or modify * Alfresco is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as published by * it under the terms of the GNU Lesser General Public License as published by
* the Free Software Foundation, either version 3 of the License, or * the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version. * (at your option) any later version.
* *
* Alfresco is distributed in the hope that it will be useful, * Alfresco is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of * but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License for more details. * GNU Lesser General Public License for more details.
* *
* You should have received a copy of the GNU Lesser General Public License * You should have received a copy of the GNU Lesser General Public License
* along with Alfresco. If not, see <http://www.gnu.org/licenses/>. * along with Alfresco. If not, see <http://www.gnu.org/licenses/>.
* #L% * #L%
*/ */
package org.alfresco.repo.admin.patch.impl; package org.alfresco.repo.admin.patch.impl;
import java.util.ArrayList; import java.util.ArrayList;
@@ -143,6 +143,12 @@ public class RenameSiteAuthorityDisplayName extends AbstractPatch
{ {
return siteInfos.size(); return siteInfos.size();
} }
@Override
public long getTotalEstimatedWorkSizeLong()
{
return siteInfos.size();
}
@Override @Override
public Collection<SiteInfo> getNextWork() public Collection<SiteInfo> getNextWork()

View File

@@ -1,28 +1,28 @@
/* /*
* #%L * #%L
* Alfresco Repository * Alfresco Repository
* %% * %%
* Copyright (C) 2005 - 2016 Alfresco Software Limited * Copyright (C) 2005 - 2016 Alfresco Software Limited
* %% * %%
* This file is part of the Alfresco software. * This file is part of the Alfresco software.
* If the software was purchased under a paid Alfresco license, the terms of * If the software was purchased under a paid Alfresco license, the terms of
* the paid license agreement will prevail. Otherwise, the software is * the paid license agreement will prevail. Otherwise, the software is
* provided under the following open source license terms: * provided under the following open source license terms:
* *
* Alfresco is free software: you can redistribute it and/or modify * Alfresco is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as published by * it under the terms of the GNU Lesser General Public License as published by
* the Free Software Foundation, either version 3 of the License, or * the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version. * (at your option) any later version.
* *
* Alfresco is distributed in the hope that it will be useful, * Alfresco is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of * but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License for more details. * GNU Lesser General Public License for more details.
* *
* You should have received a copy of the GNU Lesser General Public License * You should have received a copy of the GNU Lesser General Public License
* along with Alfresco. If not, see <http://www.gnu.org/licenses/>. * along with Alfresco. If not, see <http://www.gnu.org/licenses/>.
* #L% * #L%
*/ */
package org.alfresco.repo.admin.patch.impl; package org.alfresco.repo.admin.patch.impl;
@@ -449,6 +449,12 @@ public class SurfConfigFolderPatch extends AsynchronousPatch
@Override @Override
public synchronized int getTotalEstimatedWorkSize() public synchronized int getTotalEstimatedWorkSize()
{
return (int)getTotalEstimatedWorkSizeLong();
}
@Override
public synchronized long getTotalEstimatedWorkSizeLong()
{ {
if (maxId == Long.MAX_VALUE) if (maxId == Long.MAX_VALUE)
{ {
@@ -459,6 +465,7 @@ public class SurfConfigFolderPatch extends AsynchronousPatch
} }
} }
return 0; return 0;
} }
@Override @Override

View File

@@ -1,28 +1,28 @@
/* /*
* #%L * #%L
* Alfresco Repository * Alfresco Repository
* %% * %%
* Copyright (C) 2005 - 2016 Alfresco Software Limited * Copyright (C) 2005 - 2016 Alfresco Software Limited
* %% * %%
* This file is part of the Alfresco software. * This file is part of the Alfresco software.
* If the software was purchased under a paid Alfresco license, the terms of * If the software was purchased under a paid Alfresco license, the terms of
* the paid license agreement will prevail. Otherwise, the software is * the paid license agreement will prevail. Otherwise, the software is
* provided under the following open source license terms: * provided under the following open source license terms:
* *
* Alfresco is free software: you can redistribute it and/or modify * Alfresco is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as published by * it under the terms of the GNU Lesser General Public License as published by
* the Free Software Foundation, either version 3 of the License, or * the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version. * (at your option) any later version.
* *
* Alfresco is distributed in the hope that it will be useful, * Alfresco is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of * but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License for more details. * GNU Lesser General Public License for more details.
* *
* You should have received a copy of the GNU Lesser General Public License * You should have received a copy of the GNU Lesser General Public License
* along with Alfresco. If not, see <http://www.gnu.org/licenses/>. * along with Alfresco. If not, see <http://www.gnu.org/licenses/>.
* #L% * #L%
*/ */
package org.alfresco.repo.batch; package org.alfresco.repo.batch;
import java.util.Date; import java.util.Date;
@@ -50,10 +50,10 @@ public interface BatchMonitor
/** /**
* Gets the total number of results. * Gets the total number of results.
* * @deprecated use {@link #getTotalResultsLong()} instead
* @return the total number of results * @return the total number of results
*/ */
public int getTotalResults(); @Deprecated public int getTotalResults();
/** /**
* Gets the ID of the entry being processed * Gets the ID of the entry being processed
@@ -64,10 +64,10 @@ public interface BatchMonitor
/** /**
* Gets the number of successfully processed entries. * Gets the number of successfully processed entries.
* * @deprecated use {@link #getSuccessfullyProcessedEntriesLong()} instead
* @return the successfully processed entries * @return the successfully processed entries
*/ */
public int getSuccessfullyProcessedEntries(); @Deprecated public int getSuccessfullyProcessedEntries();
/** /**
* Gets the progress expressed as a percentage. * Gets the progress expressed as a percentage.
@@ -78,10 +78,10 @@ public interface BatchMonitor
/** /**
* Gets the total number of errors. * Gets the total number of errors.
* * @deprecated use {@link #getTotalErrorsLong()} instead
* @return the total number of errors * @return the total number of errors
*/ */
public int getTotalErrors(); @Deprecated public int getTotalErrors();
/** /**
* Gets the stack trace of the last error. * Gets the stack trace of the last error.
@@ -103,4 +103,35 @@ public interface BatchMonitor
* @return the end time * @return the end time
*/ */
public Date getEndTime(); public Date getEndTime();
/**
* Gets the total number of results.
*
* @return the total number of results
*/
public default long getTotalResultsLong()
{
throw new UnsupportedOperationException("getTotalResultsLong need to be implemented");
}
/**
* Gets the total number of errors.
*
* @return the total number of errors
*/
public default long getTotalErrorsLong()
{
throw new UnsupportedOperationException("getTotalErrorsLong need to be implemented");
}
/**
* Gets the number of successfully processed entries.
*
* @return the successfully processed entries
*/
public default long getSuccessfullyProcessedEntriesLong()
{
throw new UnsupportedOperationException("getSuccessfullyProcessedEntriesLong need to be implemented");
}
} }

View File

@@ -43,10 +43,10 @@ public interface BatchProcessWorkProvider<T>
* Instances can provide accurate answers on each call, but only if the answer can be * Instances can provide accurate answers on each call, but only if the answer can be
* provided quickly and efficiently; usually it is enough to to cache the result after * provided quickly and efficiently; usually it is enough to to cache the result after
* providing an initial estimate. * providing an initial estimate.
* * @deprecated use {@link #getTotalEstimatedWorkSizeLong()} instead.
* @return a total work size estimate * @return a total work size estimate
*/ */
int getTotalEstimatedWorkSize(); @Deprecated int getTotalEstimatedWorkSize();
/** /**
* Get the next lot of work for the batch processor. Implementations should return * Get the next lot of work for the batch processor. Implementations should return
@@ -58,4 +58,18 @@ public interface BatchProcessWorkProvider<T>
* if there is no more work remaining. * if there is no more work remaining.
*/ */
Collection<T> getNextWork(); Collection<T> getNextWork();
/**
* Get an estimate of the total number of objects that will be provided by this instance.
* Instances can provide accurate answers on each call, but only if the answer can be
* provided quickly and efficiently; usually it is enough to to cache the result after
* providing an initial estimate.
*
* @return a total work size estimate
*/
default long getTotalEstimatedWorkSizeLong()
{
throw new UnsupportedOperationException("getTotalEstimatedWorkSizeLong need to implemented");
}
} }

View File

@@ -110,10 +110,10 @@ public class BatchProcessor<T> implements BatchMonitor
private String lastErrorEntryId; private String lastErrorEntryId;
/** The total number of errors. */ /** The total number of errors. */
private int totalErrors; private long totalErrors;
/** The number of successfully processed entries. */ /** The number of successfully processed entries. */
private int successfullyProcessedEntries; private long successfullyProcessedEntries;
/** The start time. */ /** The start time. */
private Date startTime; private Date startTime;
@@ -280,7 +280,15 @@ public class BatchProcessor<T> implements BatchMonitor
/** /**
* {@inheritDoc} * {@inheritDoc}
*/ */
public synchronized int getSuccessfullyProcessedEntries() @Deprecated public synchronized int getSuccessfullyProcessedEntries()
{
return Math.toIntExact(this.successfullyProcessedEntries);
}
/**
* {@inheritDoc}
*/
public synchronized long getSuccessfullyProcessedEntriesLong()
{ {
return this.successfullyProcessedEntries; return this.successfullyProcessedEntries;
} }
@@ -290,8 +298,8 @@ public class BatchProcessor<T> implements BatchMonitor
*/ */
public synchronized String getPercentComplete() public synchronized String getPercentComplete()
{ {
int totalResults = this.workProvider.getTotalEstimatedWorkSize(); long totalResults = this.workProvider.getTotalEstimatedWorkSizeLong();
int processed = this.successfullyProcessedEntries + this.totalErrors; long processed = this.successfullyProcessedEntries + this.totalErrors;
return processed <= totalResults ? NumberFormat.getPercentInstance().format( return processed <= totalResults ? NumberFormat.getPercentInstance().format(
totalResults == 0 ? 1.0F : (float) processed / totalResults) : "Unknown"; totalResults == 0 ? 1.0F : (float) processed / totalResults) : "Unknown";
} }
@@ -299,7 +307,23 @@ public class BatchProcessor<T> implements BatchMonitor
/** /**
* {@inheritDoc} * {@inheritDoc}
*/ */
public synchronized int getTotalErrors() @Deprecated public synchronized int getTotalErrors()
{
return Math.toIntExact(this.totalErrors);
}
/**
* {@inheritDoc}
*/
@Deprecated public int getTotalResults()
{
return this.workProvider.getTotalEstimatedWorkSize();
}
/**
* {@inheritDoc}
*/
public synchronized long getTotalErrorsLong()
{ {
return this.totalErrors; return this.totalErrors;
} }
@@ -307,9 +331,9 @@ public class BatchProcessor<T> implements BatchMonitor
/** /**
* {@inheritDoc} * {@inheritDoc}
*/ */
public int getTotalResults() public long getTotalResultsLong()
{ {
return this.workProvider.getTotalEstimatedWorkSize(); return this.workProvider.getTotalEstimatedWorkSizeLong();
} }
/** /**
@@ -340,12 +364,42 @@ public class BatchProcessor<T> implements BatchMonitor
* increased performance. If <code>false</code>, all invocations are performed in the current * increased performance. If <code>false</code>, all invocations are performed in the current
* transaction. This is required if calling synchronously (e.g. in response to an authentication event in * transaction. This is required if calling synchronously (e.g. in response to an authentication event in
* the same transaction). * the same transaction).
* @deprecated use {@link #processLong(BatchProcessWorker, boolean)} instead
* @return the number of invocations * @return the number of invocations
*/ */
@SuppressWarnings("serial") @SuppressWarnings("serial")
public int process(final BatchProcessWorker<T> worker, final boolean splitTxns) @Deprecated public int process(final BatchProcessWorker<T> worker, final boolean splitTxns)
{ {
int count = workProvider.getTotalEstimatedWorkSize(); int count = workProvider.getTotalEstimatedWorkSize();
return (int)process(worker, splitTxns, count);
}
/**
* Invokes the worker for each entry in the collection, managing transactions and collating success / failure
* information.
*
* @param worker
* the worker
* @param splitTxns
* Can the modifications to Alfresco be split across multiple transactions for maximum performance? If
* <code>true</code>, worker invocations are isolated in separate transactions in batches for
* increased performance. If <code>false</code>, all invocations are performed in the current
* transaction. This is required if calling synchronously (e.g. in response to an authentication event in
* the same transaction).
* @return the number of invocations
*/
@SuppressWarnings("serial")
public long processLong(final BatchProcessWorker<T> worker, final boolean splitTxns)
{
long count = workProvider.getTotalEstimatedWorkSizeLong();
return process(worker, splitTxns, count);
}
private long process(final BatchProcessWorker<T> worker, final boolean splitTxns, long count)
{
synchronized (this) synchronized (this)
{ {
this.startTime = new Date(); this.startTime = new Date();
@@ -365,27 +419,27 @@ public class BatchProcessor<T> implements BatchMonitor
// Create a thread pool executor with the specified number of threads and a finite blocking queue of jobs // Create a thread pool executor with the specified number of threads and a finite blocking queue of jobs
ExecutorService executorService = splitTxns && this.workerThreads > 1 ? ExecutorService executorService = splitTxns && this.workerThreads > 1 ?
new ThreadPoolExecutor( new ThreadPoolExecutor(
this.workerThreads, this.workerThreads, 0L, TimeUnit.MILLISECONDS, this.workerThreads, this.workerThreads, 0L, TimeUnit.MILLISECONDS,
new ArrayBlockingQueue<Runnable>(this.workerThreads * this.batchSize * 10) new ArrayBlockingQueue<Runnable>(this.workerThreads * this.batchSize * 10)
{ {
// Add blocking behaviour to work queue // Add blocking behaviour to work queue
@Override @Override
public boolean offer(Runnable o) public boolean offer(Runnable o)
{ {
try try
{ {
put(o); put(o);
} }
catch (InterruptedException e) catch (InterruptedException e)
{ {
return false; return false;
} }
return true; return true;
} }
}, },
threadFactory) : null; threadFactory) : null;
try try
{ {
Iterator<T> iterator = new WorkProviderIterator<T>(this.workProvider); Iterator<T> iterator = new WorkProviderIterator<T>(this.workProvider);
@@ -402,7 +456,7 @@ public class BatchProcessor<T> implements BatchMonitor
{ {
batch = new ArrayList<T>(this.batchSize); batch = new ArrayList<T>(this.batchSize);
} }
if (executorService == null) if (executorService == null)
{ {
callback.run(); callback.run();
@@ -447,13 +501,12 @@ public class BatchProcessor<T> implements BatchMonitor
if (this.totalErrors > 0 && this.logger.isErrorEnabled()) if (this.totalErrors > 0 && this.logger.isErrorEnabled())
{ {
this.logger.error(getProcessName() + ": " + this.totalErrors this.logger.error(getProcessName() + ": " + this.totalErrors
+ " error(s) detected. Last error from entry \"" + this.lastErrorEntryId + "\"", + " error(s) detected. Last error from entry \"" + this.lastErrorEntryId + "\"",
this.lastError); this.lastError);
} }
} }
} }
} }
/** /**
* Reports the current progress. * Reports the current progress.
* *
@@ -464,12 +517,20 @@ public class BatchProcessor<T> implements BatchMonitor
*/ */
private synchronized void reportProgress(boolean last) private synchronized void reportProgress(boolean last)
{ {
int processed = this.successfullyProcessedEntries + this.totalErrors; long processed = this.successfullyProcessedEntries + this.totalErrors;
if (processed % this.loggingInterval == 0 ^ last) if (processed % this.loggingInterval == 0 ^ last)
{ {
StringBuilder message = new StringBuilder(100).append(getProcessName()).append(": Processed ").append( StringBuilder message = new StringBuilder(100).append(getProcessName()).append(": Processed ").append(
processed).append(" entries"); processed).append(" entries");
int totalResults = this.workProvider.getTotalEstimatedWorkSize(); long totalResults = 0;
try
{
totalResults = this.workProvider.getTotalEstimatedWorkSizeLong();
}
catch (UnsupportedOperationException uoe)
{
totalResults = this.workProvider.getTotalEstimatedWorkSize();
}
if (totalResults >= processed) if (totalResults >= processed)
{ {
message.append(" out of ").append(totalResults).append(". ").append( message.append(" out of ").append(totalResults).append(". ").append(
@@ -830,11 +891,11 @@ public class BatchProcessor<T> implements BatchMonitor
{ {
if (this.txnErrors > 0) if (this.txnErrors > 0)
{ {
int processed = BatchProcessor.this.successfullyProcessedEntries + BatchProcessor.this.totalErrors; long processed = BatchProcessor.this.successfullyProcessedEntries + BatchProcessor.this.totalErrors;
int currentIncrement = processed % BatchProcessor.this.loggingInterval; long currentIncrement = processed % BatchProcessor.this.loggingInterval;
int newErrors = BatchProcessor.this.totalErrors + this.txnErrors; long newErrors = BatchProcessor.this.totalErrors + this.txnErrors;
// Work out the number of logging intervals we will cross and report them // Work out the number of logging intervals we will cross and report them
int intervals = (this.txnErrors + currentIncrement) / BatchProcessor.this.loggingInterval; long intervals = (this.txnErrors + currentIncrement) / BatchProcessor.this.loggingInterval;
if (intervals > 0) if (intervals > 0)
{ {
BatchProcessor.this.totalErrors += BatchProcessor.this.loggingInterval - currentIncrement; BatchProcessor.this.totalErrors += BatchProcessor.this.loggingInterval - currentIncrement;
@@ -850,11 +911,11 @@ public class BatchProcessor<T> implements BatchMonitor
if (this.txnSuccesses > 0) if (this.txnSuccesses > 0)
{ {
int processed = BatchProcessor.this.successfullyProcessedEntries + BatchProcessor.this.totalErrors; long processed = BatchProcessor.this.successfullyProcessedEntries + BatchProcessor.this.totalErrors;
int currentIncrement = processed % BatchProcessor.this.loggingInterval; long currentIncrement = processed % BatchProcessor.this.loggingInterval;
int newSuccess = BatchProcessor.this.successfullyProcessedEntries + this.txnSuccesses; long newSuccess = BatchProcessor.this.successfullyProcessedEntries + this.txnSuccesses;
// Work out the number of logging intervals we will cross and report them // Work out the number of logging intervals we will cross and report them
int intervals = (this.txnSuccesses + currentIncrement) / BatchProcessor.this.loggingInterval; long intervals = (this.txnSuccesses + currentIncrement) / BatchProcessor.this.loggingInterval;
if (intervals > 0) if (intervals > 0)
{ {
BatchProcessor.this.successfullyProcessedEntries += BatchProcessor.this.loggingInterval BatchProcessor.this.successfullyProcessedEntries += BatchProcessor.this.loggingInterval

View File

@@ -1,20 +1,20 @@
/* /*
* #%L * #%L
* Alfresco Repository * Alfresco Repository
* %% * %%
* Copyright (C) 2005 - 2016 Alfresco Software Limited * Copyright (C) 2005 - 2016 Alfresco Software Limited
* %% * %%
* This file is part of the Alfresco software. * This file is part of the Alfresco software.
* If the software was purchased under a paid Alfresco license, the terms of * If the software was purchased under a paid Alfresco license, the terms of
* the paid license agreement will prevail. Otherwise, the software is * the paid license agreement will prevail. Otherwise, the software is
* provided under the following open source license terms: * provided under the following open source license terms:
* *
* Alfresco is free software: you can redistribute it and/or modify * Alfresco is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as published by * it under the terms of the GNU Lesser General Public License as published by
* the Free Software Foundation, either version 3 of the License, or * the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version. * (at your option) any later version.
* *
* Alfresco is distributed in the hope that it will be useful, * Alfresco is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of * but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License for more details. * GNU Lesser General Public License for more details.
@@ -195,6 +195,12 @@ public class StripingFilesystemTracker extends AbstractFilesystemTracker
return count(); return count();
} }
@Override
public long getTotalEstimatedWorkSizeLong()
{
return count();
}
@Override @Override
public Collection<ImportableItem> getNextWork() public Collection<ImportableItem> getNextWork()
{ {

View File

@@ -241,9 +241,14 @@ public class FixedAclUpdater extends TransactionListenerAdapter implements Appli
@Override @Override
public int getTotalEstimatedWorkSize() public int getTotalEstimatedWorkSize()
{ {
int workSize = getNodesWithAspects.getWorkSize(); return (int)getTotalEstimatedWorkSizeLong();
return workSize;
} }
@Override
public long getTotalEstimatedWorkSizeLong()
{
return getNodesWithAspects.getWorkSize();
}
@Override @Override
public Collection<NodeRef> getNextWork() public Collection<NodeRef> getNextWork()

View File

@@ -244,6 +244,15 @@ public class NodeArchiveServiceImpl implements NodeArchiveService
{ {
return 0; return 0;
} }
/**
* @return Returns 0, always
*/
public synchronized long getTotalEstimatedWorkSizeLong()
{
return 0;
}
public synchronized Collection<NodeRef> getNextWork() public synchronized Collection<NodeRef> getNextWork()
{ {
if (vmShutdownLister.isVmShuttingDown()) if (vmShutdownLister.isVmShuttingDown())

View File

@@ -1,28 +1,28 @@
/* /*
* #%L * #%L
* Alfresco Repository * Alfresco Repository
* %% * %%
* Copyright (C) 2005 - 2016 Alfresco Software Limited * Copyright (C) 2005 - 2016 Alfresco Software Limited
* %% * %%
* This file is part of the Alfresco software. * This file is part of the Alfresco software.
* If the software was purchased under a paid Alfresco license, the terms of * If the software was purchased under a paid Alfresco license, the terms of
* the paid license agreement will prevail. Otherwise, the software is * the paid license agreement will prevail. Otherwise, the software is
* provided under the following open source license terms: * provided under the following open source license terms:
* *
* Alfresco is free software: you can redistribute it and/or modify * Alfresco is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as published by * it under the terms of the GNU Lesser General Public License as published by
* the Free Software Foundation, either version 3 of the License, or * the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version. * (at your option) any later version.
* *
* Alfresco is distributed in the hope that it will be useful, * Alfresco is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of * but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License for more details. * GNU Lesser General Public License for more details.
* *
* You should have received a copy of the GNU Lesser General Public License * You should have received a copy of the GNU Lesser General Public License
* along with Alfresco. If not, see <http://www.gnu.org/licenses/>. * along with Alfresco. If not, see <http://www.gnu.org/licenses/>.
* #L% * #L%
*/ */
package org.alfresco.repo.node.db; package org.alfresco.repo.node.db;
import java.util.Collection; import java.util.Collection;
@@ -240,6 +240,12 @@ public class NodeStringLengthWorker implements ApplicationContextAware
return -1; return -1;
} }
@Override
public long getTotalEstimatedWorkSizeLong()
{
return -1;
}
@Override @Override
public Collection<NodePropertyEntity> getNextWork() public Collection<NodePropertyEntity> getNextWork()
{ {

View File

@@ -1,28 +1,28 @@
/* /*
* #%L * #%L
* Alfresco Repository * Alfresco Repository
* %% * %%
* Copyright (C) 2005 - 2016 Alfresco Software Limited * Copyright (C) 2005 - 2016 Alfresco Software Limited
* %% * %%
* This file is part of the Alfresco software. * This file is part of the Alfresco software.
* If the software was purchased under a paid Alfresco license, the terms of * If the software was purchased under a paid Alfresco license, the terms of
* the paid license agreement will prevail. Otherwise, the software is * the paid license agreement will prevail. Otherwise, the software is
* provided under the following open source license terms: * provided under the following open source license terms:
* *
* Alfresco is free software: you can redistribute it and/or modify * Alfresco is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as published by * it under the terms of the GNU Lesser General Public License as published by
* the Free Software Foundation, either version 3 of the License, or * the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version. * (at your option) any later version.
* *
* Alfresco is distributed in the hope that it will be useful, * Alfresco is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of * but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License for more details. * GNU Lesser General Public License for more details.
* *
* You should have received a copy of the GNU Lesser General Public License * You should have received a copy of the GNU Lesser General Public License
* along with Alfresco. If not, see <http://www.gnu.org/licenses/>. * along with Alfresco. If not, see <http://www.gnu.org/licenses/>.
* #L% * #L%
*/ */
package org.alfresco.repo.security.authentication; package org.alfresco.repo.security.authentication;
import java.io.Serializable; import java.io.Serializable;
@@ -403,6 +403,15 @@ public class UpgradePasswordHashWorker implements ApplicationContextAware, Initi
return (int)totalUserCount; return (int)totalUserCount;
} }
@Override
public long getTotalEstimatedWorkSizeLong()
{
// execute a query to get total number of user nodes in the system.
long totalUserCount = patchDAO.getCountNodesWithTypId(ContentModel.TYPE_USER);
return totalUserCount;
}
@Override @Override
public Collection<Long> getNextWork() public Collection<Long> getNextWork()
{ {

View File

@@ -1,28 +1,28 @@
/* /*
* #%L * #%L
* Alfresco Repository * Alfresco Repository
* %% * %%
* Copyright (C) 2005 - 2016 Alfresco Software Limited * Copyright (C) 2005 - 2016 Alfresco Software Limited
* %% * %%
* This file is part of the Alfresco software. * This file is part of the Alfresco software.
* If the software was purchased under a paid Alfresco license, the terms of * If the software was purchased under a paid Alfresco license, the terms of
* the paid license agreement will prevail. Otherwise, the software is * the paid license agreement will prevail. Otherwise, the software is
* provided under the following open source license terms: * provided under the following open source license terms:
* *
* Alfresco is free software: you can redistribute it and/or modify * Alfresco is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as published by * it under the terms of the GNU Lesser General Public License as published by
* the Free Software Foundation, either version 3 of the License, or * the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version. * (at your option) any later version.
* *
* Alfresco is distributed in the hope that it will be useful, * Alfresco is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of * but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License for more details. * GNU Lesser General Public License for more details.
* *
* You should have received a copy of the GNU Lesser General Public License * You should have received a copy of the GNU Lesser General Public License
* along with Alfresco. If not, see <http://www.gnu.org/licenses/>. * along with Alfresco. If not, see <http://www.gnu.org/licenses/>.
* #L% * #L%
*/ */
package org.alfresco.repo.security.person; package org.alfresco.repo.security.person;
import java.util.ArrayList; import java.util.ArrayList;
@@ -320,8 +320,8 @@ public class HomeFolderProviderSynchronizer extends AbstractLifecycleBean
threadCount, peoplePerTransaction, threadCount, peoplePerTransaction,
null, null,
batchLogger, 100); batchLogger, 100);
processor.process(worker, true); processor.processLong(worker, true);
if (processor.getTotalErrors() > 0) if (processor.getTotalErrorsLong() > 0)
{ {
logger.info(" -- Give up after error --"); logger.info(" -- Give up after error --");
break; break;
@@ -874,6 +874,12 @@ public class HomeFolderProviderSynchronizer extends AbstractLifecycleBean
return size; return size;
} }
@Override
public synchronized long getTotalEstimatedWorkSizeLong()
{
return size;
}
@Override @Override
public synchronized Collection<NodeRef> getNextWork() public synchronized Collection<NodeRef> getNextWork()
{ {

View File

@@ -1,28 +1,28 @@
/* /*
* #%L * #%L
* Alfresco Repository * Alfresco Repository
* %% * %%
* Copyright (C) 2005 - 2016 Alfresco Software Limited * Copyright (C) 2005 - 2016 Alfresco Software Limited
* %% * %%
* This file is part of the Alfresco software. * This file is part of the Alfresco software.
* If the software was purchased under a paid Alfresco license, the terms of * If the software was purchased under a paid Alfresco license, the terms of
* the paid license agreement will prevail. Otherwise, the software is * the paid license agreement will prevail. Otherwise, the software is
* provided under the following open source license terms: * provided under the following open source license terms:
* *
* Alfresco is free software: you can redistribute it and/or modify * Alfresco is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as published by * it under the terms of the GNU Lesser General Public License as published by
* the Free Software Foundation, either version 3 of the License, or * the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version. * (at your option) any later version.
* *
* Alfresco is distributed in the hope that it will be useful, * Alfresco is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of * but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License for more details. * GNU Lesser General Public License for more details.
* *
* You should have received a copy of the GNU Lesser General Public License * You should have received a copy of the GNU Lesser General Public License
* along with Alfresco. If not, see <http://www.gnu.org/licenses/>. * along with Alfresco. If not, see <http://www.gnu.org/licenses/>.
* #L% * #L%
*/ */
package org.alfresco.tools; package org.alfresco.tools;
import java.io.BufferedReader; import java.io.BufferedReader;
@@ -59,13 +59,13 @@ import org.alfresco.service.transaction.TransactionService;
import org.alfresco.util.VmShutdownListener; import org.alfresco.util.VmShutdownListener;
import org.apache.commons.logging.Log; import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory; import org.apache.commons.logging.LogFactory;
/** /**
* Rename user tool. This tool provides minimal support for renaming users. * Rename user tool. This tool provides minimal support for renaming users.
* See {@link #displayHelp} message for restrictions. * See {@link #displayHelp} message for restrictions.
* <pre> * <pre>
* Usage: renameUser -user username [options] oldUsername newUsername"); * Usage: renameUser -user username [options] oldUsername newUsername");
* renameUser -user username [options] -file filename"); * renameUser -user username [options] -file filename");
* </pre> * </pre>
* The csv file has a simple comma separated list, with * The csv file has a simple comma separated list, with
* a pair of usernames on each line. Comments and blank * a pair of usernames on each line. Comments and blank
@@ -549,6 +549,12 @@ public class RenameUser extends Tool
return size; return size;
} }
@Override
public synchronized long getTotalEstimatedWorkSizeLong()
{
return size;
}
@Override @Override
public synchronized Collection<User> getNextWork() public synchronized Collection<User> getNextWork()
{ {