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

com.microsoft.azure.servicebus.amqp.RequestResponseCloser Maven / Gradle / Ivy

There is a newer version: 3.3.0
Show newest version
package com.microsoft.azure.servicebus.amqp;

import com.microsoft.azure.servicebus.FaultTolerantObject;

public class RequestResponseCloser implements IOperation {
	private FaultTolerantObject innerChannel = null;
	
	public RequestResponseCloser() {
	}

	// innerChannel is not available when this object is constructed, have to set later
	public void setInnerChannel(final FaultTolerantObject innerChannel)	{
		this.innerChannel = innerChannel;
	}
	
    @Override
    public void run(IOperationResult closeOperationCallback) {
        final RequestResponseChannel channelToBeClosed = this.innerChannel.unsafeGetIfOpened();
        if (channelToBeClosed == null) {
            closeOperationCallback.onComplete(null);
        }
        else {
            channelToBeClosed.close(new IOperationResult() {
                @Override
                public void onComplete(Void result) {
                    closeOperationCallback.onComplete(result);
                }

                @Override
                public void onError(Exception error) {
                    closeOperationCallback.onError(error);
                }
            });
        }
    }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy