本文整理汇总了Java中com.amazonaws.AbortedException类的典型用法代码示例。如果您正苦于以下问题:Java AbortedException类的具体用法?Java AbortedException怎么用?Java AbortedException使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
AbortedException类属于com.amazonaws包,在下文中一共展示了AbortedException类的14个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。
示例1: handleInterruptedException
import com.amazonaws.AbortedException; //导入依赖的package包/类
/**
* Determine if an interrupted exception is caused by the client execution timer
* interrupting the current thread or some other task interrupting the thread for another
* purpose.
*
* @return {@link ClientExecutionTimeoutException} if the {@link InterruptedException} was
* caused by the {@link ClientExecutionTimer}. Otherwise re-interrupts the current thread
* and returns a {@link SdkClientException} wrapping an {@link InterruptedException}
*/
private RuntimeException handleInterruptedException(InterruptedException e) {
if (e instanceof SdkInterruptedException) {
if (((SdkInterruptedException) e).getResponse() != null) {
((SdkInterruptedException) e).getResponse().getHttpResponse().getHttpRequest().abort();
}
}
if (executionContext.getClientExecutionTrackerTask().hasTimeoutExpired()) {
// Clear the interrupt status
Thread.interrupted();
return new ClientExecutionTimeoutException();
} else {
Thread.currentThread().interrupt();
return new AbortedException(e);
}
}
开发者ID:IBM,项目名称:ibm-cos-sdk-java,代码行数:25,代码来源:AmazonHttpClient.java
示例2: clientExecutionTimeoutEnabled_aborted_exception_occurs_timeout_not_expired
import com.amazonaws.AbortedException; //导入依赖的package包/类
@Test(expected = AbortedException.class)
public void
clientExecutionTimeoutEnabled_aborted_exception_occurs_timeout_not_expired()
throws Exception {
ClientConfiguration config = new ClientConfiguration()
.withClientExecutionTimeout(CLIENT_EXECUTION_TIMEOUT)
.withMaxErrorRetry(0);
ConnectionManagerAwareHttpClient rawHttpClient =
createRawHttpClientSpy(config);
doThrow(new AbortedException()).when(rawHttpClient).execute(any
(HttpRequestBase.class), any(HttpContext.class));
httpClient = new AmazonHttpClient(config, rawHttpClient, null);
execute(httpClient, createMockGetRequest());
}
开发者ID:IBM,项目名称:ibm-cos-sdk-java,代码行数:18,代码来源:AbortedExceptionClientExecutionTimerIntegrationTest.java
示例3: run
import com.amazonaws.AbortedException; //导入依赖的package包/类
@Override public void run() {
while(!closed.get()) {
try {
process(client.receiveMessage(request).getMessages());
status.lazySet(CheckResult.OK);
failureBackoff = DEFAULT_BACKOFF;
} catch (AbortedException ae) {
status.lazySet(CheckResult.failed(ae));
} catch (Exception e) {
logger.log(Level.WARNING, "sqs receive failed", e);
status.lazySet(CheckResult.failed(e));
// backoff on failures to avoid pinging SQS in a tight loop if there are failures.
try {
Thread.sleep(failureBackoff);
} catch (InterruptedException ie) {}
finally {
failureBackoff = Math.max (failureBackoff * 2, MAX_BACKOFF);
}
}
}
}
开发者ID:openzipkin,项目名称:zipkin-aws,代码行数:23,代码来源:SQSSpanProcessor.java
示例4: closeStream
import com.amazonaws.AbortedException; //导入依赖的package包/类
private void closeStream()
{
if (in != null) {
try {
if (in instanceof S3ObjectInputStream) {
((S3ObjectInputStream) in).abort();
}
else {
in.close();
}
}
catch (IOException | AbortedException ignored) {
// thrown if the current thread is in the interrupted state
}
in = null;
STATS.connectionReleased();
}
}
开发者ID:y-lan,项目名称:presto,代码行数:19,代码来源:PrestoS3FileSystem.java
示例5: execute
import com.amazonaws.AbortedException; //导入依赖的package包/类
/**
* Executes the request and returns the result.
*/
private Response<Output> execute() {
if (executionContext == null) {
throw new SdkClientException(
"Internal SDK Error: No execution context parameter specified.");
}
try {
return executeWithTimer();
} catch (InterruptedException ie) {
throw handleInterruptedException(ie);
} catch (AbortedException ae) {
throw handleAbortedException(ae);
}
}
开发者ID:IBM,项目名称:ibm-cos-sdk-java,代码行数:17,代码来源:AmazonHttpClient.java
示例6: abortIfNeeded
import com.amazonaws.AbortedException; //导入依赖的package包/类
/**
* Aborts with subclass specific abortion logic executed if needed.
* Note the interrupted status of the thread is cleared by this method.
* @throws AbortedException if found necessary.
*/
protected final void abortIfNeeded() {
if (shouldAbort()) {
abort(); // execute subclass specific abortion logic
throw new AbortedException();
}
}
开发者ID:IBM,项目名称:ibm-cos-sdk-java,代码行数:12,代码来源:SdkFilterInputStream.java
示例7: abortIfNeeded
import com.amazonaws.AbortedException; //导入依赖的package包/类
/**
* Aborts with subclass specific abortion logic executed if needed.
* Note the interrupted status of the thread is cleared by this method.
* @throws AbortedException if found necessary.
*/
protected final void abortIfNeeded() {
if (shouldAbort()) {
try {
abort(); // execute subclass specific abortion logic
} catch (IOException e) {
LogFactory.getLog(getClass()).debug("FYI", e);
}
throw new AbortedException();
}
}
开发者ID:IBM,项目名称:ibm-cos-sdk-java,代码行数:16,代码来源:SdkInputStream.java
示例8: blockIfNecessary
import com.amazonaws.AbortedException; //导入依赖的package包/类
/**
* Blocks the running thread if running out of disk space.
*
* @throws AbortedException
* if the running thread is interrupted while acquiring a
* semaphore
*/
private void blockIfNecessary() {
if (diskPermits == null || diskLimit == Long.MAX_VALUE)
return;
try {
diskPermits.acquire();
} catch (InterruptedException e) {
// don't want to re-interrupt so it won't cause SDK stream to be
// closed in case the thread is reused for a different request
throw new AbortedException(e);
}
}
开发者ID:IBM,项目名称:ibm-cos-sdk-java,代码行数:19,代码来源:MultiFileOutputStream.java
示例9: whenShortTimeoutSet_timesOut
import com.amazonaws.AbortedException; //导入依赖的package包/类
@Test
public void whenShortTimeoutSet_timesOut() throws Exception {
// By setting a timeout of 1ms, it's not physically possible to complete both the us-west-2 and eu-central-1
// requests due to speed of light limits.
KmsMasterKeyProvider mkp = KmsMasterKeyProvider.builder()
.withClientBuilder(
AWSKMSClientBuilder.standard()
.withClientConfiguration(
new ClientConfiguration()
.withRequestTimeout(1)
)
)
.withKeysForEncryption(Arrays.asList(KMSTestFixtures.TEST_KEY_IDS))
.build();
try {
new AwsCrypto().encryptData(mkp, new byte[1]);
fail("Expected exception");
} catch (Exception e) {
if (e instanceof AbortedException) {
// ok - one manifestation of a timeout
} else if (e.getCause() instanceof HttpRequestTimeoutException) {
// ok - another kind of timeout
} else {
throw e;
}
}
}
开发者ID:awslabs,项目名称:aws-encryption-sdk-java,代码行数:29,代码来源:KMSProviderBuilderIntegrationTests.java
示例10: putItems
import com.amazonaws.AbortedException; //导入依赖的package包/类
@Override
public void putItems(T... items) {
if ( null == items || 0 == items.length ) return;
for ( int chunk=0; chunk < items.length; chunk += DDB_MAX_BATCH_WRITE_ITEM ) {
TableWriteItems request = new TableWriteItems(_tableName);
int max = Math.min(items.length-chunk, DDB_MAX_BATCH_WRITE_ITEM);
for ( int idx=0; idx < max; idx++ ) {
request.addItemToPut(_encryption.encrypt(toItem(items[chunk+idx])));
}
BatchWriteItemOutcome response = maybeBackoff(false, () ->
_dynamodb.batchWriteItem(request));
while ( true ) {
if ( null == response.getUnprocessedItems() ) break;
List<WriteRequest> unprocessed = response.getUnprocessedItems().get(_tableName);
if ( null == unprocessed || unprocessed.size() == 0 ) {
resetPTE(null);
break;
}
if(LOG.isDebugEnabled())
LOG.debug("putItems() unprocessed: "+unprocessed.size());
gotPTE(false);
try {
Thread.sleep(backoffSleep(false));
} catch ( InterruptedException ex ) {
Thread.currentThread().interrupt();
throw new AbortedException(ex);
}
Map<String,List<WriteRequest>> unproc = response.getUnprocessedItems();
response = maybeBackoff(false, () ->
_dynamodb.batchWriteItemUnprocessed(unproc));
}
}
}
开发者ID:Distelli,项目名称:java-persistence,代码行数:34,代码来源:DdbIndex.java
示例11: deleteItems
import com.amazonaws.AbortedException; //导入依赖的package包/类
@Override
public void deleteItems(IndexKey... keys) {
if ( null == keys || 0 == keys.length ) return;
for ( int chunk=0; chunk < keys.length; chunk += DDB_MAX_BATCH_WRITE_ITEM ) {
TableWriteItems request = new TableWriteItems(_tableName);
int max = Math.min(keys.length-chunk, DDB_MAX_BATCH_WRITE_ITEM);
for ( int idx=0; idx < max; idx++ ) {
IndexKey key = keys[chunk+idx];
if ( null == key ) continue;
request.addPrimaryKeyToDelete(toPrimaryKey(key));
}
BatchWriteItemOutcome response = maybeBackoff(false, () ->
_dynamodb.batchWriteItem(request));
while ( true ) {
if ( null == response.getUnprocessedItems() ) break;
List<WriteRequest> unprocessed = response.getUnprocessedItems().get(_tableName);
if ( null == unprocessed || unprocessed.size() == 0 ) {
resetPTE(null);
break;
}
if(LOG.isDebugEnabled())
LOG.debug("deleteItems() unprocessed: "+unprocessed.size());
gotPTE(false);
try {
Thread.sleep(backoffSleep(false));
} catch ( InterruptedException ex ) {
Thread.currentThread().interrupt();
throw new AbortedException(ex);
}
Map<String,List<WriteRequest>> unproc = response.getUnprocessedItems();
response = maybeBackoff(false, () ->
_dynamodb.batchWriteItemUnprocessed(unproc));
}
}
}
开发者ID:Distelli,项目名称:java-persistence,代码行数:36,代码来源:DdbIndex.java
示例12: newReadError
import com.amazonaws.AbortedException; //导入依赖的package包/类
public void newReadError(Exception e)
{
if (e instanceof SocketException) {
socketExceptions.update(1);
}
else if (e instanceof SocketTimeoutException) {
socketTimeoutExceptions.update(1);
}
else if (e instanceof AbortedException) {
awsAbortedExceptions.update(1);
}
else {
otherReadErrors.update(1);
}
}
开发者ID:y-lan,项目名称:presto,代码行数:16,代码来源:PrestoS3FileSystemStats.java
示例13: deleteMessageFromQueue
import com.amazonaws.AbortedException; //导入依赖的package包/类
private void deleteMessageFromQueue(String messageReceiptHandle, String messageQueueUrl) throws MessagingException {
try {
amazonSQS.deleteMessage(new DeleteMessageRequest(messageQueueUrl, messageReceiptHandle));
} catch (AbortedException e) {
LOG.info("Client abort delete message.");
} catch (AmazonClientException ase) {
throw new MessagingException("Failed to delete message with receipt handle " + messageReceiptHandle + " from queue " + messageQueueUrl, ase);
}
}
开发者ID:iZettle,项目名称:izettle-toolbox,代码行数:10,代码来源:QueueProcessor.java
示例14: handleAbortedException
import com.amazonaws.AbortedException; //导入依赖的package包/类
/**
* Determine if an aborted exception is caused by the client execution timer interrupting
* the current thread. If so throws {@link ClientExecutionTimeoutException} else throws the
* original {@link AbortedException}
*
* @param ae aborted exception that occurred
* @return {@link ClientExecutionTimeoutException} if the {@link AbortedException} was
* caused by the {@link ClientExecutionTimer}. Otherwise throws the original {@link
* AbortedException}
*/
private RuntimeException handleAbortedException(final AbortedException ae) {
if (executionContext.getClientExecutionTrackerTask().hasTimeoutExpired()) {
return new ClientExecutionTimeoutException();
} else {
return ae;
}
}
开发者ID:IBM,项目名称:ibm-cos-sdk-java,代码行数:18,代码来源:AmazonHttpClient.java
注:本文中的com.amazonaws.AbortedException类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论