本文整理汇总了Java中org.apache.http.conn.ConnectionReleaseTrigger类的典型用法代码示例。如果您正苦于以下问题:Java ConnectionReleaseTrigger类的具体用法?Java ConnectionReleaseTrigger怎么用?Java ConnectionReleaseTrigger使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
ConnectionReleaseTrigger类属于org.apache.http.conn包,在下文中一共展示了ConnectionReleaseTrigger类的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: setReleaseTrigger
import org.apache.http.conn.ConnectionReleaseTrigger; //导入依赖的package包/类
@Override
@Deprecated
public void setReleaseTrigger(final ConnectionReleaseTrigger releaseTrigger) {
setCancellable(new Cancellable() {
@Override
public boolean cancel() {
try {
releaseTrigger.abortConnection();
return true;
} catch (final IOException ex) {
return false;
}
}
});
}
示例2: setReleaseTrigger
import org.apache.http.conn.ConnectionReleaseTrigger; //导入依赖的package包/类
public void setReleaseTrigger(final ConnectionReleaseTrigger releaseTrigger)
throws IOException {
if (this.aborted) {
throw new IOException("Request already aborted");
}
this.abortLock.lock();
try {
this.releaseTrigger = releaseTrigger;
} finally {
this.abortLock.unlock();
}
}
示例3: setReleaseTrigger
import org.apache.http.conn.ConnectionReleaseTrigger; //导入依赖的package包/类
@Deprecated
public void setReleaseTrigger(final ConnectionReleaseTrigger releaseTrigger) {
setCancellable(new Cancellable() {
public boolean cancel() {
try {
releaseTrigger.abortConnection();
return true;
} catch (final IOException ex) {
return false;
}
}
});
}
示例4: a
import org.apache.http.conn.ConnectionReleaseTrigger; //导入依赖的package包/类
public static void a(InputStream paramInputStream)
{
if ((paramInputStream instanceof ConnectionReleaseTrigger)) {}
try
{
((ConnectionReleaseTrigger)paramInputStream).abortConnection();
return;
}
catch (Throwable localThrowable) {}
}
示例5: getBody
import org.apache.http.conn.ConnectionReleaseTrigger; //导入依赖的package包/类
@Override
public InputStream getBody() throws IOException {
final InputStream body = response.getBody();
return new FilterInputStream(body) {
@Override
public void close() throws IOException {
if (body instanceof ConnectionReleaseTrigger) {
// effectively releasing the connection back to the pool in order to prevent starvation
ConnectionReleaseTrigger.class.cast(body).abortConnection();
}
super.close();
}
};
}
示例6: setReleaseTrigger
import org.apache.http.conn.ConnectionReleaseTrigger; //导入依赖的package包/类
public void setReleaseTrigger(final ConnectionReleaseTrigger releaseTrigger)
throws IOException {
this.abortLock.lock();
try {
if (this.aborted) {
throw new IOException("Request already aborted");
}
this.connRequest = null;
this.releaseTrigger = releaseTrigger;
} finally {
this.abortLock.unlock();
}
}
示例7: abort
import org.apache.http.conn.ConnectionReleaseTrigger; //导入依赖的package包/类
public void abort() {
ClientConnectionRequest localRequest;
ConnectionReleaseTrigger localTrigger;
this.abortLock.lock();
try {
if (this.aborted) {
return;
}
this.aborted = true;
localRequest = connRequest;
localTrigger = releaseTrigger;
} finally {
this.abortLock.unlock();
}
// Trigger the callbacks outside of the lock, to prevent
// deadlocks in the scenario where the callbacks have
// their own locks that may be used while calling
// setReleaseTrigger or setConnectionRequest.
if (localRequest != null) {
localRequest.abortRequest();
}
if (localTrigger != null) {
try {
localTrigger.abortConnection();
} catch (IOException ex) {
// ignore
}
}
}
示例8: setReleaseTrigger
import org.apache.http.conn.ConnectionReleaseTrigger; //导入依赖的package包/类
/**
* Sets the {@link ConnectionReleaseTrigger} callback that can
* be used to abort an active connection.
* Typically, this will be the {@link ManagedClientConnection} itself.
* If the request is already aborted, throws an {@link IOException}.
*/
void setReleaseTrigger(ConnectionReleaseTrigger releaseTrigger) throws IOException;
示例9: setReleaseTrigger
import org.apache.http.conn.ConnectionReleaseTrigger; //导入依赖的package包/类
/**
* Sets the {@link ConnectionReleaseTrigger} callback that can
* be used to abort an active connection.
* Typically, this will be the
* {@link org.apache.http.conn.ManagedClientConnection} itself.
* If the request is already aborted, throws an {@link IOException}.
*/
void setReleaseTrigger(ConnectionReleaseTrigger releaseTrigger) throws IOException;