idx
int64
0
165k
question
stringlengths
73
5.81k
target
stringlengths
5
918
123,100
public void addElement ( Element element , int sortOrder ) { final String deepName = getDeepName ( element ) ; elementNameSortOrderMap . put ( deepName , sortOrder ) ; }
Add an Xml element to the map
123,101
public boolean containsElement ( Element element ) { String deepName = getDeepName ( element ) ; return elementNameSortOrderMap . containsKey ( deepName ) ; }
Returns true if element is in the map
123,102
public void setOriginalXml ( final InputStream originalXml ) throws JDOMException , IOException { SAXBuilder parser = new SAXBuilder ( ) ; originalDocument = parser . build ( originalXml ) ; }
Sets the original xml that should be sorted . Builds a dom document of the xml .
123,103
public void sortXml ( ) { newDocument = ( Document ) originalDocument . clone ( ) ; final Element rootElement = ( Element ) originalDocument . getRootElement ( ) . clone ( ) ; HierarchyRootWrapper rootWrapper = factory . createFromRootElement ( rootElement ) ; rootWrapper . createWrappedStructure ( factory ) ; rootWrap...
Creates a new dom document that contains the sorted xml .
123,104
public void setup ( PluginParameters pluginParameters ) { this . indentCharacters = pluginParameters . indentCharacters ; this . lineSeparatorUtil = pluginParameters . lineSeparatorUtil ; this . encoding = pluginParameters . encoding ; this . expandEmptyElements = pluginParameters . expandEmptyElements ; this . indentB...
Setup default configuration
123,105
public String getSortedXml ( Document newDocument ) { try ( ByteArrayOutputStream sortedXml = new ByteArrayOutputStream ( ) ) { BufferedLineSeparatorOutputStream bufferedLineOutputStream = new BufferedLineSeparatorOutputStream ( lineSeparatorUtil . toString ( ) , sortedXml ) ; XMLOutputter xmlOutputter = new PatchedXML...
Returns the sorted xml as an OutputStream .
123,106
private void initializeSortOrderMap ( ) { try { Document document = createDocumentFromDefaultSortOrderFile ( ) ; addElementsToSortOrderMap ( document . getRootElement ( ) , SORT_ORDER_BASE ) ; } catch ( IOException | JDOMException e ) { throw new FailureException ( e . getMessage ( ) , e ) ; } }
Creates sort order map from chosen sort order .
123,107
private void addElementsToSortOrderMap ( final Element element , int baseSortOrder ) { elementSortOrderMap . addElement ( element , baseSortOrder ) ; final List < Element > castToChildElementList = castToChildElementList ( element ) ; int sortOrder = baseSortOrder ; for ( Element child : castToChildElementList ) { sort...
Processes the chosen sort order . Adds sort order element and sort index to a map .
123,108
public void sortPom ( ) { log . info ( "Sorting file " + pomFile . getAbsolutePath ( ) ) ; String originalXml = fileUtil . getPomFileContent ( ) ; String sortedXml = sortXml ( originalXml ) ; if ( pomFileIsSorted ( originalXml , sortedXml ) ) { log . info ( "Pom file is already sorted, exiting" ) ; return ; } createBac...
Sorts the pom file .
123,109
private String sortXml ( final String originalXml ) { xmlProcessingInstructionParser . scanForIgnoredSections ( originalXml ) ; String xml = xmlProcessingInstructionParser . replaceIgnoredSections ( ) ; insertXmlInXmlProcessor ( xml , ( ) -> "Could not sort " + pomFile . getAbsolutePath ( ) + " content: " ) ; xmlProces...
Sorts the incoming xml .
123,110
private void createBackupFile ( ) { if ( createBackupFile ) { if ( backupFileExtension . trim ( ) . length ( ) == 0 ) { throw new FailureException ( "Could not create backup file, extension name was empty" ) ; } fileUtil . backupFile ( ) ; log . info ( String . format ( "Saved backup of %s to %s%s" , pomFile . getAbsol...
Creates the backup file for pom .
123,111
private void saveSortedPomFile ( final String sortedXml ) { fileUtil . savePomFile ( sortedXml ) ; log . info ( "Saved sorted pom file to " + pomFile . getAbsolutePath ( ) ) ; }
Saves the sorted pom file .
123,112
public void verifyPom ( ) { String pomFileName = pomFile . getAbsolutePath ( ) ; log . info ( "Verifying file " + pomFileName ) ; XmlOrderedResult xmlOrderedResult = isPomElementsSorted ( ) ; if ( ! xmlOrderedResult . isOrdered ( ) ) { switch ( verifyFailType ) { case WARN : log . warn ( xmlOrderedResult . getErrorMess...
Verify that the pom - file is sorted regardless of formatting
123,113
public static byte [ ] s2n ( String string ) { if ( string == null ) { return null ; } byte [ ] stringBytes = string . getBytes ( UTF8 ) ; byte [ ] allBytes = new byte [ stringBytes . length + 1 ] ; System . arraycopy ( stringBytes , 0 , allBytes , 0 , stringBytes . length ) ; return allBytes ; }
Java - to - native string mapping
123,114
public synchronized boolean spell ( String word ) { requireValidHandle ( ) ; if ( ! isValidInput ( word ) ) { return false ; } int spellResult = getLib ( ) . voikkoSpellCstr ( handle , s2n ( word ) ) ; return ( spellResult == Libvoikko . VOIKKO_SPELL_OK ) ; }
Check the spelling of given word .
123,115
public synchronized List < GrammarError > grammarErrors ( String text , String language ) { requireValidHandle ( ) ; List < GrammarError > errorList = new ArrayList < GrammarError > ( ) ; if ( ! isValidInput ( text ) ) { return errorList ; } int offset = 0 ; for ( String paragraph : text . replace ( "\r" , "\n" ) . spl...
Check the given text for grammar errors and return a list of GrammarError objects representing the errors that were found . Unlike the C based API this method accepts multiple paragraphs separated by newline characters .
123,116
public synchronized List < Analysis > analyze ( String word ) { requireValidHandle ( ) ; List < Analysis > analysisList = new ArrayList < Analysis > ( ) ; if ( ! isValidInput ( word ) ) { return analysisList ; } Libvoikko lib = getLib ( ) ; Pointer cAnalysisList = lib . voikkoAnalyzeWordCstr ( handle , s2n ( word ) ) ;...
Analyze the morphology of given word and return the list of analysis results .
123,117
public synchronized List < Token > tokens ( String text ) { requireValidHandle ( ) ; List < Token > allTokens = new ArrayList < Token > ( ) ; int lastStart = 0 ; for ( int i = indexOfSpecialUnknown ( text , 0 ) ; i != - 1 ; i = indexOfSpecialUnknown ( text , i + 1 ) ) { allTokens . addAll ( tokensNonNull ( text . subst...
Split the given natural language text into a list of Token objects .
123,118
public synchronized List < Sentence > sentences ( String text ) { requireValidHandle ( ) ; Libvoikko lib = getLib ( ) ; List < Sentence > result = new ArrayList < Sentence > ( ) ; if ( ! isValidInput ( text ) ) { result . add ( new Sentence ( text , SentenceStartType . NONE ) ) ; return result ; } byte [ ] textBytes = ...
Split the given natural language text into a list of Sentence objects .
123,119
public static void addLibraryPath ( String libraryPath ) { for ( String libraryName : LIBRARY_NAMES ) { NativeLibrary . addSearchPath ( libraryName , libraryPath ) ; } }
Set the explicit path to the folder containing shared library files .
123,120
public final < U > void addPartial ( HtmlView < U > partial , U model ) { getVisitor ( ) . closeBeginTag ( ) ; partial . getVisitor ( ) . depth = getVisitor ( ) . depth ; if ( this . getVisitor ( ) . isWriting ( ) ) getVisitor ( ) . write ( partial . render ( model ) ) ; }
Adds a partial view to this view .
123,121
public File attemptToDownload ( URL fileLocation ) throws URISyntaxException , IOException { String filename = FilenameUtils . getName ( fileLocation . getFile ( ) ) ; SocketConfig socketConfig = SocketConfig . custom ( ) . setSoTimeout ( fileDownloadReadTimeout ) . build ( ) ; RequestConfig requestConfig = RequestConf...
Attempt to download a file
123,122
private String localFilePath ( File downloadDirectory ) throws MojoFailureException { if ( downloadDirectory . exists ( ) ) { if ( downloadDirectory . isDirectory ( ) ) { return downloadDirectory . getAbsolutePath ( ) ; } else { throw new MojoFailureException ( "'" + downloadDirectory . getAbsolutePath ( ) + "' is not ...
Set the location directory where files will be downloaded to
123,123
protected File downloadFile ( DriverDetails driverDetails , boolean shouldWeCheckFileHash ) throws MojoExecutionException , IOException , URISyntaxException { URL remoteFileLocation = driverDetails . fileLocation ; final String filename = FilenameUtils . getName ( remoteFileLocation . getFile ( ) ) ; for ( int retryAtt...
Perform the file download
123,124
InputStream getInputStream ( ) throws IOException { switch ( filetype ) { case GZ : LOG . debug ( "Decompressing .gz file" ) ; return new GzipCompressorInputStream ( new FileInputStream ( compressedFile ) ) ; case BZ2 : LOG . debug ( "Decompressing .bz2 file" ) ; return new BZip2CompressorInputStream ( new FileInputStr...
Get an InputStream for the decompressed file .
123,125
DownloadableFileType getArchiveType ( ) { try { return DownloadableFileType . valueOf ( FilenameUtils . getExtension ( decompressedFilename ) . toUpperCase ( ) ) ; } catch ( IllegalArgumentException e ) { LOG . debug ( "Not a recognised Archive type" ) ; return null ; } }
Find out if the uncompressed file is an archive
123,126
private void setRepositoryMapFile ( ) throws MojoExecutionException { if ( this . customRepositoryMap != null && ! this . customRepositoryMap . isEmpty ( ) ) { File repositoryMap = getRepositoryMapFile ( this . customRepositoryMap ) ; if ( repositoryMap . exists ( ) ) { checkRepositoryMapIsValid ( repositoryMap ) ; try...
Set the RepositoryMap used to get file information . If the supplied map is invalid it will default to the pre - packaged one here .
123,127
protected void checkRepositoryMapIsValid ( File repositoryMap ) throws MojoExecutionException { URL schemaFile = this . getClass ( ) . getResource ( "/RepositoryMap.xsd" ) ; Source xmlFile = new StreamSource ( repositoryMap ) ; SchemaFactory schemaFactory = SchemaFactory . newInstance ( XMLConstants . W3C_XML_SCHEMA_NS...
Validate any custom repository maps that are supplied against the xsd . Throw an error and stop if it is not valid . Assume it doesn t exist if we get an IOError and fall back to default file .
123,128
public String extractFileFromArchive ( File downloadedCompressedFile , String extractedToFilePath , BinaryType possibleFilenames ) throws IOException , IllegalArgumentException , MojoFailureException { DownloadableFileType fileType = DownloadableFileType . valueOf ( FilenameUtils . getExtension ( downloadedCompressedFi...
Extract binary from a downloaded archive file
123,129
private String copyFileToDisk ( InputStream inputStream , String pathToExtractTo , String filename ) throws IOException { if ( ! overwriteFilesThatExist ) { File [ ] existingFiles = new File ( pathToExtractTo ) . listFiles ( ) ; if ( null != existingFiles && existingFiles . length > 0 ) { for ( File existingFile : exis...
Copy a file from an inputsteam to disk
123,130
void postStart ( final DownloadRequest request , final long totalBytes ) { downloadPoster . execute ( new Runnable ( ) { public void run ( ) { request . downloadCallback ( ) . onStart ( request . downloadId ( ) , totalBytes ) ; } } ) ; }
Post download start event .
123,131
void postRetry ( final DownloadRequest request ) { downloadPoster . execute ( new Runnable ( ) { public void run ( ) { request . downloadCallback ( ) . onRetry ( request . downloadId ( ) ) ; } } ) ; }
Post download retry event .
123,132
void postProgress ( final DownloadRequest request , final long bytesWritten , final long totalBytes ) { downloadPoster . execute ( new Runnable ( ) { public void run ( ) { request . downloadCallback ( ) . onProgress ( request . downloadId ( ) , bytesWritten , totalBytes ) ; } } ) ; }
Post download progress event .
123,133
void postSuccess ( final DownloadRequest request ) { downloadPoster . execute ( new Runnable ( ) { public void run ( ) { request . downloadCallback ( ) . onSuccess ( request . downloadId ( ) , request . destinationFilePath ( ) ) ; } } ) ; }
Post download success event .
123,134
void postFailure ( final DownloadRequest request , final int statusCode , final String errMsg ) { downloadPoster . execute ( new Runnable ( ) { public void run ( ) { request . downloadCallback ( ) . onFailure ( request . downloadId ( ) , statusCode , errMsg ) ; } } ) ; }
Post download failure event .
123,135
public int add ( DownloadRequest request ) { request = checkNotNull ( request , "request == null" ) ; if ( isDownloading ( request . uri ( ) . toString ( ) ) ) { return - 1 ; } request . context ( context ) ; request . downloader ( downloader . copy ( ) ) ; return downloadRequestQueue . add ( request ) ? request . down...
Add one download request into the queue .
123,136
@ SuppressWarnings ( "ResultOfMethodCallIgnored" ) void updateDestinationFilePath ( String filename ) { String separator = destinationDirectory . endsWith ( "/" ) ? "" : File . separator ; destinationFilePath = destinationDirectory + separator + filename ; Log . d ( "TAG" , "destinationFilePath: " + destinationFilePath...
Update absolute file path according to the directory and filename .
123,137
boolean add ( DownloadRequest request ) { if ( query ( request . downloadId ( ) ) != DownloadState . INVALID || query ( request . uri ( ) ) != DownloadState . INVALID ) { Log . w ( TAG , "the download requst is in downloading" ) ; return false ; } request . downloadRequestQueue ( this ) ; synchronized ( currentRequests...
Add download request to the download request queue .
123,138
boolean cancel ( int downloadId ) { synchronized ( currentRequests ) { for ( DownloadRequest request : currentRequests ) { if ( request . downloadId ( ) == downloadId ) { request . cancel ( ) ; return true ; } } } return false ; }
Cancel a download in progress .
123,139
DownloadState query ( int downloadId ) { synchronized ( currentRequests ) { for ( DownloadRequest request : currentRequests ) { if ( request . downloadId ( ) == downloadId ) { return request . downloadState ( ) ; } } } return DownloadState . INVALID ; }
To check if the request is downloading according to download id .
123,140
DownloadState query ( Uri uri ) { synchronized ( currentRequests ) { for ( DownloadRequest request : currentRequests ) { if ( request . uri ( ) . toString ( ) . equals ( uri . toString ( ) ) ) { return request . downloadState ( ) ; } } } return DownloadState . INVALID ; }
To check if the request is downloading according to download url .
123,141
void release ( ) { cancelAll ( ) ; if ( downloadQueue != null ) { downloadQueue = null ; } if ( dispatchers != null ) { stop ( ) ; for ( int i = 0 ; i < dispatchers . length ; i ++ ) { dispatchers [ i ] = null ; } dispatchers = null ; } }
Release all the resource .
123,142
static boolean isWifi ( Context context ) { if ( context == null ) { return false ; } ConnectivityManager manager = ( ConnectivityManager ) context . getSystemService ( Context . CONNECTIVITY_SERVICE ) ; if ( manager == null ) { return false ; } NetworkInfo info = manager . getActiveNetworkInfo ( ) ; return info != nul...
To check whether current network is wifi .
123,143
static String getFilenameFromUrl ( String url ) { String filename = md5 ( url ) + ".down" ; int index = url . lastIndexOf ( "/" ) ; if ( index > 0 ) { String tmpFilename = url . substring ( index + 1 ) ; int qmarkIndex = tmpFilename . indexOf ( "?" ) ; if ( qmarkIndex > 0 ) { tmpFilename = tmpFilename . substring ( 0 ,...
Get filename from url .
123,144
public static String getFilenameFromHeader ( String url , String contentDisposition ) { String filename ; if ( ! TextUtils . isEmpty ( contentDisposition ) ) { int index = contentDisposition . indexOf ( "filename" ) ; if ( index > 0 ) { filename = contentDisposition . substring ( index + 9 , contentDisposition . length...
Get filename from content disposition in header .
123,145
@ SuppressWarnings ( "unchecked" ) public static JobManagerProfiler loadJobManagerProfiler ( String profilerClassName , InetAddress jobManagerBindAddress ) { final Class < ? extends JobManagerProfiler > profilerClass ; try { profilerClass = ( Class < ? extends JobManagerProfiler > ) Class . forName ( profilerClassName ...
Creates an instance of the job manager s profiling component .
123,146
@ SuppressWarnings ( "unchecked" ) public static TaskManagerProfiler loadTaskManagerProfiler ( String profilerClassName , InetAddress jobManagerAddress , InstanceConnectionInfo instanceConnectionInfo ) { final Class < ? extends TaskManagerProfiler > profilerClass ; try { profilerClass = ( Class < ? extends TaskManagerP...
Creates an instance of the task manager s profiling component .
123,147
public static boolean createWire ( final DistributionPattern pattern , final int nodeLowerStage , final int nodeUpperStage , final int sizeSetLowerStage , final int sizeSetUpperStage ) { switch ( pattern ) { case BIPARTITE : return true ; case POINTWISE : if ( sizeSetLowerStage < sizeSetUpperStage ) { if ( nodeLowerSta...
Checks if two subtasks of different tasks should be wired .
123,148
void insertForwardEdge ( final ManagementGroupEdge edge , final int index ) { while ( index >= this . forwardEdges . size ( ) ) { this . forwardEdges . add ( null ) ; } this . forwardEdges . set ( index , edge ) ; }
Inserts a new edge starting at this group vertex at the given index .
123,149
void insertBackwardEdge ( final ManagementGroupEdge edge , final int index ) { while ( index >= this . backwardEdges . size ( ) ) { this . backwardEdges . add ( null ) ; } this . backwardEdges . set ( index , edge ) ; }
Inserts a new edge arriving at this group vertex at the given index .
123,150
public ManagementGroupEdge getForwardEdge ( final int index ) { if ( index < this . forwardEdges . size ( ) ) { return this . forwardEdges . get ( index ) ; } return null ; }
Returns the group edge which leaves this group vertex at the given index .
123,151
public ManagementGroupEdge getBackwardEdge ( final int index ) { if ( index < this . backwardEdges . size ( ) ) { return this . backwardEdges . get ( index ) ; } return null ; }
Returns the group edge which arrives at this group vertex at the given index .
123,152
void collectVertices ( final List < ManagementVertex > vertices ) { final Iterator < ManagementVertex > it = this . groupMembers . iterator ( ) ; while ( it . hasNext ( ) ) { vertices . add ( it . next ( ) ) ; } }
Adds all management vertices which are included in this group vertex to the given list .
123,153
public ManagementVertex getGroupMember ( final int index ) { if ( index < this . groupMembers . size ( ) ) { return this . groupMembers . get ( index ) ; } return null ; }
Returns the management vertex with the given index .
123,154
public List < ManagementGroupVertex > getSuccessors ( ) { final List < ManagementGroupVertex > successors = new ArrayList < ManagementGroupVertex > ( ) ; for ( ManagementGroupEdge edge : this . forwardEdges ) { successors . add ( edge . getTarget ( ) ) ; } return successors ; }
Returns the list of successors of this group vertex . A successor is a group vertex which can be reached via a group edge originating at this group vertex .
123,155
public List < ManagementGroupVertex > getPredecessors ( ) { final List < ManagementGroupVertex > predecessors = new ArrayList < ManagementGroupVertex > ( ) ; for ( ManagementGroupEdge edge : this . backwardEdges ) { predecessors . add ( edge . getSource ( ) ) ; } return predecessors ; }
Returns the list of predecessors of this group vertex . A predecessors is a group vertex which can be reached via a group edge arriving at this group vertex .
123,156
public String toJson ( ) { StringBuilder json = new StringBuilder ( "" ) ; json . append ( "{" ) ; json . append ( "\"groupvertexid\": \"" + this . getID ( ) + "\"," ) ; json . append ( "\"groupvertexname\": \"" + StringUtils . escapeHtml ( this . getName ( ) ) + "\"," ) ; json . append ( "\"numberofgroupmembers\": " +...
Returns Json representation of this ManagementGroupVertex
123,157
public static final InstanceType createDefaultInstanceType ( ) { final HardwareDescription hardwareDescription = HardwareDescriptionFactory . extractFromSystem ( ) ; int diskCapacityInGB = 0 ; final String [ ] tempDirs = GlobalConfiguration . getString ( ConfigConstants . TASK_MANAGER_TMP_DIR_KEY , ConfigConstants . DE...
Creates a default instance type based on the hardware characteristics of the machine that calls this method . The default instance type contains the machine s number of CPU cores and size of physical memory . The disc capacity is calculated from the free space in the directory for temporary files .
123,158
public JobExecutionResult run ( JobWithJars prog , int parallelism , boolean wait ) throws CompilerException , ProgramInvocationException { return run ( getOptimizedPlan ( prog , parallelism ) , prog . getJarFiles ( ) , wait ) ; }
Runs a program on the nephele system whose job - manager is configured in this client s configuration . This method involves all steps from compiling job - graph generation to submission .
123,159
public FutureTask < Path > createTmpFile ( String name , String filePath , JobID jobID ) { synchronized ( count ) { Pair < JobID , String > key = new ImmutablePair ( jobID , name ) ; if ( count . containsKey ( key ) ) { count . put ( key , count . get ( key ) + 1 ) ; } else { count . put ( key , 1 ) ; } } CopyProcess c...
If the file doesn t exists locally it will copy the file to the temp directory .
123,160
public void deleteTmpFile ( String name , JobID jobID ) { DeleteProcess dp = new DeleteProcess ( name , jobID , count . get ( new ImmutablePair ( jobID , name ) ) ) ; executorService . schedule ( dp , 5000L , TimeUnit . MILLISECONDS ) ; }
Leave a 5 seconds delay to clear the local file .
123,161
public void configure ( Configuration parameters ) { super . configure ( parameters ) ; String delimString = parameters . getString ( RECORD_DELIMITER , null ) ; if ( delimString != null ) { String charsetName = parameters . getString ( RECORD_DELIMITER_ENCODING , null ) ; if ( charsetName == null ) { setDelimiter ( de...
Configures this input format by reading the path to the file from the configuration andge the string that defines the record delimiter .
123,162
@ SuppressWarnings ( "unchecked" ) static InstanceManager loadInstanceManager ( final String instanceManagerClassName ) { Class < ? extends InstanceManager > instanceManagerClass ; try { instanceManagerClass = ( Class < ? extends InstanceManager > ) Class . forName ( instanceManagerClassName ) ; } catch ( ClassNotFound...
Tries to locate a class with given name and to instantiate a instance manager from it .
123,163
private void recycleBuffer ( MemorySegment buffer ) { synchronized ( this . buffers ) { if ( this . isDestroyed ) { this . globalBufferPool . returnBuffer ( buffer ) ; this . numRequestedBuffers -- ; } else { if ( this . numRequestedBuffers > this . numDesignatedBuffers ) { this . globalBufferPool . returnBuffer ( buff...
Returns a buffer to the buffer pool and notifies listeners about the availability of a new buffer .
123,164
public int getDistance ( final NetworkNode networkNode ) { int steps = 0 ; NetworkNode tmp = this ; while ( tmp != null ) { final int distance = tmp . isPredecessorOrSelfOf ( networkNode ) ; if ( distance >= 0 ) { return ( steps + distance ) ; } tmp = tmp . getParentNode ( ) ; ++ steps ; } return Integer . MAX_VALUE ; ...
Determines the distance to the given network node . The distance is determined as the number of internal network nodes that must be traversed in order to send a packet from one node to the other plus one .
123,165
public Record nextRecord ( Record record ) { try { resultSet . next ( ) ; ResultSetMetaData rsmd = resultSet . getMetaData ( ) ; int column_count = rsmd . getColumnCount ( ) ; record . setNumFields ( column_count ) ; for ( int pos = 0 ; pos < column_count ; pos ++ ) { int type = rsmd . getColumnType ( pos + 1 ) ; retri...
Stores the next resultSet row in a Record
123,166
public < T extends Aggregator < ? > > T getIterationAggregator ( String name ) { return this . runtimeContext . < T > getIterationAggregator ( name ) ; }
Gets the iteration aggregator registered under the given name . The iteration aggregator is combines all aggregates globally once per superstep and makes them available in the next superstep .
123,167
public < T extends Value > T getPreviousIterationAggregate ( String name ) { return this . runtimeContext . < T > getPreviousIterationAggregate ( name ) ; }
Get the aggregated value that an aggregator computed in the previous iteration .
123,168
public void writeBlock ( MemorySegment segment ) throws IOException { checkErroneous ( ) ; this . requestsNotReturned . incrementAndGet ( ) ; if ( this . closed || this . requestQueue . isClosed ( ) ) { this . requestsNotReturned . decrementAndGet ( ) ; throw new IOException ( "The writer has been closed." ) ; } this ....
Issues a asynchronous write request to the writer .
123,169
static Options getProgramSpecificOptions ( Options options ) { options . addOption ( JAR_OPTION ) ; options . addOption ( CLASS_OPTION ) ; options . addOption ( PARALLELISM_OPTION ) ; options . addOption ( ARGS_OPTION ) ; return options ; }
gets the program options with the old flags for jar file and arguments
123,170
static Options getProgramSpecificOptionsWithoutDeprecatedOptions ( Options options ) { options . addOption ( CLASS_OPTION ) ; options . addOption ( PARALLELISM_OPTION ) ; return options ; }
gets the program options without the old flags for jar file and arguments
123,171
static Options getRunOptions ( Options options ) { Options o = getProgramSpecificOptions ( options ) ; return getJobManagerAddressOption ( o ) ; }
Builds command line options for the run action .
123,172
static Options getInfoOptions ( Options options ) { options = getProgramSpecificOptions ( options ) ; options = getJobManagerAddressOption ( options ) ; options . addOption ( DESCR_OPTION ) ; options . addOption ( PLAN_OPTION ) ; return options ; }
Builds command line options for the info action .
123,173
static Options getListOptions ( Options options ) { options . addOption ( RUNNING_OPTION ) ; options . addOption ( SCHEDULED_OPTION ) ; options = getJobManagerAddressOption ( options ) ; return options ; }
Builds command line options for the list action .
123,174
static Options getCancelOptions ( Options options ) { options . addOption ( ID_OPTION ) ; options = getJobManagerAddressOption ( options ) ; return options ; }
Builds command line options for the cancel action .
123,175
protected int cancel ( String [ ] args ) { CommandLine line ; try { line = parser . parse ( CANCEL_OPTIONS , args , false ) ; } catch ( MissingOptionException e ) { System . out . println ( e . getMessage ( ) ) ; printHelpForCancel ( ) ; return 1 ; } catch ( UnrecognizedOptionException e ) { System . out . println ( e ...
Executes the cancel action .
123,176
protected Configuration getGlobalConfiguration ( ) { if ( ! globalConfigurationLoaded ) { String location = getConfigurationDirectory ( ) ; GlobalConfiguration . loadConfiguration ( location ) ; globalConfigurationLoaded = true ; } return GlobalConfiguration . getConfiguration ( ) ; }
Reads configuration settings . The default path can be overridden by setting the ENV variable STRATOSPHERE_CONF_DIR .
123,177
private int handleError ( Throwable t ) { System . out . println ( "Error: " + t . getMessage ( ) ) ; if ( this . verbose ) { t . printStackTrace ( ) ; } else { System . out . println ( "For a more detailed error message use the vebose output option '-v'." ) ; } return 1 ; }
Displays exceptions .
123,178
public static void main ( String [ ] args ) throws ParseException { CliFrontend cli = new CliFrontend ( ) ; int retCode = cli . parseParameters ( args ) ; System . exit ( retCode ) ; }
Submits the job based on the arguments
123,179
public void registerInputOutput ( ) { if ( LOG . isDebugEnabled ( ) ) { LOG . debug ( formatLogString ( "Start registering input and output." ) ) ; } if ( this . userCodeClassLoader == null ) { try { this . userCodeClassLoader = LibraryCacheManager . getClassLoader ( getEnvironment ( ) . getJobID ( ) ) ; } catch ( IOEx...
Initialization method . Runs in the execution graph setup phase in the JobManager and as a setup method on the TaskManager .
123,180
protected static void reportAndClearAccumulators ( Environment env , Map < String , Accumulator < ? , ? > > accumulators , ArrayList < ChainedDriver < ? , ? > > chainedTasks ) { for ( ChainedDriver < ? , ? > chainedTask : chainedTasks ) { Map < String , Accumulator < ? , ? > > chainedAccumulators = chainedTask . getStu...
This method is called at the end of a task receiving the accumulators of the task and the chained tasks . It merges them into a single map of accumulators and sends them to the JobManager .
123,181
protected void initInputsSerializersAndComparators ( int numInputs ) throws Exception { this . inputSerializers = new TypeSerializerFactory < ? > [ numInputs ] ; this . inputComparators = this . driver . requiresComparatorOnInput ( ) ? new TypeComparator [ numInputs ] : null ; this . inputIterators = new MutableObjectI...
Creates all the serializers and comparators .
123,182
public void setAllocatedResource ( final AllocatedResource resource ) { final Iterator < ExecutionVertex > it = this . vertices . iterator ( ) ; while ( it . hasNext ( ) ) { final ExecutionVertex vertex = it . next ( ) ; vertex . setAllocatedResource ( resource ) ; } }
Sets the given allocated resource for all vertices included in this pipeline .
123,183
public void updateExecutionState ( final ExecutionState executionState ) { final Iterator < ExecutionVertex > it = this . vertices . iterator ( ) ; while ( it . hasNext ( ) ) { final ExecutionVertex vertex = it . next ( ) ; vertex . updateExecutionState ( executionState ) ; } }
Updates the execution state for all vertices included in this pipeline .
123,184
public Thread getExecutingThread ( ) { synchronized ( this ) { if ( this . executingThread == null ) { if ( this . taskName == null ) { this . executingThread = new Thread ( this ) ; } else { this . executingThread = new Thread ( this , getTaskNameWithIndex ( ) ) ; } } return this . executingThread ; } }
Returns the thread which is assigned to execute the user code .
123,185
private void waitForInputChannelsToBeClosed ( ) throws IOException , InterruptedException { while ( true ) { if ( this . executionObserver . isCanceled ( ) ) { throw new InterruptedException ( ) ; } boolean allClosed = true ; for ( int i = 0 ; i < getNumberOfInputGates ( ) ; i ++ ) { final InputGate < ? extends IOReada...
Blocks until all input channels are closed .
123,186
private void closeInputGates ( ) throws IOException , InterruptedException { for ( int i = 0 ; i < this . inputGates . size ( ) ; i ++ ) { final InputGate < ? extends IOReadableWritable > eig = this . inputGates . get ( i ) ; eig . close ( ) ; } }
Closes all input gates which are not already closed .
123,187
private void requestAllOutputGatesToClose ( ) throws IOException , InterruptedException { for ( int i = 0 ; i < this . outputGates . size ( ) ; i ++ ) { this . outputGates . get ( i ) . requestClose ( ) ; } }
Requests all output gates to be closed .
123,188
public static void stopProxy ( VersionedProtocol proxy ) { if ( proxy != null ) { ( ( Invoker ) Proxy . getInvocationHandler ( proxy ) ) . close ( ) ; } }
Stop this proxy and release its invoker s resource
123,189
public static final String arrayToString ( Object array ) { if ( array == null ) { throw new NullPointerException ( ) ; } if ( array instanceof int [ ] ) { return Arrays . toString ( ( int [ ] ) array ) ; } if ( array instanceof long [ ] ) { return Arrays . toString ( ( long [ ] ) array ) ; } if ( array instanceof Obje...
Returns a string representation of the given array . This method takes an Object to allow also all types of primitive type arrays .
123,190
public LocalProperties filterByNodesConstantSet ( OptimizerNode node , int input ) { Ordering no = this . ordering ; FieldList ngf = this . groupedFields ; Set < FieldSet > nuf = this . uniqueFields ; if ( this . ordering != null ) { final FieldList involvedIndexes = this . ordering . getInvolvedIndexes ( ) ; for ( int...
Filters these properties by what can be preserved through a user function s constant fields set .
123,191
public static synchronized ExecutionSignature createSignature ( final Class < ? extends AbstractInvokable > invokableClass , final JobID jobID ) { if ( messageDigest == null ) { try { messageDigest = MessageDigest . getInstance ( HASHINGALGORITHM ) ; } catch ( NoSuchAlgorithmException e ) { LOG . error ( "Unable to loa...
Calculates the execution signature from the given class name and job ID .
123,192
public void open ( InputSplit ignored ) throws IOException { try { establishConnection ( ) ; statement = dbConn . createStatement ( ResultSet . TYPE_SCROLL_INSENSITIVE , ResultSet . CONCUR_READ_ONLY ) ; resultSet = statement . executeQuery ( query ) ; } catch ( SQLException se ) { close ( ) ; throw new IllegalArgumentE...
Connects to the source database and executes the query .
123,193
public OUT nextRecord ( OUT tuple ) throws IOException { try { resultSet . next ( ) ; if ( columnTypes == null ) { extractTypes ( tuple ) ; } addValue ( tuple ) ; return tuple ; } catch ( SQLException se ) { close ( ) ; throw new IOException ( "Couldn't read data - " + se . getMessage ( ) , se ) ; } catch ( NullPointer...
Stores the next resultSet row in a tuple
123,194
public static org . apache . hadoop . conf . Configuration getHadoopConfiguration ( ) { Configuration retConf = new org . apache . hadoop . conf . Configuration ( ) ; final String hdfsDefaultPath = GlobalConfiguration . getString ( ConfigConstants . HDFS_DEFAULT_CONFIG , null ) ; if ( hdfsDefaultPath != null ) { retCon...
Returns a new Hadoop Configuration object using the path to the hadoop conf configured in the Stratosphere configuration . This method is public because its being used in the HadoopDataSource .
123,195
public void readBlock ( MemorySegment segment ) throws IOException { checkErroneous ( ) ; this . requestsNotReturned . incrementAndGet ( ) ; if ( this . closed || this . requestQueue . isClosed ( ) ) { this . requestsNotReturned . decrementAndGet ( ) ; throw new IOException ( "The reader has been closed." ) ; } this . ...
Issues a read request which will asynchronously fill the given segment with the next block in the underlying file channel . Once the read request is fulfilled the segment will be added to this reader s return queue .
123,196
public DataSource < String > readTextFile ( String filePath ) { Validate . notNull ( filePath , "The file path may not be null." ) ; return new DataSource < String > ( this , new TextInputFormat ( new Path ( filePath ) ) , BasicTypeInfo . STRING_TYPE_INFO ) ; }
Creates a DataSet that represents the Strings produced by reading the given file line wise . The file will be read with the system s default character set .
123,197
public DataSource < Long > generateSequence ( long from , long to ) { return fromParallelCollection ( new NumberSequenceIterator ( from , to ) , BasicTypeInfo . LONG_TYPE_INFO ) ; }
Creates a new data set that contains a sequence of numbers . The data set will be created in parallel so there is no guarantee about the oder of the elements .
123,198
public void configure ( Configuration config ) { super . configure ( config ) ; final String delim = config . getString ( RECORD_DELIMITER , "\n" ) ; final String charsetName = config . getString ( RECORD_DELIMITER_ENCODING , null ) ; if ( delim == null ) { throw new IllegalArgumentException ( "The delimiter in the Del...
Calls the super classes to configure themselves and reads the config parameters for the delimiter and the write buffer size .
123,199
public void addBroadcastSetForMessagingFunction ( String name , DataSet < ? > data ) { this . bcVarsMessaging . add ( new Tuple2 < String , DataSet < ? > > ( name , data ) ) ; }
Adds a data set as a broadcast set to the messaging function .