@description Terminates a transaction due to an explicit abort or
timeout.

@method _ioCancel
@private
@static
@param {object} o - Transaction object generated by _create().
@param {string} s - Identifies timed out or aborted transaction.

@return void
423819
function _ioCancel(o, s) {
        if (o && o.c) {
            o.e = s;
            o.c.abort();
        }
    }
901166
@Override
    public void setTransactionTimeout(int timeout) throws SystemException
    {
        Transaction tx = threadLocal.get();
        if (tx == null)
        {
            timerThead.set(timeout);
        }
        else
        {
            if (log.isDebugEnabled())
                log.debug("Cannot reset running transaction:" + tx);
        }

    }
63878
private void abortTransactions(Set<String> transactionalIds) {
		for (String transactionalId : transactionalIds) {
			try (FlinkKafkaInternalProducer<byte[], byte[]> kafkaProducer =
				initTransactionalProducer(transactionalId, false)) {
				// it suffice to call initTransactions - this will abort any lingering transactions
				kafkaProducer.initTransactions();
			}
		}
	}
1033186
function handleSignals (sigOrSigs, runHooks, timeout) {
    const sigs = Array.isArray(sigOrSigs) ? sigOrSigs : [sigOrSigs];
    sigs.forEach(s => process.on(s, crash.bind(null, s, runHooks, timeout)));
}
607769
def abort_io(self, iocb, err):
        """"""
        if _debug: IOChainMixIn._debug("abort_io %r %r", iocb, err)

        # make sure we're being notified of an abort request from
        # the iocb we are chained from
        if iocb is not self.ioChain:
            raise RuntimeError("broken chain")

        # call my own Abort(), which may forward it to a controller or
        # be overridden by IOGroup
        self.abort(err)
507161
public void cancel(String[] protocol, int[] reasonCode, String[] reasonText) {
		if(proxy.getAckReceived()) throw new IllegalStateException("There has been an ACK received on this branch. Can not cancel.");
		
		try {			
			cancelTimer();
			if(this.isStarted() && !canceled && !timedOut &&
					(outgoingRequest.getMethod().equalsIgnoreCase(Request.INVITE) ||
							// https://code.google.com/p/sipservlets/issues/detail?id=253
							outgoingRequest.getMethod().equalsIgnoreCase(Request.PRACK) ||
							// https://code.google.com/p/sipservlets/issues/detail?id=33
							outgoingRequest.getMethod().equalsIgnoreCase(Request.UPDATE))) {
				if(lastResponse != null) { /* According to SIP RFC we should send cancel only if we receive any response first*/
					if(logger.isDebugEnabled()) {
						logger.debug("Trying to cancel ProxyBranch for outgoing request " + outgoingRequest);
					}
					if(lastResponse.getStatus() > Response.OK && !recursedBranches.isEmpty()) {
						//  Javadoc says it should throw an java.lang.IllegalStateException if the transaction has already been completed and it has no child branches
						if(logger.isDebugEnabled()) {
							logger.debug("lastResponse status for this branch is " + lastResponse.getStatus() + " and it has " + recursedBranches.size() + " to cancel");
						}
						return;
					}
					SipServletRequest cancelRequest = null;
					if(outgoingRequest.getMethod().equalsIgnoreCase(Request.PRACK) || outgoingRequest.getMethod().equalsIgnoreCase(Request.UPDATE)) {
						// https://code.google.com/p/sipservlets/issues/detail?id=253 and https://code.google.com/p/sipservlets/issues/detail?id=33
						// in case of PRACK or UPDATE we need to take the original INVITE
						cancelRequest = originalRequest.getLinkedRequest().createCancel();
					} else {
						cancelRequest = outgoingRequest.createCancel();
					}
					
					//https://code.google.com/p/sipservlets/issues/detail?id=272 Adding reason headers if needed
					if(protocol != null && reasonCode != null && reasonText != null
							&& protocol.length == reasonCode.length && reasonCode.length == reasonText.length) {
						for (int i = 0; i < protocol.length; i++) {
							String reasonHeaderValue = protocol[i] + ";cause=" + reasonCode[i];
							if(reasonText[i] != null && reasonText[i].trim().length() > 0) {
								reasonHeaderValue = reasonHeaderValue.concat(";text=\"" + reasonText[i] + "\"");
							}
							((SipServletRequestImpl)cancelRequest).setHeaderInternal("Reason", reasonHeaderValue, false);
							
						}
					}
					cancelRequest.send();
				} else {
					// We dont send cancel, but we must stop the invite retrans
					SIPClientTransaction tx = (SIPClientTransaction) outgoingRequest.getTransaction();
					
					if(tx != null) {
						StaticServiceHolder.disableRetransmissionTimer.invoke(tx);
						//disableTimeoutTimer.invoke(tx);
					} else {
						logger.warn("Transaction is null. Can not stop retransmission, they are already dead in the branch.");
					}
					/*
					try {
						//tx.terminate();
						// Do not terminate the tx here, because com.bea.sipservlet.tck.agents.spec.ProxyTest.testProxyCancel test is failing. If the tx
						// is terminated 100 Trying is dropped at JSIP.
					} catch(Exception e2) {
						logger.error("Can not terminate transaction", e2);
					}*/

				}
				canceled = true;
			}
			if(!this.isStarted() &&
					(outgoingRequest.getMethod().equalsIgnoreCase(Request.INVITE) ||
							// https://code.google.com/p/sipservlets/issues/detail?id=253
							outgoingRequest.getMethod().equalsIgnoreCase(Request.PRACK))) {
				canceled = true;	
			}
		}
		catch(Exception e) {
			throw new IllegalStateException("Failed canceling proxy branch", e);
		} finally {
			onBranchTerminated();
		}
			
	}
