idx
int64
0
165k
question
stringlengths
73
5.81k
target
stringlengths
5
918
150,000
public static < T > Observable < T > delayedEmitAsync ( T event , int milliseconds ) { return delayProvider . delayedEmitAsync ( event , milliseconds ) ; }
Wrapper delayed emission based on delayProvider .
150,001
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 .
150,002
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 .
150,003
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 .
150,004
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 . initial...
Creates a polling state .
150,005
public static < ResultT > PollingState < ResultT > createFromJSONString ( String serializedPollingState ) { ObjectMapper mapper = initMapper ( new ObjectMapper ( ) ) ; PollingState < ResultT > pollingState ; try { pollingState = mapper . readValue ( serializedPollingState , PollingState . class ) ; } catch ( IOExceptio...
Creates PollingState from the json string .
150,006
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...
Creates PollingState from another polling state .
150,007
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 . i...
Updates the polling state from a PUT or PATCH operation .
150,008
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 ( serialize...
Updates the polling state from a DELETE or POST operation .
150,009
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 .
150,010
PollingState < T > withResponse ( Response < ResponseBody > response ) { this . response = response ; withPollingUrlFromResponse ( response ) ; withPollingRetryTimeoutFromResponse ( response ) ; return this ; }
Sets the last operation response .
150,011
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 f...
If status is in failed state then throw CloudException .
150,012
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 ( ) ; asyncOperatio...
Creates AzureAsyncOperation from the given HTTP response .
150,013
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 .
150,014
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 .
150,015
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 .
150,016
public static String groupFromResourceId ( String id ) { return ( id != null ) ? ResourceId . fromString ( id ) . resourceGroupName ( ) : null ; }
Extract resource group from a resource ID string .
150,017
public static String subscriptionFromResourceId ( String id ) { return ( id != null ) ? ResourceId . fromString ( id ) . subscriptionId ( ) : null ; }
Extract the subscription ID from a resource ID string .
150,018
public static String resourceProviderFromResourceId ( String id ) { return ( id != null ) ? ResourceId . fromString ( id ) . providerNamespace ( ) : null ; }
Extract resource provider from a resource ID string .
150,019
public static String resourceTypeFromResourceId ( String id ) { return ( id != null ) ? ResourceId . fromString ( id ) . resourceType ( ) : null ; }
Extract resource type from a resource ID string .
150,020
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 ( "/" ) [...
Extract information from a resource ID string with the resource type as the identifier .
150,021
public static String nameFromResourceId ( String id ) { return ( id != null ) ? ResourceId . fromString ( id ) . name ( ) : null ; }
Extract name of the resource from a resource ID .
150,022
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 ...
Creates a resource ID from information of a generic resource .
150,023
private < T > ServiceResponse < T > getPutOrPatchResult ( Observable < Response < ResponseBody > > observable , Type resourceType ) throws CloudException , InterruptedException , IOException { Observable < ServiceResponse < T > > asyncObservable = getPutOrPatchResultAsync ( observable , resourceType ) ; return asyncObs...
Handles an initial response from a PUT or PATCH operation response by polling the status of the operation until the long running operation terminates .
150,024
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 ...
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 .
150,025
private < T > Observable < PollingState < T > > updateStateFromLocationHeaderOnPutAsync ( final PollingState < T > pollingState ) { return pollAsync ( pollingState . locationHeaderLink ( ) , pollingState . loggingContext ( ) ) . flatMap ( new Func1 < Response < ResponseBody > , Observable < PollingState < T > > > ( ) {...
Polls from the location header and updates the polling state with the polling response for a PUT operation .
150,026
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 > > > ( ) { public Observable <...
Polls from the provided URL and updates the polling state with the polling response .
150,027
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 ( lo...
Polls from the URL provided .
150,028
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 '" +...
Retrieve the result produced by a task with the given id in the group .
150,029
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 .
150,030
public void addDependencyTaskGroup ( TaskGroup dependencyTaskGroup ) { if ( dependencyTaskGroup . proxyTaskGroupWrapper . isActive ( ) ) { dependencyTaskGroup . proxyTaskGroupWrapper . addDependentTaskGroup ( this ) ; } else { DAGraph < TaskItem , TaskGroupEntry < TaskItem > > dependencyGraph = dependencyTaskGroup ; su...
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 .
150,031
public String addPostRunDependent ( FunctionalTaskItem dependentTaskItem ) { IndexableTaskItem taskItem = IndexableTaskItem . create ( dependentTaskItem ) ; this . addPostRunDependent ( taskItem ) ; return taskItem . key ( ) ; }
Mark the given TaskItem depends on this taskGroup .
150,032
private Observable < Indexable > invokeReadyTasksAsync ( final InvocationContext context ) { TaskGroupEntry < TaskItem > readyTaskEntry = super . getNext ( ) ; final List < Observable < Indexable > > observables = new ArrayList < > ( ) ; while ( readyTaskEntry != null ) { final TaskGroupEntry < TaskItem > currentEntry ...
Invokes the ready tasks .
150,033
private Observable < Indexable > processFaultedTaskAsync ( final TaskGroupEntry < TaskItem > faultedEntry , final Throwable throwable , final InvocationContext context ) { markGroupAsCancelledIfTerminationStrategyIsIPTC ( ) ; reportError ( faultedEntry , throwable ) ; if ( isRootEntry ( faultedEntry ) ) { if ( shouldPr...
Handles a faulted task .
150,034
public boolean shouldRetry ( int retryCount , Response response ) { int code = response . code ( ) ; 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 .
150,035
@ Beta ( SinceVersion . V1_1_0 ) public void close ( ) { httpClient . dispatcher ( ) . executorService ( ) . shutdown ( ) ; httpClient . connectionPool ( ) . evictAll ( ) ; synchronized ( httpClient . connectionPool ( ) ) { httpClient . connectionPool ( ) . notifyAll ( ) ; } synchronized ( AsyncTimeout . class ) { Asyn...
Closes the HTTP client and recycles the resources associated . The threads will be recycled after 60 seconds of inactivity .
150,036
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 ) { public Page < InnerT > nextPage ( String nextPageLink ) { return null ; } ...
Converts the List to PagedList .
150,037
public static < InnerT > Observable < InnerT > convertListToInnerAsync ( Observable < List < InnerT > > innerList ) { return innerList . flatMap ( new Func1 < List < InnerT > , Observable < InnerT > > ( ) { public Observable < InnerT > call ( List < InnerT > inners ) { return Observable . from ( inners ) ; } } ) ; }
Converts Observable of list to Observable of Inner .
150,038
public static < InnerT > Observable < InnerT > convertPageToInnerAsync ( Observable < Page < InnerT > > innerPage ) { return innerPage . flatMap ( new Func1 < Page < InnerT > , Observable < InnerT > > ( ) { public Observable < InnerT > call ( Page < InnerT > pageInner ) { return Observable . from ( pageInner . items ( ...
Converts Observable of page to Observable of Inner .
150,039
public void add ( final IndexableTaskItem taskItem ) { this . dependsOnTaskGroup . addPostRunDependentTaskGroup ( taskItem . taskGroup ( ) ) ; this . collection . add ( taskItem ) ; }
Adds a Post Run task to the collection .
150,040
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
150,041
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
150,042
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
150,043
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
150,044
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
150,045
public Try < R , Throwable > execute ( T input ) { return Try . withCatch ( ( ) -> transactionTemplate . execute ( status -> transaction . apply ( input ) ) ) ; }
Execute the transactional flow - catch all exceptions
150,046
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
150,047
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
150,048
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
150,049
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
150,050
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
150,051
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 .
150,052
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 .
150,053
public ModelSource resolveModel ( Parent parent ) throws UnresolvableModelException { Dependency parentDependency = new Dependency ( ) ; parentDependency . setGroupId ( parent . getGroupId ( ) ) ; parentDependency . setArtifactId ( parent . getArtifactId ( ) ) ; parentDependency . setVersion ( parent . getVersion ( ) )...
Resolves the POM for the specified parent .
150,054
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 ) ;...
This method extracts the XML header comment if available .
150,055
protected Model createFlattenedPom ( File pomFile ) throws MojoExecutionException , MojoFailureException { ModelBuildingRequest buildingRequest = createModelBuildingRequest ( pomFile ) ; Model effectivePom = createEffectivePom ( buildingRequest , isEmbedBuildProfileDependencies ( ) , this . flattenMode ) ; Model flatte...
This method creates the flattened POM what is the main task of this plugin .
150,056
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 ) ; fin...
Converts a sequence of Java characters to a sequence of unicode code points .
150,057
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...
Converts a sequence of unicode code points to a sequence of Java characters .
150,058
public static List < Sentence > splitSentences ( CharSequence text ) { return JavaConversions . seqAsJavaList ( TwitterKoreanProcessor . splitSentences ( text ) ) ; }
Split input text into sentences .
150,059
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
150,060
public static String detokenize ( List < String > tokens ) { return TwitterKoreanProcessor . detokenize ( JavaConversions . iterableAsScalaIterable ( tokens ) ) ; }
Detokenize the input list of words .
150,061
public ConverterServerBuilder baseUri ( String baseUri ) { checkNotNull ( baseUri ) ; this . baseUri = URI . create ( baseUri ) ; return this ; }
Specifies the base URI of this conversion server .
150,062
public ConverterServerBuilder workerPool ( int corePoolSize , int maximumPoolSize , long keepAliveTime , TimeUnit unit ) { assertNumericArgument ( corePoolSize , true ) ; assertNumericArgument ( maximumPoolSize , true ) ; assertNumericArgument ( corePoolSize + maximumPoolSize , false ) ; assertNumericArgument ( keepAli...
Configures a worker pool for the converter .
150,063
public ConverterServerBuilder requestTimeout ( long timeout , TimeUnit unit ) { assertNumericArgument ( timeout , true ) ; this . requestTimeout = unit . toMillis ( timeout ) ; return this ; }
Specifies the timeout for a network request .
150,064
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 .
150,065
public HttpServer build ( ) { checkNotNull ( baseUri ) ; StandaloneWebConverterConfiguration configuration = makeConfiguration ( ) ; ResourceConfig resourceConfig = ResourceConfig . forApplication ( new WebConverterApplication ( configuration ) ) . register ( configuration ) ; if ( sslContext == null ) { return Grizzly...
Creates the conversion server that is specified by this builder .
150,066
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
150,067
protected void expandView ( ) { setExpanded ( true ) ; onExpansionToggled ( false ) ; if ( mParentViewHolderExpandCollapseListener != null ) { mParentViewHolderExpandCollapseListener . onParentExpanded ( getAdapterPosition ( ) ) ; } }
Triggers expansion of the parent .
150,068
protected void collapseView ( ) { setExpanded ( false ) ; onExpansionToggled ( true ) ; if ( mParentViewHolderExpandCollapseListener != null ) { mParentViewHolderExpandCollapseListener . onParentCollapsed ( getAdapterPosition ( ) ) ; } }
Triggers collapse of the parent .
150,069
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
150,070
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
150,071
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 .
150,072
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 .
150,073
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 ) ; generateParentW...
Generates a full list of all parents and their children in order .
150,074
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 par...
Generates a full list of all parents and their children in order . Uses Map to preserve last expanded state .
150,075
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...
Generates a HashMap used to store expanded state for items in the list on configuration change or whenever onResume is called .
150,076
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_POS...
Gets the index of a ExpandableWrapper within the helper item list based on the index of the ExpandableWrapper .
150,077
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
150,078
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
150,079
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 ( ) ; boolea...
Returns sql statement used in this prepared statement together with the parameters .
150,080
protected static void sendInitSQL ( Connection connection , String initSQL ) throws SQLException { if ( initSQL != null ) { Statement stmt = null ; try { stmt = connection . createStatement ( ) ; stmt . execute ( initSQL ) ; if ( testSupport ) { stmt = null ; } } finally { if ( stmt != null ) { stmt . close ( ) ; } } }...
Sends out the SQL as defined in the config upon first init of the connection .
150,081
public void close ( ) throws SQLException { try { if ( this . resetConnectionOnClose ) { rollback ( ) ; if ( ! getAutoCommit ( ) ) { setAutoCommit ( true ) ; } } if ( this . logicallyClosed . compareAndSet ( false , true ) ) { if ( this . threadWatch != null ) { this . threadWatch . interrupt ( ) ; this . threadWatch =...
Release the connection back to the pool .
150,082
protected void internalClose ( ) throws SQLException { try { clearStatementCaches ( true ) ; if ( this . connection != null ) { this . connection . close ( ) ; if ( ! this . connectionTrackingDisabled && this . finalizableRefs != null ) { this . finalizableRefs . remove ( this . connection ) ; } } this . logicallyClose...
Close off the connection .
150,083
protected void clearStatementCaches ( boolean internalClose ) { if ( this . statementCachingEnabled ) { if ( internalClose ) { this . callableStatementCache . clear ( ) ; this . preparedStatementCache . clear ( ) ; } else { if ( this . pool . closeConnectionWatch ) { this . callableStatementCache . checkForProperClosur...
Clears out the statement handles .
150,084
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 .
150,085
public void refreshConnection ( ) throws SQLException { this . connection . close ( ) ; try { this . connection = this . pool . obtainRawInternalConnection ( ) ; } catch ( SQLException e ) { throw markPossiblyBroken ( e ) ; } }
Destroys the internal connection handle and creates a new one .
150,086
public void switchDataSource ( BoneCPConfig newConfig ) throws SQLException { logger . info ( "Switch to new datasource requested. New Config: " + newConfig ) ; DataSource oldDS = getTargetDataSource ( ) ; if ( ! ( oldDS instanceof BoneCPDataSource ) ) { throw new SQLException ( "Unknown datasource type! Was expecting ...
Switch to a new DataSource using the given configuration .
150,087
protected static Connection memorize ( final Connection target , final ConnectionHandle connectionHandle ) { return ( Connection ) Proxy . newProxyInstance ( ConnectionProxy . class . getClassLoader ( ) , new Class [ ] { ConnectionProxy . class } , new MemorizeTransactionProxy ( target , connectionHandle ) ) ; }
Wrap connection with a proxy .
150,088
protected static Statement memorize ( final Statement target , final ConnectionHandle connectionHandle ) { return ( Statement ) Proxy . newProxyInstance ( StatementProxy . class . getClassLoader ( ) , new Class [ ] { StatementProxy . class } , new MemorizeTransactionProxy ( target , connectionHandle ) ) ; }
Wrap Statement with a proxy .
150,089
protected static PreparedStatement memorize ( final PreparedStatement target , final ConnectionHandle connectionHandle ) { return ( PreparedStatement ) Proxy . newProxyInstance ( PreparedStatementProxy . class . getClassLoader ( ) , new Class [ ] { PreparedStatementProxy . class } , new MemorizeTransactionProxy ( targe...
Wrap PreparedStatement with a proxy .
150,090
protected static CallableStatement memorize ( final CallableStatement target , final ConnectionHandle connectionHandle ) { return ( CallableStatement ) Proxy . newProxyInstance ( CallableStatementProxy . class . getClassLoader ( ) , new Class [ ] { CallableStatementProxy . class } , new MemorizeTransactionProxy ( targe...
Wrap CallableStatement with a proxy .
150,091
private Object runWithPossibleProxySwap ( Method method , Object target , Object [ ] args ) throws IllegalAccessException , InvocationTargetException { Object result ; if ( method . getName ( ) . equals ( "createStatement" ) ) { result = memorize ( ( Statement ) method . invoke ( target , args ) , this . connectionHand...
Runs the given method with the specified arguments substituting with proxies where necessary
150,092
private void fillConnections ( int connectionsToCreate ) throws InterruptedException { try { for ( int i = 0 ; i < connectionsToCreate ; i ++ ) { if ( this . pool . poolShuttingDown ) { break ; } this . partition . addFreeConnection ( new ConnectionHandle ( null , this . partition , this . pool , false ) ) ; } } catch ...
Adds new connections to the partition .
150,093
public String calculateCacheKey ( String sql , int resultSetType , int resultSetConcurrency , int resultSetHoldability ) { StringBuilder tmp = calculateCacheKeyInternal ( sql , resultSetType , resultSetConcurrency ) ; tmp . append ( ", H:" ) ; tmp . append ( resultSetHoldability ) ; return tmp . toString ( ) ; }
Simply appends the given parameters and returns it to obtain a cache key
150,094
private StringBuilder calculateCacheKeyInternal ( String sql , int resultSetType , int resultSetConcurrency ) { StringBuilder tmp = new StringBuilder ( sql . length ( ) + 20 ) ; tmp . append ( sql ) ; tmp . append ( ", T" ) ; tmp . append ( resultSetType ) ; tmp . append ( ", C" ) ; tmp . append ( resultSetConcurrency ...
Cache key calculation .
150,095
public String calculateCacheKey ( String sql , int autoGeneratedKeys ) { StringBuilder tmp = new StringBuilder ( sql . length ( ) + 4 ) ; tmp . append ( sql ) ; tmp . append ( autoGeneratedKeys ) ; return tmp . toString ( ) ; }
Alternate version of autoGeneratedKeys .
150,096
public String calculateCacheKey ( String sql , int [ ] columnIndexes ) { StringBuilder tmp = new StringBuilder ( sql . length ( ) + 4 ) ; tmp . append ( sql ) ; for ( int i = 0 ; i < columnIndexes . length ; i ++ ) { tmp . append ( columnIndexes [ i ] ) ; tmp . append ( "CI," ) ; } return tmp . toString ( ) ; }
Calculate a cache key .
150,097
public void run ( ) { ConnectionHandle connection = null ; long tmp ; long nextCheckInMs = this . maxAgeInMs ; int partitionSize = this . partition . getAvailableConnections ( ) ; long currentTime = System . currentTimeMillis ( ) ; for ( int i = 0 ; i < partitionSize ; i ++ ) { try { connection = this . partition . get...
Invoked periodically .
150,098
protected void closeConnection ( ConnectionHandle connection ) { if ( connection != null ) { try { connection . internalClose ( ) ; } catch ( Throwable t ) { logger . error ( "Destroy connection exception" , t ) ; } finally { this . pool . postDestroyConnection ( connection ) ; } } }
Closes off this connection
150,099
public void setIdleMaxAge ( long idleMaxAge , TimeUnit timeUnit ) { this . idleMaxAgeInSeconds = TimeUnit . SECONDS . convert ( idleMaxAge , checkNotNull ( timeUnit ) ) ; }
Sets Idle max age .