This is part of the larger task of developing Configuration Manager Proxy (CMP) applications.
GregorianCalendar oldCCTime = b.getTimeOfLastCompletionCode(); b.setLongDescription(newDesc); GregorianCalendar newCCTime = oldCCTime; while (oldCCTime.equals(newCCTime)) { newCCTime = b.getTimeOfLastCompletionCode()); Thread.sleep(1000); } CompletionCodeType ccType = b.getLastCompletionCode(); if (ccType == CompletionCodeType.success) { // etc. }
This example causes the application to continually query the time the topology last received a completion code; that is, when an action on the topology was last completed. When the results of the createBroker() are returned to the CMP, the completion code is updated and control breaks out of the while loop. At this point the last completion code is determined.
As well as being unsuitable for a multi-threaded application, this algorithm for determining the outcome of commands is inefficient as it causes the CMP application to wait while the Configuration Manager processes the request.
A better way of doing this is to make use of administered object notifications; see Checking the results of broker domain management using the Configuration Manager Proxy with object notification.