/** * Updates managed contexts based on the marshaledContext. * * @param marshaledContext The marshaled context to process. * @param commit If true the pending contexts are committed. * @param callback Callback to report subscriber responses. */ /*package*/void setMarshaledContext(ContextItems marshaledContext, boolean commit, ISurveyCallback callback) { ISurveyResponse response = new SurveyResponse(); Iterator<IManagedContext<?>> iter = managedContexts.iterator(); setMarshaledContext(marshaledContext, iter, response, __ -> { if (commit) { commitContexts(!response.rejected(), false); } }); }
/** * Callback to handle a polling request from the CCOW context manager. */ @Override public void ccowPending(CCOWContextManager sender, ContextItems contextItems) { ccowTransaction = true; updateCCOWStatus(); setMarshaledContext(contextItems, false, response -> { if (response.rejected()) { sender.setSurveyResponse(response.toString()); } ccowTransaction = false; updateCCOWStatus(); }); }
boolean accept = !response.rejected();
/** * Joins the CCOW common context, if available. */ public void ccowJoin() { if (ccowIsActive()) { return; } if (ccowContextManager == null && ccowEnabled) { ccowContextManager = new CCOWContextManager(); ccowContextManager.subscribe(this); ccowContextManager.run("CareWebFramework#", "", true, "*"); } if (ccowContextManager != null) { if (!ccowContextManager.isActive()) { ccowContextManager.resume(); } init(response -> { if (response.rejected()) { ccowContextManager.suspend(); } updateCCOWStatus(); }); } }