idx int64 0 165k | question stringlengths 73 5.81k | target stringlengths 5 918 |
|---|---|---|
121,600 | public void acquireWakeLock ( ) { if ( mWakeLock == null ) { PowerManager manager = ( PowerManager ) mContext . getSystemService ( Context . POWER_SERVICE ) ; mWakeLock = manager . newWakeLock ( PowerManager . PARTIAL_WAKE_LOCK , mTag ) ; mWakeLock . acquire ( ) ; Log . d ( mTag , "Wake lock acquired" ) ; } else { Log ... | Acquire a wake lock if we don t already have one . |
121,601 | public void releaseWakeLock ( ) { if ( mWakeLock != null && mWakeLock . isHeld ( ) ) { mWakeLock . release ( ) ; mWakeLock = null ; Log . d ( mTag , "Wake lock released" ) ; } } | If we have an active wake lock release it . |
121,602 | public void setOverwritingStatus ( boolean enabled ) { mOverwriteNativeStatus = enabled ; mNativeGpsOverridden = false ; if ( mLocationManager != null && ! enabled ) { try { mLocationManager . removeTestProvider ( LocationManager . GPS_PROVIDER ) ; Log . d ( TAG , "Disabled overwriting native GPS with OpenXC GPS" ) ; }... | Enable or disable overwriting Android s native GPS values with those from the vehicle . |
121,603 | public static boolean sameResource ( URI uri , String otherResource ) { try { return createUri ( otherResource ) . equals ( uri ) ; } catch ( DataSourceException e ) { return false ; } } | Determine if two URIs refer to the same resource . |
121,604 | public static boolean validateResource ( String uriString ) { if ( uriString == null ) { return false ; } try { return validateResource ( createUri ( uriString ) ) ; } catch ( DataSourceException e ) { Log . d ( TAG , "URI is not valid" , e ) ; return false ; } } | Convert the parameter to a URI and validate the correctness of its host and port . |
121,605 | public static boolean validateResource ( URI uri ) { return uri != null && uri . getPort ( ) != - 1 && uri . getHost ( ) != null ; } | Validate the correctness of the host and port in a given URI . |
121,606 | public static URI createUri ( String uriString ) throws DataSourceException { if ( uriString == null ) { throw new DataSourceResourceException ( "URI string is null" ) ; } try { return new URI ( uriString ) ; } catch ( URISyntaxException e ) { throw new DataSourceResourceException ( "Not a valid URI: " + uriString , e ... | Attempt to construct an instance of URI from the given String . |
121,607 | @ TargetApi ( Build . VERSION_CODES . KITKAT ) @ SuppressLint ( "NewApi" ) public static String getPath ( final Context context , final Uri uri ) { final boolean isKitKat = Build . VERSION . SDK_INT >= Build . VERSION_CODES . KITKAT ; if ( isKitKat && DocumentsContract . isDocumentUri ( context , uri ) ) { if ( isExter... | Thanks to Paul Burke on Stack Overflow |
121,608 | public void receive ( VehicleMessage message ) { if ( message == null ) { return ; } if ( message instanceof KeyedMessage ) { KeyedMessage keyedMessage = message . asKeyedMessage ( ) ; mKeyedMessages . put ( keyedMessage . getKey ( ) , keyedMessage ) ; } List < VehicleDataSink > deadSinks = new ArrayList < > ( ) ; for ... | Accept new values from data sources and send it out to all registered sinks . |
121,609 | public void removeSink ( VehicleDataSink sink ) { if ( sink != null ) { mSinks . remove ( sink ) ; sink . stop ( ) ; } } | Remove a previously added sink from the pipeline . |
121,610 | public VehicleDataSource addSource ( VehicleDataSource source ) { source . setCallback ( this ) ; mSources . add ( source ) ; if ( isActive ( ) ) { source . onPipelineActivated ( ) ; } else { source . onPipelineDeactivated ( ) ; } return source ; } | Add a new source to the pipeline . |
121,611 | public void removeSource ( VehicleDataSource source ) { if ( source != null ) { mSources . remove ( source ) ; source . stop ( ) ; } } | Remove a previously added source from the pipeline . |
121,612 | public boolean isActive ( VehicleDataSource skipSource ) { boolean connected = false ; for ( VehicleDataSource s : mSources ) { if ( s != skipSource ) { connected = connected || s . isConnected ( ) ; } } return connected ; } | Return true if at least one source is active . |
121,613 | public void sourceDisconnected ( VehicleDataSource source ) { if ( mOperator != null ) { if ( ! isActive ( source ) ) { mOperator . onPipelineDeactivated ( ) ; for ( VehicleDataSource s : mSources ) { s . onPipelineDeactivated ( ) ; } } } } | At least one source is not active - if all sources are inactive notify the operator . |
121,614 | public void sourceConnected ( VehicleDataSource source ) { if ( mOperator != null ) { mOperator . onPipelineActivated ( ) ; for ( VehicleDataSource s : mSources ) { s . onPipelineActivated ( ) ; } } } | At least one source is active - notify the operator . |
121,615 | public void setImageResource ( int imageResource , int imageWidth , int imageHeight ) { bitmap = extractBitmapFromDrawable ( getResources ( ) . getDrawable ( imageResource ) ) ; bitmapSrcRect = bitmapRect ( bitmap ) ; this . imageWidth = imageWidth ; this . imageHeight = imageHeight ; rebuildFitter ( ) ; } | Changes the background image and its layout dimensions . |
121,616 | public static boolean isConnectedToWiFiOrMobileNetwork ( Context context ) { final String service = Context . CONNECTIVITY_SERVICE ; final ConnectivityManager manager = ( ConnectivityManager ) context . getSystemService ( service ) ; final NetworkInfo networkInfo = manager . getActiveNetworkInfo ( ) ; if ( networkInfo ... | Helper method which checks if device is connected to WiFi or mobile network . |
121,617 | public NetworkEvents setPingParameters ( String host , int port , int timeoutInMs ) { onlineChecker . setPingParameters ( host , port , timeoutInMs ) ; return this ; } | Sets ping parameters of the host used to check Internet connection . If it s not set library will use default ping parameters . |
121,618 | public static < T extends Query < ? , R > , R extends Object > T createMock ( Class < T > type ) { return Mockito . mock ( type , createAnswer ( type ) ) ; } | Creates a new mock of given type with a fluent default answer already set up . |
121,619 | public static < T extends Query < ? , R > , R extends Object > FluentAnswer < T , R > createAnswer ( Class < T > type ) { return new FluentAnswer < T , R > ( type ) ; } | Creates a new instance for the given type . |
121,620 | public CallActivityMock onExecutionAddVariables ( final VariableMap variables ) { return this . onExecutionDo ( "addVariablesServiceMock_" + randomUUID ( ) , ( execution ) -> variables . forEach ( execution :: setVariable ) ) ; } | On execution the MockProcess will add the given VariableMap to the execution |
121,621 | public CallActivityMock onExecutionAddVariable ( final String key , final Object val ) { return this . onExecutionAddVariables ( createVariables ( ) . putValue ( key , val ) ) ; } | On execution the MockProcess will add the given process variable |
121,622 | public CallActivityMock onExecutionDo ( final String serviceId , final Consumer < DelegateExecution > consumer ) { flowNodeBuilder = flowNodeBuilder . serviceTask ( serviceId ) . camundaDelegateExpression ( "${id}" . replace ( "id" , serviceId ) ) ; registerInstance ( serviceId , ( JavaDelegate ) consumer :: accept ) ;... | On execution the MockProcess will execute the given consumer with a DelegateExecution . |
121,623 | public CallActivityMock onExecutionSendMessage ( final String message ) { return onExecutionDo ( execution -> execution . getProcessEngineServices ( ) . getRuntimeService ( ) . correlateMessage ( message ) ) ; } | On execution the MockProcess will send the given message to all |
121,624 | public Deployment deploy ( final RepositoryService repositoryService ) { return new DeployProcess ( repositoryService ) . apply ( processId , flowNodeBuilder . endEvent ( "end" ) . done ( ) ) ; } | This will deploy the mock process . |
121,625 | private RebelXmlBuilder buildWar ( ) throws MojoExecutionException { RebelXmlBuilder builder = createXmlBuilder ( ) ; buildWeb ( builder ) ; buildClasspath ( builder ) ; if ( war != null ) { war . setPath ( fixFilePath ( war . getPath ( ) ) ) ; builder . setWar ( war ) ; } return builder ; } | Build war configuration . |
121,626 | private RebelXmlBuilder buildJar ( ) throws MojoExecutionException { RebelXmlBuilder builder = createXmlBuilder ( ) ; buildClasspath ( builder ) ; if ( web != null && web . getResources ( ) != null && web . getResources ( ) . length != 0 ) { generateDefaultWeb = false ; buildWeb ( builder ) ; } return builder ; } | Build jar configuration . |
121,627 | private boolean handleResourceAsInclude ( RebelResource rebelResource , Resource resource ) { File dir = new File ( resource . getDirectory ( ) ) ; if ( ! dir . isAbsolute ( ) ) { dir = new File ( getProject ( ) . getBasedir ( ) , resource . getDirectory ( ) ) ; } if ( ! dir . exists ( ) || ! dir . isDirectory ( ) ) { ... | Set includes & excludes for filtered resources . |
121,628 | private String [ ] getFilesToCopy ( Resource resource ) { DirectoryScanner scanner = new DirectoryScanner ( ) ; scanner . setBasedir ( resource . getDirectory ( ) ) ; if ( resource . getIncludes ( ) != null && ! resource . getIncludes ( ) . isEmpty ( ) ) { scanner . setIncludes ( resource . getIncludes ( ) . toArray ( ... | Taken from war plugin . |
121,629 | private List < Resource > parseWarResources ( Xpp3Dom warResourcesNode ) { List < Resource > resources = new ArrayList < Resource > ( ) ; Xpp3Dom [ ] resourceNodes = warResourcesNode . getChildren ( "resource" ) ; for ( Xpp3Dom resourceNode : resourceNodes ) { if ( resourceNode == null || resourceNode . getChild ( "dir... | Parse resources node content . |
121,630 | private Resource parseResourceNode ( Xpp3Dom rn ) { Resource r = new Resource ( ) ; if ( rn . getChild ( "directory" ) != null ) { r . setDirectory ( getValue ( getProject ( ) , rn . getChild ( "directory" ) ) ) ; } if ( rn . getChild ( "filtering" ) != null ) { r . setFiltering ( ( Boolean . valueOf ( getValue ( getPr... | Parse resouce node content . |
121,631 | private static Xpp3Dom getPluginConfigurationDom ( MavenProject project , String pluginId ) { Plugin plugin = project . getBuild ( ) . getPluginsAsMap ( ) . get ( pluginId ) ; if ( plugin != null ) { return ( Xpp3Dom ) plugin . getConfiguration ( ) ; } return null ; } | Taken from eclipse plugin . Search for the configuration Xpp3 dom of an other plugin . |
121,632 | private String getPluginSetting ( MavenProject project , String pluginId , String optionName , String defaultValue ) { Xpp3Dom dom = getPluginConfigurationDom ( project , pluginId ) ; if ( dom != null && dom . getChild ( optionName ) != null ) { return getValue ( project , dom . getChild ( optionName ) ) ; } return def... | Search for a configuration setting of an other plugin . |
121,633 | protected String fixFilePath ( File file ) throws MojoExecutionException { File baseDir = getProject ( ) . getFile ( ) . getParentFile ( ) ; if ( file . isAbsolute ( ) && ! isRelativeToPath ( new File ( baseDir , getRelativePath ( ) ) , file ) ) { return StringUtils . replace ( getCanonicalPath ( file ) , '\\' , '/' ) ... | Returns path expressed through rootPath and relativePath . |
121,634 | public static String getMatchingRootFolder ( String targetedUrl ) { String [ ] targetedRootFolders = SiteProperties . getRootFolders ( ) ; if ( ArrayUtils . isNotEmpty ( targetedRootFolders ) ) { for ( String targetedRootFolder : targetedRootFolders ) { if ( targetedUrl . startsWith ( targetedRootFolder ) ) { return ta... | Return the root folder of the specified targeted URL |
121,635 | public static boolean excludePath ( String path ) { String [ ] excludePatterns = SiteProperties . getExcludePatterns ( ) ; if ( ArrayUtils . isNotEmpty ( excludePatterns ) ) { return RegexUtils . matchesAny ( path , excludePatterns ) ; } else { return false ; } } | Returns true if the path should be excluded or ignored for targeting . |
121,636 | public static boolean isTargetingEnabled ( ) { Configuration config = ConfigUtils . getCurrentConfig ( ) ; if ( config != null ) { return config . getBoolean ( TARGETING_ENABLED_CONFIG_KEY , false ) ; } else { return false ; } } | Returns trues if targeting is enabled . |
121,637 | public static String [ ] getAvailableTargetIds ( ) { Configuration config = ConfigUtils . getCurrentConfig ( ) ; if ( config != null ) { return config . getStringArray ( AVAILABLE_TARGET_IDS_CONFIG_KEY ) ; } else { return null ; } } | Returns the list of available target IDs . |
121,638 | public static String getFallbackTargetId ( ) { Configuration config = ConfigUtils . getCurrentConfig ( ) ; if ( config != null ) { return config . getString ( FALLBACK_ID_CONFIG_KEY ) ; } else { return null ; } } | Returns the fallback target ID . The fallback target ID is used in case none of the resolved candidate targeted URLs map to existing content . |
121,639 | public static String [ ] getRootFolders ( ) { Configuration config = ConfigUtils . getCurrentConfig ( ) ; if ( config != null ) { return config . getStringArray ( ROOT_FOLDERS_CONFIG_KEY ) ; } else { return null ; } } | Returns the folders that will be handled for targeted content . |
121,640 | public static String [ ] getExcludePatterns ( ) { Configuration config = ConfigUtils . getCurrentConfig ( ) ; if ( config != null ) { return config . getStringArray ( EXCLUDE_PATTERNS_CONFIG_KEY ) ; } else { return null ; } } | Returns the patterns that a path might match if it should be excluded |
121,641 | public static boolean isRedirectToTargetedUrl ( ) { Configuration config = ConfigUtils . getCurrentConfig ( ) ; if ( config != null ) { return config . getBoolean ( REDIRECT_TO_TARGETED_URL_CONFIG_KEY , false ) ; } else { return false ; } } | Returns true if the request should be redirected when the targeted URL is different from the current URL . |
121,642 | public static boolean isDisableFullModelTypeConversion ( ) { Configuration config = ConfigUtils . getCurrentConfig ( ) ; if ( config != null ) { return config . getBoolean ( DISABLE_FULL_MODEL_TYPE_CONVERSION_CONFIG_KEY , false ) ; } else { return false ; } } | Returns true if full content model type conversion should be disabled . |
121,643 | public static String [ ] getNavigationAdditionalFields ( ) { Configuration config = ConfigUtils . getCurrentConfig ( ) ; if ( config != null && config . containsKey ( NAVIGATION_ADDITIONAL_FIELDS_CONFIG_KEY ) ) { return config . getStringArray ( NAVIGATION_ADDITIONAL_FIELDS_CONFIG_KEY ) ; } else { return new String [ ]... | Returns the list of additional fields that navigation items should extract from the item descriptor . |
121,644 | public static BeanDefinition createBeanDefinitionFromOriginal ( ApplicationContext applicationContext , String beanName ) { ApplicationContext parentContext = applicationContext . getParent ( ) ; BeanDefinition parentDefinition = null ; if ( parentContext != null && parentContext . getAutowireCapableBeanFactory ( ) ins... | Creates a bean definition for the specified bean name . If the parent context of the current context contains a bean definition with the same name the definition is created as a bean copy of the parent definition . This method is useful for config parsers that want to create a bean definition from configuration but als... |
121,645 | public static void addPropertyIfNotNull ( BeanDefinition definition , String propertyName , Object propertyValue ) { if ( propertyValue != null ) { definition . getPropertyValues ( ) . add ( propertyName , propertyValue ) ; } } | Adds the property to the bean definition if the values it not empty |
121,646 | public static void setCurrent ( SiteContext current ) { threadLocal . set ( current ) ; MDC . put ( SITE_NAME_MDC_KEY , current . getSiteName ( ) ) ; } | Sets the context for the current thread . |
121,647 | protected boolean shouldNotFilter ( final HttpServletRequest request ) throws ServletException { SiteContext siteContext = SiteContext . getCurrent ( ) ; HierarchicalConfiguration config = siteContext . getConfig ( ) ; try { HierarchicalConfiguration corsConfig = config . configurationAt ( CONFIG_KEY ) ; if ( corsConfi... | Exclude requests for sites that have no configuration or it is marked as disabled . |
121,648 | protected void doFilterInternal ( final HttpServletRequest request , final HttpServletResponse response , final FilterChain filterChain ) throws ServletException , IOException { SiteContext siteContext = SiteContext . getCurrent ( ) ; HierarchicalConfiguration corsConfig = siteContext . getConfig ( ) . configurationAt ... | Copy the values from the site configuration to the response headers . |
121,649 | public static HierarchicalConfiguration getCurrentConfig ( ) { SiteContext siteContext = SiteContext . getCurrent ( ) ; if ( siteContext != null ) { return siteContext . getConfig ( ) ; } else { return null ; } } | Returns the configuration from the current site context . |
121,650 | public static SpannableString getFormattedText ( Span span ) { SpannableString ss = null ; if ( span != null ) { ss = setUpSpannableString ( span ) ; } return ss ; } | Set a single span |
121,651 | public static CharSequence getFormattedText ( List < Span > spans ) { CharSequence formattedText = null ; if ( spans != null ) { int size = spans . size ( ) ; List < SpannableString > spannableStrings = new ArrayList < > ( size ) ; for ( Span span : spans ) { SpannableString ss = setUpSpannableString ( span ) ; spannab... | Set multiple spans |
121,652 | private static Set < Parameter < ? > > getParametersFromPublicFields ( Class < ? > type ) { Set < Parameter < ? > > params = new HashSet < > ( ) ; try { Field [ ] fields = type . getFields ( ) ; for ( Field field : fields ) { if ( field . getType ( ) . isAssignableFrom ( Parameter . class ) ) { params . add ( ( Paramet... | Get all parameters defined as public static fields in the given type . |
121,653 | public static String [ ] splitPreserveAllTokens ( String value , char separatorChar ) { if ( value == null ) { return ArrayUtils . EMPTY_STRING_ARRAY ; } int len = value . length ( ) ; if ( len == 0 ) { return ArrayUtils . EMPTY_STRING_ARRAY ; } List < String > list = new ArrayList < > ( ) ; int i = 0 ; int start = 0 ;... | String tokenizer that preservers all tokens and ignores escaped separator chars . |
121,654 | public static String traceOutput ( Map < String , Object > properties ) { SortedSet < String > propertyNames = new TreeSet < > ( properties . keySet ( ) ) ; StringBuilder sb = new StringBuilder ( ) ; sb . append ( "{" ) ; Iterator < String > propertyNameIterator = propertyNames . iterator ( ) ; while ( propertyNameIter... | Produce trace output for properties map . |
121,655 | @ SuppressWarnings ( "unchecked" ) private Iterator < String > findConfigRefs ( final Resource startResource , final Collection < String > bucketNames ) { final Iterator < ContextResource > contextResources = new FilterIterator ( contextPathStrategy . findContextResources ( startResource ) , new Predicate ( ) { public ... | Searches the resource hierarchy upwards for all config references and returns them . |
121,656 | public static Resource ensurePageIfNotContainingPage ( ResourceResolver resolver , String pagePath , String resourceType , ConfigurationManagementSettings configurationManagementSettings ) { Matcher matcher = PAGE_PATH_PATTERN . matcher ( pagePath ) ; if ( matcher . matches ( ) ) { String detectedPagePath = matcher . g... | Ensure that a page at the given path exists if the path is not already contained in a page . |
121,657 | public static void deleteChildrenNotInCollection ( Resource resource , ConfigurationCollectionPersistData data ) { Set < String > collectionItemNames = data . getItems ( ) . stream ( ) . map ( item -> item . getCollectionItemName ( ) ) . collect ( Collectors . toSet ( ) ) ; for ( Resource child : resource . getChildren... | Delete children that are no longer contained in list of collection items . |
121,658 | public static void deletePageOrResource ( Resource resource ) { Page configPage = resource . adaptTo ( Page . class ) ; if ( configPage != null ) { try { log . trace ( "! Delete page {}" , configPage . getPath ( ) ) ; PageManager pageManager = configPage . getPageManager ( ) ; pageManager . delete ( configPage , false ... | If the given resource points to an AEM page delete the page using PageManager . Otherwise delete the resource using ResourceResolver . |
121,659 | @ SuppressWarnings ( "unchecked" ) public static < T > T stringToObject ( String value , Class < T > type ) { if ( value == null ) { return null ; } if ( type == String . class ) { return ( T ) value ; } else if ( type == String [ ] . class ) { return ( T ) decodeString ( splitPreserveAllTokens ( value , ARRAY_DELIMITE... | Converts a string value to an object with the given parameter type . |
121,660 | public static String objectToString ( Object value ) { if ( value == null ) { return null ; } if ( value instanceof String ) { return ( String ) value ; } if ( value instanceof String [ ] ) { return StringUtils . join ( encodeString ( ( String [ ] ) value ) , ARRAY_DELIMITER ) ; } else if ( value instanceof Integer ) {... | Converts a typed value to it s string representation . |
121,661 | public ParameterBuilder < T > defaultOsgiConfigProperty ( String value ) { if ( value == null || ! OSGI_CONFIG_PROPERTY_PATTERN . matcher ( value ) . matches ( ) ) { throw new IllegalArgumentException ( "Invalid value: " + value ) ; } this . defaultOsgiConfigProperty = value ; return this ; } | References OSGi configuration property which is checked for default value if this parameter is not set in any configuration . |
121,662 | public ParameterBuilder < T > properties ( Map < String , Object > map ) { if ( map == null ) { throw new IllegalArgumentException ( "Map argument must not be null." ) ; } this . properties . putAll ( map ) ; return this ; } | Further properties for documentation and configuration of behavior in configuration editor . |
121,663 | public ParameterBuilder < T > property ( String key , Object value ) { if ( key == null ) { throw new IllegalArgumentException ( "Key argument must not be null." ) ; } this . properties . put ( key , value ) ; return this ; } | Further property for documentation and configuration of behavior in configuration editor . |
121,664 | @ SuppressWarnings ( "unchecked" ) public synchronized < T > Evaluator < T > createEvaluator ( String source , ClassType projection , String [ ] names , Type [ ] types , Class < ? > [ ] classes , Map < String , Object > constants ) { try { final String id = toId ( source , projection . getJavaClass ( ) , types , consta... | Create a new Evaluator instance |
121,665 | public void cleanQueueJob ( ) { try { Set < Long > ids = queueCleanerService . getFinishedExecStateIds ( ) ; if ( logger . isDebugEnabled ( ) ) logger . debug ( "Will clean from queue the next Exec state ids amount:" + ids . size ( ) ) ; Set < Long > execIds = new HashSet < > ( ) ; for ( Long id : ids ) { execIds . add... | Job that will handle the cleaning of queue table . |
121,666 | public void joinFinishedSplitsJob ( ) { try { if ( logger . isDebugEnabled ( ) ) logger . debug ( "SplitJoinJob woke up at " + new Date ( ) ) ; StopWatch stopWatch = new StopWatch ( ) ; stopWatch . start ( ) ; boolean moreToJoin = true ; for ( int i = 0 ; i < SPLIT_JOIN_ITERATIONS && moreToJoin ; i ++ ) { int joinedSpl... | Job that will handle the joining of finished branches . |
121,667 | public void executionRecoveryJob ( ) { if ( logger . isDebugEnabled ( ) ) { logger . debug ( "ExecutionRecoveryJob woke up at " + new Date ( ) ) ; } try { executionRecoveryService . doRecovery ( ) ; } catch ( Exception e ) { logger . error ( "Can't run queue recovery job." , e ) ; } } | Job to execute the recovery check . |
121,668 | private void cancelPausedRun ( ExecutionState executionStateToCancel ) { final List < ExecutionState > branches = executionStateService . readByExecutionId ( executionStateToCancel . getExecutionId ( ) ) ; if ( branches . size ( ) > 1 ) { for ( ExecutionState branch : branches ) { if ( ! EMPTY_BRANCH . equals ( branch ... | If it doesn t - just cancel it straight away - extract the Run Object set its context accordingly and put into the queue . |
121,669 | private boolean isBranch ( Execution execution ) { return execution != null && ! StringUtils . isEmpty ( execution . getSystemContext ( ) . getBranchId ( ) ) ; } | Returns true when the execution is a branch with the new branch mechanism It will return true for executions of parallel multi - instance sub - flows and non blocking |
121,670 | public void doRecovery ( ) { try { synchronized ( this ) { executorService . shutdownNow ( ) ; threadPoolVersion ++ ; logger . warn ( "Worker is in doRecovery(). Cleaning state and cancelling running tasks. It may take up to 30 seconds..." ) ; } boolean finished = executorService . awaitTermination ( 30 , TimeUnit . SE... | Must clean the buffer that holds Runnables that wait for execution and also drop all the executions that currently run |
121,671 | public PythonExecutionResult exec ( String script , Map < String , Serializable > callArguments ) { checkValidInterpreter ( ) ; initInterpreter ( ) ; prepareInterpreterContext ( callArguments ) ; Exception originException = null ; for ( int i = 0 ; i < RETRIES_NUMBER_ON_THREADED_ISSUE ; i ++ ) { try { return exec ( scr... | we need this method to be synchronized so we will not have multiple scripts run in parallel on the same context |
121,672 | public String escapeLikeExpression ( String likeExpression ) { String normalizeLikeExpression = likeExpression ; if ( likeExpression != null && ! likeExpression . isEmpty ( ) ) { normalizeLikeExpression = normalizeLikeExpression . replace ( ESCAPE_CHAR , DOUBLE_ESCAPE_CHAR ) ; for ( String charToEscape : currentSpecial... | Escaping like expressions so wildcards will not be evaluated . The HQL query should have the ESCAPE_EXPRESSION in it s suffix for this to work!!! |
121,673 | public Pair < Integer , Integer > getMinSizeAndSizeOfInBuffer ( int executionThreadsCount ) { int defaultMinInBufferSize = Math . max ( 1 , executionThreadsCount / 5 ) ; int minInBufferSizeLocal = getInteger ( WORKER_INBUFFER_MIN_SIZE , defaultMinInBufferSize ) ; int minInBufferSize = ( minInBufferSizeLocal > 0 ) ? min... | 10 percent of Xmx |
121,674 | private boolean isExecutionPaused ( Execution nextStepExecution ) { if ( nextStepExecution == null ) { executionMessage . setStatus ( ExecStatus . FINISHED ) ; executionMessage . incMsgSeqId ( ) ; executionMessage . setPayload ( null ) ; try { outBuffer . put ( executionMessage ) ; } catch ( InterruptedException e ) { ... | If execution was paused it sends the current step with status FINISHED and that is all ... |
121,675 | private ExecutionMessage createTerminatedExecutionMessage ( Execution nextStepExecution ) { Payload payload = converter . createPayload ( nextStepExecution ) ; ExecutionMessage finalMessage = ( ExecutionMessage ) executionMessage . clone ( ) ; finalMessage . setStatus ( ExecStatus . TERMINATED ) ; finalMessage . incMsg... | Creates termination execution message base on current execution message |
121,676 | private ExecutionMessage createPendingExecutionMessage ( Execution nextStepExecution ) { String groupName = nextStepExecution . getGroupName ( ) ; if ( groupName == null ) { groupName = WorkerNode . DEFAULT_WORKER_GROUPS [ 0 ] ; } return new ExecutionMessage ( ExecutionMessage . EMPTY_EXEC_STATE_ID , ExecutionMessage .... | Creates pending execution message for the next step base on current execution message |
121,677 | private ExecutionMessage createInProgressExecutionMessage ( Execution nextStepExecution ) { String groupName = nextStepExecution . getGroupName ( ) ; if ( groupName == null ) { groupName = WorkerNode . DEFAULT_WORKER_GROUPS [ 0 ] ; } Long id = queueStateIdGeneratorService . generateStateId ( ) ; return new ExecutionMes... | Creates InProgress execution message for the next step base on current execution message - used for short cut! |
121,678 | public void setFinishedChildBranchesData ( ArrayList < EndBranchDataContainer > data ) { Validate . isTrue ( ! contextMap . containsKey ( ExecutionParametersConsts . FINISHED_CHILD_BRANCHES_DATA ) , "not allowed to overwrite finished branches data" ) ; contextMap . put ( ExecutionParametersConsts . FINISHED_CHILD_BRANC... | setter for the finished child brunches data |
121,679 | public void setBranchId ( String brunchId ) { Validate . isTrue ( StringUtils . isEmpty ( getBranchId ( ) ) , "not allowed to overwrite branch id" ) ; contextMap . put ( BRANCH_ID , brunchId ) ; } | setter for the brunch id of the current Execution |
121,680 | public void setSplitId ( String splitId ) { Validate . isTrue ( StringUtils . isEmpty ( getSplitId ( ) ) , "not allowed to overwrite split id" ) ; contextMap . put ( NEW_SPLIT_ID , splitId ) ; } | set teh split id |
121,681 | public void addEvent ( String eventType , Serializable eventData ) { @ SuppressWarnings ( "unchecked" ) Queue < ScoreEvent > eventsQueue = getFromMap ( SCORE_EVENTS_QUEUE ) ; if ( eventsQueue == null ) { eventsQueue = new ArrayDeque < > ( ) ; contextMap . put ( SCORE_EVENTS_QUEUE , ( ArrayDeque ) eventsQueue ) ; } even... | add event - for score to fire |
121,682 | public void addBranch ( Long startPosition , String flowUuid , Map < String , Serializable > context ) { Map < String , Long > runningPlansIds = getFromMap ( RUNNING_PLANS_MAP ) ; Long runningPlanId = runningPlansIds . get ( flowUuid ) ; addBranch ( startPosition , runningPlanId , context , new ExecutionRuntimeServices... | add brunch - means you want to split your execution |
121,683 | protected boolean handlePausedFlow ( Execution execution ) throws InterruptedException { String branchId = execution . getSystemContext ( ) . getBranchId ( ) ; PauseReason reason = findPauseReason ( execution . getExecutionId ( ) , branchId ) ; if ( reason != null ) { pauseFlow ( reason , execution ) ; return true ; } ... | check if the execution should be Paused and pause it if needed |
121,684 | private boolean handlePausedFlowAfterStep ( Execution execution ) throws InterruptedException { String branchId = execution . getSystemContext ( ) . getBranchId ( ) ; PauseReason reason = null ; ExecutionSummary execSummary = pauseService . readPausedExecution ( execution . getExecutionId ( ) , branchId ) ; if ( execSu... | no need to check if paused - because this is called after the step when the Pause flag exists in the context |
121,685 | private Set < String > extractAndRemoveUpToLimit ( Set < String > source , int limit ) { Set < String > result = new HashSet < > ( ) ; Iterator < String > iterator = source . iterator ( ) ; while ( iterator . hasNext ( ) && result . size ( ) < limit ) { result . add ( iterator . next ( ) ) ; iterator . remove ( ) ; } r... | Extracts items from source in the ammount set in limit and also removes them from source |
121,686 | public static String getTypeName ( Class < ? extends Tag < ? > > clazz ) { return TagType . getByTagClass ( clazz ) . getTypeName ( ) ; } | Gets the type name of a tag . |
121,687 | public void writeTag ( Tag < ? > tag ) throws IOException { String name = tag . getName ( ) ; byte [ ] nameBytes = name . getBytes ( NBTConstants . CHARSET . name ( ) ) ; os . writeByte ( tag . getType ( ) . getId ( ) ) ; os . writeShort ( nameBytes . length ) ; os . write ( nameBytes ) ; if ( tag . getType ( ) == TagT... | Writes a tag . |
121,688 | private void writeTagPayload ( Tag < ? > tag ) throws IOException { switch ( tag . getType ( ) ) { case TAG_END : writeEndTagPayload ( ( EndTag ) tag ) ; break ; case TAG_BYTE : writeByteTagPayload ( ( ByteTag ) tag ) ; break ; case TAG_SHORT : writeShortTagPayload ( ( ShortTag ) tag ) ; break ; case TAG_INT : writeInt... | Writes tag payload . |
121,689 | public T load ( CompoundTag tag ) { Tag subTag = tag . getValue ( ) . get ( key ) ; if ( subTag == null ) { return ( value = defaultValue ) ; } return ( value = field . getValue ( subTag ) ) ; } | Get this field from a CompoundTag |
121,690 | public static < T > FieldValue < T > from ( String name , Field < T > field , T defaultValue ) { return new FieldValue < T > ( name , field , defaultValue ) ; } | So generic info doesn t have to be duplicated |
121,691 | public static < T > T getTagValue ( Tag < ? > t , Class < ? extends T > clazz ) { Object o = toTagValue ( t ) ; if ( o == null ) { return null ; } try { return clazz . cast ( o ) ; } catch ( ClassCastException e ) { return null ; } } | Takes in an NBT tag sanely checks null status and then returns it value . This method will return null if the value cannot be cast to the given class . |
121,692 | public static < T , U extends T > T toTagValue ( Tag < ? > t , Class < ? extends T > clazz , U defaultValue ) { Object o = toTagValue ( t ) ; if ( o == null ) { return defaultValue ; } try { T value = clazz . cast ( o ) ; return value ; } catch ( ClassCastException e ) { return defaultValue ; } } | Takes in an NBT tag sanely checks null status and then returns it value . This method will return null if the value cannot be cast to the default value . |
121,693 | public static < T extends Tag < ? > > T checkTagCast ( Tag < ? > tag , Class < T > type ) throws IllegalArgumentException { if ( tag == null ) { throw new IllegalArgumentException ( "Expected tag of type " + type . getName ( ) + ", was null" ) ; } else if ( ! type . isInstance ( tag ) ) { throw new IllegalArgumentExcep... | Checks that a tag is not null and of the required type |
121,694 | public X509Certificate [ ] getCertificates ( ) { if ( this . certSubjectDNMap == null ) { return null ; } Collection certs = this . certSubjectDNMap . values ( ) ; return ( X509Certificate [ ] ) certs . toArray ( new X509Certificate [ certs . size ( ) ] ) ; } | so moved some things over to there |
121,695 | public SigningPolicy [ ] getSigningPolicies ( ) { if ( this . policyDNMap == null ) { return null ; } Collection values = this . policyDNMap . values ( ) ; return ( SigningPolicy [ ] ) this . policyDNMap . values ( ) . toArray ( new SigningPolicy [ values . size ( ) ] ) ; } | Returns all signing policies |
121,696 | public SigningPolicy getSigningPolicy ( String subject ) { if ( this . policyDNMap == null ) { return null ; } return ( SigningPolicy ) this . policyDNMap . get ( subject ) ; } | Returns signing policy associated with the given CA subject . |
121,697 | private ByteBuffer sslDataWrap ( ByteBuffer inBBuff , ByteBuffer outBBuff ) throws GSSException { try { if ( sslEngine . getHandshakeStatus ( ) != SSLEngineResult . HandshakeStatus . NOT_HANDSHAKING ) { throw new Exception ( "SSLEngine handshaking needed! " + "HandshakeStatus: " + sslEngine . getHandshakeStatus ( ) . t... | Meant for non - handshake processing |
121,698 | private ByteBuffer sslDataUnwrap ( ByteBuffer inBBuff , ByteBuffer outBBuff ) throws GSSException { try { int iter = 0 ; if ( sslEngine . getHandshakeStatus ( ) != SSLEngineResult . HandshakeStatus . NOT_HANDSHAKING ) { throw new Exception ( "SSLEngine handshaking needed! " + "HandshakeStatus: " + sslEngine . getHandsh... | Not all in inBBuff might be consumed by this method!!! |
121,699 | public byte [ ] wrap ( byte [ ] inBuf , int off , int len , MessageProp prop ) throws GSSException { checkContext ( ) ; logger . debug ( "enter wrap" ) ; byte [ ] token = null ; boolean doGSIWrap = false ; if ( prop != null ) { if ( prop . getQOP ( ) != 0 && prop . getQOP ( ) != GSSConstants . GSI_BIG ) { throw new GSS... | Wraps a message for integrity and protection . A regular SSL - wrapped token is returned . |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.