op.get(OPERATION_HEADERS, "execute-for-coordinator").set(true);
op.get(OP_ADDR).setEmptyList();
op.get(DOMAIN_MODEL).set(modelDescription);
//TODO get this from somewhere
final ProxyController proxy = registry.popChannelAndCreateProxy(hostName);
final AtomicReference<ModelNode> failedRef = new AtomicReference<ModelNode>();
final AtomicReference<ModelNode> preparedRef = new AtomicReference<ModelNode>();
final AtomicReference<OperationTransaction> txRef = new AtomicReference<OperationTransaction>();
ProxyController.ProxyOperationControl control = new ProxyController.ProxyOperationControl() {
@Override
public void operationFailed(ModelNode response) {
failedRef.set(response);
}
@Override
public void operationPrepared(OperationTransaction transaction, ModelNode result) {
txRef.set(transaction);
preparedRef.set(result);
}
@Override
public void operationCompleted(ModelNode response) {
}
};
proxy.execute(op, OperationMessageHandler.logging, control, null);
if (failedRef.get() != null) {
final ModelNode failed = failedRef.get();
context.getResult().set(failed.get(RESULT));
context.getFailureDescription().set(failed.get(FAILURE_DESCRIPTION));