idx
int64
0
165k
question
stringlengths
73
4.15k
target
stringlengths
5
918
len_question
int64
21
890
len_target
int64
3
255
11,100
public boolean covariantReturnType ( Type t , Type s , Warner warner ) { return isSameType ( t , s ) || allowCovariantReturns && ! t . isPrimitive ( ) && ! s . isPrimitive ( ) && isAssignable ( t , s , warner ) ; }
Is t an appropriate return type in an overrider for a method that returns s?
67
17
11,101
public ClassSymbol boxedClass ( Type t ) { return reader . enterClass ( syms . boxedName [ t . getTag ( ) . ordinal ( ) ] ) ; }
Return the class that boxes the given primitive .
38
9
11,102
protected String getSpace ( Request req ) { String spaceToken = req . headers ( SPACE_TOKEN_HEADER ) ; if ( StringUtils . isBlank ( spaceToken ) ) { throw new MissingSpaceTokenException ( "Missing header '" + SPACE_TOKEN_HEADER + "'." ) ; } String space = this . spacesService . getSpaceForAuthenticationToken ( spaceTok...
Extract spaceToken from request headers .
109
8
11,103
public WithCache . CacheState getCacheState ( ) { return new WithCache . CacheState ( size ( ) , _max , _get , _hit , _rep ) ; }
Reports the cumulative statistics of this cache .
38
8
11,104
static Class < ? > resolveParameterName ( String parameterName , Class < ? > target ) { Map < Type , Type > typeVariableMap = getTypeVariableMap ( target ) ; Set < Entry < Type , Type > > set = typeVariableMap . entrySet ( ) ; Type type = Object . class ; for ( Entry < Type , Type > entry : set ) { if ( entry . getKey ...
Resolves the generic parameter name of a class .
124
10
11,105
public List < Widget > putFactories ( Iterable < ? extends IWidgetFactory > factories ) throws IndexOutOfBoundsException { List < Widget > instances = new LinkedList < Widget > ( ) ; for ( IWidgetFactory factory : factories ) { instances . add ( put ( factory ) ) ; } return instances ; }
Creates widgets instance from given iterable and adds it to this panel
72
14
11,106
protected List < File > getSpooledFileList ( ) { final List < File > spooledFileList = new ArrayList < File > ( ) ; for ( final File file : spoolDirectory . listFiles ( ) ) { if ( file . isFile ( ) ) { spooledFileList . add ( file ) ; } } return spooledFileList ; }
protected for overriding during unit tests
81
6
11,107
public void add ( Collection < Application > applications ) { for ( Application application : applications ) this . applications . put ( application . getId ( ) , application ) ; }
Adds the application list to the applications for the account .
35
11
11,108
public ApplicationHostCache applicationHosts ( long applicationId ) { ApplicationHostCache cache = applicationHosts . get ( applicationId ) ; if ( cache == null ) applicationHosts . put ( applicationId , cache = new ApplicationHostCache ( applicationId ) ) ; return cache ; }
Returns the cache of application hosts for the given application creating one if it doesn t exist .
59
18
11,109
public KeyTransactionCache keyTransactions ( long applicationId ) { KeyTransactionCache cache = keyTransactions . get ( applicationId ) ; if ( cache == null ) keyTransactions . put ( applicationId , cache = new KeyTransactionCache ( applicationId ) ) ; return cache ; }
Returns the cache of key transactions for the given application creating one if it doesn t exist .
59
18
11,110
public void addKeyTransactions ( Collection < KeyTransaction > keyTransactions ) { for ( KeyTransaction keyTransaction : keyTransactions ) { // Add the transaction to any applications it is associated with long applicationId = keyTransaction . getLinks ( ) . getApplication ( ) ; Application application = applications ....
Adds the key transactions to the applications for the account .
129
11
11,111
public DeploymentCache deployments ( long applicationId ) { DeploymentCache cache = deployments . get ( applicationId ) ; if ( cache == null ) deployments . put ( applicationId , cache = new DeploymentCache ( applicationId ) ) ; return cache ; }
Returns the cache of deployments for the given application creating one if it doesn t exist .
53
17
11,112
public LabelCache labels ( long applicationId ) { LabelCache cache = labels . get ( applicationId ) ; if ( cache == null ) labels . put ( applicationId , cache = new LabelCache ( applicationId ) ) ; return cache ; }
Returns the cache of labels for the given application creating one if it doesn t exist .
50
17
11,113
public void addLabel ( Label label ) { // Add the label to any applications it is associated with List < Long > applicationIds = label . getLinks ( ) . getApplications ( ) ; for ( long applicationId : applicationIds ) { Application application = applications . get ( applicationId ) ; if ( application != null ) labels (...
Adds the label to the applications for the account .
118
10
11,114
private static < T , R > Function < T , R > doThrow ( Supplier < ? extends RuntimeException > exceptionSupplier ) { return t -> { throw exceptionSupplier . get ( ) ; } ; }
Returns a function that throws the exception supplied by the given supplier .
45
13
11,115
@ SuppressWarnings ( "unchecked" ) public < E extends BaseException > E put ( String name , Object value ) { properties . put ( name , value ) ; return ( E ) this ; }
Put a property in this exception .
45
7
11,116
@ GET @ PermitAll @ Path ( "uniquetag/{uniqueTag}" ) public Response findByUniqueTag ( @ PathParam ( "uniqueTag" ) String uniqueTag ) { checkNotNull ( uniqueTag ) ; DContact contact = dao . findByUniqueTag ( null , uniqueTag ) ; return null != contact ? Response . ok ( contact ) . build ( ) : Response . status ( Respon...
Find a contact based on its unique tag .
102
9
11,117
public static void generate ( ConfigurationImpl configuration ) { ProfileIndexFrameWriter profilegen ; DocPath filename = DocPaths . PROFILE_OVERVIEW_FRAME ; try { profilegen = new ProfileIndexFrameWriter ( configuration , filename ) ; profilegen . buildProfileIndexFile ( "doclet.Window_Overview" , false ) ; profilegen...
Generate the profile index file named profile - overview - frame . html .
127
15
11,118
protected Content getProfile ( String profileName ) { Content profileLinkContent ; Content profileLabel ; profileLabel = new StringContent ( profileName ) ; profileLinkContent = getHyperLink ( DocPaths . profileFrame ( profileName ) , profileLabel , "" , "packageListFrame" ) ; Content li = HtmlTree . LI ( profileLinkCo...
Gets each profile name as a separate link .
79
10
11,119
public void newRound ( Context context ) { this . context = context ; this . log = Log . instance ( context ) ; clearRoundState ( ) ; }
Update internal state for a new round .
33
8
11,120
public static GameSettings getInstance ( ) { SecurityManager sm = System . getSecurityManager ( ) ; if ( sm != null ) { sm . checkPermission ( new GamePermission ( "readSettings" ) ) ; } return INSTANCE ; }
Checks if the caller has permission to read the game settings
52
12
11,121
public static ClassFileReader newInstance ( Path path , JarFile jf ) throws IOException { return new JarFileReader ( path , jf ) ; }
Returns a ClassFileReader instance of a given JarFile .
33
12
11,122
Type rawInstantiate ( Env < AttrContext > env , Type site , Symbol m , ResultInfo resultInfo , List < Type > argtypes , List < Type > typeargtypes , boolean allowBoxing , boolean useVarargs , Warner warn ) throws Infer . InferenceException { Type mt = types . memberType ( site , m ) ; // tvars is the list of formal typ...
Try to instantiate the type of a method so that it fits given type arguments and argument types . If successful return the method s instantiated type else return null . The instantiation will take into account an additional leading formal parameter if the method is an instance method seen as a member of an under determ...
766
90
11,123
@ SuppressWarnings ( "fallthrough" ) Symbol selectBest ( Env < AttrContext > env , Type site , List < Type > argtypes , List < Type > typeargtypes , Symbol sym , Symbol bestSoFar , boolean allowBoxing , boolean useVarargs , boolean operator ) { if ( sym . kind == ERR || ! sym . isInheritedIn ( site . tsym , types ) ) {...
Select the best method for a call site among two choices .
464
12
11,124
Symbol findMethod ( Env < AttrContext > env , Type site , Name name , List < Type > argtypes , List < Type > typeargtypes , boolean allowBoxing , boolean useVarargs , boolean operator ) { Symbol bestSoFar = methodNotFound ; bestSoFar = findMethod ( env , site , name , argtypes , typeargtypes , site . tsym . type , best...
Find best qualified method matching given name type and value arguments .
106
12
11,125
public void printscopes ( Scope s ) { while ( s != null ) { if ( s . owner != null ) System . err . print ( s . owner + ": " ) ; for ( Scope . Entry e = s . elems ; e != null ; e = e . sibling ) { if ( ( e . sym . flags ( ) & ABSTRACT ) != 0 ) System . err . print ( "abstract " ) ; System . err . print ( e . sym + " " ...
print all scopes starting with scope s and proceeding outwards . used for debugging .
124
17
11,126
Symbol resolveBinaryOperator ( DiagnosticPosition pos , JCTree . Tag optag , Env < AttrContext > env , Type left , Type right ) { return resolveOperator ( pos , optag , env , List . of ( left , right ) ) ; }
Resolve binary operator .
60
5
11,127
private boolean matches ( String classname , AccessFlags flags ) { if ( options . apiOnly && ! flags . is ( AccessFlags . ACC_PUBLIC ) ) { return false ; } else if ( options . includePattern != null ) { return options . includePattern . matcher ( classname . replace ( ' ' , ' ' ) ) . matches ( ) ; } else { return true ...
Tests if the given class matches the pattern given in the - include option or if it s a public class if - apionly option is specified
84
30
11,128
private String replacementFor ( String cn ) { String name = cn ; String value = null ; while ( value == null && name != null ) { try { value = ResourceBundleHelper . jdkinternals . getString ( name ) ; } catch ( MissingResourceException e ) { // go up one subpackage level int i = name . lastIndexOf ( ' ' ) ; name = i >...
Returns the recommended replacement API for the given classname ; or return null if replacement API is not known .
106
21
11,129
@ Override public void setContract ( Contract c ) { super . setContract ( c ) ; for ( Field f : params ) { f . setContract ( c ) ; } if ( returns != null ) { returns . setContract ( c ) ; } }
Sets the Contract for this Function . Propegates this down to its param and return Fields
54
19
11,130
public Object invoke ( RpcRequest req , Object handler ) throws RpcException , IllegalAccessException , InvocationTargetException { if ( contract == null ) { throw new IllegalStateException ( "contract cannot be null" ) ; } if ( req == null ) { throw new IllegalArgumentException ( "req cannot be null" ) ; } if ( handle...
Invokes this Function against the given handler Class for the given request . This is the heart of the RPC dispatch and is where your application code gets run .
139
31
11,131
public Object [ ] marshalParams ( RpcRequest req ) throws RpcException { Object [ ] converted = new Object [ params . size ( ) ] ; Object [ ] reqParams = req . getParams ( ) ; if ( reqParams . length != converted . length ) { String msg = "Function '" + req . getMethod ( ) + "' expects " + params . size ( ) + " param(s...
Marshals the req . params to their RPC format equivalents . For example a Java Struct class will be converted to a Map .
166
25
11,132
public Object unmarshalResult ( Object respObj ) throws RpcException { if ( returns == null ) { if ( respObj != null ) { throw new IllegalArgumentException ( "Function " + name + " is a notification and should not have a result" ) ; } } return returns . getTypeConverter ( ) . unmarshal ( respObj ) ; }
Unmarshals respObj into its Java representation
79
10
11,133
public Object [ ] unmarshalParams ( RpcRequest req ) throws RpcException { Object reqParams [ ] = req . getParams ( ) ; if ( reqParams . length != params . size ( ) ) { String msg = "Function '" + req . getMethod ( ) + "' expects " + params . size ( ) + " param(s). " + reqParams . length + " given." ; throw invParams (...
Unmarshals req . params into their Java representations
178
11
11,134
@ Nullable public static String getCompactMessage ( final String sMsg ) { UPCA . validateMessage ( sMsg ) ; final String sUPCA = UPCA . handleChecksum ( sMsg , EEANChecksumMode . AUTO ) ; final byte nNumberSystem = _extractNumberSystem ( sUPCA ) ; if ( nNumberSystem != 0 && nNumberSystem != 1 ) return null ; final byte...
Compacts an UPC - A message to an UPC - E message if possible .
668
18
11,135
@ Nonnull public static String getExpandedMessage ( @ Nonnull final String sMsg ) { final char cCheck = sMsg . length ( ) == 8 ? sMsg . charAt ( 7 ) : ' ' ; final String sUpce = sMsg . substring ( 0 , 0 + 7 ) ; final byte nNumberSystem = _extractNumberSystem ( sUpce ) ; if ( nNumberSystem != 0 && nNumberSystem != 1 ) t...
Expands an UPC - E message to an UPC - A message .
562
16
11,136
@ Nonnull public static EValidity validateMessage ( @ Nullable final String sMsg ) { final int nLen = StringHelper . getLength ( sMsg ) ; if ( nLen >= 7 && nLen <= 8 ) { final byte nNumberSystem = _extractNumberSystem ( sMsg ) ; if ( nNumberSystem >= 0 && nNumberSystem <= 1 ) return EValidity . VALID ; } return EValidi...
Validates an UPC - E message . The message can also be UPC - A in which case the message is compacted to a UPC - E message if possible . If it s not possible an IllegalArgumentException is thrown
97
48
11,137
public Iterable < DUser > queryByBirthInfo ( java . lang . String birthInfo ) { return queryByField ( null , DUserMapper . Field . BIRTHINFO . getFieldName ( ) , birthInfo ) ; }
query - by method for field birthInfo
51
8
11,138
public Iterable < DUser > queryByFriends ( java . lang . Object friends ) { return queryByField ( null , DUserMapper . Field . FRIENDS . getFieldName ( ) , friends ) ; }
query - by method for field friends
47
7
11,139
public Iterable < DUser > queryByPassword ( java . lang . String password ) { return queryByField ( null , DUserMapper . Field . PASSWORD . getFieldName ( ) , password ) ; }
query - by method for field password
47
7
11,140
public Iterable < DUser > queryByPhoneNumber1 ( java . lang . String phoneNumber1 ) { return queryByField ( null , DUserMapper . Field . PHONENUMBER1 . getFieldName ( ) , phoneNumber1 ) ; }
query - by method for field phoneNumber1
56
9
11,141
public Iterable < DUser > queryByPhoneNumber2 ( java . lang . String phoneNumber2 ) { return queryByField ( null , DUserMapper . Field . PHONENUMBER2 . getFieldName ( ) , phoneNumber2 ) ; }
query - by method for field phoneNumber2
56
9
11,142
public Iterable < DUser > queryByPreferredLanguage ( java . lang . String preferredLanguage ) { return queryByField ( null , DUserMapper . Field . PREFERREDLANGUAGE . getFieldName ( ) , preferredLanguage ) ; }
query - by method for field preferredLanguage
55
8
11,143
public Iterable < DUser > queryByTimeZoneCanonicalId ( java . lang . String timeZoneCanonicalId ) { return queryByField ( null , DUserMapper . Field . TIMEZONECANONICALID . getFieldName ( ) , timeZoneCanonicalId ) ; }
query - by method for field timeZoneCanonicalId
67
12
11,144
public DUser findByUsername ( java . lang . String username ) { return queryUniqueByField ( null , DUserMapper . Field . USERNAME . getFieldName ( ) , username ) ; }
find - by method for unique field username
45
8
11,145
public < T > T executeSelect ( Connection conn , DataObject object , ResultSetWorker < T > worker ) throws Exception { PreparedStatement statement = conn . prepareStatement ( _sql ) ; try { load ( statement , object ) ; return worker . process ( statement . executeQuery ( ) ) ; } finally { statement . close ( ) ; } }
Executes the SELECT statement passing the result set to the ResultSetWorker for processing .
74
18
11,146
public ClassDoc [ ] enums ( ) { ListBuffer < ClassDocImpl > ret = new ListBuffer < ClassDocImpl > ( ) ; for ( ClassDocImpl c : getClasses ( true ) ) { if ( c . isEnum ( ) ) { ret . append ( c ) ; } } return ret . toArray ( new ClassDocImpl [ ret . length ( ) ] ) ; }
Get included enum types in this package .
85
8
11,147
public ClassDoc [ ] interfaces ( ) { ListBuffer < ClassDocImpl > ret = new ListBuffer < ClassDocImpl > ( ) ; for ( ClassDocImpl c : getClasses ( true ) ) { if ( c . isInterface ( ) ) { ret . append ( c ) ; } } return ret . toArray ( new ClassDocImpl [ ret . length ( ) ] ) ; }
Get included interfaces in this package omitting annotation types .
83
11
11,148
public Rejected acquirePermits ( long number , long nanoTime ) { for ( int i = 0 ; i < backPressureList . size ( ) ; ++ i ) { BackPressure < Rejected > bp = backPressureList . get ( i ) ; Rejected rejected = bp . acquirePermit ( number , nanoTime ) ; if ( rejected != null ) { rejectedCounts . write ( rejected , number ...
Acquire permits for task execution . If the acquisition is rejected then a reason will be returned . If the acquisition is successful null will be returned .
140
29
11,149
public void releasePermitsWithoutResult ( long number , long nanoTime ) { for ( BackPressure < Rejected > backPressure : backPressureList ) { backPressure . releasePermit ( number , nanoTime ) ; } }
Release acquired permits without result . Since there is not a known result the result count object and latency will not be updated .
51
24
11,150
@ GET @ Path ( "{taskName}" ) public Response enqueueTask ( @ PathParam ( "taskName" ) String taskName ) { checkNotNull ( taskName ) ; taskQueue . enqueueTask ( taskName , requestParamsProvider . get ( ) ) ; return Response . ok ( ) . build ( ) ; }
Enqueue an admin task for processing . The request will return immediately and the task will be run in a separate thread . The execution model depending on the implementation of the queue .
70
35
11,151
@ POST @ Path ( "{taskName}" ) public Response processTask ( @ PathParam ( "taskName" ) String taskName ) { checkNotNull ( requestParamsProvider . get ( ) ) ; checkNotNull ( taskName ) ; LOGGER . info ( "Processing task for {}..." , taskName ) ; for ( AdminTask adminTask : adminTasks ) { final Object body = adminTask ....
Process an admin task . The admin task will be processed on the requesting thread .
137
16
11,152
public void run ( Map < String , Object > extra ) { if ( getParameterConfig ( ) != null ) { Boolean parametersRequired = false ; List < String > requiredParameters = new ArrayList < String > ( ) ; for ( ParamConfig paramConfig : getParameterConfig ( ) ) { if ( BooleanUtils . isTrue ( paramConfig . getRequired ( ) ) ) {...
Runs the report .
244
5
11,153
public static Date getDateFromString ( final String dateString , final String pattern ) { try { SimpleDateFormat df = buildDateFormat ( pattern ) ; return df . parse ( dateString ) ; } catch ( ParseException e ) { throw new DateException ( String . format ( "Could not parse %s with pattern %s." , dateString , pattern )...
Get data from data string using the given pattern and the default date format symbols for the default locale .
82
20
11,154
public static String getDateFormat ( final Date date , final String pattern ) { SimpleDateFormat simpleDateFormat = buildDateFormat ( pattern ) ; return simpleDateFormat . format ( date ) ; }
Format date by given pattern .
41
6
11,155
public static Date getDateOfSecondsBack ( final int secondsBack , final Date date ) { return dateBack ( Calendar . SECOND , secondsBack , date ) ; }
Get specify seconds back form given date .
36
8
11,156
public static Date getDateOfMinutesBack ( final int minutesBack , final Date date ) { return dateBack ( Calendar . MINUTE , minutesBack , date ) ; }
Get specify minutes back form given date .
36
8
11,157
public static Date getDateOfHoursBack ( final int hoursBack , final Date date ) { return dateBack ( Calendar . HOUR_OF_DAY , hoursBack , date ) ; }
Get specify hours back form given date .
39
8
11,158
public static Date getDateOfDaysBack ( final int daysBack , final Date date ) { return dateBack ( Calendar . DAY_OF_MONTH , daysBack , date ) ; }
Get specify days back from given date .
39
8
11,159
public static Date getDateOfWeeksBack ( final int weeksBack , final Date date ) { return dateBack ( Calendar . WEEK_OF_MONTH , weeksBack , date ) ; }
Get specify weeks back from given date .
40
8
11,160
public static Date getDateOfMonthsBack ( final int monthsBack , final Date date ) { return dateBack ( Calendar . MONTH , monthsBack , date ) ; }
Get specify months back from given date .
36
8
11,161
public static Date getDateOfYearsBack ( final int yearsBack , final Date date ) { return dateBack ( Calendar . YEAR , yearsBack , date ) ; }
Get specify years back from given date .
34
8
11,162
public static boolean isLastDayOfTheMonth ( final Date date ) { Date dateOfMonthsBack = getDateOfMonthsBack ( - 1 , date ) ; int dayOfMonth = getDayOfMonth ( dateOfMonthsBack ) ; Date dateOfDaysBack = getDateOfDaysBack ( dayOfMonth , dateOfMonthsBack ) ; return dateOfDaysBack . equals ( date ) ; }
Return true if the given date is the last day of the month ; false otherwise .
87
17
11,163
public static long subSeconds ( final Date date1 , final Date date2 ) { return subTime ( date1 , date2 , DatePeriod . SECOND ) ; }
Get how many seconds between two date .
37
8
11,164
public static long subMinutes ( final Date date1 , final Date date2 ) { return subTime ( date1 , date2 , DatePeriod . MINUTE ) ; }
Get how many minutes between two date .
37
8
11,165
public static long subHours ( final Date date1 , final Date date2 ) { return subTime ( date1 , date2 , DatePeriod . HOUR ) ; }
Get how many hours between two date .
36
8
11,166
public static long subDays ( final Date date1 , final Date date2 ) { return subTime ( date1 , date2 , DatePeriod . DAY ) ; }
Get how many days between two date .
35
8
11,167
public static long subMonths ( final String dateString1 , final String dateString2 ) { Date date1 = getDateFromString ( dateString1 , DEFAULT_DATE_SIMPLE_PATTERN ) ; Date date2 = getDateFromString ( dateString2 , DEFAULT_DATE_SIMPLE_PATTERN ) ; return subMonths ( date1 , date2 ) ; }
Get how many months between two date the date pattern is yyyy - MM - dd .
87
19
11,168
public static long subMonths ( final Date date1 , final Date date2 ) { Calendar calendar1 = buildCalendar ( date1 ) ; int monthOfDate1 = calendar1 . get ( Calendar . MONTH ) ; int yearOfDate1 = calendar1 . get ( Calendar . YEAR ) ; Calendar calendar2 = buildCalendar ( date2 ) ; int monthOfDate2 = calendar2 . get ( Cale...
Get how many months between two date .
156
8
11,169
public static long subYears ( final Date date1 , final Date date2 ) { return Math . abs ( getYear ( date1 ) - getYear ( date2 ) ) ; }
Get how many years between two date .
38
8
11,170
private static SimpleDateFormat buildDateFormat ( final String pattern ) { SimpleDateFormat simpleDateFormat = simpleDateFormatCache . get ( ) ; if ( simpleDateFormat == null ) { simpleDateFormat = new SimpleDateFormat ( ) ; simpleDateFormatCache . set ( simpleDateFormat ) ; } simpleDateFormat . applyPattern ( pattern ...
Get a SimpleDateFormat object by given pattern .
79
10
11,171
Type fold1 ( int opcode , Type operand ) { try { Object od = operand . constValue ( ) ; switch ( opcode ) { case nop : return operand ; case ineg : // unary - return syms . intType . constType ( - intValue ( od ) ) ; case ixor : // ~ return syms . intType . constType ( ~ intValue ( od ) ) ; case bool_not : // ! return ...
Fold unary operation .
427
6
11,172
public synchronized void addHandler ( Class iface , Object handler ) { try { iface . cast ( handler ) ; } catch ( Exception e ) { throw new IllegalArgumentException ( "Handler: " + handler . getClass ( ) . getName ( ) + " does not implement: " + iface . getName ( ) ) ; } if ( contract . getInterfaces ( ) . get ( iface ...
Associates the handler instance with the given IDL interface . Replaces an existing handler for this iface if one was previously registered .
167
28
11,173
@ SuppressWarnings ( "unchecked" ) public void call ( Serializer ser , InputStream is , OutputStream os ) throws IOException { Object obj = null ; try { obj = ser . readMapOrList ( is ) ; } catch ( Exception e ) { String msg = "Unable to deserialize request: " + e . getMessage ( ) ; ser . write ( new RpcResponse ( null...
Reads a RpcRequest from the input stream deserializes it invokes the matching handler method serializes the result and writes it to the output stream .
294
32
11,174
public RpcResponse call ( RpcRequest req ) { for ( Filter filter : filters ) { RpcRequest tmp = filter . alterRequest ( req ) ; if ( tmp != null ) { req = tmp ; } } RpcResponse resp = null ; for ( Filter filter : filters ) { resp = filter . preInvoke ( req ) ; if ( resp != null ) { break ; } } if ( resp == null ) { res...
Calls the method associated with the RpcRequest and wraps the result as a RpcResponse .
158
20
11,175
public static String doGet ( final String url , final int retryTimes ) { try { return doGetByLoop ( url , retryTimes ) ; } catch ( HttpException e ) { throw new HttpException ( format ( "Failed to download content for url: '%s'. Tried '%s' times" , url , Math . max ( retryTimes + 1 , 1 ) ) ) ; } }
access given url by get request if get exception will retry by given retryTimes .
90
18
11,176
public static String doPost ( final String action , final Map < String , String > parameters , final int retryTimes ) { try { return doPostByLoop ( action , parameters , retryTimes ) ; } catch ( HttpException e ) { throw new HttpException ( format ( "Failed to download content for action url: '%s' with parameters. Trie...
access given action with given parameters by post if get exception will retry by given retryTimes .
107
20
11,177
public < A extends Appendable > A document ( A output ) throws IOException { StringBuilder line = new StringBuilder ( ) ; for ( Field field : Beans . getKnownInstanceFields ( _prototype ) ) { description d = field . getAnnotation ( description . class ) ; if ( d == null ) continue ; placeholder p = field . getAnnotatio...
Writes usage documentation to an Appendable .
331
10
11,178
public static InetAddress getAddress ( String host ) throws UnknownHostException { if ( timeToClean ( ) ) { synchronized ( storedAddresses ) { if ( timeToClean ( ) ) { cleanOldAddresses ( ) ; } } } Pair < InetAddress , Long > cachedAddress ; synchronized ( storedAddresses ) { cachedAddress = storedAddresses . get ( hos...
only allow 5 simultaneous DNS requests
312
6
11,179
private VarSymbol enterConstant ( String name , Type type ) { VarSymbol c = new VarSymbol ( PUBLIC | STATIC | FINAL , names . fromString ( name ) , type , predefClass ) ; c . setData ( type . constValue ( ) ) ; predefClass . members ( ) . enter ( c ) ; return c ; }
Enter a constant into symbol table .
77
7
11,180
private void enterBinop ( String name , Type left , Type right , Type res , int opcode ) { predefClass . members ( ) . enter ( new OperatorSymbol ( makeOperatorName ( name ) , new MethodType ( List . of ( left , right ) , res , List . < Type > nil ( ) , methodClass ) , opcode , predefClass ) ) ; }
Enter a binary operation into symbol table .
85
8
11,181
private OperatorSymbol enterUnop ( String name , Type arg , Type res , int opcode ) { OperatorSymbol sym = new OperatorSymbol ( makeOperatorName ( name ) , new MethodType ( List . of ( arg ) , res , List . < Type > nil ( ) , methodClass ) , opcode , predefClass ) ; predefClass . members ( ) . enter ( sym ) ; return sym...
Enter a unary operation into symbol table .
91
9
11,182
private Name makeOperatorName ( String name ) { Name opName = names . fromString ( name ) ; operatorNames . add ( opName ) ; return opName ; }
Create a new operator name from corresponding String representation and add the name to the set of known operator names .
37
21
11,183
public Widget put ( IWidgetFactory factory , String name ) { Widget widget = factory . getWidget ( ) ; put ( widget , name ) ; return widget ; }
Creates new widget and puts it to container at first free index
36
13
11,184
public static String getEventTypeDescription ( final XMLStreamReader reader ) { final int eventType = reader . getEventType ( ) ; if ( eventType == XMLStreamConstants . START_ELEMENT ) { final String namespace = reader . getNamespaceURI ( ) ; return "<" + reader . getLocalName ( ) + ( ! StringUtils . isEmpty ( namespac...
Returns string describing the current event .
190
7
11,185
public static boolean isStartElement ( final XMLStreamReader reader , final String namespace , final String localName ) { return reader . getEventType ( ) == XMLStreamConstants . START_ELEMENT && nameEquals ( reader , namespace , localName ) ; }
Method isStartElement .
56
5
11,186
public static boolean nameEquals ( final XMLStreamReader reader , final String namespace , final String localName ) { if ( ! reader . getLocalName ( ) . equals ( localName ) ) { return false ; } if ( namespace == null ) { return true ; } final String namespaceURI = reader . getNamespaceURI ( ) ; if ( namespaceURI == nu...
Method nameEquals .
108
5
11,187
public static Class optionalClassAttribute ( final XMLStreamReader reader , final String localName , final Class defaultValue ) throws XMLStreamException { return optionalClassAttribute ( reader , null , localName , defaultValue ) ; }
Returns the value of an attribute as a Class . If the attribute is empty this method returns the default value provided .
45
23
11,188
public static void skipElement ( final XMLStreamReader reader ) throws XMLStreamException , IOException { if ( reader . getEventType ( ) != XMLStreamConstants . START_ELEMENT ) { return ; } final String namespace = reader . getNamespaceURI ( ) ; final String name = reader . getLocalName ( ) ; for ( ; ; ) { switch ( rea...
Method skipElement .
187
4
11,189
public UriBuilder path ( String path ) throws URISyntaxException { path = path . trim ( ) ; if ( getPath ( ) . endsWith ( "/" ) ) { return new UriBuilder ( setPath ( String . format ( "%s%s" , getPath ( ) , path ) ) ) ; } else { return new UriBuilder ( setPath ( String . format ( "%s/%s" , getPath ( ) , path ) ) ) ; } ...
Appends a path to the current one
100
8
11,190
public < T > ApruveResponse < List < T > > index ( String path , GenericType < List < T > > resultType ) { Response response = restRequest ( path ) . get ( ) ; List < T > responseObject = null ; ApruveResponse < List < T > > result ; if ( response . getStatusInfo ( ) . getFamily ( ) == Family . SUCCESSFUL ) { responseO...
is kind of a pain and it duplicates processResponse .
167
12
11,191
public < T > ApruveResponse < T > get ( String path , Class < T > resultType ) { Response response = restRequest ( path ) . get ( ) ; return processResponse ( response , resultType ) ; }
Issues a GET request against to the Apruve REST API using the specified path .
48
18
11,192
public boolean sync ( NewRelicCache cache ) { if ( cache == null ) throw new IllegalArgumentException ( "null cache" ) ; checkInitialize ( cache ) ; boolean ret = isInitialized ( ) ; if ( ! ret ) throw new IllegalStateException ( "cache not initialized" ) ; clear ( cache ) ; if ( ret ) ret = syncApplications ( cache ) ...
Synchronises the cache .
162
6
11,193
public boolean syncAlerts ( NewRelicCache cache ) { boolean ret = true ; if ( apiClient == null ) throw new IllegalArgumentException ( "null API client" ) ; // Get the alert configuration using the REST API if ( cache . isAlertsEnabled ( ) ) { ret = false ; // Get the alert policies logger . info ( "Getting the alert p...
Synchronise the alerts configuration with the cache .
585
10
11,194
public boolean syncApplications ( NewRelicCache cache ) { boolean ret = true ; if ( apiClient == null ) throw new IllegalArgumentException ( "null API client" ) ; // Get the application configuration using the REST API if ( cache . isApmEnabled ( ) || cache . isBrowserEnabled ( ) || cache . isMobileEnabled ( ) ) { ret ...
Synchronise the application configuration with the cache .
534
10
11,195
public boolean syncPlugins ( NewRelicCache cache ) { boolean ret = true ; if ( apiClient == null ) throw new IllegalArgumentException ( "null API client" ) ; // Get the Plugins configuration using the REST API if ( cache . isPluginsEnabled ( ) ) { ret = false ; logger . info ( "Getting the plugins" ) ; Collection < Plu...
Synchronise the Plugins configuration with the cache .
215
11
11,196
public boolean syncMonitors ( NewRelicCache cache ) { boolean ret = true ; if ( apiClient == null ) throw new IllegalArgumentException ( "null API client" ) ; // Get the Synthetics configuration using the REST API if ( cache . isSyntheticsEnabled ( ) ) { ret = false ; logger . info ( "Getting the monitors" ) ; cache . ...
Synchronise the Synthetics configuration with the cache .
117
11
11,197
public boolean syncServers ( NewRelicCache cache ) { boolean ret = true ; if ( apiClient == null ) throw new IllegalArgumentException ( "null API client" ) ; // Get the server configuration using the REST API if ( cache . isServersEnabled ( ) ) { ret = false ; logger . info ( "Getting the servers" ) ; cache . servers (...
Synchronise the server configuration with the cache .
112
10
11,198
public boolean syncLabels ( NewRelicCache cache ) { boolean ret = true ; if ( apiClient == null ) throw new IllegalArgumentException ( "null API client" ) ; // Get the label configuration using the REST API if ( cache . isApmEnabled ( ) || cache . isSyntheticsEnabled ( ) ) { ret = false ; logger . info ( "Getting the l...
Synchronise the label configuration with the cache .
252
10
11,199
public boolean syncDashboards ( NewRelicCache cache ) { boolean ret = true ; if ( apiClient == null ) throw new IllegalArgumentException ( "null API client" ) ; // Get the dashboard configuration using the REST API if ( cache . isInsightsEnabled ( ) ) { ret = false ; logger . info ( "Getting the dashboards" ) ; cache ....
Synchronise the dashboard configuration with the cache .
115
10