idx int64 0 165k | question stringlengths 73 4.15k | target stringlengths 5 918 | len_question int64 21 890 | len_target int64 3 255 |
|---|---|---|---|---|
43,400 | public CommunicationGroupDriver getNewInstance ( final Class < ? extends Name < String > > groupName , final Class < ? extends Topology > topologyClass , final int numberOfTasks , final int customFanOut ) throws InjectionException { final Injector newInjector = injector . forkInjector ( ) ; newInjector . bindVolatilePa... | Instantiates a new CommunicationGroupDriver instance . | 175 | 10 |
43,401 | @ Override public byte [ ] call ( final byte [ ] memento ) throws IOException { try ( final DataOutputStream outputStream = outputStreamProvider . create ( "hello" ) ) { outputStream . writeBytes ( "Hello REEF!" ) ; } return null ; } | Receives an output stream from the output service and writes Hello REEF! on it . | 60 | 19 |
43,402 | public static void main ( final String [ ] args ) { try { final Configuration config = getClientConfiguration ( args ) ; LOG . log ( Level . INFO , "Configuration:\n--\n{0}--" , Configurations . toString ( config , true ) ) ; final Injector injector = Tang . Factory . getTang ( ) . newInjector ( config ) ; final Suspen... | Main method that runs the example . | 192 | 7 |
43,403 | @ Override public String getTrackingUrl ( ) { if ( this . httpServer == null ) { return "" ; } try { return InetAddress . getLocalHost ( ) . getHostAddress ( ) + ":" + httpServer . getPort ( ) ; } catch ( final UnknownHostException e ) { LOG . log ( Level . WARNING , "Cannot get host address." , e ) ; throw new Runtime... | get tracking URI . | 103 | 4 |
43,404 | private void kill ( final String applicationId ) throws IOException { LOG . log ( Level . INFO , "Killing application [{0}]" , applicationId ) ; this . hdInsightInstance . killApplication ( applicationId ) ; } | Kills the application with the given id . | 51 | 9 |
43,405 | private void logs ( final String applicationId ) throws IOException { LOG . log ( Level . INFO , "Fetching logs for application [{0}]" , applicationId ) ; this . logFetcher . fetch ( applicationId , new OutputStreamWriter ( System . out , StandardCharsets . UTF_8 ) ) ; } | Fetches the logs for the application with the given id and prints them to System . out . | 71 | 20 |
43,406 | private void logs ( final String applicationId , final File folder ) throws IOException { LOG . log ( Level . FINE , "Fetching logs for application [{0}] and storing them in folder [{1}]" , new Object [ ] { applicationId , folder . getAbsolutePath ( ) } ) ; if ( ! folder . exists ( ) && ! folder . mkdirs ( ) ) { LOG . ... | Fetches the logs for the application with the given id and stores them in the given folder . One file per container . | 133 | 25 |
43,407 | private void list ( ) throws IOException { LOG . log ( Level . FINE , "Listing applications" ) ; final List < ApplicationState > applications = this . hdInsightInstance . listApplications ( ) ; for ( final ApplicationState appState : applications ) { if ( appState . getState ( ) . equals ( "RUNNING" ) ) { System . out ... | Fetches a list of all running applications . | 107 | 10 |
43,408 | public byte [ ] toBytes ( final DefinedRuntimes definedRuntimes ) { final DatumWriter < DefinedRuntimes > configurationWriter = new SpecificDatumWriter <> ( DefinedRuntimes . class ) ; try ( final ByteArrayOutputStream out = new ByteArrayOutputStream ( ) ) { final BinaryEncoder binaryEncoder = EncoderFactory . get ( ) ... | Serializes DefinedRuntimes . | 163 | 8 |
43,409 | private static boolean couldBeYarnConfigurationPath ( final String path ) { return path . contains ( "conf" ) || path . contains ( "etc" ) || path . contains ( HadoopEnvironment . HADOOP_CONF_DIR ) ; } | The oracle that tells us whether a given path could be a YARN configuration path . | 55 | 19 |
43,410 | public static String parseIp ( final String remoteIdentifier ) { return remoteIdentifier . substring ( PROTOCOL . length ( ) , remoteIdentifier . lastIndexOf ( ' ' ) ) ; } | Get the IP address from the remote identifier . | 44 | 9 |
43,411 | @ Override public void onNext ( final JobSubmissionEvent jobSubmissionEvent ) { LOG . log ( Level . FINEST , "Submitting job: {0}" , jobSubmissionEvent ) ; try { this . applicationId = createApplicationId ( jobSubmissionEvent ) ; final String folderName = this . azureBatchFileNames . getStorageJobFolder ( this . applic... | Invoked when JobSubmissionEvent is triggered . | 440 | 10 |
43,412 | public static void main ( final String [ ] args ) throws InjectionException , IOException { final JavaConfigurationBuilder driverConfigBuilder = TANG . newConfigurationBuilder ( STATIC_DRIVER_CONFIG ) ; new CommandLine ( driverConfigBuilder ) . registerShortNameOfClass ( Command . class ) . registerShortNameOfClass ( N... | Start the distributed shell job . | 413 | 6 |
43,413 | synchronized void add ( final Container container ) { final String containerId = container . getId ( ) . toString ( ) ; if ( this . hasContainer ( containerId ) ) { throw new RuntimeException ( "Trying to add a Container that is already known: " + containerId ) ; } this . containers . put ( containerId , container ) ; ... | Registers the given container . | 77 | 6 |
43,414 | synchronized Container removeAndGet ( final String containerId ) { final Container result = this . containers . remove ( containerId ) ; if ( null == result ) { throw new RuntimeException ( "Unknown container to remove: " + containerId ) ; } return result ; } | Removes the container with the given ID . | 57 | 9 |
43,415 | public static void main ( final String [ ] args ) throws Exception { LOG . log ( Level . INFO , "Entering EvaluatorShimLauncher.main()." ) ; final Injector injector = Tang . Factory . getTang ( ) . newInjector ( parseCommandLine ( args ) ) ; final EvaluatorShimLauncher launcher = injector . getInstance ( EvaluatorShimL... | The starting point of the evaluator shim launcher . | 101 | 12 |
43,416 | @ Override public void onNext ( final RemoteEvent < T > value ) { try { LOG . log ( Level . FINEST , "Link: {0} event: {1}" , new Object [ ] { linkRef , value } ) ; if ( linkRef . get ( ) == null ) { queue . add ( value ) ; final Link < byte [ ] > link = transport . get ( value . remoteAddress ( ) ) ; if ( link != null... | Handles the event to send to a remote node . | 289 | 11 |
43,417 | @ Override public byte [ ] recvFromChildren ( ) { LOG . entering ( "OperatorTopologyStructImpl" , "recvFromChildren" , getQualifiedName ( ) ) ; for ( final NodeStruct child : children ) { childrenToRcvFrom . add ( child . getId ( ) ) ; } byte [ ] retVal = new byte [ 0 ] ; while ( ! childrenToRcvFrom . isEmpty ( ) ) { L... | Receive data from all children as a single byte array . Messages from children are simply byte - concatenated . This method is currently used only by the Gather operator . | 243 | 35 |
43,418 | public MultiRuntimeConfigurationBuilder addRuntime ( final String runtimeName ) { Validate . isTrue ( SUPPORTED_RUNTIMES . contains ( runtimeName ) , "unsupported runtime " + runtimeName ) ; this . runtimeNames . add ( runtimeName ) ; return this ; } | Adds runtime name to the builder . | 60 | 7 |
43,419 | public MultiRuntimeConfigurationBuilder setDefaultRuntime ( final String runtimeName ) { Validate . isTrue ( SUPPORTED_RUNTIMES . contains ( runtimeName ) , "Unsupported runtime " + runtimeName ) ; Validate . isTrue ( ! this . defaultRuntime . isPresent ( ) , "Default runtime was already added" ) ; this . defaultRuntim... | Sets default runtime . Default runtime is used when no runtime was specified for evaluator | 89 | 18 |
43,420 | public MultiRuntimeConfigurationBuilder setSubmissionRuntime ( final String runtimeName ) { Validate . isTrue ( SUPPORTED_SUBMISSION_RUNTIMES . contains ( runtimeName ) , "Unsupported submission runtime " + runtimeName ) ; Validate . isTrue ( this . submissionRuntime == null , "Submission runtime was already added" ) ;... | Sets the submission runtime . Submission runtime is used for launching the job driver . | 88 | 16 |
43,421 | public Configuration build ( ) { Validate . notNull ( this . submissionRuntime , "Default Runtime was not defined" ) ; if ( ! this . defaultRuntime . isPresent ( ) || this . runtimeNames . size ( ) == 1 ) { this . defaultRuntime = Optional . of ( this . runtimeNames . toArray ( new String [ 0 ] ) [ 0 ] ) ; } Validate .... | Builds the configuration . | 421 | 5 |
43,422 | @ SuppressWarnings ( "unchecked" ) @ Override public < T > T parseDefaultValue ( final NamedParameterNode < T > name ) { final String [ ] vals = name . getDefaultInstanceAsStrings ( ) ; final T [ ] ret = ( T [ ] ) new Object [ vals . length ] ; for ( int i = 0 ; i < vals . length ; i ++ ) { final String val = vals [ i ... | A helper method that returns the parsed default value of a given NamedParameter . | 274 | 15 |
43,423 | @ Override public Class < ? > classForName ( final String name ) throws ClassNotFoundException { return ReflectionUtilities . classForName ( name , loader ) ; } | Helper method that converts a String to a Class using this ClassHierarchy s classloader . | 38 | 19 |
43,424 | @ SuppressWarnings ( "unchecked" ) private < T > Node registerClass ( final Class < T > c ) throws ClassHierarchyException { if ( c . isArray ( ) ) { throw new UnsupportedOperationException ( "Can't register array types" ) ; } try { return getAlreadyBoundNode ( c ) ; } catch ( final NameResolutionException ignored ) { ... | Assumes that all of the parents of c have been registered already . | 278 | 14 |
43,425 | private static void logToken ( final Level logLevel , final String msgPrefix , final UserGroupInformation user ) { if ( LOG . isLoggable ( logLevel ) ) { LOG . log ( logLevel , "{0} number of tokens: [{1}]." , new Object [ ] { msgPrefix , user . getCredentials ( ) . numberOfTokens ( ) } ) ; for ( final org . apache . h... | Log all the tokens in the container for thr user . | 164 | 11 |
43,426 | private void writeDriverHttpEndPoint ( final File driverFolder , final String applicationId , final Path dfsPath ) throws IOException { final FileSystem fs = FileSystem . get ( yarnConfiguration ) ; final Path httpEndpointPath = new Path ( dfsPath , fileNames . getDriverHttpEndpoint ( ) ) ; String trackingUri = null ; ... | We leave a file behind in job submission directory so that clr client can figure out the applicationId and yarn rest endpoint . | 588 | 25 |
43,427 | @ Override public void start ( final VortexThreadPool vortexThreadPool ) { final Vector < Integer > inputVector = new Vector <> ( ) ; for ( int i = 0 ; i < dimension ; i ++ ) { inputVector . add ( i ) ; } final List < VortexFuture < Integer > > futures = new ArrayList <> ( ) ; final AddOneFunction addOneFunction = new ... | Perform a simple vector calculation on Vortex . | 205 | 9 |
43,428 | public static int getTotalPhysicalMemorySizeInMB ( ) { int memorySizeInMB ; try { long memorySizeInBytes = ( ( com . sun . management . OperatingSystemMXBean ) ManagementFactory . getOperatingSystemMXBean ( ) ) . getTotalPhysicalMemorySize ( ) ; memorySizeInMB = ( int ) ( memorySizeInBytes / BYTES_IN_MEGABYTE ) ; } cat... | Returns the total amount of physical memory on the current machine in megabytes . | 113 | 15 |
43,429 | public void submitContextAndTaskString ( final String evaluatorConfigurationString , final String contextConfigurationString , final String taskConfigurationString ) { final DateFormat dateFormat = new SimpleDateFormat ( "yyyy/MM/dd HH:mm:ss" ) ; LOG . log ( Level . FINE , "AllocatedEvaluatorBridge:submitContextAndTask... | Bridge function for REEF . NET to submit context and task configurations for the allocated evaluator . | 290 | 20 |
43,430 | public void submitContextString ( final String evaluatorConfigurationString , final String contextConfigurationString ) { if ( evaluatorConfigurationString . isEmpty ( ) ) { throw new RuntimeException ( "empty evaluatorConfigurationString provided." ) ; } if ( contextConfigurationString . isEmpty ( ) ) { throw new Runt... | Bridge function for REEF . NET to submit context configuration for the allocated evaluator . | 156 | 18 |
43,431 | public void submitContextAndServiceString ( final String evaluatorConfigurationString , final String contextConfigurationString , final String serviceConfigurationString ) { if ( evaluatorConfigurationString . isEmpty ( ) ) { throw new RuntimeException ( "empty evaluatorConfigurationString provided." ) ; } if ( context... | Bridge function for REEF . NET to submit context and service configurations for the allocated evaluator . | 202 | 20 |
43,432 | public void submitContextAndServiceAndTaskString ( final String evaluatorConfigurationString , final String contextConfigurationString , final String serviceConfigurationString , final String taskConfigurationString ) { if ( evaluatorConfigurationString . isEmpty ( ) ) { throw new RuntimeException ( "empty evaluatorCon... | Bridge function for REEF . NET to submit context service . and task configurations for the allocated evaluator . | 250 | 22 |
43,433 | public String getEvaluatorDescriptorString ( ) { final String descriptorString = Utilities . getEvaluatorDescriptorString ( jallocatedEvaluator . getEvaluatorDescriptor ( ) ) ; LOG . log ( Level . INFO , "allocated evaluator - serialized evaluator descriptor: " + descriptorString ) ; return descriptorString ; } | Gets the serialized evaluator descriptor from the Java allocated evaluator . | 84 | 17 |
43,434 | public static String getGraphvizString ( final InjectionPlan < ? > injectionPlan , final boolean showLegend ) { final GraphvizInjectionPlanVisitor visitor = new GraphvizInjectionPlanVisitor ( showLegend ) ; Walk . preorder ( visitor , visitor , injectionPlan ) ; return visitor . toString ( ) ; } | Produce a Graphviz DOT string for a given TANG injection plan . | 72 | 16 |
43,435 | @ Override public boolean visit ( final Constructor < ? > node ) { this . graphStr . append ( " \"" ) . append ( node . getClass ( ) ) . append ( ' ' ) . append ( node . getNode ( ) . getName ( ) ) . append ( "\" [label=\"" ) . append ( node . getNode ( ) . getName ( ) ) . append ( "\", shape=box];\n" ) ; return true ;... | Process current injection plan node of Constructor type . | 101 | 10 |
43,436 | @ Override public boolean visit ( final JavaInstance < ? > node ) { this . graphStr . append ( " \"" ) . append ( node . getClass ( ) ) . append ( ' ' ) . append ( node . getNode ( ) . getName ( ) ) . append ( "\" [label=\"" ) . append ( node . getNode ( ) . getName ( ) ) . append ( " = " ) . append ( node . getInstanc... | Process current injection plan node of JavaInstance type . | 124 | 10 |
43,437 | @ Override public boolean visit ( final InjectionPlan < ? > nodeFrom , final InjectionPlan < ? > nodeTo ) { this . graphStr . append ( " \"" ) . append ( nodeFrom . getClass ( ) ) . append ( ' ' ) . append ( nodeFrom . getNode ( ) . getName ( ) ) . append ( "\" -> \"" ) . append ( nodeTo . getClass ( ) ) . append ( ' '... | Process current edge of the injection plan . | 133 | 8 |
43,438 | public static void main ( final String [ ] args ) { LOG . log ( Level . INFO , "Entering Launch at :::" + new Date ( ) ) ; try { if ( args == null || args . length == 0 ) { throw new IllegalArgumentException ( "No arguments provided, at least a clrFolder should be supplied." ) ; } final File dotNetFolder = new File ( a... | Main method that starts the CLR Bridge from Java . | 474 | 10 |
43,439 | public static String getIdentifier ( final Configuration c ) { try { return Tang . Factory . getTang ( ) . newInjector ( c ) . getNamedInstance ( ContextIdentifier . class ) ; } catch ( final InjectionException e ) { throw new RuntimeException ( "Unable to determine context identifier. Giving up." , e ) ; } } | Extracts a context id from the given configuration . | 76 | 11 |
43,440 | private void log ( final String message ) { if ( this . optionalParams . isPresent ( ) ) { logger . log ( logLevel , message , params ) ; } else { logger . log ( logLevel , message ) ; } } | Log message . | 50 | 3 |
43,441 | String getWhereTaskletWasScheduledTo ( final int taskletId ) { for ( final Map . Entry < String , VortexWorkerManager > entry : runningWorkers . entrySet ( ) ) { final String workerId = entry . getKey ( ) ; final VortexWorkerManager vortexWorkerManager = entry . getValue ( ) ; if ( vortexWorkerManager . containsTasklet... | Find where a tasklet is scheduled to . | 100 | 9 |
43,442 | public static void logThreads ( final Logger logger , final Level level , final String prefix , final String threadPrefix , final String stackElementPrefix ) { if ( logger . isLoggable ( level ) ) { logger . log ( level , getFormattedThreadList ( prefix , threadPrefix , stackElementPrefix ) ) ; } } | Logs the currently active threads and their stack trace to the given Logger and Level . | 74 | 18 |
43,443 | public static String getFormattedThreadList ( final String prefix , final String threadPrefix , final String stackElementPrefix ) { // Sort by thread name final TreeMap < String , StackTraceElement [ ] > threadNames = new TreeMap <> ( ) ; for ( final Map . Entry < Thread , StackTraceElement [ ] > entry : Thread . getAl... | Produces a String representation of the currently running threads . | 359 | 11 |
43,444 | public static String getFormattedDeadlockInfo ( final String prefix , final String threadPrefix , final String stackElementPrefix ) { final StringBuilder message = new StringBuilder ( prefix ) ; final DeadlockInfo deadlockInfo = new DeadlockInfo ( ) ; final ThreadInfo [ ] deadlockedThreads = deadlockInfo . getDeadlocke... | Produces a String representation of threads that are deadlocked including lock information . | 406 | 15 |
43,445 | void parseOneFile ( final Path inputPath , final Writer outputWriter ) throws IOException { try ( final TFile . Reader . Scanner scanner = this . getScanner ( inputPath ) ) { while ( ! scanner . atEnd ( ) ) { new LogFileEntry ( scanner . entry ( ) ) . write ( outputWriter ) ; scanner . advance ( ) ; } } } | Parses the given file and writes its contents into the outputWriter for all logs in it . | 80 | 20 |
43,446 | void parseOneFile ( final Path inputPath , final File outputFolder ) throws IOException { try ( final TFile . Reader . Scanner scanner = this . getScanner ( inputPath ) ) { while ( ! scanner . atEnd ( ) ) { new LogFileEntry ( scanner . entry ( ) ) . write ( outputFolder ) ; scanner . advance ( ) ; } } } | Parses the given file and stores the logs for each container in a file named after the container in the given . outputFolder | 80 | 26 |
43,447 | @ Override public byte [ ] encode ( final NSMessage < T > obj ) { if ( isStreamingCodec ) { final StreamingCodec < T > streamingCodec = ( StreamingCodec < T > ) codec ; try ( ByteArrayOutputStream baos = new ByteArrayOutputStream ( ) ) { try ( DataOutputStream daos = new DataOutputStream ( baos ) ) { daos . writeUTF ( ... | Encodes a network service message to bytes . | 356 | 9 |
43,448 | @ Override public NSMessage < T > decode ( final byte [ ] buf ) { if ( isStreamingCodec ) { final StreamingCodec < T > streamingCodec = ( StreamingCodec < T > ) codec ; try ( ByteArrayInputStream bais = new ByteArrayInputStream ( buf ) ) { try ( DataInputStream dais = new DataInputStream ( bais ) ) { final Identifier s... | Decodes a network service message from bytes . | 392 | 9 |
43,449 | @ SuppressWarnings ( "checkstyle:illegalcatch" ) public void beforeTaskStart ( ) throws TaskStartHandlerFailure { LOG . log ( Level . FINEST , "Sending TaskStart event to the registered event handlers." ) ; for ( final EventHandler < TaskStart > startHandler : this . taskStartHandlers ) { try { startHandler . onNext ( ... | Sends the TaskStart event to the handlers for it . | 135 | 12 |
43,450 | @ SuppressWarnings ( "checkstyle:illegalcatch" ) public void afterTaskExit ( ) throws TaskStopHandlerFailure { LOG . log ( Level . FINEST , "Sending TaskStop event to the registered event handlers." ) ; for ( final EventHandler < TaskStop > stopHandler : this . taskStopHandlers ) { try { stopHandler . onNext ( this . t... | Sends the TaskStop event to the handlers for it . | 135 | 12 |
43,451 | @ Override public void write ( final T message ) { LOG . log ( Level . FINEST , "write {0} :: {1}" , new Object [ ] { channel , message } ) ; final ChannelFuture future = channel . writeAndFlush ( Unpooled . wrappedBuffer ( encoder . encode ( message ) ) ) ; if ( listener != null ) { future . addListener ( new NettyCha... | Writes the message to this link . | 100 | 8 |
43,452 | private static Configuration readConfigurationFromDisk ( final String configPath , final ConfigurationSerializer serializer ) { LOG . log ( Level . FINER , "Loading configuration file: {0}" , configPath ) ; final File evaluatorConfigFile = new File ( configPath ) ; if ( ! evaluatorConfigFile . exists ( ) ) { throw fata... | Read configuration from a given file and deserialize it into Tang configuration object that can be used for injection . Configuration is currently serialized using Avro . This method also prints full deserialized configuration into log . | 230 | 43 |
43,453 | synchronized ResourceRequestEvent satisfyOne ( ) { final ResourceRequest req = this . requestQueue . element ( ) ; req . satisfyOne ( ) ; if ( req . isSatisfied ( ) ) { this . requestQueue . poll ( ) ; } return req . getRequestProto ( ) ; } | Satisfies one resource for the front - most request . If that satisfies the request it is removed from the queue . | 65 | 24 |
43,454 | public void serialize ( final ByteArrayOutputStream outputStream , final SpecificRecord message , final long sequence ) throws IOException { // Binary encoder for both the header and message. final BinaryEncoder encoder = EncoderFactory . get ( ) . binaryEncoder ( outputStream , null ) ; // Write the header and the mes... | Deserialize messages of type TMessage from input outputStream . | 113 | 13 |
43,455 | private synchronized void onJobFailure ( final JobStatusProto jobStatusProto ) { assert jobStatusProto . getState ( ) == ReefServiceProtos . State . FAILED ; final String id = this . jobId ; final Optional < byte [ ] > data = jobStatusProto . hasException ( ) ? Optional . of ( jobStatusProto . getException ( ) . toByte... | Inform the client of a failed job . | 250 | 9 |
43,456 | @ Override public synchronized Set < String > recoverEvaluators ( ) { final Set < String > expectedContainers = new HashSet <> ( ) ; try { if ( this . fileSystem == null || this . changeLogLocation == null ) { LOG . log ( Level . WARNING , "Unable to recover evaluators due to failure to instantiate FileSystem. Returnin... | Recovers the set of evaluators that are alive . | 402 | 12 |
43,457 | @ Override public synchronized void recordAllocatedEvaluator ( final String id ) { if ( this . fileSystem != null && this . changeLogLocation != null ) { final String entry = ADD_FLAG + id + System . lineSeparator ( ) ; this . logContainerChange ( entry ) ; } } | Adds the allocated evaluator entry to the evaluator log . | 67 | 14 |
43,458 | @ Override public synchronized void recordRemovedEvaluator ( final String id ) { if ( this . fileSystem != null && this . changeLogLocation != null ) { final String entry = REMOVE_FLAG + id + System . lineSeparator ( ) ; this . logContainerChange ( entry ) ; } } | Adds the removed evaluator entry to the evaluator log . | 68 | 14 |
43,459 | @ Override public synchronized void close ( ) throws Exception { if ( this . readerWriter != null && ! this . writerClosed ) { this . readerWriter . close ( ) ; this . writerClosed = true ; } } | Closes the readerWriter which in turn closes the FileSystem . | 48 | 13 |
43,460 | private void onCleanExit ( final String processId ) { this . onResourceStatus ( ResourceStatusEventImpl . newBuilder ( ) . setIdentifier ( processId ) . setState ( State . DONE ) . setExitCode ( 0 ) . build ( ) ) ; } | Inform REEF of a cleanly exited process . | 58 | 11 |
43,461 | private void onUncleanExit ( final String processId , final int exitCode ) { this . onResourceStatus ( ResourceStatusEventImpl . newBuilder ( ) . setIdentifier ( processId ) . setState ( State . FAILED ) . setExitCode ( exitCode ) . build ( ) ) ; } | Inform REEF of an unclean process exit . | 66 | 11 |
43,462 | @ SuppressWarnings ( "checkstyle:illegalCatch" ) public Throwable dispatch ( final StopTime stopTime ) { try { for ( final EventHandler < StopTime > handler : stopHandlers ) { handler . onNext ( stopTime ) ; } return null ; } catch ( Throwable t ) { return t ; } } | We must implement this synchronously in order to catch exceptions and forward them back via the bridge before the server shuts down after this method returns . | 72 | 28 |
43,463 | @ Override public void launchTask ( final ExecutorDriver driver , final TaskInfo task ) { driver . sendStatusUpdate ( TaskStatus . newBuilder ( ) . setTaskId ( TaskID . newBuilder ( ) . setValue ( this . mesosExecutorId ) . build ( ) ) . setState ( TaskState . TASK_STARTING ) . setSlaveId ( task . getSlaveId ( ) ) . se... | We assume a long - running Mesos Task that manages a REEF Evaluator process leveraging Mesos Executor s interface . | 117 | 26 |
43,464 | public static void main ( final String [ ] args ) throws Exception { final Injector injector = Tang . Factory . getTang ( ) . newInjector ( parseCommandLine ( args ) ) ; final REEFExecutor reefExecutor = injector . getInstance ( REEFExecutor . class ) ; reefExecutor . onStart ( ) ; } | The starting point of the executor . | 76 | 8 |
43,465 | void addTokensFromFile ( final UserGroupInformation ugi ) throws IOException { LOG . log ( Level . FINE , "Reading security tokens from file: {0}" , this . securityTokensFile ) ; try ( final FileInputStream stream = new FileInputStream ( securityTokensFile ) ) { final BinaryDecoder decoder = decoderFactory . binaryDeco... | Read tokens from a file and add them to the user s credentials . | 222 | 14 |
43,466 | LocalResource makeLocalResourceForJarFile ( final Path path ) throws IOException { final LocalResource localResource = Records . newRecord ( LocalResource . class ) ; final FileStatus status = FileContext . getFileContext ( this . fileSystem . getUri ( ) ) . getFileStatus ( path ) ; localResource . setType ( LocalResou... | Creates a LocalResource instance for the JAR file referenced by the given Path . | 159 | 17 |
43,467 | public static ArrayList < String > getFilteredLinesFromFile ( final String fileName , final String filter , final String removeBeforeToken , final String removeAfterToken ) throws IOException { final ArrayList < String > filteredLines = new ArrayList <> ( ) ; try ( final BufferedReader in = new BufferedReader ( new Inp... | Get lines from a given file with a specified filter trim the line by removing strings before removeBeforeToken and after removeAfterToken . | 291 | 26 |
43,468 | public static ArrayList < String > getFilteredLinesFromFile ( final String fileName , final String filter ) throws IOException { return getFilteredLinesFromFile ( fileName , filter , null , null ) ; } | get lines from given file with specified filter . | 48 | 9 |
43,469 | public static ArrayList < String > findStages ( final ArrayList < String > lines , final String [ ] stageIndicators ) { final ArrayList < String > stages = new ArrayList <> ( ) ; int i = 0 ; for ( final String line : lines ) { if ( line . contains ( stageIndicators [ i ] ) ) { stages . add ( stageIndicators [ i ] ) ; i... | find lines that contain stage indicators . The stageIndicators must be in sequence which appear in the lines . | 108 | 21 |
43,470 | public static void runHelloReefWithoutClient ( final Configuration runtimeConf ) throws InjectionException { final REEF reef = Tang . Factory . getTang ( ) . newInjector ( runtimeConf ) . getInstance ( REEF . class ) ; final Configuration driverConf = getDriverConfiguration ( ) ; reef . submit ( driverConf ) ; } | Used in the HDInsight example . | 72 | 8 |
43,471 | @ Override @ SuppressWarnings ( "checkstyle:hiddenfield" ) public void resourceOffers ( final SchedulerDriver driver , final List < Protos . Offer > offers ) { final Map < String , NodeDescriptorEventImpl . Builder > nodeDescriptorEvents = new HashMap <> ( ) ; for ( final Offer offer : offers ) { if ( nodeDescriptorEve... | All offers in each batch of offers will be either be launched or declined . | 358 | 15 |
43,472 | public YarnSubmissionHelper addLocalResource ( final String resourceName , final LocalResource resource ) { resources . put ( resourceName , resource ) ; return this ; } | Add a file to be localized on the driver . | 35 | 10 |
43,473 | public YarnSubmissionHelper setPreserveEvaluators ( final boolean preserveEvaluators ) { if ( preserveEvaluators ) { // when supported, set KeepContainersAcrossApplicationAttempts to be true // so that when driver (AM) crashes, evaluators will still be running and we can recover later. if ( YarnTypes . isAtOrAfterVersi... | Set whether or not the resource manager should preserve evaluators across driver restarts . | 262 | 17 |
43,474 | public YarnSubmissionHelper setJobSubmissionEnvMap ( final Map < String , String > map ) { for ( final Map . Entry < String , String > entry : map . entrySet ( ) ) { environmentVariablesMap . put ( entry . getKey ( ) , entry . getValue ( ) ) ; } return this ; } | Sets environment variable map . | 72 | 6 |
43,475 | public YarnSubmissionHelper setJobSubmissionEnvVariable ( final String key , final String value ) { environmentVariablesMap . put ( key , value ) ; return this ; } | Adds a job submission environment variable . | 39 | 7 |
43,476 | @ Override public void onException ( final Throwable cause , final SocketAddress remoteAddress , final T message ) { if ( LOG . isLoggable ( Level . FINEST ) ) { LOG . log ( Level . FINEST , "Error sending message " + message + " to " + remoteAddress , cause ) ; } } | Called when the sent message to remoteAddress is failed to be transferred . | 69 | 15 |
43,477 | static YarnClusterSubmissionFromCS fromJobSubmissionParametersFile ( final File yarnClusterAppSubmissionParametersFile , final File yarnClusterJobSubmissionParametersFile ) throws IOException { try ( final FileInputStream appFileInputStream = new FileInputStream ( yarnClusterAppSubmissionParametersFile ) ) { try ( fina... | Takes the YARN cluster job submission configuration file deserializes it and creates submission object . | 131 | 20 |
43,478 | @ Override public void onMeasure ( int widthMeasureSpec , int heightMeasureSpec ) { int measuredWidth = MeasureSpec . getSize ( widthMeasureSpec ) ; int widthMode = MeasureSpec . getMode ( widthMeasureSpec ) ; int measuredHeight = MeasureSpec . getSize ( heightMeasureSpec ) ; int heightMode = MeasureSpec . getMode ( he... | Measure the view to end up as a square based on the minimum of the height and width . | 132 | 19 |
43,479 | private void setItem ( int index , int value ) { if ( index == HOUR_INDEX ) { setValueForItem ( HOUR_INDEX , value ) ; int hourDegrees = ( value % 12 ) * HOUR_VALUE_TO_DEGREES_STEP_SIZE ; mHourRadialSelectorView . setSelection ( hourDegrees , isHourInnerCircle ( value ) , false ) ; mHourRadialSelectorView . invalidate ... | Set either the hour or the minute . Will set the internal value and set the selection . | 198 | 18 |
43,480 | public void setCurrentItemShowing ( int index , boolean animate ) { if ( index != HOUR_INDEX && index != MINUTE_INDEX ) { Log . e ( TAG , "TimePicker does not support view at index " + index ) ; return ; } int lastIndex = getCurrentItemShowing ( ) ; mCurrentItemShowing = index ; if ( animate && ( index != lastIndex ) )... | Set either minutes or hours as showing . | 479 | 8 |
43,481 | public final void attach ( T object , IAddon parent ) { if ( mObject != null || object == null || mParent != null || parent == null ) { throw new IllegalStateException ( ) ; } mParent = parent ; onAttach ( mObject = object ) ; } | Only for system usage don t call it! | 59 | 9 |
43,482 | public void setFocusedItem ( T item ) { final int itemId = getIdForItem ( item ) ; if ( itemId == INVALID_ID ) { return ; } performAction ( itemId , AccessibilityNodeInfoCompat . ACTION_ACCESSIBILITY_FOCUS , null ) ; } | Requests accessibility focus be placed on the specified item . | 66 | 11 |
43,483 | public void clearFocusedItem ( ) { final int itemId = mFocusedItemId ; if ( itemId == INVALID_ID ) { return ; } performAction ( itemId , AccessibilityNodeInfoCompat . ACTION_CLEAR_ACCESSIBILITY_FOCUS , null ) ; } | Clears the current accessibility focused item . | 65 | 8 |
43,484 | @ TargetApi ( Build . VERSION_CODES . ICE_CREAM_SANDWICH ) public boolean sendEventForItem ( T item , int eventType ) { if ( ! mManager . isEnabled ( ) || Build . VERSION . SDK_INT < Build . VERSION_CODES . ICE_CREAM_SANDWICH ) { return false ; } final AccessibilityEvent event = getEventForItem ( item , eventType ) ; f... | Populates an event of the specified type with information about an item and attempts to send it up through the view hierarchy . | 134 | 24 |
43,485 | void drawDivider ( Canvas canvas , Rect bounds , int childIndex ) { final Drawable divider = getDivider ( ) ; divider . setBounds ( bounds ) ; divider . draw ( canvas ) ; } | O_O This method doesn t override super method but super class invoke it instead of android . widget . ListView . drawDivider . It s fucking magic of dalvik? | 48 | 37 |
43,486 | @ SuppressLint ( "InlinedApi" ) private static Object [ ] parseFontStyle ( Context context , AttributeSet attrs , int defStyleAttr ) { final TypedArray a = context . obtainStyledAttributes ( attrs , R . styleable . TextAppearance , defStyleAttr , 0 ) ; final Object [ ] result = parseFontStyle ( a ) ; a . recycle ( ) ; ... | Looks ugly? Yea i know . | 93 | 8 |
43,487 | private void removeItemAtInt ( int index , boolean updateChildrenOnMenuViews ) { if ( ( index < 0 ) || ( index >= mItems . size ( ) ) ) { return ; } mItems . remove ( index ) ; if ( updateChildrenOnMenuViews ) { onItemsChanged ( true ) ; } } | Remove the item at the given index and optionally forces menu views to update . | 69 | 15 |
43,488 | public void updateMenuView ( boolean cleared ) { final ViewGroup parent = ( ViewGroup ) mMenuView ; if ( parent == null ) { return ; } int childIndex = 0 ; if ( mMenu != null ) { mMenu . flagActionItems ( ) ; ArrayList < MenuItemImpl > visibleItems = mMenu . getVisibleItems ( ) ; final int itemCount = visibleItems . si... | Reuses item views when it can | 320 | 7 |
43,489 | private void updateProgressBars ( int value ) { ProgressBar circularProgressBar = getCircularProgressBar ( ) ; ProgressBar horizontalProgressBar = getHorizontalProgressBar ( ) ; if ( value == Window . PROGRESS_VISIBILITY_ON ) { if ( mFeatureProgress ) { int level = horizontalProgressBar . getProgress ( ) ; int visibili... | Progress Bar function . Mostly extracted from PhoneWindow . java | 397 | 11 |
43,490 | public CalendarDay getDayFromLocation ( float x , float y ) { int dayStart = mPadding ; if ( x < dayStart || x > mWidth - mPadding ) { return null ; } // Selection is (x - start) / (pixels/day) == (x -s) * day / pixels int row = ( int ) ( y - MONTH_HEADER_SIZE ) / mRowHeight ; int column = ( int ) ( ( x - dayStart ) * ... | Calculates the day that the given x position is in accounting for week number . Returns a Time referencing that day or null if | 176 | 26 |
43,491 | private Drawable getDrawable ( Uri uri ) { try { String scheme = uri . getScheme ( ) ; if ( ContentResolver . SCHEME_ANDROID_RESOURCE . equals ( scheme ) ) { // Load drawables through Resources, to get the source density information try { return getDrawableFromResourceUri ( uri ) ; } catch ( Resources . NotFoundExcepti... | Gets a drawable by URI without using the cache . | 278 | 12 |
43,492 | private Drawable getDefaultIcon1 ( Cursor cursor ) { // Check the component that gave us the suggestion Drawable drawable = getActivityIconWithCache ( mSearchable . getSearchActivity ( ) ) ; if ( drawable != null ) { return drawable ; } // Fall back to a default icon return mContext . getPackageManager ( ) . getDefault... | Gets the left - hand side icon that will be used for the current suggestion if the suggestion contains an icon column but no icon or a broken icon . | 82 | 31 |
43,493 | public ResolveInfo getDefaultActivity ( ) { synchronized ( mInstanceLock ) { ensureConsistentState ( ) ; if ( ! mActivities . isEmpty ( ) ) { return mActivities . get ( 0 ) . resolveInfo ; } } return null ; } | Gets the default activity The default activity is defined as the one with highest rank i . e . the first one in the list of activities that can handle the intent . | 56 | 34 |
43,494 | public void setDefaultActivity ( int index ) { synchronized ( mInstanceLock ) { ensureConsistentState ( ) ; ActivityResolveInfo newDefaultActivity = mActivities . get ( index ) ; ActivityResolveInfo oldDefaultActivity = mActivities . get ( 0 ) ; final float weight ; if ( oldDefaultActivity != null ) { // Add a record w... | Sets the default activity . The default activity is set by adding a historical record with weight high enough that this activity will become the highest ranked . Such a strategy guarantees that the default will eventually change if not used . Also the weight of the record for setting a default is inflated with a consta... | 201 | 70 |
43,495 | public void setActivitySorter ( ActivitySorter activitySorter ) { synchronized ( mInstanceLock ) { if ( mActivitySorter == activitySorter ) { return ; } mActivitySorter = activitySorter ; if ( sortActivitiesIfNeeded ( ) ) { notifyChanged ( ) ; } } } | Sets the sorter for ordering activities based on historical data and an intent . | 66 | 16 |
43,496 | private boolean sortActivitiesIfNeeded ( ) { if ( mActivitySorter != null && mIntent != null && ! mActivities . isEmpty ( ) && ! mHistoricalRecords . isEmpty ( ) ) { mActivitySorter . sort ( mIntent , mActivities , Collections . unmodifiableList ( mHistoricalRecords ) ) ; return true ; } return false ; } | Sorts the activities if necessary which is if there is a sorter there are some activities to sort and there is some historical data . | 87 | 27 |
43,497 | private boolean loadActivitiesIfNeeded ( ) { if ( mReloadActivities && mIntent != null ) { mReloadActivities = false ; mActivities . clear ( ) ; List < ResolveInfo > resolveInfos = mContext . getPackageManager ( ) . queryIntentActivities ( mIntent , 0 ) ; final int resolveInfoCount = resolveInfos . size ( ) ; for ( int... | Loads the activities for the current intent if needed which is if they are not already loaded for the current intent . | 146 | 23 |
43,498 | private boolean readHistoricalDataIfNeeded ( ) { if ( mCanReadHistoricalData && mHistoricalRecordsChanged && ! TextUtils . isEmpty ( mHistoryFileName ) ) { mCanReadHistoricalData = false ; mReadShareHistoryCalled = true ; readHistoricalDataImpl ( ) ; return true ; } return false ; } | Reads the historical data if necessary which is it has changed there is a history file and there is not persist in progress . | 77 | 25 |
43,499 | private void pruneExcessiveHistoricalRecordsIfNeeded ( ) { final int pruneCount = mHistoricalRecords . size ( ) - mHistoryMaxSize ; if ( pruneCount <= 0 ) { return ; } mHistoricalRecordsChanged = true ; for ( int i = 0 ; i < pruneCount ; i ++ ) { HistoricalRecord prunedRecord = mHistoricalRecords . remove ( 0 ) ; if ( ... | Prunes older excessive records to guarantee maxHistorySize . | 120 | 11 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.