Send message asynchronously with callback.

@param builder
@param cb
@param timeout
@param unit
@since 1.4.5
420614
public void send(MessageBuilder builder, SendMessageCallback cb, long timeout, TimeUnit unit) {
        Message msg = builder.build(this.messageBodyConverter);
        final String topic = msg.getTopic();
        MessageProducer producer = this.getOrCreateProducer(topic);
        producer.sendMessage(msg, cb, timeout, unit);
    }
460972
public void setWriteTimeout(int writeTimeout) {
		this.client = this.client.newBuilder()
				.writeTimeout(writeTimeout, TimeUnit.MILLISECONDS)
				.build();
	}
993624
public void setConnectTimeout(long connectTimeout, TimeUnit unit) {
        this.connectTimeout = Duration.ofMillis(unit.toMillis(connectTimeout));
    }
937917
@Override
    public boolean registerReadAhead(InterChannelCallback cb, int timeout) {

        if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) {
            Tr.debug(tc, "Read-ahead requested (timeout=" + timeout + ") " + getVC());
        }
        if (-1 > timeout) {
            if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) {
                Tr.debug(tc, "Invalid timeout used by caller.");
            }
            return false;
        }
        int state;
        int myState;
        // grab the read-ahead states in a sync block to avoid timing windows
        // with the callback kicking in at the same time
        synchronized (this.stateSyncObject) {
            state = getCallbackState();
            myState = getReadState();
            setCallbackState(CALLBACK_STATE_PENDING, null);
        }
        if (CALLBACK_STATE_IDLE != state) {
            // invalid state to start this read-ahead from
            if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) {
                Tr.debug(tc, "Callback state is invalid: " + state);
            }
            return false;
        }
        if (READ_STATE_IDLE != myState) {
            if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) {
                Tr.debug(tc, "Read for response state is invalid: " + myState);
            }
            return false;
        }

        // start the read now
        this.bReadAheadEnabled = true;
        int time = (-1 == timeout) ? getReadTimeout() : timeout;
        setAppReadCallback(cb);
        setupJITRead(getHttpConfig().getIncomingHdrBufferSize());
        getTSC().getReadInterface().read(1, HttpOSCReadAhead.getRef(), true, time);
        return true;
    }
630370
public void send(CEMI frame, BlockingMode mode) throws KNXTimeoutException,
		KNXConnectionClosedException
	{
		if (!(frame instanceof CEMIDevMgmt))
			throw new KNXIllegalArgumentException("unsupported cEMI type");
		super.send(frame, mode);
	}
1199815
@Override
    public SIBusMessage receiveWithWait(SITransaction siTran,
                                        long timeout)
                    throws SISessionUnavailableException, SISessionDroppedException,
                    SIResourceException, SIConnectionLostException, SILimitExceededException,
                    SIErrorException,
                    SIIncorrectCallException
    {
        if (TraceComponent.isAnyTracingEnabled() && CoreSPIConsumerSession.tc.isEntryEnabled())
            SibTr.entry(
                        CoreSPIConsumerSession.tc,
                        "receiveWithWait",
                        new Object[] { this, new Long(timeout), siTran });

        checkTransaction(siTran, "TRANSACTION_RECEIVE_USAGE_ERROR_CWSIP0777");

        SIBusMessage jsMsg = null;

        boolean sucessful = false;

        //Try to receive a message from the LCP
        try
        {
            jsMsg =
                            _localConsumerPoint.receive(timeout,
                                                        (TransactionCommon) siTran);
            sucessful = true;
        } catch (SINotPossibleInCurrentConfigurationException e)
        {
            // No FFDC code needed.

            // This case indicates that the destination has changed in some way
            // Probably receiveAllowed = false.
            if (TraceComponent.isAnyTracingEnabled() && CoreSPIConsumerSession.tc.isEntryEnabled())
                SibTr.exit(CoreSPIConsumerSession.tc, "receiveWithWait", "SISessionUnavailableException");
            throw new SISessionUnavailableException(
                            nls.getFormattedMessage(
                                                    "CONSUMER_CLOSED_ERROR_CWSIP0177",
                                                    new Object[] { _destAddr.getDestinationName(),
                                                                  _messageProcessor.getMessagingEngineName() },
                                                    null));
        }

        if (TraceComponent.isAnyTracingEnabled() && UserTrace.tc_mt.isDebugEnabled())
            UserTrace.trace_Receive(siTran, (JsMessage) jsMsg, _destAddr, getIdInternal());

        if (TraceComponent.isAnyTracingEnabled() && CoreSPIConsumerSession.tc.isEntryEnabled())
            SibTr.exit(CoreSPIConsumerSession.tc, "receiveWithWait", jsMsg);

        //return the message or null
        return jsMsg;
    }
