public Declare newInstance(Object described) { List l = (List) described; Declare o = new Declare(); if(!l.isEmpty()) { o.setGlobalId( (GlobalTxId) l.get( 0 ) ); } return o; }
@Override protected List wrap(Declare val) { GlobalTxId globalId = val.getGlobalId(); return globalId == null ? Collections.EMPTY_LIST : Collections.singletonList(globalId); }
public CompletableFuture<Binary> declareAsync() { Message message = Message.Factory.create(); Declare declare = new Declare(); message.setBody(new AmqpValue(declare)); return this.internalSender.sendAndReturnDeliveryStateAsync( message, TransactionContext.NULL_TXN) .thenApply( state -> { Binary txnId = null; if (state instanceof Declared) { Declared declared = (Declared) state; txnId = declared.getTxnId(); TRACE_LOGGER.debug("New TX started: {}", txnId); } else { CompletableFuture<String> exceptionFuture = new CompletableFuture<>(); exceptionFuture.completeExceptionally(new UnsupportedOperationException("Received unknown state: " + state.toString())); } return txnId; }); }
public void declare(AmqpTransactionId txId, AsyncResult request) throws Exception { if (txId.getRemoteTxId() != null) { throw new IllegalStateException("Declare called while a TX is still Active."); } if (isClosed()) { request.onFailure(new JMSException("Cannot start new transaction: Coordinator remotely closed")); return; } Message message = Message.Factory.create(); Declare declare = new Declare(); message.setBody(new AmqpValue(declare)); Delivery pendingDelivery = getEndpoint().delivery(tagGenerator.getNextTag()); pendingDelivery.setContext(txId); // Store away for completion pendingDeliveries.add(pendingDelivery); pendingRequests.put(txId, request); sendTxCommand(message); }
public Declare newInstance(Object described) { List l = (List) described; Declare o = new Declare(); if(!l.isEmpty()) { o.setGlobalId( (GlobalTxId) l.get( 0 ) ); } return o; }
@Override protected List wrap(Declare val) { GlobalTxId globalId = val.getGlobalId(); return globalId == null ? Collections.EMPTY_LIST : Collections.singletonList(globalId); }
public void declare(JmsTransactionId txId, AsyncResult request) throws Exception { if (isClosed()) { request.onFailure(new JMSException("Cannot start new transaction: Coordinator remotely closed")); return; } if (txId.getProviderHint() != null) { throw new IllegalStateException("Declar called while a TX is still Active."); } Message message = Message.Factory.create(); Declare declare = new Declare(); message.setBody(new AmqpValue(declare)); ScheduledFuture<?> timeout = scheduleTimeoutIfNeeded("Timed out waiting for declare of TX.", request); OperationContext context = new OperationContext(txId, request, timeout); Delivery delivery = getEndpoint().delivery(tagGenerator.getNextTag()); delivery.setContext(context); sendTxCommand(message); }
public Declare newInstance(Object described) { List l = (List) described; Declare o = new Declare(); if(!l.isEmpty()) { o.setGlobalId( (GlobalTxId) l.get( 0 ) ); } return o; }
@Override protected List wrap(Declare val) { GlobalTxId globalId = val.getGlobalId(); return globalId == null ? Collections.EMPTY_LIST : Collections.singletonList(globalId); }
public void declare(JmsTransactionId txId, AsyncResult request) throws Exception { if (isClosed()) { request.onFailure(new JMSException("Cannot start new transaction: Coordinator remotely closed")); return; } if (txId.getProviderHint() != null) { throw new IllegalStateException("Declar called while a TX is still Active."); } Message message = Message.Factory.create(); Declare declare = new Declare(); message.setBody(new AmqpValue(declare)); ScheduledFuture<?> timeout = scheduleTimeoutIfNeeded("Timed out waiting for declare of TX.", request); OperationContext context = new OperationContext(txId, request, timeout); Delivery delivery = getEndpoint().delivery(tagGenerator.getNextTag()); delivery.setContext(context); sendTxCommand(message); }
public Declare newInstance(Object described) { List l = (List) described; Declare o = new Declare(); if(!l.isEmpty()) { o.setGlobalId( (GlobalTxId) l.get( 0 ) ); } return o; }
@Override protected List wrap(Declare val) { GlobalTxId globalId = val.getGlobalId(); return globalId == null ? Collections.EMPTY_LIST : Collections.singletonList(globalId); }
if (action instanceof Declare) { Declare declare = (Declare) action; if (declare.getGlobalId() != null) { throw new Exception("don't know how to handle a declare /w a set GlobalId");
if (action instanceof Declare) { Declare declare = (Declare) action; if (declare.getGlobalId() != null) { throw new Exception("don't know how to handle a declare /w a set GlobalId");