idx
int64
0
41.2k
question
stringlengths
74
4.21k
target
stringlengths
5
888
30,600
public static S3Versions forKey ( AmazonS3 s3 , String bucketName , String key ) { S3Versions versions = new S3Versions ( s3 , bucketName ) ; versions . key = key ; return versions ; }
Constructs an iterable that covers the versions of a single Amazon S3 object .
30,601
public void setInputChannelLevels ( java . util . Collection < InputChannelLevel > inputChannelLevels ) { if ( inputChannelLevels == null ) { this . inputChannelLevels = null ; return ; } this . inputChannelLevels = new java . util . ArrayList < InputChannelLevel > ( inputChannelLevels ) ; }
Indices and gain values for each input channel that should be remixed into this output channel .
30,602
public Waiter < HeadBucketRequest > bucketNotExists ( ) { return new WaiterBuilder < HeadBucketRequest , HeadBucketResult > ( ) . withSdkFunction ( new HeadBucketFunction ( client ) ) . withAcceptors ( new HttpFailureStatusAcceptor < HeadBucketResult > ( 404 , WaiterState . SUCCESS ) ) . withDefaultPollingStrategy ( new PollingStrategy ( new MaxAttemptsRetryStrategy ( 20 ) , new FixedDelayStrategy ( 5 ) ) ) . withExecutorService ( executorService ) . build ( ) ; }
Builds a BucketNotExists waiter by using custom parameters waiterParameters and other parameters defined in the waiters specification and then polls until it determines whether the resource entered the desired state or not where polling criteria is bound by either default polling strategy or custom polling strategy .
30,603
public Waiter < HeadBucketRequest > bucketExists ( ) { return new WaiterBuilder < HeadBucketRequest , HeadBucketResult > ( ) . withSdkFunction ( new HeadBucketFunction ( client ) ) . withAcceptors ( new HttpSuccessStatusAcceptor < HeadBucketResult > ( WaiterState . SUCCESS ) , new HttpFailureStatusAcceptor < HeadBucketResult > ( 301 , WaiterState . SUCCESS ) , new HttpFailureStatusAcceptor < HeadBucketResult > ( 403 , WaiterState . SUCCESS ) , new HttpFailureStatusAcceptor < HeadBucketResult > ( 404 , WaiterState . RETRY ) ) . withDefaultPollingStrategy ( new PollingStrategy ( new MaxAttemptsRetryStrategy ( 20 ) , new FixedDelayStrategy ( 5 ) ) ) . withExecutorService ( executorService ) . build ( ) ; }
Builds a BucketExists waiter by using custom parameters waiterParameters and other parameters defined in the waiters specification and then polls until it determines whether the resource entered the desired state or not where polling criteria is bound by either default polling strategy or custom polling strategy .
30,604
public static byte [ ] convertToXmlByteArray ( List < PartETag > partETags ) { XmlWriter xml = new XmlWriter ( ) ; xml . start ( "CompleteMultipartUpload" ) ; if ( partETags != null ) { List < PartETag > sortedPartETags = new ArrayList < PartETag > ( partETags ) ; Collections . sort ( sortedPartETags , new Comparator < PartETag > ( ) { public int compare ( PartETag tag1 , PartETag tag2 ) { if ( tag1 . getPartNumber ( ) < tag2 . getPartNumber ( ) ) return - 1 ; if ( tag1 . getPartNumber ( ) > tag2 . getPartNumber ( ) ) return 1 ; return 0 ; } } ) ; for ( PartETag partEtag : sortedPartETags ) { xml . start ( "Part" ) ; xml . start ( "PartNumber" ) . value ( Integer . toString ( partEtag . getPartNumber ( ) ) ) . end ( ) ; xml . start ( "ETag" ) . value ( partEtag . getETag ( ) ) . end ( ) ; xml . end ( ) ; } } xml . end ( ) ; return xml . getBytes ( ) ; }
Converts the specified list of PartETags to an XML fragment that can be sent to the CompleteMultipartUpload operation of Amazon S3 .
30,605
public static byte [ ] convertToXmlByteArray ( SelectObjectContentRequest selectRequest ) { XmlWriter xml = new XmlWriter ( ) ; xml . start ( "SelectObjectContentRequest" ) ; addIfNotNull ( xml , "Expression" , selectRequest . getExpression ( ) ) ; addIfNotNull ( xml , "ExpressionType" , selectRequest . getExpressionType ( ) ) ; addRequestProgressIfNotNull ( xml , selectRequest . getRequestProgress ( ) ) ; addInputSerializationIfNotNull ( xml , selectRequest . getInputSerialization ( ) ) ; addOutputSerializationIfNotNull ( xml , selectRequest . getOutputSerialization ( ) ) ; xml . end ( ) ; return xml . getBytes ( ) ; }
Converts the SelectObjectContentRequest to an XML fragment that can be sent to the SelectObjectContent operation of Amazon S3 .
30,606
private void blockingRefresh ( ) { try { if ( blockingRefreshLock . tryLock ( BLOCKING_REFRESH_MAX_WAIT_IN_SECONDS , TimeUnit . SECONDS ) ) { try { if ( ! shouldDoBlockingRefresh ( ) ) { return ; } else { refreshValue ( ) ; return ; } } finally { blockingRefreshLock . unlock ( ) ; } } } catch ( InterruptedException ex ) { handleInterruptedException ( "Interrupted waiting to refresh the value." , ex ) ; } refreshValue ( ) ; }
Used when there is no valid value to return . Callers are blocked until a new value is created or an exception is thrown .
30,607
private void asyncRefresh ( ) { if ( asyncRefreshing . compareAndSet ( false , true ) ) { try { executor . submit ( new Runnable ( ) { public void run ( ) { try { refreshValue ( ) ; } finally { asyncRefreshing . set ( false ) ; } } } ) ; } catch ( RuntimeException ex ) { asyncRefreshing . set ( false ) ; throw ex ; } } }
Used to asynchronously refresh the value . Caller is never blocked .
30,608
private void refreshValue ( ) { try { refreshableValueHolder . compareAndSet ( refreshableValueHolder . get ( ) , refreshCallable . call ( ) ) ; } catch ( AmazonServiceException ase ) { throw ase ; } catch ( AmazonClientException ace ) { throw ace ; } catch ( Exception e ) { throw new AmazonClientException ( e ) ; } }
Invokes the callback to get a new value .
30,609
private void handleInterruptedException ( String message , InterruptedException cause ) { Thread . currentThread ( ) . interrupt ( ) ; throw new AbortedException ( message , cause ) ; }
If we are interrupted while waiting for a lock we just restore the interrupt status and throw an AmazonClientException back to the caller .
30,610
public void setAttributes ( java . util . Collection < String > attributes ) { if ( attributes == null ) { this . attributes = null ; return ; } this . attributes = new java . util . ArrayList < String > ( attributes ) ; }
The attributes for the application .
30,611
private AWSKMSClient newAWSKMSClient ( AWSCredentialsProvider credentialsProvider , ClientConfiguration clientConfig , CryptoConfiguration cryptoConfig , RequestMetricCollector requestMetricCollector ) { final AWSKMSClient kmsClient = new AWSKMSClient ( credentialsProvider , clientConfig , requestMetricCollector ) ; final Region kmsRegion = cryptoConfig . getAwsKmsRegion ( ) ; if ( kmsRegion != null ) kmsClient . setRegion ( kmsRegion ) ; return kmsClient ; }
Creates and returns a new instance of AWS KMS client in the case when an explicit AWS KMS client is not specified .
30,612
private < T extends Throwable > T onAbort ( UploadObjectObserver observer , T t ) { observer . onAbort ( ) ; return t ; }
Convenient method to notifies the observer to abort the multi - part upload and returns the original exception .
30,613
public void setRawResponseContent ( String rawResponseContent ) { this . rawResponse = rawResponseContent == null ? null : rawResponseContent . getBytes ( StringUtils . UTF8 ) ; }
Sets the raw response content .
30,614
static String getFieldNameByGetter ( Method getter , boolean forceCamelCase ) { String getterName = getter . getName ( ) ; String fieldNameWithUpperCamelCase = "" ; if ( getterName . startsWith ( "get" ) ) { fieldNameWithUpperCamelCase = getterName . substring ( "get" . length ( ) ) ; } else if ( getterName . startsWith ( "is" ) ) { fieldNameWithUpperCamelCase = getterName . substring ( "is" . length ( ) ) ; } if ( fieldNameWithUpperCamelCase . length ( ) == 0 ) { throw new DynamoDBMappingException ( "Getter must begin with 'get' or 'is', and the field name must contain at least one character." ) ; } if ( forceCamelCase ) { return StringUtils . lowerCase ( fieldNameWithUpperCamelCase . substring ( 0 , 1 ) ) + fieldNameWithUpperCamelCase . substring ( 1 ) ; } else { return fieldNameWithUpperCamelCase ; } }
Returns the field name that corresponds to the given getter method according to the Java naming convention .
30,615
static Field getClassFieldByName ( Class < ? > clazz , String fieldName ) { try { return clazz . getDeclaredField ( fieldName ) ; } catch ( SecurityException e ) { throw new DynamoDBMappingException ( "Denied access to the [" + fieldName + "] field in class [" + clazz + "]." , e ) ; } catch ( NoSuchFieldException e ) { return null ; } }
Returns the Field object for the specified field name declared in the specified class . Returns null if no such field can be found .
30,616
static < T extends Annotation > T getAnnotationFromGetterOrField ( Method getter , Class < T > annotationClass ) { T onGetter = getter . getAnnotation ( annotationClass ) ; if ( onGetter != null ) { return onGetter ; } String fieldName = getFieldNameByGetter ( getter , true ) ; Field field = getClassFieldByName ( getter . getDeclaringClass ( ) , fieldName ) ; T onField = null ; if ( field != null ) { onField = field . getAnnotation ( annotationClass ) ; } return onField ; }
This method searches for a specific type of annotation that is applied to either the specified getter method or its corresponding class field . Returns the annotation if it is found else null .
30,617
static < T extends Annotation > boolean getterOrFieldHasAnnotation ( Method getter , Class < T > annotationClass ) { return getAnnotationFromGetterOrField ( getter , annotationClass ) != null ; }
Returns true if an annotation for the specified type is found on the getter method or its corresponding class field .
30,618
public DeleteJobTemplateResult deleteJobTemplate ( DeleteJobTemplateRequest request ) { request = beforeClientExecution ( request ) ; return executeDeleteJobTemplate ( request ) ; }
Permanently delete a job template you have created .
30,619
public DeleteQueueResult deleteQueue ( DeleteQueueRequest request ) { request = beforeClientExecution ( request ) ; return executeDeleteQueue ( request ) ; }
Permanently delete a queue you have created .
30,620
public GetJobTemplateResult getJobTemplate ( GetJobTemplateRequest request ) { request = beforeClientExecution ( request ) ; return executeGetJobTemplate ( request ) ; }
Retrieve the JSON for a specific job template .
30,621
public GetPresetResult getPreset ( GetPresetRequest request ) { request = beforeClientExecution ( request ) ; return executeGetPreset ( request ) ; }
Retrieve the JSON for a specific preset .
30,622
public GetQueueResult getQueue ( GetQueueRequest request ) { request = beforeClientExecution ( request ) ; return executeGetQueue ( request ) ; }
Retrieve the JSON for a specific queue .
30,623
public ListJobTemplatesResult listJobTemplates ( ListJobTemplatesRequest request ) { request = beforeClientExecution ( request ) ; return executeListJobTemplates ( request ) ; }
Retrieve a JSON array of up to twenty of your job templates . This will return the templates themselves not just a list of them . To retrieve the next twenty templates use the nextToken string returned with the array
30,624
public ListQueuesResult listQueues ( ListQueuesRequest request ) { request = beforeClientExecution ( request ) ; return executeListQueues ( request ) ; }
Retrieve a JSON array of up to twenty of your queues . This will return the queues themselves not just a list of them . To retrieve the next twenty queues use the nextToken string returned with the array .
30,625
public UpdateJobTemplateResult updateJobTemplate ( UpdateJobTemplateRequest request ) { request = beforeClientExecution ( request ) ; return executeUpdateJobTemplate ( request ) ; }
Modify one of your existing job templates .
30,626
public UpdatePresetResult updatePreset ( UpdatePresetRequest request ) { request = beforeClientExecution ( request ) ; return executeUpdatePreset ( request ) ; }
Modify one of your existing presets .
30,627
public UpdateQueueResult updateQueue ( UpdateQueueRequest request ) { request = beforeClientExecution ( request ) ; return executeUpdateQueue ( request ) ; }
Modify one of your existing queues .
30,628
public static < K , V > ImmutableMapParameter < K , V > of ( K k0 , V v0 ) { Map < K , V > map = Collections . singletonMap ( k0 , v0 ) ; return new ImmutableMapParameter < K , V > ( map ) ; }
Returns an ImmutableMapParameter instance containing a single entry .
30,629
public static < K , V > ImmutableMapParameter < K , V > of ( K k0 , V v0 , K k1 , V v1 ) { Map < K , V > map = new HashMap < K , V > ( ) ; putAndWarnDuplicateKeys ( map , k0 , v0 ) ; putAndWarnDuplicateKeys ( map , k1 , v1 ) ; return new ImmutableMapParameter < K , V > ( map ) ; }
Returns an ImmutableMapParameter instance containing two entries .
30,630
public Waiter < DescribeTableRequest > tableExists ( ) { return new WaiterBuilder < DescribeTableRequest , DescribeTableResult > ( ) . withSdkFunction ( new DescribeTableFunction ( client ) ) . withAcceptors ( new TableExists . IsACTIVEMatcher ( ) , new TableExists . IsResourceNotFoundExceptionMatcher ( ) ) . withDefaultPollingStrategy ( new PollingStrategy ( new MaxAttemptsRetryStrategy ( 25 ) , new FixedDelayStrategy ( 20 ) ) ) . withExecutorService ( executorService ) . build ( ) ; }
Builds a TableExists waiter by using custom parameters waiterParameters and other parameters defined in the waiters specification and then polls until it determines whether the resource entered the desired state or not where polling criteria is bound by either default polling strategy or custom polling strategy .
30,631
public Waiter < DescribeTableRequest > tableNotExists ( ) { return new WaiterBuilder < DescribeTableRequest , DescribeTableResult > ( ) . withSdkFunction ( new DescribeTableFunction ( client ) ) . withAcceptors ( new TableNotExists . IsResourceNotFoundExceptionMatcher ( ) ) . withDefaultPollingStrategy ( new PollingStrategy ( new MaxAttemptsRetryStrategy ( 25 ) , new FixedDelayStrategy ( 20 ) ) ) . withExecutorService ( executorService ) . build ( ) ; }
Builds a TableNotExists waiter by using custom parameters waiterParameters and other parameters defined in the waiters specification and then polls until it determines whether the resource entered the desired state or not where polling criteria is bound by either default polling strategy or custom polling strategy .
30,632
public void setOutputDetails ( java . util . Collection < OutputDetail > outputDetails ) { if ( outputDetails == null ) { this . outputDetails = null ; return ; } this . outputDetails = new java . util . ArrayList < OutputDetail > ( outputDetails ) ; }
Details about the output
30,633
public void mark ( int readlimit ) { abortIfNeeded ( ) ; if ( ! isAtStart ) throw new UnsupportedOperationException ( "Chunk-encoded stream only supports mark() at the start of the stream." ) ; if ( is . markSupported ( ) ) { if ( log . isDebugEnabled ( ) ) { log . debug ( "AwsChunkedEncodingInputStream marked at the start of the stream " + "(will directly mark the wrapped stream since it's mark-supported)." ) ; } is . mark ( readlimit ) ; } else { if ( log . isDebugEnabled ( ) ) { log . debug ( "AwsChunkedEncodingInputStream marked at the start of the stream " + "(initializing the buffer since the wrapped stream is not mark-supported)." ) ; } decodedStreamBuffer = new DecodedStreamBuffer ( maxBufferSize ) ; } }
The readlimit parameter is ignored .
30,634
public void reset ( ) throws IOException { abortIfNeeded ( ) ; currentChunkIterator = null ; priorChunkSignature = headerSignature ; if ( is . markSupported ( ) ) { if ( log . isDebugEnabled ( ) ) log . debug ( "AwsChunkedEncodingInputStream reset " + "(will reset the wrapped stream because it is mark-supported)." ) ; is . reset ( ) ; } else { if ( log . isDebugEnabled ( ) ) log . debug ( "AwsChunkedEncodingInputStream reset " + "(will use the buffer of the decoded stream)." ) ; if ( null == decodedStreamBuffer ) { throw new IOException ( "Cannot reset the stream because the mark is not set." ) ; } decodedStreamBuffer . startReadBuffer ( ) ; } currentChunkIterator = null ; isAtStart = true ; isTerminating = false ; }
Reset the stream either by resetting the wrapped stream or using the buffer created by this class .
30,635
private boolean setUpNextChunk ( ) throws IOException { byte [ ] chunkData = new byte [ DEFAULT_CHUNK_SIZE ] ; int chunkSizeInBytes = 0 ; while ( chunkSizeInBytes < DEFAULT_CHUNK_SIZE ) { if ( null != decodedStreamBuffer && decodedStreamBuffer . hasNext ( ) ) { chunkData [ chunkSizeInBytes ++ ] = decodedStreamBuffer . next ( ) ; } else { int bytesToRead = DEFAULT_CHUNK_SIZE - chunkSizeInBytes ; int count = is . read ( chunkData , chunkSizeInBytes , bytesToRead ) ; if ( count != - 1 ) { if ( null != decodedStreamBuffer ) decodedStreamBuffer . buffer ( chunkData , chunkSizeInBytes , count ) ; chunkSizeInBytes += count ; } else break ; } } if ( chunkSizeInBytes == 0 ) { byte [ ] signedFinalChunk = createSignedChunk ( FINAL_CHUNK ) ; currentChunkIterator = new ChunkContentIterator ( signedFinalChunk ) ; return true ; } else { if ( chunkSizeInBytes < chunkData . length ) { chunkData = Arrays . copyOf ( chunkData , chunkSizeInBytes ) ; } byte [ ] signedChunkContent = createSignedChunk ( chunkData ) ; currentChunkIterator = new ChunkContentIterator ( signedChunkContent ) ; return false ; } }
Read in the next chunk of data and create the necessary chunk extensions .
30,636
public FindingCriteria withCriterion ( java . util . Map < String , Condition > criterion ) { setCriterion ( criterion ) ; return this ; }
Represents a map of finding properties that match specified conditions and values when querying findings .
30,637
private static boolean requiresApiKey ( ServiceModel serviceModel ) { return serviceModel . getOperations ( ) . values ( ) . stream ( ) . anyMatch ( Operation :: requiresApiKey ) ; }
If any operation requires an API key we generate a setter on the builder .
30,638
public Waiter < DescribeNodeAssociationStatusRequest > nodeAssociated ( ) { return new WaiterBuilder < DescribeNodeAssociationStatusRequest , DescribeNodeAssociationStatusResult > ( ) . withSdkFunction ( new DescribeNodeAssociationStatusFunction ( client ) ) . withAcceptors ( new NodeAssociated . IsSUCCESSMatcher ( ) , new NodeAssociated . IsFAILEDMatcher ( ) ) . withDefaultPollingStrategy ( new PollingStrategy ( new MaxAttemptsRetryStrategy ( 15 ) , new FixedDelayStrategy ( 15 ) ) ) . withExecutorService ( executorService ) . build ( ) ; }
Builds a NodeAssociated waiter by using custom parameters waiterParameters and other parameters defined in the waiters specification and then polls until it determines whether the resource entered the desired state or not where polling criteria is bound by either default polling strategy or custom polling strategy .
30,639
public static StringEqualsCondition . Builder eq ( String variable , String expectedValue ) { return StringEqualsCondition . builder ( ) . variable ( variable ) . expectedValue ( expectedValue ) ; }
Binary condition for String equality comparison .
30,640
public static NumericEqualsCondition . Builder eq ( String variable , long expectedValue ) { return NumericEqualsCondition . builder ( ) . variable ( variable ) . expectedValue ( expectedValue ) ; }
Binary condition for Numeric equality comparison . Supports both integral and floating point numeric types .
30,641
public static BooleanEqualsCondition . Builder eq ( String variable , boolean expectedValue ) { return BooleanEqualsCondition . builder ( ) . variable ( variable ) . expectedValue ( expectedValue ) ; }
Binary condition for Boolean equality comparison .
30,642
public static TimestampEqualsCondition . Builder eq ( String variable , Date expectedValue ) { return TimestampEqualsCondition . builder ( ) . variable ( variable ) . expectedValue ( expectedValue ) ; }
Binary condition for Timestamp equality comparison . Dates are converted to ISO8601 UTC timestamps .
30,643
public static StringGreaterThanCondition . Builder gt ( String variable , String expectedValue ) { return StringGreaterThanCondition . builder ( ) . variable ( variable ) . expectedValue ( expectedValue ) ; }
Binary condition for String greater than comparison .
30,644
public static TimestampGreaterThanCondition . Builder gt ( String variable , Date expectedValue ) { return TimestampGreaterThanCondition . builder ( ) . variable ( variable ) . expectedValue ( expectedValue ) ; }
Binary condition for Timestamp greater than comparison . Dates are converted to ISO8601 UTC timestamps .
30,645
public static StringGreaterThanOrEqualCondition . Builder gte ( String variable , String expectedValue ) { return StringGreaterThanOrEqualCondition . builder ( ) . variable ( variable ) . expectedValue ( expectedValue ) ; }
Binary condition for String greater than or equal to comparison .
30,646
public static TimestampGreaterThanOrEqualCondition . Builder gte ( String variable , Date expectedValue ) { return TimestampGreaterThanOrEqualCondition . builder ( ) . variable ( variable ) . expectedValue ( expectedValue ) ; }
Binary condition for Timestamp greater than or equal to comparison . Dates are converted to ISO8601 UTC timestamps .
30,647
public static StringLessThanCondition . Builder lt ( String variable , String expectedValue ) { return StringLessThanCondition . builder ( ) . variable ( variable ) . expectedValue ( expectedValue ) ; }
Binary condition for String less than comparison .
30,648
public static NumericLessThanCondition . Builder lt ( String variable , long expectedValue ) { return NumericLessThanCondition . builder ( ) . variable ( variable ) . expectedValue ( expectedValue ) ; }
Binary condition for Numeric less than comparison . Supports both integral and floating point numeric types .
30,649
public static TimestampLessThanCondition . Builder lt ( String variable , Date expectedValue ) { return TimestampLessThanCondition . builder ( ) . variable ( variable ) . expectedValue ( expectedValue ) ; }
Binary condition for Timestamp less than comparison . Dates are converted to ISO8601 UTC timestamps .
30,650
public static StringLessThanOrEqualCondition . Builder lte ( String variable , String expectedValue ) { return StringLessThanOrEqualCondition . builder ( ) . variable ( variable ) . expectedValue ( expectedValue ) ; }
Binary condition for String less than or equal to comparison .
30,651
public static NumericLessThanOrEqualCondition . Builder lte ( String variable , long expectedValue ) { return NumericLessThanOrEqualCondition . builder ( ) . variable ( variable ) . expectedValue ( expectedValue ) ; }
Binary condition for Numeric less than or equal to comparison . Supports both integral and floating point numeric types .
30,652
public static TimestampLessThanOrEqualCondition . Builder lte ( String variable , Date expectedValue ) { return TimestampLessThanOrEqualCondition . builder ( ) . variable ( variable ) . expectedValue ( expectedValue ) ; }
Binary condition for Timestamp less than or equal to comparison . Dates are converted to ISO8601 UTC timestamps .
30,653
public static String encodeZeroPadding ( int number , int maxNumDigits ) { String integerString = Integer . toString ( number ) ; int numZeroes = maxNumDigits - integerString . length ( ) ; StringBuffer strBuffer = new StringBuffer ( numZeroes + integerString . length ( ) ) ; for ( int i = 0 ; i < numZeroes ; i ++ ) { strBuffer . insert ( i , '0' ) ; } strBuffer . append ( integerString ) ; return strBuffer . toString ( ) ; }
Encodes positive integer value into a string by zero - padding number up to the specified number of digits .
30,654
public static String encodeZeroPadding ( long number , int maxNumDigits ) { String longString = Long . toString ( number ) ; int numZeroes = maxNumDigits - longString . length ( ) ; StringBuffer strBuffer = new StringBuffer ( numZeroes + longString . length ( ) ) ; for ( int i = 0 ; i < numZeroes ; i ++ ) { strBuffer . insert ( i , '0' ) ; } strBuffer . append ( longString ) ; return strBuffer . toString ( ) ; }
Encodes positive long value into a string by zero - padding the value up to the specified number of digits .
30,655
public static String encodeZeroPadding ( float number , int maxNumDigits ) { String floatString = Float . toString ( number ) ; int numBeforeDecimal = floatString . indexOf ( '.' ) ; numBeforeDecimal = ( numBeforeDecimal >= 0 ? numBeforeDecimal : floatString . length ( ) ) ; int numZeroes = maxNumDigits - numBeforeDecimal ; StringBuffer strBuffer = new StringBuffer ( numZeroes + floatString . length ( ) ) ; for ( int i = 0 ; i < numZeroes ; i ++ ) { strBuffer . insert ( i , '0' ) ; } strBuffer . append ( floatString ) ; return strBuffer . toString ( ) ; }
Encodes positive float value into a string by zero - padding number up to the specified number of digits
30,656
public static String encodeRealNumberRange ( int number , int maxNumDigits , int offsetValue ) { long offsetNumber = number + offsetValue ; String longString = Long . toString ( offsetNumber ) ; int numZeroes = maxNumDigits - longString . length ( ) ; StringBuffer strBuffer = new StringBuffer ( numZeroes + longString . length ( ) ) ; for ( int i = 0 ; i < numZeroes ; i ++ ) { strBuffer . insert ( i , '0' ) ; } strBuffer . append ( longString ) ; return strBuffer . toString ( ) ; }
Encodes real integer value into a string by offsetting and zero - padding number up to the specified number of digits . Use this encoding method if the data range set includes both positive and negative values .
30,657
public static String encodeRealNumberRange ( float number , int maxDigitsLeft , int maxDigitsRight , int offsetValue ) { int shiftMultiplier = ( int ) Math . pow ( 10 , maxDigitsRight ) ; long shiftedNumber = ( long ) Math . round ( ( double ) number * shiftMultiplier ) ; long shiftedOffset = offsetValue * shiftMultiplier ; long offsetNumber = shiftedNumber + shiftedOffset ; if ( offsetNumber < 0 ) { throw new IllegalArgumentException ( "OffsetNumber[" + offsetNumber + "] is negative - Number[" + number + "], maxDigitsLeft[" + maxDigitsLeft + "], maxDigitsRight[" + maxDigitsRight + "], offsetValue[" + offsetValue + "]" ) ; } String longString = Long . toString ( offsetNumber ) ; int numBeforeDecimal = longString . length ( ) ; int numZeroes = maxDigitsLeft + maxDigitsRight - numBeforeDecimal ; if ( numZeroes < 0 ) { throw new IllegalArgumentException ( "Number[" + number + "] has too many digits - maxDigitsLeft[" + maxDigitsLeft + "], maxDigitsRight[" + maxDigitsRight + "], offsetValue[" + offsetValue + "]" ) ; } StringBuffer strBuffer = new StringBuffer ( numZeroes + longString . length ( ) ) ; for ( int i = 0 ; i < numZeroes ; i ++ ) { strBuffer . insert ( i , '0' ) ; } strBuffer . append ( longString ) ; return strBuffer . toString ( ) ; }
Encodes real float value into a string by offsetting and zero - padding number up to the specified number of digits . Use this encoding method if the data range set includes both positive and negative values .
30,658
public static String quoteValues ( Collection < String > values ) { StringBuilder sb = new StringBuilder ( ) ; boolean first = true ; for ( String s : values ) { if ( ! first ) sb . append ( "," ) ; first = false ; sb . append ( quoteValue ( s ) ) ; } return sb . toString ( ) ; }
Quotes and escapes a list of values so that they can be used in a SimpleDB query .
30,659
public void setEngineVersions ( java . util . Collection < EngineVersion > engineVersions ) { if ( engineVersions == null ) { this . engineVersions = null ; return ; } this . engineVersions = new java . util . ArrayList < EngineVersion > ( engineVersions ) ; }
The list of engine versions .
30,660
public Waiter < DescribeClusterSnapshotsRequest > snapshotAvailable ( ) { return new WaiterBuilder < DescribeClusterSnapshotsRequest , DescribeClusterSnapshotsResult > ( ) . withSdkFunction ( new DescribeClusterSnapshotsFunction ( client ) ) . withAcceptors ( new SnapshotAvailable . IsAvailableMatcher ( ) , new SnapshotAvailable . IsFailedMatcher ( ) , new SnapshotAvailable . IsDeletedMatcher ( ) ) . withDefaultPollingStrategy ( new PollingStrategy ( new MaxAttemptsRetryStrategy ( 20 ) , new FixedDelayStrategy ( 15 ) ) ) . withExecutorService ( executorService ) . build ( ) ; }
Builds a SnapshotAvailable waiter by using custom parameters waiterParameters and other parameters defined in the waiters specification and then polls until it determines whether the resource entered the desired state or not where polling criteria is bound by either default polling strategy or custom polling strategy .
30,661
public Waiter < DescribeClustersRequest > clusterRestored ( ) { return new WaiterBuilder < DescribeClustersRequest , DescribeClustersResult > ( ) . withSdkFunction ( new DescribeClustersFunction ( client ) ) . withAcceptors ( new ClusterRestored . IsCompletedMatcher ( ) , new ClusterRestored . IsDeletingMatcher ( ) ) . withDefaultPollingStrategy ( new PollingStrategy ( new MaxAttemptsRetryStrategy ( 30 ) , new FixedDelayStrategy ( 60 ) ) ) . withExecutorService ( executorService ) . build ( ) ; }
Builds a ClusterRestored waiter by using custom parameters waiterParameters and other parameters defined in the waiters specification and then polls until it determines whether the resource entered the desired state or not where polling criteria is bound by either default polling strategy or custom polling strategy .
30,662
public Waiter < DescribeClustersRequest > clusterAvailable ( ) { return new WaiterBuilder < DescribeClustersRequest , DescribeClustersResult > ( ) . withSdkFunction ( new DescribeClustersFunction ( client ) ) . withAcceptors ( new ClusterAvailable . IsAvailableMatcher ( ) , new ClusterAvailable . IsDeletingMatcher ( ) , new ClusterAvailable . IsClusterNotFoundMatcher ( ) ) . withDefaultPollingStrategy ( new PollingStrategy ( new MaxAttemptsRetryStrategy ( 30 ) , new FixedDelayStrategy ( 60 ) ) ) . withExecutorService ( executorService ) . build ( ) ; }
Builds a ClusterAvailable waiter by using custom parameters waiterParameters and other parameters defined in the waiters specification and then polls until it determines whether the resource entered the desired state or not where polling criteria is bound by either default polling strategy or custom polling strategy .
30,663
public SegmentResponse withTags ( java . util . Map < String , String > tags ) { setTags ( tags ) ; return this ; }
The Tags for the segment .
30,664
public static synchronized STSSessionCredentialsProvider getSessionCredentialsProvider ( AWSCredentials longTermCredentials , String serviceEndpoint , ClientConfiguration stsClientConfiguration ) { Key key = new Key ( longTermCredentials . getAWSAccessKeyId ( ) , serviceEndpoint ) ; if ( ! cache . containsKey ( key ) ) { cache . put ( key , new STSSessionCredentialsProvider ( longTermCredentials , stsClientConfiguration ) ) ; } return cache . get ( key ) ; }
Gets a session credentials provider for the long - term credentials and service endpoint given . These are shared globally to support reuse of session tokens .
30,665
public void run ( WaiterParameters < Input > waiterParameters ) throws AmazonServiceException , WaiterTimedOutException , WaiterUnrecoverableException { ValidationUtils . assertNotNull ( waiterParameters , "waiterParameters" ) ; @ SuppressWarnings ( "unchecked" ) Input request = ( Input ) ValidationUtils . assertNotNull ( waiterParameters . getRequest ( ) , "request" ) . clone ( ) ; request . getRequestClientOptions ( ) . appendUserAgent ( "waiter-request" ) ; WaiterExecution < Input , Output > waiterExecution = new WaiterExecutionBuilder < Input , Output > ( ) . withRequest ( request ) . withPollingStrategy ( waiterParameters . getPollingStrategy ( ) != null ? waiterParameters . getPollingStrategy ( ) : defaultPollingStrategy ) . withAcceptors ( acceptors ) . withSdkFunction ( sdkFunction ) . build ( ) ; waiterExecution . pollResource ( ) ; }
Polls synchronously until it is determined that the resource transitioned into the desired state or not .
30,666
public Future < Void > runAsync ( final WaiterParameters < Input > waiterParameters , final WaiterHandler callback ) throws AmazonServiceException , WaiterTimedOutException , WaiterUnrecoverableException { return executorService . submit ( new java . util . concurrent . Callable < Void > ( ) { public Void call ( ) throws Exception { try { run ( waiterParameters ) ; callback . onWaitSuccess ( waiterParameters . getRequest ( ) ) ; } catch ( Exception ex ) { callback . onWaitFailure ( ex ) ; throw ex ; } return null ; } } ) ; }
Polls asynchronously until it is determined that the resource transitioned into the desired state or not . Includes additional callback .
30,667
public void setDestinations ( java . util . Collection < InputDestinationRequest > destinations ) { if ( destinations == null ) { this . destinations = null ; return ; } this . destinations = new java . util . ArrayList < InputDestinationRequest > ( destinations ) ; }
Destination settings for PUSH type inputs .
30,668
public void setInputSecurityGroups ( java . util . Collection < String > inputSecurityGroups ) { if ( inputSecurityGroups == null ) { this . inputSecurityGroups = null ; return ; } this . inputSecurityGroups = new java . util . ArrayList < String > ( inputSecurityGroups ) ; }
A list of security groups referenced by IDs to attach to the input .
30,669
public void setMediaConnectFlows ( java . util . Collection < MediaConnectFlowRequest > mediaConnectFlows ) { if ( mediaConnectFlows == null ) { this . mediaConnectFlows = null ; return ; } this . mediaConnectFlows = new java . util . ArrayList < MediaConnectFlowRequest > ( mediaConnectFlows ) ; }
A list of the MediaConnect Flows that you want to use in this input . You can specify as few as one Flow and presently as many as two . The only requirement is when you have more than one is that each Flow is in a separate Availability Zone as this ensures your EML input is redundant to AZ issues .
30,670
private int nextChunk ( ) throws IOException { abortIfNeeded ( ) ; if ( eof ) return - 1 ; bufout = null ; int len = in . read ( bufin ) ; if ( len == - 1 ) { eof = true ; if ( ! multipart || lastMultiPart ) { try { bufout = cipherLite . doFinal ( ) ; if ( bufout == null ) { return - 1 ; } curr_pos = 0 ; return max_pos = bufout . length ; } catch ( IllegalBlockSizeException ignore ) { } catch ( BadPaddingException e ) { if ( S3CryptoScheme . isAesGcm ( cipherLite . getCipherAlgorithm ( ) ) ) throw new SecurityException ( e ) ; } } return - 1 ; } bufout = cipherLite . update ( bufin , 0 , len ) ; curr_pos = 0 ; return max_pos = ( bufout == null ? 0 : bufout . length ) ; }
Reads and process the next chunk of data into memory .
30,671
public static InternalLogApi getLog ( Class < ? > clazz ) { return factoryConfigured ? factory . doGetLog ( clazz ) : new InternalLog ( clazz . getName ( ) ) ; }
Returns an SDK logger that logs using the currently configured default log factory given the class .
30,672
public static InternalLogApi getLog ( String name ) { return factoryConfigured ? factory . doGetLog ( name ) : new InternalLog ( name ) ; }
Returns an SDK logger that logs using the currently configured default log factory given the name .
30,673
public synchronized static boolean configureFactory ( InternalLogFactory factory ) { if ( factory == null ) throw new IllegalArgumentException ( ) ; if ( factoryConfigured ) return false ; InternalLogFactory . factory = factory ; factoryConfigured = true ; return true ; }
Used to explicitly configure the log factory . The log factory can only be configured at most once . All subsequent configurations will have no effect .
30,674
public void setJobs ( java . util . Collection < Job > jobs ) { if ( jobs == null ) { this . jobs = null ; return ; } this . jobs = new java . util . ArrayList < Job > ( jobs ) ; }
List of jobs
30,675
public final boolean matches ( JsonNode lhs , JsonNode rhs ) { return matches ( lhs . decimalValue ( ) , rhs . decimalValue ( ) ) ; }
Converts the lhs and rhs JsonNodes to the numeric values and delegates to the matches method that operates on the numeric values alone .
30,676
public boolean acquire ( int capacity ) { if ( capacity < 0 ) { throw new IllegalArgumentException ( "capacity to acquire cannot be negative" ) ; } if ( availableCapacity < 0 ) { return true ; } synchronized ( lock ) { if ( availableCapacity - capacity >= 0 ) { availableCapacity -= capacity ; return true ; } else { return false ; } } }
Attempts to acquire a given amount of capacity . If acquired capacity will be consumed from the available pool .
30,677
public void release ( int capacity ) { if ( capacity < 0 ) { throw new IllegalArgumentException ( "capacity to release cannot be negative" ) ; } if ( availableCapacity >= 0 && availableCapacity != maxCapacity ) { synchronized ( lock ) { availableCapacity = Math . min ( ( availableCapacity + capacity ) , maxCapacity ) ; } } }
Releases a given amount of capacity back to the pool making it available to consumers .
30,678
public Waiter < DescribeVaultRequest > vaultExists ( ) { return new WaiterBuilder < DescribeVaultRequest , DescribeVaultResult > ( ) . withSdkFunction ( new DescribeVaultFunction ( client ) ) . withAcceptors ( new HttpSuccessStatusAcceptor ( WaiterState . SUCCESS ) , new VaultExists . IsResourceNotFoundExceptionMatcher ( ) ) . withDefaultPollingStrategy ( new PollingStrategy ( new MaxAttemptsRetryStrategy ( 15 ) , new FixedDelayStrategy ( 3 ) ) ) . withExecutorService ( executorService ) . build ( ) ; }
Builds a VaultExists waiter by using custom parameters waiterParameters and other parameters defined in the waiters specification and then polls until it determines whether the resource entered the desired state or not where polling criteria is bound by either default polling strategy or custom polling strategy .
30,679
public Waiter < DescribeVaultRequest > vaultNotExists ( ) { return new WaiterBuilder < DescribeVaultRequest , DescribeVaultResult > ( ) . withSdkFunction ( new DescribeVaultFunction ( client ) ) . withAcceptors ( new HttpSuccessStatusAcceptor ( WaiterState . RETRY ) , new VaultNotExists . IsResourceNotFoundExceptionMatcher ( ) ) . withDefaultPollingStrategy ( new PollingStrategy ( new MaxAttemptsRetryStrategy ( 15 ) , new FixedDelayStrategy ( 3 ) ) ) . withExecutorService ( executorService ) . build ( ) ; }
Builds a VaultNotExists waiter by using custom parameters waiterParameters and other parameters defined in the waiters specification and then polls until it determines whether the resource entered the desired state or not where polling criteria is bound by either default polling strategy or custom polling strategy .
30,680
public MetricCollector getInstance ( ) { AWSCredentialsProvider provider = AwsSdkMetrics . getCredentialProvider ( ) ; Region region = RegionUtils . getRegion ( AwsSdkMetrics . getRegionName ( ) ) ; Integer qSize = AwsSdkMetrics . getMetricQueueSize ( ) ; Long timeoutMilli = AwsSdkMetrics . getQueuePollTimeoutMilli ( ) ; CloudWatchMetricConfig config = new CloudWatchMetricConfig ( ) ; ClientConfiguration clientConfig = new ClientConfiguration ( ) ; if ( provider != null ) config . setCredentialsProvider ( provider ) ; if ( region != null ) { String endPoint = region . getServiceEndpoint ( AmazonCloudWatch . ENDPOINT_PREFIX ) ; config . setCloudWatchEndPoint ( endPoint ) ; } if ( qSize != null ) config . setMetricQueueSize ( qSize . intValue ( ) ) ; if ( timeoutMilli != null ) config . setQueuePollTimeoutMilli ( timeoutMilli . longValue ( ) ) ; config . setClientConfiguration ( clientConfig ) ; MetricCollectorSupport . startSingleton ( config ) ; return MetricCollectorSupport . getInstance ( ) ; }
Returns a instance of the Amazon CloudWatch request metric collector either by starting up a new one or returning an existing one if it s already started ; null if any failure .
30,681
protected AmazonDynamoDB build ( AwsSyncClientParams params ) { if ( endpointDiscoveryEnabled ( ) && getEndpoint ( ) == null ) { return new AmazonDynamoDBClient ( params , true ) ; } return new AmazonDynamoDBClient ( params ) ; }
Construct a synchronous implementation of AmazonDynamoDB using the current builder configuration .
30,682
protected void run ( Scanner scanner ) { String currentProfileName = null ; try { while ( scanner . hasNextLine ( ) ) { String line = scanner . nextLine ( ) . trim ( ) ; if ( line . isEmpty ( ) || line . startsWith ( "#" ) ) { onEmptyOrCommentLine ( currentProfileName , line ) ; continue ; } String newProfileName = parseProfileName ( line ) ; boolean atNewProfileStartingLine = newProfileName != null ; if ( atNewProfileStartingLine ) { if ( currentProfileName != null ) { onProfileEndingLine ( currentProfileName ) ; } onProfileStartingLine ( newProfileName , line ) ; currentProfileName = newProfileName ; } else { Entry < String , String > property = parsePropertyLine ( line ) ; if ( currentProfileName == null ) { throw new IllegalArgumentException ( "Property is defined without a preceding profile name. " + "Current line: " + line ) ; } onProfileProperty ( currentProfileName , property . getKey ( ) , property . getValue ( ) , isSupportedProperty ( property . getKey ( ) ) , line ) ; } } if ( currentProfileName != null ) { onProfileEndingLine ( currentProfileName ) ; } onEndOfFile ( ) ; } finally { scanner . close ( ) ; } }
Scan through the given input and perform the defined actions .
30,683
private static String parseProfileName ( String trimmedLine ) { if ( trimmedLine . startsWith ( "[" ) && trimmedLine . endsWith ( "]" ) ) { String profileName = trimmedLine . substring ( 1 , trimmedLine . length ( ) - 1 ) ; return profileName . trim ( ) ; } return null ; }
Returns the profile name if this line indicates the beginning of a new profile section . Otherwise returns null .
30,684
public static String convertStreamToString ( InputStream in ) throws Exception { BufferedReader reader = new BufferedReader ( new InputStreamReader ( in ) ) ; StringBuilder stringbuilder = new StringBuilder ( ) ; String line = null ; while ( ( line = reader . readLine ( ) ) != null ) { stringbuilder . append ( line + "\n" ) ; } in . close ( ) ; return stringbuilder . toString ( ) ; }
Convert a stream into a single newline separated string
30,685
public static String waitForCompletion ( AmazonCloudFormation stackbuilder , String stackName ) throws Exception { DescribeStacksRequest wait = new DescribeStacksRequest ( ) ; wait . setStackName ( stackName ) ; Boolean completed = false ; String stackStatus = "Unknown" ; String stackReason = "" ; System . out . print ( "Waiting" ) ; while ( ! completed ) { List < Stack > stacks = stackbuilder . describeStacks ( wait ) . getStacks ( ) ; if ( stacks . isEmpty ( ) ) { completed = true ; stackStatus = "NO_SUCH_STACK" ; stackReason = "Stack has been deleted" ; } else { for ( Stack stack : stacks ) { if ( stack . getStackStatus ( ) . equals ( StackStatus . CREATE_COMPLETE . toString ( ) ) || stack . getStackStatus ( ) . equals ( StackStatus . CREATE_FAILED . toString ( ) ) || stack . getStackStatus ( ) . equals ( StackStatus . ROLLBACK_FAILED . toString ( ) ) || stack . getStackStatus ( ) . equals ( StackStatus . DELETE_FAILED . toString ( ) ) ) { completed = true ; stackStatus = stack . getStackStatus ( ) ; stackReason = stack . getStackStatusReason ( ) ; } } } System . out . print ( "." ) ; if ( ! completed ) Thread . sleep ( 10000 ) ; } System . out . print ( "done\n" ) ; return stackStatus + " (" + stackReason + ")" ; }
OR the stack no longer exists
30,686
private static < E extends RuntimeException > E handleException ( E ex ) { if ( JodaTime . hasExpectedBehavior ( ) ) return ex ; throw new IllegalStateException ( "Joda-time 2.2 or later version is required, but found version: " + JodaTime . getVersion ( ) , ex ) ; }
Returns the original runtime exception iff the joda - time being used at runtime behaves as expected .
30,687
public static Date parseRFC822Date ( String dateString ) { if ( dateString == null ) { return null ; } try { return new Date ( rfc822DateFormat . parseMillis ( dateString ) ) ; } catch ( RuntimeException ex ) { throw handleException ( ex ) ; } }
Parses the specified date string as an RFC 822 date and returns the Date object .
30,688
public static String formatRFC822Date ( Date date ) { try { return rfc822DateFormat . print ( date . getTime ( ) ) ; } catch ( RuntimeException ex ) { throw handleException ( ex ) ; } }
Formats the specified date as an RFC 822 string .
30,689
public static Date parseServiceSpecificDate ( String dateString ) { if ( dateString == null ) return null ; try { BigDecimal dateValue = new BigDecimal ( dateString ) ; return new Date ( dateValue . scaleByPowerOfTen ( AWS_DATE_MILLI_SECOND_PRECISION ) . longValue ( ) ) ; } catch ( NumberFormatException nfe ) { throw new SdkClientException ( "Unable to parse date : " + dateString , nfe ) ; } }
Parses the given date string returned by the AWS service into a Date object .
30,690
public static String formatServiceSpecificDate ( Date date ) { if ( date == null ) return null ; BigDecimal dateValue = BigDecimal . valueOf ( date . getTime ( ) ) ; return dateValue . scaleByPowerOfTen ( 0 - AWS_DATE_MILLI_SECOND_PRECISION ) . toPlainString ( ) ; }
Formats the give date object into an AWS Service format .
30,691
public static String formatUnixTimestampInMills ( Date date ) { if ( date == null ) return null ; BigDecimal dateValue = BigDecimal . valueOf ( date . getTime ( ) ) ; return dateValue . toPlainString ( ) ; }
Formats the give date object into unit timestamp in milli seconds .
30,692
private String getErrorCode ( String errorShapeName ) { ErrorTrait errorTrait = getServiceModel ( ) . getShapes ( ) . get ( errorShapeName ) . getErrorTrait ( ) ; if ( isErrorCodeOverridden ( errorTrait ) ) { return errorTrait . getErrorCode ( ) ; } else { return errorShapeName ; } }
The error code may be overridden for query or rest protocols via the error trait on the exception shape . If the error code isn t overridden and for all other protocols other than query or rest the error code should just be the shape name
30,693
public boolean areAnyOpen ( ) { DescribeSpotInstanceRequestsRequest describeRequest = new DescribeSpotInstanceRequestsRequest ( ) ; describeRequest . setSpotInstanceRequestIds ( spotInstanceRequestIds ) ; System . out . println ( "Checking to determine if Spot Bids have reached the active state..." ) ; instanceIds = new ArrayList < String > ( ) ; try { DescribeSpotInstanceRequestsResult describeResult = ec2 . describeSpotInstanceRequests ( describeRequest ) ; List < SpotInstanceRequest > describeResponses = describeResult . getSpotInstanceRequests ( ) ; for ( SpotInstanceRequest describeResponse : describeResponses ) { System . out . println ( " " + describeResponse . getSpotInstanceRequestId ( ) + " is in the " + describeResponse . getState ( ) + " state." ) ; if ( describeResponse . getState ( ) . equals ( "open" ) ) { return true ; } instanceIds . add ( describeResponse . getInstanceId ( ) ) ; } } catch ( AmazonServiceException e ) { System . out . println ( "Error when calling describeSpotInstances" ) ; System . out . println ( "Caught Exception: " + e . getMessage ( ) ) ; System . out . println ( "Reponse Status Code: " + e . getStatusCode ( ) ) ; System . out . println ( "Error Code: " + e . getErrorCode ( ) ) ; System . out . println ( "Request ID: " + e . getRequestId ( ) ) ; return true ; } return false ; }
The areOpen method will determine if any of the requests that were started are still in the open state . If all of them have transitioned to either active cancelled or closed then this will return false .
30,694
public void cleanup ( ) { try { System . out . println ( "Cancelling requests." ) ; CancelSpotInstanceRequestsRequest cancelRequest = new CancelSpotInstanceRequestsRequest ( spotInstanceRequestIds ) ; ec2 . cancelSpotInstanceRequests ( cancelRequest ) ; } catch ( AmazonServiceException e ) { System . out . println ( "Error cancelling instances" ) ; System . out . println ( "Caught Exception: " + e . getMessage ( ) ) ; System . out . println ( "Reponse Status Code: " + e . getStatusCode ( ) ) ; System . out . println ( "Error Code: " + e . getErrorCode ( ) ) ; System . out . println ( "Request ID: " + e . getRequestId ( ) ) ; } try { System . out . println ( "Terminate instances" ) ; TerminateInstancesRequest terminateRequest = new TerminateInstancesRequest ( instanceIds ) ; ec2 . terminateInstances ( terminateRequest ) ; } catch ( AmazonServiceException e ) { System . out . println ( "Error terminating instances" ) ; System . out . println ( "Caught Exception: " + e . getMessage ( ) ) ; System . out . println ( "Reponse Status Code: " + e . getStatusCode ( ) ) ; System . out . println ( "Error Code: " + e . getErrorCode ( ) ) ; System . out . println ( "Request ID: " + e . getRequestId ( ) ) ; } instanceIds . clear ( ) ; spotInstanceRequestIds . clear ( ) ; }
The cleanup method will cancel and active requests and terminate any running instances that were created using this object .
30,695
public void setPrivateIpAddresses ( java . util . Collection < PrivateIpAddressDetails > privateIpAddresses ) { if ( privateIpAddresses == null ) { this . privateIpAddresses = null ; return ; } this . privateIpAddresses = new java . util . ArrayList < PrivateIpAddressDetails > ( privateIpAddresses ) ; }
Other private IP address information of the EC2 instance .
30,696
private static boolean wrapWithByteCounting ( InputStream in ) { if ( ! AwsSdkMetrics . isMetricsEnabled ( ) ) { return false ; } if ( in instanceof MetricAware ) { MetricAware aware = ( MetricAware ) in ; return ! aware . isMetricActivated ( ) ; } return true ; }
Returns true if we should wrap the given input stream with a byte counting wrapper ; false otherwise .
30,697
public SegmentDimensions withUserAttributes ( java . util . Map < String , AttributeDimension > userAttributes ) { setUserAttributes ( userAttributes ) ; return this ; }
Custom segment user attributes .
30,698
public void setEntitlements ( java . util . Collection < Entitlement > entitlements ) { if ( entitlements == null ) { this . entitlements = null ; return ; } this . entitlements = new java . util . ArrayList < Entitlement > ( entitlements ) ; }
The entitlements in this flow .
30,699
public < T extends AbstractPutObjectRequest > T withKey ( String key ) { setKey ( key ) ; @ SuppressWarnings ( "unchecked" ) T t = ( T ) this ; return t ; }
Sets the key under which to store the new object . Returns this object enabling additional method calls to be chained together .