+ @Override
+ public void flowErrorReported(Node node, long rid, Object err) {
+ log.trace("Got error {} for message rid {} from node {}", new Object[] { err, rid, node });
+ pendingEvents.offer(new ErrorReportedEvent(rid, node, err));
+ }
+
+ private void processErrorEvent(ErrorReportedEvent event) {
+ Node node = event.getNode();
+ long rid = event.getRequestId();
+ Object error = event.getError();
+ String errorString = (error == null) ? "Not provided" : error.toString();
+ /*
+ * If this was for a flow install, remove the corresponding entry from
+ * the software view. If it was a Looking for the rid going through the
+ * software database. TODO: A more efficient rid <-> FlowEntryInstall
+ * mapping will have to be added in future
+ */
+ FlowEntryInstall target = null;
+ for (FlowEntryInstall index : nodeFlows.get(node)) {
+ FlowEntryInstall entry = installedSwView.get(index);
+ if (entry.getRequestId() == rid) {
+ target = entry;
+ break;
+ }
+ }
+ if (target != null) {
+ // This was a flow install, update database
+ this.updateLocalDatabase(target, false);
+ }
+
+ // Notify listeners
+ if (frmAware != null) {
+ synchronized (frmAware) {
+ for (IForwardingRulesManagerAware frma : frmAware) {
+ try {
+ frma.requestFailed(rid, errorString);
+ } catch (Exception e) {
+ log.warn("Failed to notify {}", frma);
+ }
+ }
+ }
+ }
+ }
+
+ @Override
+ public Status solicitStatusResponse(Node node, boolean blocking) {
+ Status rv = new Status(StatusCode.INTERNALERROR);
+
+ if (this.programmer != null) {
+ if (blocking) {
+ rv = programmer.syncSendBarrierMessage(node);
+ } else {
+ rv = programmer.asyncSendBarrierMessage(node);
+ }
+ }
+
+ return rv;
+ }