All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.sun.xml.ws.rx.rm.runtime.ApplicationMessageBase Maven / Gradle / Ivy

There is a newer version: 4.0.4
Show newest version
/*
 * Copyright (c) 1997, 2018 Oracle and/or its affiliates. All rights reserved.
 *
 * This program and the accompanying materials are made available under the
 * terms of the Eclipse Distribution License v. 1.0, which is available at
 * http://www.eclipse.org/org/documents/edl-v10.php.
 *
 * SPDX-License-Identifier: BSD-3-Clause
 */

package com.sun.xml.ws.rx.rm.runtime;

import com.sun.istack.NotNull;
import com.sun.xml.ws.rx.RxException;
import com.sun.xml.ws.rx.message.RxMessageBase;
import com.sun.xml.ws.rx.rm.protocol.AcknowledgementData;
import java.util.concurrent.atomic.AtomicInteger;

/**
 *
 * @author Marek Potociar 
 */
public abstract class ApplicationMessageBase extends RxMessageBase implements ApplicationMessage {
    
    private String sequenceId;
    private long messageNumber;
    private AcknowledgementData acknowledgementData;
    private final AtomicInteger resendCount;

    protected ApplicationMessageBase(@NotNull String correlationId) {
        this(1, correlationId, null, 0L, null);
    }

    protected ApplicationMessageBase(@NotNull String correlationId, String sequenceId, long messageNumber, AcknowledgementData acknowledgementData) {
        this(1, correlationId, sequenceId, messageNumber, acknowledgementData);
    }

    protected ApplicationMessageBase(int initialResendCounterValue, @NotNull String correlationId, String sequenceId, long messageNumber, AcknowledgementData acknowledgementData) {
        super(correlationId);

        this.resendCount = new AtomicInteger(initialResendCounterValue);

        this.sequenceId = sequenceId;
        this.messageNumber = messageNumber;
        this.acknowledgementData = acknowledgementData;
    }

    public AcknowledgementData getAcknowledgementData() {
        return acknowledgementData;
    }

    public long getMessageNumber() {
        return messageNumber;
    }

    public String getSequenceId() {
        return sequenceId;
    }

    public void setAcknowledgementData(AcknowledgementData data) {
        this.acknowledgementData = data;
    }

    public void setSequenceData(String sequenceId, long messageNumber) {
        assert sequenceId != null;
        this.sequenceId = sequenceId;
        this.messageNumber = messageNumber;
    }

    public int getNextResendCount() {
        return resendCount.getAndIncrement();
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy