protected void processPorts(Instance instance) { Set<String> portSpecs = new HashSet<>(); for (Port port : objectManager.children(instance, Port.class)) { if (port.getRemoved() != null) { continue; } portSpecs.add(new PortSpec(port).toSpec()); } objectManager.setFields(instance, InstanceConstants.FIELD_PORTS, new ArrayList<>(portSpecs)); instanceDao.clearCacheInstanceData(instance.getId()); }
@Override public HandlerResult handle(ProcessState state, ProcessInstance process) { Port port = (Port) state.getResource(); final Instance instance = getObjectManager().loadResource(Instance.class, port.getInstanceId()); if (instance == null) { return null; } lockManager.lock( new InstancePortsLock(instance), new LockCallbackNoReturn() { @Override public void doWithLockNoResult() { processPorts(instance); } }); return null; }