idx int64 0 165k | question stringlengths 73 4.15k | target stringlengths 5 918 | len_question int64 21 890 | len_target int64 3 255 |
|---|---|---|---|---|
149,700 | public static < OutT , InT > PagedList < OutT > toPagedList ( List < InT > list , final Func1 < InT , OutT > mapper ) { PageImpl < InT > page = new PageImpl <> ( ) ; page . setItems ( list ) ; page . setNextPageLink ( null ) ; PagedList < InT > pagedList = new PagedList < InT > ( page ) { @ Override public Page < InT > nextPage ( String nextPageLink ) { return null ; } } ; PagedListConverter < InT , OutT > converter = new PagedListConverter < InT , OutT > ( ) { @ Override public Observable < OutT > typeConvertAsync ( InT inner ) { return Observable . just ( mapper . call ( inner ) ) ; } } ; return converter . convert ( pagedList ) ; } | Converts the given list of a type to paged list of a different type . | 205 | 17 |
149,701 | public static void addToListIfNotExists ( List < String > list , String value ) { boolean found = false ; for ( String item : list ) { if ( item . equalsIgnoreCase ( value ) ) { found = true ; break ; } } if ( ! found ) { list . add ( value ) ; } } | Adds a value to the list if does not already exists . | 70 | 12 |
149,702 | public static void removeFromList ( List < String > list , String value ) { int foundIndex = - 1 ; int i = 0 ; for ( String id : list ) { if ( id . equalsIgnoreCase ( value ) ) { foundIndex = i ; break ; } i ++ ; } if ( foundIndex != - 1 ) { list . remove ( foundIndex ) ; } } | Removes a value from the list . | 81 | 8 |
149,703 | public PagedList < V > convert ( final PagedList < U > uList ) { if ( uList == null || uList . isEmpty ( ) ) { return new PagedList < V > ( ) { @ Override public Page < V > nextPage ( String s ) throws RestException , IOException { return null ; } } ; } Page < U > uPage = uList . currentPage ( ) ; final PageImpl < V > vPage = new PageImpl <> ( ) ; vPage . setNextPageLink ( uPage . nextPageLink ( ) ) ; vPage . setItems ( new ArrayList < V > ( ) ) ; loadConvertedList ( uPage , vPage ) ; return new PagedList < V > ( vPage ) { @ Override public Page < V > nextPage ( String nextPageLink ) throws RestException , IOException { Page < U > uPage = uList . nextPage ( nextPageLink ) ; final PageImpl < V > vPage = new PageImpl <> ( ) ; vPage . setNextPageLink ( uPage . nextPageLink ( ) ) ; vPage . setItems ( new ArrayList < V > ( ) ) ; loadConvertedList ( uPage , vPage ) ; return vPage ; } } ; } | Converts the paged list . | 278 | 7 |
149,704 | public CustomHeadersInterceptor replaceHeader ( String name , String value ) { this . headers . put ( name , new ArrayList < String > ( ) ) ; this . headers . get ( name ) . add ( value ) ; return this ; } | Add a single header key - value pair . If one with the name already exists it gets replaced . | 52 | 20 |
149,705 | public CustomHeadersInterceptor addHeader ( String name , String value ) { if ( ! this . headers . containsKey ( name ) ) { this . headers . put ( name , new ArrayList < String > ( ) ) ; } this . headers . get ( name ) . add ( value ) ; return this ; } | Add a single header key - value pair . If one with the name already exists both stay in the header map . | 67 | 23 |
149,706 | public CustomHeadersInterceptor addHeaderMap ( Map < String , String > headers ) { for ( Map . Entry < String , String > header : headers . entrySet ( ) ) { this . headers . put ( header . getKey ( ) , Collections . singletonList ( header . getValue ( ) ) ) ; } return this ; } | Add all headers in a header map . | 72 | 8 |
149,707 | public CustomHeadersInterceptor addHeaderMultimap ( Map < String , List < String > > headers ) { this . headers . putAll ( headers ) ; return this ; } | Add all headers in a header multimap . | 38 | 9 |
149,708 | public static < T > Observable < T > map ( Observable < ? > fromObservable , final T toValue ) { if ( fromObservable != null ) { return fromObservable . subscribeOn ( Schedulers . io ( ) ) . map ( new RXMapper < T > ( toValue ) ) ; } else { return Observable . empty ( ) ; } } | Shortcut for mapping the output of an arbitrary observable to one returning an instance of a specific type using the IO scheduler . | 84 | 25 |
149,709 | public static Observable < Void > mapToVoid ( Observable < ? > fromObservable ) { if ( fromObservable != null ) { return fromObservable . subscribeOn ( Schedulers . io ( ) ) . map ( new RXMapper < Void > ( ) ) ; } else { return Observable . empty ( ) ; } } | Shortcut for mapping an arbitrary observable to void using the IO scheduler . | 77 | 15 |
149,710 | @ SuppressWarnings ( "unchecked" ) public final FluentModelImplT withTag ( String key , String value ) { if ( this . inner ( ) . getTags ( ) == null ) { this . inner ( ) . withTags ( new HashMap < String , String > ( ) ) ; } this . inner ( ) . getTags ( ) . put ( key , value ) ; return ( FluentModelImplT ) this ; } | Adds a tag to the resource . | 96 | 7 |
149,711 | @ SuppressWarnings ( "unchecked" ) public final FluentModelImplT withoutTag ( String key ) { if ( this . inner ( ) . getTags ( ) != null ) { this . inner ( ) . getTags ( ) . remove ( key ) ; } return ( FluentModelImplT ) this ; } | Removes a tag from the resource . | 70 | 8 |
149,712 | public void load ( List < E > result ) { ++ pageCount ; if ( this . result == null || this . result . isEmpty ( ) ) { this . result = result ; } else { this . result . addAll ( result ) ; } } | This method is called by the client to load the most recent list of resources . This method should only be called by the service client . | 54 | 27 |
149,713 | public < T > Observable < T > delayedEmitAsync ( T event , int milliseconds ) { return Observable . just ( event ) . delay ( milliseconds , TimeUnit . MILLISECONDS , Schedulers . immediate ( ) ) ; } | Creates an observable that emits the given item after the specified time in milliseconds . | 53 | 16 |
149,714 | public static String [ ] randomResourceNames ( String prefix , int maxLen , int count ) { String [ ] names = new String [ count ] ; ResourceNamer resourceNamer = SdkContext . getResourceNamerFactory ( ) . createResourceNamer ( "" ) ; for ( int i = 0 ; i < count ; i ++ ) { names [ i ] = resourceNamer . randomName ( prefix , maxLen ) ; } return names ; } | Generates the specified number of random resource names with the same prefix . | 96 | 14 |
149,715 | public static < T > Observable < T > delayedEmitAsync ( T event , int milliseconds ) { return delayProvider . delayedEmitAsync ( event , milliseconds ) ; } | Wrapper delayed emission based on delayProvider . | 37 | 9 |
149,716 | @ Beta public MSICredentials withObjectId ( String objectId ) { this . objectId = objectId ; this . clientId = null ; this . identityId = null ; return this ; } | Specifies the object id associated with a user assigned managed service identity resource that should be used to retrieve the access token . | 42 | 24 |
149,717 | @ Beta public MSICredentials withIdentityId ( String identityId ) { this . identityId = identityId ; this . clientId = null ; this . objectId = null ; return this ; } | Specifies the ARM resource id of the user assigned managed service identity resource that should be used to retrieve the access token . | 43 | 24 |
149,718 | protected String addPostRunDependent ( TaskGroup . HasTaskGroup dependent ) { Objects . requireNonNull ( dependent ) ; this . taskGroup . addPostRunDependentTaskGroup ( dependent . taskGroup ( ) ) ; return dependent . taskGroup ( ) . key ( ) ; } | Add a post - run dependent for this model . | 60 | 10 |
149,719 | public static < T > PollingState < T > create ( Response < ResponseBody > response , LongRunningOperationOptions lroOptions , int defaultRetryTimeout , Type resourceType , SerializerAdapter < ? > serializerAdapter ) throws IOException { PollingState < T > pollingState = new PollingState <> ( ) ; pollingState . initialHttpMethod = response . raw ( ) . request ( ) . method ( ) ; pollingState . defaultRetryTimeout = defaultRetryTimeout ; pollingState . withResponse ( response ) ; pollingState . resourceType = resourceType ; pollingState . serializerAdapter = serializerAdapter ; pollingState . loggingContext = response . raw ( ) . request ( ) . header ( LOGGING_HEADER ) ; pollingState . finalStateVia = lroOptions . finalStateVia ( ) ; String responseContent = null ; PollingResource resource = null ; if ( response . body ( ) != null ) { responseContent = response . body ( ) . string ( ) ; response . body ( ) . close ( ) ; } if ( responseContent != null && ! responseContent . isEmpty ( ) ) { pollingState . resource = serializerAdapter . deserialize ( responseContent , resourceType ) ; resource = serializerAdapter . deserialize ( responseContent , PollingResource . class ) ; } final int statusCode = pollingState . response . code ( ) ; if ( resource != null && resource . properties != null && resource . properties . provisioningState != null ) { pollingState . withStatus ( resource . properties . provisioningState , statusCode ) ; } else { switch ( statusCode ) { case 202 : pollingState . withStatus ( AzureAsyncOperation . IN_PROGRESS_STATUS , statusCode ) ; break ; case 204 : case 201 : case 200 : pollingState . withStatus ( AzureAsyncOperation . SUCCESS_STATUS , statusCode ) ; break ; default : pollingState . withStatus ( AzureAsyncOperation . FAILED_STATUS , statusCode ) ; } } return pollingState ; } | Creates a polling state . | 436 | 6 |
149,720 | public static < ResultT > PollingState < ResultT > createFromJSONString ( String serializedPollingState ) { ObjectMapper mapper = initMapper ( new ObjectMapper ( ) ) ; PollingState < ResultT > pollingState ; try { pollingState = mapper . readValue ( serializedPollingState , PollingState . class ) ; } catch ( IOException exception ) { throw new RuntimeException ( exception ) ; } return pollingState ; } | Creates PollingState from the json string . | 100 | 10 |
149,721 | public static < ResultT > PollingState < ResultT > createFromPollingState ( PollingState < ? > other , ResultT result ) { PollingState < ResultT > pollingState = new PollingState <> ( ) ; pollingState . resource = result ; pollingState . initialHttpMethod = other . initialHttpMethod ( ) ; pollingState . status = other . status ( ) ; pollingState . statusCode = other . statusCode ( ) ; pollingState . azureAsyncOperationHeaderLink = other . azureAsyncOperationHeaderLink ( ) ; pollingState . locationHeaderLink = other . locationHeaderLink ( ) ; pollingState . putOrPatchResourceUri = other . putOrPatchResourceUri ( ) ; pollingState . defaultRetryTimeout = other . defaultRetryTimeout ; pollingState . retryTimeout = other . retryTimeout ; pollingState . loggingContext = other . loggingContext ; pollingState . finalStateVia = other . finalStateVia ; return pollingState ; } | Creates PollingState from another polling state . | 211 | 10 |
149,722 | void updateFromResponseOnPutPatch ( Response < ResponseBody > response ) throws CloudException , IOException { String responseContent = null ; if ( response . body ( ) != null ) { responseContent = response . body ( ) . string ( ) ; response . body ( ) . close ( ) ; } if ( responseContent == null || responseContent . isEmpty ( ) ) { throw new CloudException ( "polling response does not contain a valid body" , response ) ; } PollingResource resource = serializerAdapter . deserialize ( responseContent , PollingResource . class ) ; final int statusCode = response . code ( ) ; if ( resource != null && resource . properties != null && resource . properties . provisioningState != null ) { this . withStatus ( resource . properties . provisioningState , statusCode ) ; } else { this . withStatus ( AzureAsyncOperation . SUCCESS_STATUS , statusCode ) ; } CloudError error = new CloudError ( ) ; this . withErrorBody ( error ) ; error . withCode ( this . status ( ) ) ; error . withMessage ( "Long running operation failed" ) ; this . withResponse ( response ) ; this . withResource ( serializerAdapter . < T > deserialize ( responseContent , resourceType ) ) ; } | Updates the polling state from a PUT or PATCH operation . | 275 | 14 |
149,723 | void updateFromResponseOnDeletePost ( Response < ResponseBody > response ) throws IOException { this . withResponse ( response ) ; String responseContent = null ; if ( response . body ( ) != null ) { responseContent = response . body ( ) . string ( ) ; response . body ( ) . close ( ) ; } this . withResource ( serializerAdapter . < T > deserialize ( responseContent , resourceType ) ) ; withStatus ( AzureAsyncOperation . SUCCESS_STATUS , response . code ( ) ) ; } | Updates the polling state from a DELETE or POST operation . | 114 | 14 |
149,724 | PollingState < T > withStatus ( String status , int statusCode ) throws IllegalArgumentException { if ( status == null ) { throw new IllegalArgumentException ( "Status is null." ) ; } this . status = status ; this . statusCode = statusCode ; return this ; } | Sets the polling status . | 62 | 6 |
149,725 | PollingState < T > withResponse ( Response < ResponseBody > response ) { this . response = response ; withPollingUrlFromResponse ( response ) ; withPollingRetryTimeoutFromResponse ( response ) ; return this ; } | Sets the last operation response . | 49 | 7 |
149,726 | void throwCloudExceptionIfInFailedState ( ) { if ( this . isStatusFailed ( ) ) { if ( this . errorBody ( ) != null ) { throw new CloudException ( "Async operation failed with provisioning state: " + this . status ( ) , this . response ( ) , this . errorBody ( ) ) ; } else { throw new CloudException ( "Async operation failed with provisioning state: " + this . status ( ) , this . response ( ) ) ; } } } | If status is in failed state then throw CloudException . | 107 | 11 |
149,727 | static AzureAsyncOperation fromResponse ( SerializerAdapter < ? > serializerAdapter , Response < ResponseBody > response ) throws CloudException { AzureAsyncOperation asyncOperation = null ; String rawString = null ; if ( response . body ( ) != null ) { try { rawString = response . body ( ) . string ( ) ; asyncOperation = serializerAdapter . deserialize ( rawString , AzureAsyncOperation . class ) ; } catch ( IOException exception ) { // Exception will be handled below } finally { response . body ( ) . close ( ) ; } } if ( asyncOperation == null || asyncOperation . status ( ) == null ) { throw new CloudException ( "polling response does not contain a valid body: " + rawString , response ) ; } else { asyncOperation . rawString = rawString ; } return asyncOperation ; } | Creates AzureAsyncOperation from the given HTTP response . | 177 | 11 |
149,728 | public void setOwner ( Graph < DataT , NodeT > ownerGraph ) { if ( this . ownerGraph != null ) { throw new RuntimeException ( "Changing owner graph is not allowed" ) ; } this . ownerGraph = ownerGraph ; } | Sets reference to the graph owning this node . | 52 | 10 |
149,729 | protected void onFaultedResolution ( String dependencyKey , Throwable throwable ) { if ( toBeResolved == 0 ) { throw new RuntimeException ( "invalid state - " + this . key ( ) + ": The dependency '" + dependencyKey + "' is already reported or there is no such dependencyKey" ) ; } toBeResolved -- ; } | Reports a dependency of this node has been faulted . | 79 | 11 |
149,730 | public String userAgent ( ) { return String . format ( "Azure-SDK-For-Java/%s OS:%s MacAddressHash:%s Java:%s" , getClass ( ) . getPackage ( ) . getImplementationVersion ( ) , OS , MAC_ADDRESS_HASH , JAVA_VERSION ) ; } | The default User - Agent header . Override this method to override the user agent . | 77 | 17 |
149,731 | public static String groupFromResourceId ( String id ) { return ( id != null ) ? ResourceId . fromString ( id ) . resourceGroupName ( ) : null ; } | Extract resource group from a resource ID string . | 37 | 10 |
149,732 | public static String subscriptionFromResourceId ( String id ) { return ( id != null ) ? ResourceId . fromString ( id ) . subscriptionId ( ) : null ; } | Extract the subscription ID from a resource ID string . | 36 | 11 |
149,733 | public static String resourceProviderFromResourceId ( String id ) { return ( id != null ) ? ResourceId . fromString ( id ) . providerNamespace ( ) : null ; } | Extract resource provider from a resource ID string . | 38 | 10 |
149,734 | public static String resourceTypeFromResourceId ( String id ) { return ( id != null ) ? ResourceId . fromString ( id ) . resourceType ( ) : null ; } | Extract resource type from a resource ID string . | 37 | 10 |
149,735 | public static String extractFromResourceId ( String id , String identifier ) { if ( id == null || identifier == null ) { return id ; } Pattern pattern = Pattern . compile ( identifier + "/[-\\w._]+" ) ; Matcher matcher = pattern . matcher ( id ) ; if ( matcher . find ( ) ) { return matcher . group ( ) . split ( "/" ) [ 1 ] ; } else { return null ; } } | Extract information from a resource ID string with the resource type as the identifier . | 97 | 16 |
149,736 | public static String nameFromResourceId ( String id ) { return ( id != null ) ? ResourceId . fromString ( id ) . name ( ) : null ; } | Extract name of the resource from a resource ID . | 35 | 11 |
149,737 | public static String constructResourceId ( final String subscriptionId , final String resourceGroupName , final String resourceProviderNamespace , final String resourceType , final String resourceName , final String parentResourcePath ) { String prefixedParentPath = parentResourcePath ; if ( parentResourcePath != null && ! parentResourcePath . isEmpty ( ) ) { prefixedParentPath = "/" + parentResourcePath ; } return String . format ( "/subscriptions/%s/resourcegroups/%s/providers/%s%s/%s/%s" , subscriptionId , resourceGroupName , resourceProviderNamespace , prefixedParentPath , resourceType , resourceName ) ; } | Creates a resource ID from information of a generic resource . | 143 | 12 |
149,738 | private < T > ServiceResponse < T > getPutOrPatchResult ( Observable < Response < ResponseBody > > observable , Type resourceType ) throws CloudException , InterruptedException , IOException { Observable < ServiceResponse < T >> asyncObservable = getPutOrPatchResultAsync ( observable , resourceType ) ; return asyncObservable . toBlocking ( ) . last ( ) ; } | Handles an initial response from a PUT or PATCH operation response by polling the status of the operation until the long running operation terminates . | 84 | 29 |
149,739 | public < T > Observable < ServiceResponse < T > > getPutOrPatchResultAsync ( Observable < Response < ResponseBody > > observable , final Type resourceType ) { return this . < T > beginPutOrPatchAsync ( observable , resourceType ) . toObservable ( ) . flatMap ( new Func1 < PollingState < T > , Observable < PollingState < T > > > ( ) { @ Override public Observable < PollingState < T > > call ( PollingState < T > pollingState ) { return pollPutOrPatchAsync ( pollingState , resourceType ) ; } } ) . last ( ) . map ( new Func1 < PollingState < T > , ServiceResponse < T > > ( ) { @ Override public ServiceResponse < T > call ( PollingState < T > pollingState ) { return new ServiceResponse <> ( pollingState . resource ( ) , pollingState . response ( ) ) ; } } ) ; } | Handles an initial response from a PUT or PATCH operation response by polling the status of the operation asynchronously once the operation finishes emits the final response . | 210 | 33 |
149,740 | private < T > Observable < PollingState < T > > updateStateFromLocationHeaderOnPutAsync ( final PollingState < T > pollingState ) { return pollAsync ( pollingState . locationHeaderLink ( ) , pollingState . loggingContext ( ) ) . flatMap ( new Func1 < Response < ResponseBody > , Observable < PollingState < T > > > ( ) { @ Override public Observable < PollingState < T > > call ( Response < ResponseBody > response ) { int statusCode = response . code ( ) ; if ( statusCode == 202 ) { pollingState . withResponse ( response ) ; pollingState . withStatus ( AzureAsyncOperation . IN_PROGRESS_STATUS , statusCode ) ; } else if ( statusCode == 200 || statusCode == 201 ) { try { pollingState . updateFromResponseOnPutPatch ( response ) ; } catch ( CloudException | IOException e ) { return Observable . error ( e ) ; } } return Observable . just ( pollingState ) ; } } ) ; } | Polls from the location header and updates the polling state with the polling response for a PUT operation . | 225 | 21 |
149,741 | private < T > Observable < PollingState < T > > updateStateFromGetResourceOperationAsync ( final PollingState < T > pollingState , String url ) { return pollAsync ( url , pollingState . loggingContext ( ) ) . flatMap ( new Func1 < Response < ResponseBody > , Observable < PollingState < T > > > ( ) { @ Override public Observable < PollingState < T > > call ( Response < ResponseBody > response ) { try { pollingState . updateFromResponseOnPutPatch ( response ) ; return Observable . just ( pollingState ) ; } catch ( CloudException | IOException e ) { return Observable . error ( e ) ; } } } ) ; } | Polls from the provided URL and updates the polling state with the polling response . | 154 | 16 |
149,742 | private Observable < Response < ResponseBody > > pollAsync ( String url , String loggingContext ) { URL endpoint ; try { endpoint = new URL ( url ) ; } catch ( MalformedURLException e ) { return Observable . error ( e ) ; } AsyncService service = restClient ( ) . retrofit ( ) . create ( AsyncService . class ) ; if ( loggingContext != null && ! loggingContext . endsWith ( " (poll)" ) ) { loggingContext += " (poll)" ; } return service . get ( endpoint . getFile ( ) , serviceClientUserAgent , loggingContext ) . flatMap ( new Func1 < Response < ResponseBody > , Observable < Response < ResponseBody > > > ( ) { @ Override public Observable < Response < ResponseBody > > call ( Response < ResponseBody > response ) { RuntimeException exception = createExceptionFromResponse ( response , 200 , 201 , 202 , 204 ) ; if ( exception != null ) { return Observable . error ( exception ) ; } else { return Observable . just ( response ) ; } } } ) ; } | Polls from the URL provided . | 235 | 7 |
149,743 | public Indexable taskResult ( String taskId ) { TaskGroupEntry < TaskItem > taskGroupEntry = super . getNode ( taskId ) ; if ( taskGroupEntry != null ) { return taskGroupEntry . taskResult ( ) ; } if ( ! this . proxyTaskGroupWrapper . isActive ( ) ) { throw new IllegalArgumentException ( "A dependency task with id '" + taskId + "' is not found" ) ; } taskGroupEntry = this . proxyTaskGroupWrapper . proxyTaskGroup . getNode ( taskId ) ; if ( taskGroupEntry != null ) { return taskGroupEntry . taskResult ( ) ; } throw new IllegalArgumentException ( "A dependency task or 'post-run' dependent task with with id '" + taskId + "' not found" ) ; } | Retrieve the result produced by a task with the given id in the group . | 173 | 16 |
149,744 | public String addDependency ( FunctionalTaskItem dependencyTaskItem ) { IndexableTaskItem dependency = IndexableTaskItem . create ( dependencyTaskItem ) ; this . addDependency ( dependency ) ; return dependency . key ( ) ; } | Mark root of this task task group depends on the given TaskItem . This ensure this task group s root get picked for execution only after the completion of invocation of provided TaskItem . | 51 | 36 |
149,745 | public void addDependencyTaskGroup ( TaskGroup dependencyTaskGroup ) { if ( dependencyTaskGroup . proxyTaskGroupWrapper . isActive ( ) ) { dependencyTaskGroup . proxyTaskGroupWrapper . addDependentTaskGroup ( this ) ; } else { DAGraph < TaskItem , TaskGroupEntry < TaskItem > > dependencyGraph = dependencyTaskGroup ; super . addDependencyGraph ( dependencyGraph ) ; } } | Mark root of this task task group depends on the given task group s root . This ensure this task group s root get picked for execution only after the completion of all tasks in the given group . | 92 | 39 |
149,746 | public String addPostRunDependent ( FunctionalTaskItem dependentTaskItem ) { IndexableTaskItem taskItem = IndexableTaskItem . create ( dependentTaskItem ) ; this . addPostRunDependent ( taskItem ) ; return taskItem . key ( ) ; } | Mark the given TaskItem depends on this taskGroup . | 56 | 11 |
149,747 | private Observable < Indexable > invokeReadyTasksAsync ( final InvocationContext context ) { TaskGroupEntry < TaskItem > readyTaskEntry = super . getNext ( ) ; final List < Observable < Indexable > > observables = new ArrayList <> ( ) ; // Enumerate the ready tasks (those with dependencies resolved) and kickoff them concurrently // while ( readyTaskEntry != null ) { final TaskGroupEntry < TaskItem > currentEntry = readyTaskEntry ; final TaskItem currentTaskItem = currentEntry . data ( ) ; if ( currentTaskItem instanceof ProxyTaskItem ) { observables . add ( invokeAfterPostRunAsync ( currentEntry , context ) ) ; } else { observables . add ( invokeTaskAsync ( currentEntry , context ) ) ; } readyTaskEntry = super . getNext ( ) ; } return Observable . mergeDelayError ( observables ) ; } | Invokes the ready tasks . | 191 | 6 |
149,748 | private Observable < Indexable > processFaultedTaskAsync ( final TaskGroupEntry < TaskItem > faultedEntry , final Throwable throwable , final InvocationContext context ) { markGroupAsCancelledIfTerminationStrategyIsIPTC ( ) ; reportError ( faultedEntry , throwable ) ; if ( isRootEntry ( faultedEntry ) ) { if ( shouldPropagateException ( throwable ) ) { return toErrorObservable ( throwable ) ; } return Observable . empty ( ) ; } else if ( shouldPropagateException ( throwable ) ) { return Observable . concatDelayError ( invokeReadyTasksAsync ( context ) , toErrorObservable ( throwable ) ) ; } else { return invokeReadyTasksAsync ( context ) ; } } | Handles a faulted task . | 170 | 7 |
149,749 | @ Override public boolean shouldRetry ( int retryCount , Response response ) { int code = response . code ( ) ; //CHECKSTYLE IGNORE MagicNumber FOR NEXT 2 LINES return retryCount < this . retryCount && ( code == 408 || ( code >= 500 && code != 501 && code != 505 ) ) ; } | Returns if a request should be retried based on the retry count current response and the current strategy . | 73 | 21 |
149,750 | @ Beta ( SinceVersion . V1_1_0 ) public void close ( ) { httpClient . dispatcher ( ) . executorService ( ) . shutdown ( ) ; httpClient . connectionPool ( ) . evictAll ( ) ; synchronized ( httpClient . connectionPool ( ) ) { httpClient . connectionPool ( ) . notifyAll ( ) ; } synchronized ( AsyncTimeout . class ) { AsyncTimeout . class . notifyAll ( ) ; } } | Closes the HTTP client and recycles the resources associated . The threads will be recycled after 60 seconds of inactivity . | 96 | 24 |
149,751 | public static < InnerT > PagedList < InnerT > convertToPagedList ( List < InnerT > list ) { PageImpl < InnerT > page = new PageImpl <> ( ) ; page . setItems ( list ) ; page . setNextPageLink ( null ) ; return new PagedList < InnerT > ( page ) { @ Override public Page < InnerT > nextPage ( String nextPageLink ) { return null ; } } ; } | Converts the List to PagedList . | 99 | 9 |
149,752 | public static < InnerT > Observable < InnerT > convertListToInnerAsync ( Observable < List < InnerT > > innerList ) { return innerList . flatMap ( new Func1 < List < InnerT > , Observable < InnerT > > ( ) { @ Override public Observable < InnerT > call ( List < InnerT > inners ) { return Observable . from ( inners ) ; } } ) ; } | Converts Observable of list to Observable of Inner . | 96 | 12 |
149,753 | public static < InnerT > Observable < InnerT > convertPageToInnerAsync ( Observable < Page < InnerT > > innerPage ) { return innerPage . flatMap ( new Func1 < Page < InnerT > , Observable < InnerT > > ( ) { @ Override public Observable < InnerT > call ( Page < InnerT > pageInner ) { return Observable . from ( pageInner . items ( ) ) ; } } ) ; } | Converts Observable of page to Observable of Inner . | 102 | 12 |
149,754 | public void add ( final IndexableTaskItem taskItem ) { this . dependsOnTaskGroup . addPostRunDependentTaskGroup ( taskItem . taskGroup ( ) ) ; this . collection . add ( taskItem ) ; } | Adds a Post Run task to the collection . | 48 | 9 |
149,755 | public Eval < UploadResult > putAsync ( String key , Object value ) { return Eval . later ( ( ) -> put ( key , value ) ) . map ( t -> t . orElse ( null ) ) . map ( FluentFunctions . ofChecked ( up -> up . waitForUploadResult ( ) ) ) ; } | Non - blocking call that will throw any Exceptions in the traditional manner on access | 70 | 16 |
149,756 | public Future < PutObjectResult > putAsync ( String key , String value ) { return Future . of ( ( ) -> put ( key , value ) , this . uploadService ) . flatMap ( t -> t . fold ( p -> Future . ofResult ( p ) , e -> Future . ofError ( e ) ) ) ; } | Non - blocking call | 70 | 4 |
149,757 | public static < T > void finish ( T query , long correlationId , EventBus bus , String ... labels ) { for ( String type : labels ) { RemoveLabelledQuery < T > next = finish ( query , correlationId , type ) ; bus . post ( next ) ; } } | Publish finish events for each of the specified query labels | 60 | 11 |
149,758 | public static < T > AddQuery < T > start ( T query , long correlationId ) { return start ( query , correlationId , "default" , null ) ; } | Marks the start of a query identified by the provided correlationId | 36 | 13 |
149,759 | public static < T > void finish ( T query , long correlationId , EventBus bus , String ... types ) { for ( String type : types ) { RemoveQuery < T > next = finish ( query , correlationId , type ) ; bus . post ( next ) ; } } | Publish finish events for each of the specified query types | 58 | 11 |
149,760 | public Try < R , Throwable > execute ( T input ) { return Try . withCatch ( ( ) -> transactionTemplate . execute ( status -> transaction . apply ( input ) ) ) ; } | Execute the transactional flow - catch all exceptions | 41 | 10 |
149,761 | public < Ex extends Throwable > Try < R , Ex > execute ( T input , Class < Ex > classes ) { return Try . withCatch ( ( ) -> transactionTemplate . execute ( status -> transaction . apply ( input ) ) , classes ) ; } | Execute the transactional flow - catch only specified exceptions | 54 | 11 |
149,762 | public Column getColumn ( String columnName ) { if ( columnName == null ) { return null ; } for ( Column column : columns ) { if ( columnName . equals ( column . getData ( ) ) ) { return column ; } } return null ; } | Find a column by its name | 55 | 6 |
149,763 | public void addColumn ( String columnName , boolean searchable , boolean orderable , String searchValue ) { this . columns . add ( new Column ( columnName , "" , searchable , orderable , new Search ( searchValue , false ) ) ) ; } | Add a new column | 54 | 4 |
149,764 | public void addOrder ( String columnName , boolean ascending ) { if ( columnName == null ) { return ; } for ( int i = 0 ; i < columns . size ( ) ; i ++ ) { if ( ! columnName . equals ( columns . get ( i ) . getData ( ) ) ) { continue ; } order . add ( new Order ( i , ascending ? "asc" : "desc" ) ) ; } } | Add an order on the given column | 91 | 7 |
149,765 | public Model interpolateModel ( Model model , File projectDir , ModelBuildingRequest config , ModelProblemCollector problems ) { interpolateObject ( model , model , projectDir , config , problems ) ; return model ; } | Empirical data from 3 . x actual = 40 | 45 | 12 |
149,766 | public String interpolate ( String input , RecursionInterceptor recursionInterceptor ) throws InterpolationException { try { return interpolate ( input , recursionInterceptor , new HashSet < String > ( ) ) ; } finally { if ( ! cacheAnswers ) { existingAnswers . clear ( ) ; } } } | Entry point for recursive resolution of an expression and all of its nested expressions . | 68 | 15 |
149,767 | public List getFeedback ( ) { List < ? > messages = new ArrayList ( ) ; for ( ValueSource vs : valueSources ) { List feedback = vs . getFeedback ( ) ; if ( feedback != null && ! feedback . isEmpty ( ) ) { messages . addAll ( feedback ) ; } } return messages ; } | Return any feedback messages and errors that were generated - but suppressed - during the interpolation process . Since unresolvable expressions will be left in the source string as - is this feedback is optional and will only be useful for debugging interpolation problems . | 70 | 49 |
149,768 | public ModelSource resolveModel ( Parent parent ) throws UnresolvableModelException { Dependency parentDependency = new Dependency ( ) ; parentDependency . setGroupId ( parent . getGroupId ( ) ) ; parentDependency . setArtifactId ( parent . getArtifactId ( ) ) ; parentDependency . setVersion ( parent . getVersion ( ) ) ; parentDependency . setClassifier ( "" ) ; parentDependency . setType ( "pom" ) ; Artifact parentArtifact = null ; try { Iterable < ArtifactResult > artifactResults = depencencyResolver . resolveDependencies ( projectBuildingRequest , singleton ( parentDependency ) , null , null ) ; Iterator < ArtifactResult > iterator = artifactResults . iterator ( ) ; if ( iterator . hasNext ( ) ) { parentArtifact = iterator . next ( ) . getArtifact ( ) ; } } catch ( DependencyResolverException e ) { throw new UnresolvableModelException ( e . getMessage ( ) , parent . getGroupId ( ) , parent . getArtifactId ( ) , parent . getVersion ( ) , e ) ; } return resolveModel ( parentArtifact . getGroupId ( ) , parentArtifact . getArtifactId ( ) , parentArtifact . getVersion ( ) ) ; } | Resolves the POM for the specified parent . | 290 | 10 |
149,769 | protected String extractHeaderComment ( File xmlFile ) throws MojoExecutionException { try { SAXParser parser = SAXParserFactory . newInstance ( ) . newSAXParser ( ) ; SaxHeaderCommentHandler handler = new SaxHeaderCommentHandler ( ) ; parser . setProperty ( "http://xml.org/sax/properties/lexical-handler" , handler ) ; parser . parse ( xmlFile , handler ) ; return handler . getHeaderComment ( ) ; } catch ( Exception e ) { throw new MojoExecutionException ( "Failed to parse XML from " + xmlFile , e ) ; } } | This method extracts the XML header comment if available . | 132 | 10 |
149,770 | protected Model createFlattenedPom ( File pomFile ) throws MojoExecutionException , MojoFailureException { ModelBuildingRequest buildingRequest = createModelBuildingRequest ( pomFile ) ; Model effectivePom = createEffectivePom ( buildingRequest , isEmbedBuildProfileDependencies ( ) , this . flattenMode ) ; Model flattenedPom = new Model ( ) ; // keep original encoding (we could also normalize to UTF-8 here) String modelEncoding = effectivePom . getModelEncoding ( ) ; if ( StringUtils . isEmpty ( modelEncoding ) ) { modelEncoding = "UTF-8" ; } flattenedPom . setModelEncoding ( modelEncoding ) ; Model cleanPom = createCleanPom ( effectivePom ) ; FlattenDescriptor descriptor = getFlattenDescriptor ( ) ; Model originalPom = this . project . getOriginalModel ( ) ; Model resolvedPom = this . project . getModel ( ) ; Model interpolatedPom = createResolvedPom ( buildingRequest ) ; // copy the configured additional POM elements... for ( PomProperty < ? > property : PomProperty . getPomProperties ( ) ) { if ( property . isElement ( ) ) { Model sourceModel = getSourceModel ( descriptor , property , effectivePom , originalPom , resolvedPom , interpolatedPom , cleanPom ) ; if ( sourceModel == null ) { if ( property . isRequired ( ) ) { throw new MojoFailureException ( "Property " + property . getName ( ) + " is required and can not be removed!" ) ; } } else { property . copy ( sourceModel , flattenedPom ) ; } } } return flattenedPom ; } | This method creates the flattened POM what is the main task of this plugin . | 377 | 16 |
149,771 | public final int toCodePoints ( char [ ] src , int srcOff , int srcLen , int [ ] dest , int destOff ) { if ( srcLen < 0 ) { throw new IllegalArgumentException ( "srcLen must be >= 0" ) ; } int codePointCount = 0 ; for ( int i = 0 ; i < srcLen ; ) { final int cp = codePointAt ( src , srcOff + i , srcOff + srcLen ) ; final int charCount = Character . charCount ( cp ) ; dest [ destOff + codePointCount ++ ] = cp ; i += charCount ; } return codePointCount ; } | Converts a sequence of Java characters to a sequence of unicode code points . | 137 | 16 |
149,772 | public final int toChars ( int [ ] src , int srcOff , int srcLen , char [ ] dest , int destOff ) { if ( srcLen < 0 ) { throw new IllegalArgumentException ( "srcLen must be >= 0" ) ; } int written = 0 ; for ( int i = 0 ; i < srcLen ; ++ i ) { written += Character . toChars ( src [ srcOff + i ] , dest , destOff + written ) ; } return written ; } | Converts a sequence of unicode code points to a sequence of Java characters . | 106 | 16 |
149,773 | public static List < Sentence > splitSentences ( CharSequence text ) { return JavaConversions . seqAsJavaList ( TwitterKoreanProcessor . splitSentences ( text ) ) ; } | Split input text into sentences . | 42 | 6 |
149,774 | public static List < KoreanPhraseExtractor . KoreanPhrase > extractPhrases ( Seq < KoreanToken > tokens , boolean filterSpam , boolean includeHashtags ) { return JavaConversions . seqAsJavaList ( TwitterKoreanProcessor . extractPhrases ( tokens , filterSpam , includeHashtags ) ) ; } | Extract phrases from Korean input text | 72 | 7 |
149,775 | public static String detokenize ( List < String > tokens ) { return TwitterKoreanProcessor . detokenize ( JavaConversions . iterableAsScalaIterable ( tokens ) ) ; } | Detokenize the input list of words . | 42 | 9 |
149,776 | public ConverterServerBuilder baseUri ( String baseUri ) { checkNotNull ( baseUri ) ; this . baseUri = URI . create ( baseUri ) ; return this ; } | Specifies the base URI of this conversion server . | 43 | 10 |
149,777 | public ConverterServerBuilder workerPool ( int corePoolSize , int maximumPoolSize , long keepAliveTime , TimeUnit unit ) { assertNumericArgument ( corePoolSize , true ) ; assertNumericArgument ( maximumPoolSize , true ) ; assertNumericArgument ( corePoolSize + maximumPoolSize , false ) ; assertNumericArgument ( keepAliveTime , true ) ; this . corePoolSize = corePoolSize ; this . maximumPoolSize = maximumPoolSize ; this . keepAliveTime = unit . toMillis ( keepAliveTime ) ; return this ; } | Configures a worker pool for the converter . | 129 | 9 |
149,778 | public ConverterServerBuilder requestTimeout ( long timeout , TimeUnit unit ) { assertNumericArgument ( timeout , true ) ; this . requestTimeout = unit . toMillis ( timeout ) ; return this ; } | Specifies the timeout for a network request . | 45 | 9 |
149,779 | public ConverterServerBuilder processTimeout ( long processTimeout , TimeUnit timeUnit ) { assertNumericArgument ( processTimeout , false ) ; this . processTimeout = timeUnit . toMillis ( processTimeout ) ; return this ; } | Returns the specified process time out in milliseconds . | 50 | 9 |
149,780 | public HttpServer build ( ) { checkNotNull ( baseUri ) ; StandaloneWebConverterConfiguration configuration = makeConfiguration ( ) ; // The configuration has to be configured both by a binder to make it injectable // and directly in order to trigger life cycle methods on the deployment container. ResourceConfig resourceConfig = ResourceConfig . forApplication ( new WebConverterApplication ( configuration ) ) . register ( configuration ) ; if ( sslContext == null ) { return GrizzlyHttpServerFactory . createHttpServer ( baseUri , resourceConfig ) ; } else { return GrizzlyHttpServerFactory . createHttpServer ( baseUri , resourceConfig , true , new SSLEngineConfigurator ( sslContext ) ) ; } } | Creates the conversion server that is specified by this builder . | 158 | 12 |
149,781 | @ UiThread public int getParentAdapterPosition ( ) { int flatPosition = getAdapterPosition ( ) ; if ( flatPosition == RecyclerView . NO_POSITION ) { return flatPosition ; } return mExpandableAdapter . getNearestParentPosition ( flatPosition ) ; } | Returns the adapter position of the Parent associated with this ParentViewHolder | 62 | 14 |
149,782 | @ UiThread protected void expandView ( ) { setExpanded ( true ) ; onExpansionToggled ( false ) ; if ( mParentViewHolderExpandCollapseListener != null ) { mParentViewHolderExpandCollapseListener . onParentExpanded ( getAdapterPosition ( ) ) ; } } | Triggers expansion of the parent . | 69 | 8 |
149,783 | @ UiThread protected void collapseView ( ) { setExpanded ( false ) ; onExpansionToggled ( true ) ; if ( mParentViewHolderExpandCollapseListener != null ) { mParentViewHolderExpandCollapseListener . onParentCollapsed ( getAdapterPosition ( ) ) ; } } | Triggers collapse of the parent . | 69 | 8 |
149,784 | @ UiThread protected void parentExpandedFromViewHolder ( int flatParentPosition ) { ExpandableWrapper < P , C > parentWrapper = mFlatItemList . get ( flatParentPosition ) ; updateExpandedParent ( parentWrapper , flatParentPosition , true ) ; } | Called when a ParentViewHolder has triggered an expansion for it s parent | 63 | 16 |
149,785 | @ UiThread protected void parentCollapsedFromViewHolder ( int flatParentPosition ) { ExpandableWrapper < P , C > parentWrapper = mFlatItemList . get ( flatParentPosition ) ; updateCollapsedParent ( parentWrapper , flatParentPosition , true ) ; } | Called when a ParentViewHolder has triggered a collapse for it s parent | 63 | 16 |
149,786 | @ UiThread public void expandParentRange ( int startParentPosition , int parentCount ) { int endParentPosition = startParentPosition + parentCount ; for ( int i = startParentPosition ; i < endParentPosition ; i ++ ) { expandParent ( i ) ; } } | Expands all parents in a range of indices in the list of parents . | 59 | 15 |
149,787 | @ UiThread public void collapseParentRange ( int startParentPosition , int parentCount ) { int endParentPosition = startParentPosition + parentCount ; for ( int i = startParentPosition ; i < endParentPosition ; i ++ ) { collapseParent ( i ) ; } } | Collapses all parents in a range of indices in the list of parents . | 59 | 15 |
149,788 | private List < ExpandableWrapper < P , C > > generateFlattenedParentChildList ( List < P > parentList ) { List < ExpandableWrapper < P , C > > flatItemList = new ArrayList <> ( ) ; int parentCount = parentList . size ( ) ; for ( int i = 0 ; i < parentCount ; i ++ ) { P parent = parentList . get ( i ) ; generateParentWrapper ( flatItemList , parent , parent . isInitiallyExpanded ( ) ) ; } return flatItemList ; } | Generates a full list of all parents and their children in order . | 119 | 14 |
149,789 | private List < ExpandableWrapper < P , C > > generateFlattenedParentChildList ( List < P > parentList , Map < P , Boolean > savedLastExpansionState ) { List < ExpandableWrapper < P , C > > flatItemList = new ArrayList <> ( ) ; int parentCount = parentList . size ( ) ; for ( int i = 0 ; i < parentCount ; i ++ ) { P parent = parentList . get ( i ) ; Boolean lastExpandedState = savedLastExpansionState . get ( parent ) ; boolean shouldExpand = lastExpandedState == null ? parent . isInitiallyExpanded ( ) : lastExpandedState ; generateParentWrapper ( flatItemList , parent , shouldExpand ) ; } return flatItemList ; } | Generates a full list of all parents and their children in order . Uses Map to preserve last expanded state . | 169 | 22 |
149,790 | @ NonNull @ UiThread private HashMap < Integer , Boolean > generateExpandedStateMap ( ) { HashMap < Integer , Boolean > parentHashMap = new HashMap <> ( ) ; int childCount = 0 ; int listItemCount = mFlatItemList . size ( ) ; for ( int i = 0 ; i < listItemCount ; i ++ ) { if ( mFlatItemList . get ( i ) != null ) { ExpandableWrapper < P , C > listItem = mFlatItemList . get ( i ) ; if ( listItem . isParent ( ) ) { parentHashMap . put ( i - childCount , listItem . isExpanded ( ) ) ; } else { childCount ++ ; } } } return parentHashMap ; } | Generates a HashMap used to store expanded state for items in the list on configuration change or whenever onResume is called . | 167 | 26 |
149,791 | @ UiThread private int getFlatParentPosition ( int parentPosition ) { int parentCount = 0 ; int listItemCount = mFlatItemList . size ( ) ; for ( int i = 0 ; i < listItemCount ; i ++ ) { if ( mFlatItemList . get ( i ) . isParent ( ) ) { parentCount ++ ; if ( parentCount > parentPosition ) { return i ; } } } return INVALID_FLAT_POSITION ; } | Gets the index of a ExpandableWrapper within the helper item list based on the index of the ExpandableWrapper . | 105 | 26 |
149,792 | @ UiThread public int getParentAdapterPosition ( ) { int flatPosition = getAdapterPosition ( ) ; if ( mExpandableAdapter == null || flatPosition == RecyclerView . NO_POSITION ) { return RecyclerView . NO_POSITION ; } return mExpandableAdapter . getNearestParentPosition ( flatPosition ) ; } | Returns the adapter position of the Parent associated with this ChildViewHolder | 77 | 14 |
149,793 | @ UiThread public int getChildAdapterPosition ( ) { int flatPosition = getAdapterPosition ( ) ; if ( mExpandableAdapter == null || flatPosition == RecyclerView . NO_POSITION ) { return RecyclerView . NO_POSITION ; } return mExpandableAdapter . getChildPosition ( flatPosition ) ; } | Returns the adapter position of the Child associated with this ChildViewHolder | 75 | 14 |
149,794 | public static String fillLogParams ( String sql , Map < Object , Object > logParams ) { StringBuilder result = new StringBuilder ( ) ; Map < Object , Object > tmpLogParam = ( logParams == null ? new HashMap < Object , Object > ( ) : logParams ) ; Iterator < Object > it = tmpLogParam . values ( ) . iterator ( ) ; boolean inQuote = false ; boolean inQuote2 = false ; char [ ] sqlChar = sql != null ? sql . toCharArray ( ) : new char [ ] { } ; for ( int i = 0 ; i < sqlChar . length ; i ++ ) { if ( sqlChar [ i ] == ' ' ) { inQuote = ! inQuote ; } if ( sqlChar [ i ] == ' ' ) { inQuote2 = ! inQuote2 ; } if ( sqlChar [ i ] == ' ' && ! ( inQuote || inQuote2 ) ) { if ( it . hasNext ( ) ) { result . append ( prettyPrint ( it . next ( ) ) ) ; } else { result . append ( ' ' ) ; } } else { result . append ( sqlChar [ i ] ) ; } } return result . toString ( ) ; } | Returns sql statement used in this prepared statement together with the parameters . | 266 | 13 |
149,795 | protected static void sendInitSQL ( Connection connection , String initSQL ) throws SQLException { // fetch any configured setup sql. if ( initSQL != null ) { Statement stmt = null ; try { stmt = connection . createStatement ( ) ; stmt . execute ( initSQL ) ; if ( testSupport ) { // only to aid code coverage, normally set to false stmt = null ; } } finally { if ( stmt != null ) { stmt . close ( ) ; } } } } | Sends out the SQL as defined in the config upon first init of the connection . | 107 | 17 |
149,796 | public void close ( ) throws SQLException { try { if ( this . resetConnectionOnClose /*FIXME: && !getAutoCommit() && !isTxResolved() */ ) { /*if (this.autoCommitStackTrace != null){ logger.debug(this.autoCommitStackTrace); this.autoCommitStackTrace = null; } else { logger.debug(DISABLED_AUTO_COMMIT_WARNING); }*/ rollback ( ) ; if ( ! getAutoCommit ( ) ) { setAutoCommit ( true ) ; } } if ( this . logicallyClosed . compareAndSet ( false , true ) ) { if ( this . threadWatch != null ) { this . threadWatch . interrupt ( ) ; // if we returned the connection to the pool, terminate thread watch thread if it's // running even if thread is still alive (eg thread has been recycled for use in some // container). this . threadWatch = null ; } if ( this . closeOpenStatements ) { for ( Entry < Statement , String > statementEntry : this . trackedStatement . entrySet ( ) ) { statementEntry . getKey ( ) . close ( ) ; if ( this . detectUnclosedStatements ) { logger . warn ( String . format ( UNCLOSED_LOG_ERROR_MESSAGE , statementEntry . getValue ( ) ) ) ; } } this . trackedStatement . clear ( ) ; } if ( ! this . connectionTrackingDisabled ) { pool . getFinalizableRefs ( ) . remove ( this . connection ) ; } ConnectionHandle handle = null ; //recreate can throw a SQLException in constructor on recreation try { handle = this . recreateConnectionHandle ( ) ; this . pool . connectionStrategy . cleanupConnection ( this , handle ) ; this . pool . releaseConnection ( handle ) ; } catch ( SQLException e ) { //check if the connection was already closed by the recreation if ( ! isClosed ( ) ) { this . pool . connectionStrategy . cleanupConnection ( this , handle ) ; this . pool . releaseConnection ( this ) ; } throw e ; } if ( this . doubleCloseCheck ) { this . doubleCloseException = this . pool . captureStackTrace ( CLOSED_TWICE_EXCEPTION_MESSAGE ) ; } } else { if ( this . doubleCloseCheck && this . doubleCloseException != null ) { String currentLocation = this . pool . captureStackTrace ( "Last closed trace from thread [" + Thread . currentThread ( ) . getName ( ) + "]:\n" ) ; logger . error ( String . format ( LOG_ERROR_MESSAGE , this . doubleCloseException , currentLocation ) ) ; } } } catch ( SQLException e ) { throw markPossiblyBroken ( e ) ; } } | Release the connection back to the pool . | 611 | 8 |
149,797 | protected void internalClose ( ) throws SQLException { try { clearStatementCaches ( true ) ; if ( this . connection != null ) { // safety! this . connection . close ( ) ; if ( ! this . connectionTrackingDisabled && this . finalizableRefs != null ) { this . finalizableRefs . remove ( this . connection ) ; } } this . logicallyClosed . set ( true ) ; } catch ( SQLException e ) { throw markPossiblyBroken ( e ) ; } } | Close off the connection . | 112 | 5 |
149,798 | protected void clearStatementCaches ( boolean internalClose ) { if ( this . statementCachingEnabled ) { // safety if ( internalClose ) { this . callableStatementCache . clear ( ) ; this . preparedStatementCache . clear ( ) ; } else { if ( this . pool . closeConnectionWatch ) { // debugging enabled? this . callableStatementCache . checkForProperClosure ( ) ; this . preparedStatementCache . checkForProperClosure ( ) ; } } } } | Clears out the statement handles . | 102 | 7 |
149,799 | public Object getProxyTarget ( ) { try { return Proxy . getInvocationHandler ( this . connection ) . invoke ( null , this . getClass ( ) . getMethod ( "getProxyTarget" ) , null ) ; } catch ( Throwable t ) { throw new RuntimeException ( "BoneCP: Internal error - transaction replay log is not turned on?" , t ) ; } } | This method will be intercepted by the proxy if it is enabled to return the internal target . | 81 | 18 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.