
com.aliyun.openservices.ots.internal.OTSExecutionContext Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of ots-public Show documentation
Show all versions of ots-public Show documentation
Aliyun Open Services SDK for Java Copyright (C) Alibaba Cloud Computing All rights reserved. 版权所有 (C)阿里云计算有限公司 http://www.aliyun.com
package com.aliyun.openservices.ots.internal;
import com.aliyun.openservices.ots.model.OTSBasicFuture;
import org.apache.http.concurrent.FutureCallback;
import java.util.concurrent.ScheduledExecutorService;
public class OTSExecutionContext {
private Req request;
private OTSBasicFuture future;
private OTSTraceLogger traceLogger;
private FutureCallback asyncClientCallback;
private OTSRetryStrategy retryStrategy;
private ScheduledExecutorService retryExecutor;
private OTSCallable callable;
protected int retries = 0;
public OTSExecutionContext(Req request, OTSBasicFuture future, OTSTraceLogger traceLogger,
OTSRetryStrategy retryStrategy, ScheduledExecutorService retryExecutor) {
this.request = request;
this.future = future;
this.traceLogger = traceLogger;
this.retryStrategy = retryStrategy;
this.retryExecutor = retryExecutor;
}
/**
* asyncClientCallback的创建依赖OTSExecutionContext对象,所以这里要单独set, 且应在setRetryHandler之后。
*/
public void setAsyncClientCallback(FutureCallback futureCallback) {
this.asyncClientCallback = futureCallback;
}
public void setCallable(OTSCallable callable) {
this.callable = callable;
}
public OTSCallable getCallable() {
return this.callable;
}
public void retry(Exception ex) {
retries++;
}
public void setRequest(Req request) {
this.request = request;
}
public Req getRequest() {
return this.request;
}
public OTSBasicFuture getFuture() {
return this.future;
}
public OTSTraceLogger getTraceLogger() {
return this.traceLogger;
}
public FutureCallback getAsyncClientCallback() {
return asyncClientCallback;
}
public OTSRetryStrategy getRetryStrategy() {
return retryStrategy;
}
public ScheduledExecutorService getRetryExecutor() {
return retryExecutor;
}
public int getRetries() {
return retries;
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy