[Fix] Fixed some execution issues

This commit is contained in:
Robert von Burg 2020-02-18 20:05:50 +01:00
parent c312f4b5b0
commit e37aaa412f
3 changed files with 8 additions and 12 deletions

View File

@ -118,10 +118,12 @@ public class EventBasedExecutionHandler extends ExecutionHandler {
@Override
public void removeFromExecution(Controller controller) {
logger.info("Removing controller " + controller.getLocator() + " from execution...");
if (this.controllers.removeElement(controller.getRealm(), controller.getLocator()) != null) {
logger.info("Removed controller " + controller.getLocator() + " from execution.");
getExecutor().submit(() -> notifyObserverRemove(controller));
} else {
logger.error(
"Controller " + controller.getRealm() + " " + controller.getLocator() + " was already removed.");
}
}

View File

@ -29,6 +29,8 @@ public class ArchiveActivityCommand extends Command {
@Override
public void doCommand() {
tx().lock(this.activityLoc);
Activity activity = tx().getActivityBy(this.activityLoc.get(1), this.activityLoc.get(2));
if (activity == null) {
logger.error("Activity " + this.activityLoc + " does not exist anymore, can not archive!");

View File

@ -4,7 +4,6 @@ import static li.strolch.model.StrolchModelConstants.BAG_PARAMETERS;
import static li.strolch.runtime.StrolchConstants.PolicyConstants.*;
import li.strolch.exception.StrolchModelException;
import li.strolch.model.Locator;
import li.strolch.model.Resource;
import li.strolch.model.State;
import li.strolch.model.activity.Action;
@ -24,8 +23,7 @@ import li.strolch.runtime.StrolchConstants;
*
* <p>
* <b>Note:</b> the reservation is done for {@link Action} of type {@link StrolchConstants.PolicyConstants#TYPE_RESERVE}
* and releasing is done for
* {@link Action} of type {@link StrolchConstants.PolicyConstants#TYPE_RELEASE}
* and releasing is done for {@link Action} of type {@link StrolchConstants.PolicyConstants#TYPE_RELEASE}
* </p>
*
* @author Robert von Burg <eitch@eitchnet.ch>
@ -72,14 +70,8 @@ public class ReservationExecution extends DurationExecution {
case TYPE_RESERVE:
case TYPE_RELEASE:
boolean isReserve = action.getType().equals(TYPE_RESERVE);
setReservation(action, isReserve);
String realmName = tx().getRealmName();
Locator locator = action.getLocator();
getDelayedExecutionTimer().execute(realmName, getContainer(), locator, 0L);
setActionState(action, State.EXECUTION);
// async to executed only causes trouble =))
toExecuted(action);
break;
default: