/*
Set the Guaranteed Delivery Remote Browse Sequence Number in the message.

Javadoc description supplied by JsMessage interface.
439079
public final void setGuaranteedRemoteBrowseSequenceNumber(long value) {
        if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
            SibTr.entry(this, tc, "setGuaranteedRemoteBrowseSequenceNumber", Long.valueOf(value));
        getHdr2().setLongField(JsHdr2Access.GUARANTEEDREMOTEBROWSE_SET_SEQNUM, value);
        if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
            SibTr.exit(this, tc, "setGuaranteedRemoteBrowseSequenceNumber");
    }
782162
public void setMaxSequenceNumber(int maxSequenceNumber) throws Exception {
        if (this.isStarted)
            throw new Exception("MaxSequenceNumber parameter can be updated only when M3UA stack is NOT running");

        if (maxSequenceNumber < 1) {
            maxSequenceNumber = 1;
        } else if (maxSequenceNumber > MAX_SEQUENCE_NUMBER) {
            maxSequenceNumber = MAX_SEQUENCE_NUMBER;
        }
        this.maxSequenceNumber = maxSequenceNumber;
    }
423541
@Nonnull
  public final HttpClientFactory setRetryMode (@Nonnull final ERetryMode eRetryMode)
  {
    ValueEnforcer.notNull (eRetryMode, "RetryMode");
    m_eRetryMode = eRetryMode;
    return this;
  }
1363471
@Override
    public void uncheckedSetDeliveryDelay(long value) {
        if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
            SibTr.entry(this, tc, "uncheckedSetDeliveryDelay", Long.valueOf(value));
        getHdr2().setLongField(JsHdr2Access.DELIVERYDELAY_DATA, value);
        if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
            SibTr.exit(this, tc, "uncheckedSetDeliveryDelay");

    }
1078908
private void validateDeliveryMode(int deliveryMode) throws JMSException {
        switch (deliveryMode) {
            case DeliveryMode.NON_PERSISTENT:
            case DeliveryMode.PERSISTENT:
                // OK - no problems.
                break;
            default:
                throw (JMSException) JmsErrorUtils.newThrowable(
                                                                JMSException.class,
                                                                "INVALID_VALUE_CWSIA0068",
                                                                new Object[] { "JMSDeliveryMode", "" + deliveryMode },
                                                                tc
                                );
        }
    }
998673
public void setRemotePath(String pRemotePath) {
        if (StringUtil.isEmpty(pRemotePath)) {
            pRemotePath = "";
        }
        else if (pRemotePath.charAt(0) != '/') {
            pRemotePath = "/" + pRemotePath;
        }

        remotePath = pRemotePath;
    }
1270772
public void setRequestNumber(int requestNumber) {
        if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
            SibTr.entry(this, tc, "setRequestNumber", requestNumber);
        this.requestNumber = requestNumber;
        if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
            SibTr.exit(this, tc, "setRequestNumber");
    }
20817
public final void setGuaranteedRemoteGetValueTick(long value) {
        if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
            SibTr.entry(this, tc, "setGuaranteedRemoteGetValueTick", Long.valueOf(value));
        getHdr2().setLongField(JsHdr2Access.GUARANTEEDREMOTEGET_SET_VALUETICK, value);
        if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
            SibTr.exit(this, tc, "setGuaranteedRemoteGetValueTick");
    }
121467
@Override
	public Long nextValue(NextValueRequest request) {
		String sequenceName = sequenceName( request.getKey() );
		// This method return 2 statements: the first one to acquire a lock and the second one to update the sequence node
		RemoteStatements remoteStatements = updateNextValueQuery( request );

		Number nextValue = nextValue( remoteStatements );

		// sequence nodes are expected to have been created up-front
		if ( request.getKey().getMetadata().getType() == IdSourceType.SEQUENCE ) {
			if ( nextValue == null ) {
				throw logger.sequenceNotFound( sequenceName );
			}
		}
		// The only way I found to make it work in a multi-threaded environment is to first increment the value and then read it.
		// Our API allows for an initial value and to make sure that I'm actually reading the correct one,
		// the first time I need to decrement the value I obtain from the db.
		return nextValue.longValue() - request.getIncrement();
	}
976423
public void setRemoteQueue(InvocationRequestQueue remoteQueue) {
        this.remoteQueue = remoteQueue;
        InvocationRequest deferredRequest = helpRequest;
        sendRequest(loadRequest, false);
        sendRequest(deferredRequest, false);
    }
59367
def set_query_sequence(self,seq):
    
    self._options = self._options.replace(query_sequence = seq)
1371677
protected void remoteInit() throws JMSException
    {
        QueueBrowserGetEnumerationQuery query = new QueueBrowserGetEnumerationQuery();
        query.setSessionId(session.getId());
        query.setBrowserId(browser.getId());
        QueueBrowserGetEnumerationResponse response = (QueueBrowserGetEnumerationResponse)transportEndpoint.blockingRequest(query);
        this.id = response.getEnumId();
        log.debug("Remote queue browser enumeration ID is "+id);
    }
410120
public void setRemoteSeparator(final String value) {
    if (value != null && value.length() != 1) {
      throw new BuildException("remote separator must be a single character");
    }
    this.remoteSeparator = value.charAt(0);
  }
882618
@Override
    public void deliverExpressMessage(MessageItem msgItem,
                                      ExpressTargetStream expressTargetStream)

                    throws SIIncorrectCallException, SIResourceException
    {
        if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
            SibTr.entry(tc, "deliverExpressMessage", new Object[] { msgItem });

        //Create transaction
        LocalTransaction siTran = _txManager.createLocalTransaction(false);

        try
        {
            long endTick = msgItem.getMessage().getGuaranteedValueValueTick();

            JsDestinationAddress routingDestinationAddr =
                            msgItem.getMessage().getRoutingDestination();
            if (routingDestinationAddr != null)
            {
                DestinationHandler routingDestination = null;
                try
                {
                    routingDestination =
                                    _destinationManager.getDestination(routingDestinationAddr, false, true);

                    if (_isLink)
                    {
                        LinkHandler link = (LinkHandler) _destination;

                        // If this is coming in off a link then use the link's configuration
                        // to determine if any local message points should be preferred
                        msgItem.setPreferLocal(link.preferLocalTargetQueuePoint());

                        String linkInboundUserid = ((LinkHandler) _destination).getInboundUserid();
                        if (linkInboundUserid != null)
                        {
                            if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled())
                                SibTr.debug(tc, "Set link inbound userid: " + linkInboundUserid + ", into message");
                            // Call SIB.security (ultimately) to set inbounduserid into msg
                            _messageProcessor.getAccessChecker().setSecurityIDInMessage(
                                                                                        linkInboundUserid,
                                                                                        msgItem.getMessage());
                        }
                    }
                    // If it's come from another ME in the bus then they're sending it
                    // to this message point because they want to so we prefer the local one.
                    // This allows the mesasge to be re-routed if absolutely necessary.
                    else
                        msgItem.setPreferLocal(true);

                    // Call the handler to deal with the message - passing null as the producer
                    // session id.
                    ProducerInputHandler inputHandler =
                                    (ProducerInputHandler) routingDestination.getInputHandler();

                    inputHandler.handleMessage(msgItem,
                                               siTran,
                                               _messageProcessor.getMessagingEngineUuid());

                } catch (SIException e)
                {
                    // No FFDC code needed

                    if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled())
                    {
                        SibTr.exception(tc, e);
                        SibTr.debug(tc, "Discarding the express message as it could not be from the targetStreamManager");
                    }
                }
            }
            else
            {
                ConsumerDispatcher consumerDispatcher;

                consumerDispatcher = (ConsumerDispatcher) _destination.getLocalPtoPConsumerManager();
                consumerDispatcher.put(msgItem, siTran, null, false);
            }

            // Update the completedPrefix on the stream
            // This will put all ticks before this point into Completed state
            expressTargetStream.setCompletedPrefix(endTick);

            siTran.commit();
        } catch (SIIncorrectCallException e)
        {
            // No FFDC code needed
            handleRollback(siTran);

            if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
                SibTr.exit(tc, "deliverExpressMessage", e);

            throw e;
        } catch (SIResourceException e)
        {
            // No FFDC code needed
            handleRollback(siTran);

            if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
                SibTr.exit(tc, "deliverExpressMessage", e);

            throw e;
        } catch (RuntimeException e)
        {
            // FFDC
            FFDCFilter.processException(
                                        e,
                                        "com.ibm.ws.sib.processor.impl.PtoPInputHandler.deliverExpressMessage",
                                        "1:2840:1.323",
                                        this);

            handleRollback(siTran);

            if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
            {
                SibTr.exception(tc, e);
                SibTr.exit(tc, "deliverExpressMessage", e);
            }

            throw e;
        }

        if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
            SibTr.exit(tc, "deliverExpressMessage");
    }
730094
protected void remoteInit() throws JMSException
    {
        CreateBrowserQuery query = new CreateBrowserQuery();
        query.setBrowserId(id);
        query.setSessionId(session.getId());
        query.setQueue(queue);
        query.setMessageSelector(messageSelector);
        transportEndpoint.blockingRequest(query);
    }
179515
@Override
    public void deliver(VoltMessage message)
    {
        if (message instanceof Iv2RepairLogResponseMessage) {
            Iv2RepairLogResponseMessage response = (Iv2RepairLogResponseMessage)message;
            if (response.getRequestId() != m_requestId) {
                if (repairLogger.isTraceEnabled()) {
                    repairLogger.trace(m_whoami + "rejecting stale repair response."
                            + " Current request id is: " + m_requestId
                            + " Received response for request id: " + response.getRequestId());
                }
                return;
            }

            // Step 1: if the msg has a known (not MAX VALUE) handle, update m_maxSeen.
            if (response.getTxnId() != Long.MAX_VALUE) {
                m_maxSeenTxnId = Math.max(m_maxSeenTxnId, response.getTxnId());
            }

            // Step 2: track hashinator versions

            if (response.hasHashinatorConfig()) {
                Pair<Long,byte[]> proposed = response.getHashinatorVersionedConfig();
                if (proposed.getFirst() > m_newestHashinatorConfig.getFirst()) {
                    m_newestHashinatorConfig = proposed;
                }
            }

            // Step 3: offer to the union
            addToRepairLog(response);
            if (repairLogger.isDebugEnabled()) {
                repairLogger.debug(m_whoami + " collected from " + CoreUtils.hsIdToString(response.m_sourceHSId) +
                        ", message: " + response.getPayload());
            }

            // Step 4: update the corresponding replica repair struct.
            ReplicaRepairStruct rrs = m_replicaRepairStructs.get(response.m_sourceHSId);
            if (rrs.m_expectedResponses < 0) {
                if (repairLogger.isDebugEnabled()) {
                    repairLogger.debug(m_whoami + "collecting " + response.getOfTotal()
                    + " repair log entries from "
                    + CoreUtils.hsIdToString(response.m_sourceHSId));
                }
            }

            if (rrs.update(response)) {
                if (repairLogger.isDebugEnabled()) {
                    repairLogger.debug(m_whoami + "collected " + rrs.m_receivedResponses
                            + " responses for " + rrs.m_expectedResponses
                            + " repair log entries from " + CoreUtils.hsIdToString(response.m_sourceHSId));
                }

                if (areRepairLogsComplete()) {

                    TheHashinator.updateHashinator(ElasticHashinator.class,
                            m_newestHashinatorConfig.getFirst(), m_newestHashinatorConfig.getSecond(), true);

                    //no real transaction repair when triggered with MigratePartitionLeader. Theoretically it should not be here.
                    //MigratePartitionLeader should not trigger MP promotion.
                    if (m_isMigratePartitionLeader) {
                        m_promotionResult.set(new RepairResult(m_maxSeenTxnId));
                    } else {
                        repairSurvivors();
                    }
                }
            }
        }
    }
849152
protected RemoteStatements updateNextValueQuery(NextValueRequest request) {
		return request.getKey().getMetadata().getType() == IdSourceType.TABLE
				? getTableQuery( request )
				: getSequenceIncrementQuery( request );
	}