Skip to content

Commit c0e4aeb

Browse files
committed
debugging locks
1 parent d5bbcd1 commit c0e4aeb

1 file changed

Lines changed: 6 additions & 0 deletions

File tree

‎src/main/java/edu/harvard/iq/dataverse/workflow/WorkflowServiceBean.java‎

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
import edu.harvard.iq.dataverse.RoleAssigneeServiceBean;
1010
import edu.harvard.iq.dataverse.UserNotification;
1111
import edu.harvard.iq.dataverse.UserNotificationServiceBean;
12+
import edu.harvard.iq.dataverse.DatasetLock.Reason;
1213
import edu.harvard.iq.dataverse.authorization.users.ApiToken;
1314
import edu.harvard.iq.dataverse.authorization.users.AuthenticatedUser;
1415
import edu.harvard.iq.dataverse.engine.command.CommandContext;
@@ -136,6 +137,7 @@ public void start(Workflow wf, WorkflowContext ctxt, boolean findDataset) throws
136137
* (e.g. if this method is not asynchronous)
137138
*
138139
*/
140+
logger.info("Ctxt lock id is " + ctxt.getLockId());
139141
boolean isLocked = ctxt.getLockId()!=null;
140142
if (!findDataset && !isLocked) {
141143
/*
@@ -353,6 +355,7 @@ void lockDataset(WorkflowContext ctxt, DatasetLock datasetLock) throws CommandEx
353355
em.persist(datasetLock);
354356
//flush creates the id
355357
em.flush();
358+
logger.info("Adding new lock id " + datasetLock.getId());
356359
ctxt.setLockId(datasetLock.getId());
357360
}
358361

@@ -369,12 +372,15 @@ public void unlockDataset(WorkflowContext ctxt) throws CommandException {
369372
lockCounter.setParameter("datasetId", ctxt.getDataset().getId());
370373
List<DatasetLock> locks = lockCounter.getResultList();
371374
for (DatasetLock lock : locks) {
375+
logger.info("Found lock id " + lock.getId());
372376
if (lock.getReason() == DatasetLock.Reason.Workflow) {
373377
ctxt.getDataset().removeLock(lock);
378+
logger.info("Removing lock id " + lock.getId());
374379
em.remove(lock);
375380
}
376381
}
377382
em.flush();
383+
logger.info("dataset locked " + (null != ctxt.getDataset().getLockFor(Reason.Workflow)));
378384
}
379385

380386
//

0 commit comments

Comments
 (0)