1010046
public final void terminateTransaction() {
      if (trace) {
         log.tracef("Terminating transaction. Is read only? %s. Is commit? %s", readOnly, committed);
      }
      long execTime = timeService.timeDuration(initTime, NANOSECONDS);
      if (readOnly) {
         if (committed) {
            incrementValue(NUM_COMMITTED_RO_TX);
            addValue(RO_TX_SUCCESSFUL_EXECUTION_TIME, execTime);
         } else {
            incrementValue(NUM_ABORTED_RO_TX);
            addValue(RO_TX_ABORTED_EXECUTION_TIME, execTime);
         }
      } else {
         if (committed) {
            incrementValue(NUM_COMMITTED_WR_TX);
            addValue(WR_TX_SUCCESSFUL_EXECUTION_TIME, execTime);
         } else {
            incrementValue(NUM_ABORTED_WR_TX);
            addValue(WR_TX_ABORTED_EXECUTION_TIME, execTime);
         }
      }

      terminate();
   }
228003
function abort() {
    var event,
        me = this,
        resetting = calledBy.reset;

    if (me.running) {
      event = Event('abort');
      me.emit(event);
      if (!event.cancelled || resetting) {
        // avoid infinite recursion
        calledBy.abort = true;
        me.reset();
        delete calledBy.abort;

        if (support.timeout) {
          clearTimeout(me._timerId);
          delete me._timerId;
        }
        if (!resetting) {
          me.aborted = true;
          me.running = false;
        }
      }
    }
    return me;
  }
743017
public void abort() {
        if (asyncHandle != 0) {
            int handle = asyncHandle;
            asyncHandle = 0;
            broker.callRPCAbort(handle);
            ZKUtil.fireEvent(new AsyncRPCAbortEvent(rpcName, target, handle));
            rpcName = null;
        }
    }
1163917
def timeout(self, timeout):
        '''
        '''
        if self._timeout is None:
            self.event('connection_made').bind(self._add_timeout)
            self.event('connection_lost').bind(self._cancel_timeout)
        self._timeout = timeout or 0
        self._add_timeout(None)
97602
@Override
    public void setUOWTimeout(int uowType, int timeout) {
        if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
            Tr.entry(tc, "setUOWTimeout", new Object[] { Integer.valueOf(uowType), Integer.valueOf(timeout) });

        switch (uowType) {
            case UOWSynchronizationRegistry.UOW_TYPE_GLOBAL_TRANSACTION:
                try {
                    EmbeddableTransactionManagerFactory.getTransactionManager().setTransactionTimeout(timeout);
                } catch (Exception e) {
                    final IllegalArgumentException iae = new IllegalArgumentException(e);
                    if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
                        Tr.exit(tc, "setUOWTimeout", iae);
                    throw iae;
                }
                break;

            default:
                final IllegalArgumentException iae = new IllegalArgumentException("Invalid UOW type: " + uowType);
                if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
                    Tr.exit(tc, "setUOWTimeout", iae);
                throw iae;
        }

        if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
            Tr.exit(tc, "setUOWTimeout");
    }
327413
public void processTimeout(TimeoutEvent timeoutEvent) {
        Transaction transaction = null;
        if(timeoutEvent.isServerTransaction()) {
            transaction = timeoutEvent.getServerTransaction();
            if(logger.isDebugEnabled()) {
                logger.debug("timeout => " + transaction.getRequest().toString());
            }
        } else {
            transaction = timeoutEvent.getClientTransaction();
            if(logger.isDebugEnabled()) {
                logger.debug("timeout => " + transaction.getRequest().toString());
            }
        }
        String callId = ((CallIdHeader)transaction.getRequest().getHeader(CallIdHeader.NAME)).getCallId();
        register.unStickSessionFromNode(callId);
    }
327470
function ok(inst, transaction) {
    if (transaction === undefined) transaction = 0;
    inst.balance = inst.balance + transaction;
    var _ok = inst.balance > 0 && Date.now() < inst.timeout;
    return _ok;
}
698016
def abort_transaction
      if @transaction_stack.empty?
        PEROBS.log.fatal 'No ongoing transaction to abort'
      end
      @transaction_stack.pop.each do |id|
        @transaction_objects[id]._restore(@transaction_stack.length)
      end
    end
230262
function(o) {
            var id = (L.isString(o)) ? o : o.tId,
                q = queues[id];
            if (q) {
                q.aborted = true;
            }
        }
575858
public void processTimeout(TimeoutEvent timeout) {
    ClientTransaction trans = timeout.getClientTransaction();
    if (trans == null) {
      return;
    }

    SipTransaction sip_trans = null;
    synchronized (respTransactions) {
      sip_trans = (SipTransaction) respTransactions.get(trans);
    }

    if (sip_trans == null) {
      return;
    }

    if (trans.getState().getValue() == TransactionState._TERMINATED) {
      synchronized (respTransactions) {
        respTransactions.remove(trans);
      }
    }

    // check for listener handling
    MessageListener listener = sip_trans.getClientListener();
    if (listener != null) {
      listener.processEvent(timeout);
      return;
    }

    // if no listener, use the default blocking mechanism
    synchronized (sip_trans.getBlock()) {
      sip_trans.getEvents().addLast(timeout);
      sip_trans.getBlock().notifyEvent();
    }
  }
1249537
def abort_io(self, iocb, err):
        """"""
        if _debug: IOController._debug("abort_io %r %r", iocb, err)

        # if it completed, leave it alone
        if iocb.ioState == COMPLETED:
            pass

        # if it already aborted, leave it alone
        elif iocb.ioState == ABORTED:
            pass

        else:
            # change the state
            iocb.ioState = ABORTED
            iocb.ioError = err

            # notify the client
            iocb.trigger()