502139
protected TimeoutId requestTimeout(final long delay, final TimeUnit unit, @Nullable final String name) {
        return requestTimeout(delay, unit, name, null);
    }
323075
public void registerOnMessage(Message.Builder builder) {
    messageMap.put(builder.getDescriptorForType().getFullName(), builder);
  }
1372061
public void waitForCompletion(final long timeout, final TimeUnit unit) 
			throws InterruptedException, ExecutionException, TimeoutException {
		doneLatch.await(timeout, unit);
	}
721180
public void setLockTimeout(int timeout, TimeUnit unit) {
        if (timeout < 0 || unit == null) {
            throw new IllegalArgumentException();
        }
        mLockTimeout = timeout;
        mLockTimeoutUnit = unit;
    }
215603
function(callback){
      var msg = ubeacon.getCommandString( false, ubeacon.uartCmd.led, new Buffer('03','hex') , false );
      ubeacon.sendMeshRemoteManagementMessage( program.destinationAddress, msg.toString(), null);
      setTimeout(callback, 2000);
    }
699900
public void processTimeout(final TimeoutEvent timeoutEvent) {
		Transaction eventTransaction = null;
		if(timeoutEvent.isServerTransaction()) {
			eventTransaction = timeoutEvent.getServerTransaction();
		} else {
			eventTransaction = timeoutEvent.getClientTransaction();
		}
		final Transaction transaction = eventTransaction;
		if(logger.isDebugEnabled()) {
			logger.debug("transaction " + transaction + " timed out => " + transaction.getRequest().toString());
		}

		final TransactionApplicationData tad = (TransactionApplicationData) transaction.getApplicationData();
		if(tad != null && tad.getSipServletMessage() != null) {
			// https://github.com/RestComm/sip-servlets/issues/107 guard against NPEon concurrent cleanup
			final SipServletMessageImpl sipServletMessage = tad.getSipServletMessage();
			final MobicentsSipSessionKey sipSessionKey = sipServletMessage.getSipSessionKey();
			final MobicentsSipSession sipSession = sipServletMessage.getSipSession();
			getAsynchronousExecutor().execute(new Runnable() {
				public void run() {
					try {
						if(logger.isDebugEnabled()) {
							logger.debug("transaction " + transaction + " timed out => " + transaction.getRequest().toString());
						}
						boolean appNotifiedOfPrackNotReceived = false;
						// session can be null if a message was sent outside of the container by the container itself during Initial request dispatching
						// but the external host doesn't send any response so we call out to the application only if the session is not null
						if(logger.isDebugEnabled()) {
                            logger.debug("time out happened on sipSession " + sipSession);
                        }
						if(sipSession != null) {
							SipContext sipContext = findSipApplication(sipSessionKey.getApplicationName());
							//the context can be null if the server is being shutdown
							if(sipContext != null) {
								MobicentsSipApplicationSession sipApplicationSession = sipSession.getSipApplicationSession();
								try {
									sipContext.enterSipApp(sipApplicationSession, sipSession, false, true);
									MobicentsB2BUAHelper b2buaHelperImpl = sipSession.getB2buaHelper();

									if(b2buaHelperImpl != null && tad.getSipServletMessage() instanceof SipServletRequestImpl) {
										b2buaHelperImpl.unlinkRequestInternal((SipServletRequestImpl)tad.getSipServletMessage(), false);
									}
									// naoki : Fix for Issue 1618 http://code.google.com/p/mobicents/issues/detail?id=1618 on Timeout don't do the 408 processing for Server Transactions
									if(logger.isDebugEnabled()) {
			                            logger.debug("time out happened on server tx ? " + timeoutEvent.isServerTransaction() + " and message " + sipServletMessage);
			                        }
									if(sipServletMessage instanceof SipServletRequestImpl && !timeoutEvent.isServerTransaction()) {
										try {
											ProxyBranchImpl proxyBranchImpl = tad.getProxyBranch();
											if(proxyBranchImpl != null) {
												ProxyImpl proxy = (ProxyImpl) proxyBranchImpl.getProxy();
												if(proxy.getFinalBranchForSubsequentRequests() != null) {
													tad.cleanUp();
													transaction.setApplicationData(null);
													return;
												}
											}
											SipServletRequestImpl sipServletRequestImpl = (SipServletRequestImpl) sipServletMessage;
											if(sipServletRequestImpl.visitNextHop()) {
												return;
											}
											sipServletMessage.setTransaction(transaction);
											SipServletResponseImpl response = (SipServletResponseImpl) sipServletRequestImpl.createResponse(408, null, false, true);
											// Fix for Issue 1734
											sipServletRequestImpl.setResponse(response);
											MessageDispatcher.callServlet(response);
											if(tad.getProxyBranch() != null) {
												tad.getProxyBranch().setResponse(response);
												tad.getProxyBranch().onResponse(response, response.getStatus());
											}
											sipSession.updateStateOnResponse(response, true);
										} catch (Throwable t) {
											logger.error("Failed to deliver 408 response on transaction timeout" + transaction, t);
										}
									}
									// Guard only invite tx should check that, otherwise proxy might become null http://code.google.com/p/mobicents/issues/detail?id=2350
									// Should check only Server Tx for ack or prack not received http://code.google.com/p/mobicents/issues/detail?id=2525
									if(Request.INVITE.equals(sipServletMessage.getMethod()) && timeoutEvent.isServerTransaction()) {
										checkForAckNotReceived(sipServletMessage);
										appNotifiedOfPrackNotReceived = checkForPrackNotReceived(sipServletMessage);
									}
								} finally {
									sipSession.removeOngoingTransaction(transaction);
									sipSession.setRequestsPending(0);
									sipContext.exitSipApp(sipApplicationSession, sipSession);
								}
								// don't invalidate here because if the application sends a final response on the noPrack received
								// the ACK to this final response won't be able to get routed since the sip session would have been invalidated
								if(!appNotifiedOfPrackNotReceived) {
									tryToInvalidateSession(sipSessionKey, false);
								}
							}
						}
						// don't clean up for the same reason we don't invalidate the sip session right above
						tad.cleanUp();
						transaction.setApplicationData(null);
					} catch (Exception e) {
						logger.error("Problem handling timeout", e);
					}
				}
			});
		}
	}
1210765
protected TimeoutId requestTimeout(final long delay, final TimeUnit unit, @Nullable final Object data) {
        return requestTimeout(delay, unit, null, data);
    }
963027
public static void waitUntilNoActivityUpTo(Jenkins jenkins, int timeout) throws Exception {
        long startTime = System.currentTimeMillis();
        int streak = 0;

        while (true) {
            Thread.sleep(10);
            if (isSomethingHappening(jenkins)) {
                streak = 0;
            } else {
                streak++;
            }

            if (streak > 5) {  // the system is quiet for a while
                return;
            }

            if (System.currentTimeMillis() - startTime > timeout) {
                List<Queue.Executable> building = new ArrayList<Queue.Executable>();
                for (Computer c : jenkins.getComputers()) {
                    for (Executor e : c.getExecutors()) {
                        if (e.isBusy())
                            building.add(e.getCurrentExecutable());
                    }
                    for (Executor e : c.getOneOffExecutors()) {
                        if (e.isBusy())
                            building.add(e.getCurrentExecutable());
                    }
                }
                dumpThreads();
                throw new AssertionError(String.format("Jenkins is still doing something after %dms: queue=%s building=%s",
                        timeout, Arrays.asList(jenkins.getQueue().getItems()), building));
            }
        }
    }
1188862
public static TimeoutException newTimeoutException(long timeout, TimeUnit unit, java.util.concurrent.TimeoutException cause) {
        return new TimeoutException(timeout, unit, cause);
    }
403817
public AsyncHttpClientBuilder setTimeout(int timeout) {
        requestConfigBuilder.setConnectTimeout(timeout);
        requestConfigBuilder.setSocketTimeout(timeout);
        requestConfigBuilder.setConnectionRequestTimeout(timeout);
        return this;
    }
399862
protected final void sendObjectToSocket(Object objectToSend, WriteCallback cb) {
        Session sess = this.getSession();
        if (sess != null) {
            String json;
            try {
                json = this.mapper.writeValueAsString(objectToSend);
            } catch (JsonProcessingException e) {
                throw new RuntimeException("Failed to serialize object", e);
            }
            sess.getRemote().sendString(json, cb);
        }
    }