_id stringlengths 2 7 | title stringlengths 3 140 | partition stringclasses 3
values | text stringlengths 73 34.1k | language stringclasses 1
value | meta_information dict |
|---|---|---|---|---|---|
q178100 | JspCServletContext.getResource | test | public URL getResource(String path) throws MalformedURLException {
if (!path.startsWith("/"))
throw new MalformedURLException("Path '" + path +
"' does not start with '/'");
URL url = new URL(myResourceBaseURL, path.substring(1));
InputStr... | java | {
"resource": ""
} |
q178101 | JspCServletContext.getResourceAsStream | test | public InputStream getResourceAsStream(String path) {
try {
return (getResource(path).openStream());
} catch (Throwable t) {
return (null);
}
} | java | {
"resource": ""
} |
q178102 | JspCServletContext.getResourcePaths | test | public Set<String> getResourcePaths(String path) {
Set<String> thePaths = new HashSet<String>();
if (!path.endsWith("/"))
path += "/";
String basePath = getRealPath(path);
if (basePath == null)
return (thePaths);
File theBaseDir = new File(basePath);
... | java | {
"resource": ""
} |
q178103 | JspCServletContext.log | test | public void log(String message, Throwable exception) {
myLogWriter.println(message);
exception.printStackTrace(myLogWriter);
} | java | {
"resource": ""
} |
q178104 | JspCServletContext.addFilter | test | public void addFilter(String filterName,
String description,
String className,
Map<String, String> initParameters) {
// Do nothing
return;
} | java | {
"resource": ""
} |
q178105 | LZEncoder.getBufSize | test | private static int getBufSize(
int dictSize, int extraSizeBefore, int extraSizeAfter,
int matchLenMax) {
int keepSizeBefore = extraSizeBefore + dictSize;
int keepSizeAfter = extraSizeAfter + matchLenMax;
int reserveSize = Math.min(dictSize / 2 + (256 << 10), 512 << 20);
... | java | {
"resource": ""
} |
q178106 | LZEncoder.getMemoryUsage | test | public static int getMemoryUsage(
int dictSize, int extraSizeBefore, int extraSizeAfter,
int matchLenMax, int mf) {
// Buffer size + a little extra
int m = getBufSize(dictSize, extraSizeBefore, extraSizeAfter,
matchLenMax) / 1024 + 10;
switch (... | java | {
"resource": ""
} |
q178107 | LZEncoder.setPresetDict | test | public void setPresetDict(int dictSize, byte[] presetDict) {
assert !isStarted();
assert writePos == 0;
if (presetDict != null) {
// If the preset dictionary buffer is bigger than the dictionary
// size, copy only the tail of the preset dictionary.
int copySi... | java | {
"resource": ""
} |
q178108 | LZEncoder.moveWindow | test | private void moveWindow() {
// Align the move to a multiple of 16 bytes. LZMA2 needs this
// because it uses the lowest bits from readPos to get the
// alignment of the uncompressed data.
int moveOffset = (readPos + 1 - keepSizeBefore) & ~15;
int moveSize = writePos - moveOffset;... | java | {
"resource": ""
} |
q178109 | LZEncoder.fillWindow | test | public int fillWindow(byte[] in, int off, int len) {
assert !finishing;
// Move the sliding window if needed.
if (readPos >= bufSize - keepSizeAfter)
moveWindow();
// Try to fill the dictionary buffer. If it becomes full,
// some of the input bytes may be left unuse... | java | {
"resource": ""
} |
q178110 | LZEncoder.processPendingBytes | test | private void processPendingBytes() {
// After flushing or setting a preset dictionary there will be
// pending data that hasn't been ran through the match finder yet.
// Run it through the match finder now if there is enough new data
// available (readPos < readLimit) that the encoder ma... | java | {
"resource": ""
} |
q178111 | LZEncoder.getMatchLen | test | public int getMatchLen(int dist, int lenLimit) {
int backPos = readPos - dist - 1;
int len = 0;
while (len < lenLimit && buf[readPos + len] == buf[backPos + len])
++len;
return len;
} | java | {
"resource": ""
} |
q178112 | LZEncoder.getMatchLen | test | public int getMatchLen(int forward, int dist, int lenLimit) {
int curPos = readPos + forward;
int backPos = curPos - dist - 1;
int len = 0;
while (len < lenLimit && buf[curPos + len] == buf[backPos + len])
++len;
return len;
} | java | {
"resource": ""
} |
q178113 | LZEncoder.verifyMatches | test | public boolean verifyMatches(Matches matches) {
int lenLimit = Math.min(getAvail(), matchLenMax);
for (int i = 0; i < matches.count; ++i)
if (getMatchLen(matches.dist[i], lenLimit) != matches.len[i])
return false;
return true;
} | java | {
"resource": ""
} |
q178114 | LZEncoder.movePos | test | int movePos(int requiredForFlushing, int requiredForFinishing) {
assert requiredForFlushing >= requiredForFinishing;
++readPos;
int avail = writePos - readPos;
if (avail < requiredForFlushing) {
if (avail < requiredForFinishing || !finishing) {
++pendingSize... | java | {
"resource": ""
} |
q178115 | JspWriterImpl.recycle | test | void recycle() {
flushed = false;
closed = false;
out = null;
byteOut = null;
releaseCharBuffer();
response = null;
} | java | {
"resource": ""
} |
q178116 | JspWriterImpl.flushBuffer | test | protected final void flushBuffer() throws IOException {
if (bufferSize == 0)
return;
flushed = true;
ensureOpen();
if (buf.pos == buf.offset)
return;
initOut();
out.write(buf.buf, buf.offset, buf.pos - buf.offset);
buf.pos = buf.offset;
... | java | {
"resource": ""
} |
q178117 | JspWriterImpl.clear | test | public final void clear() throws IOException {
if ((bufferSize == 0) && (out != null))
// clear() is illegal after any unbuffered output (JSP.5.5)
throw new IllegalStateException(
getLocalizeMessage("jsp.error.ise_on_clear"));
if (flushed)
throw ne... | java | {
"resource": ""
} |
q178118 | JspWriterImpl.flush | test | public void flush() throws IOException {
flushBuffer();
if (out != null) {
out.flush();
}
// START 6426898
else {
// Set the default character encoding if there isn't any present,
// see CR 6699416
response.setCharacterEncoding(res... | java | {
"resource": ""
} |
q178119 | JspWriterImpl.close | test | public void close() throws IOException {
if (response == null || closed)
// multiple calls to close is OK
return;
flush();
if (out != null)
out.close();
out = null;
byteOut = null;
closed = true;
} | java | {
"resource": ""
} |
q178120 | JspWriterImpl.write | test | public void write(boolean bytesOK, byte buf[], String str)
throws IOException {
ensureOpen();
if (bufferSize == 0 && bytesOK) {
initByteOut();
if (implementsByteWriter) {
write(buf, 0, buf.length);
return;
}
}
... | java | {
"resource": ""
} |
q178121 | JspWriterImpl.allocateCharBuffer | test | private void allocateCharBuffer() {
if (bufferSize == 0) return;
if (bufferSize > MAX_BUFFER_SIZE) {
buf = new CharBuffer(new char[bufferSize], 0, bufferSize);
} else {
buf = getCharBufferThreadLocalPool().allocate(bufferSize);
}
} | java | {
"resource": ""
} |
q178122 | DefaultErrorHandler.javacError | test | public void javacError(String errorReport, Exception exception)
throws JasperException {
throw new JasperException(
Localizer.getMessage("jsp.error.unable.compile"), exception);
} | java | {
"resource": ""
} |
q178123 | Aggregator.makeKey | test | public List<String> makeKey ( final Map<MetaKey, String> metaData, final boolean requireAll )
{
final List<String> result = new ArrayList<> ( this.fields.size () );
for ( final MetaKey field : this.fields )
{
final String value = metaData.get ( field );
if ( requireA... | java | {
"resource": ""
} |
q178124 | Compiler.generateClass | test | private void generateClass()
throws FileNotFoundException, JasperException, Exception {
long t1 = 0;
if (log.isLoggable(Level.FINE)) {
t1 = System.currentTimeMillis();
}
String javaFileName = ctxt.getServletJavaFileName();
setJavaCompilerOptions();
... | java | {
"resource": ""
} |
q178125 | Compiler.compile | test | public void compile(boolean compileClass)
throws FileNotFoundException, JasperException, Exception
{
try {
// Create the output directory for the generated files
// Always try and create the directory tree, in case the generated
// directories were del... | java | {
"resource": ""
} |
q178126 | Compiler.removeGeneratedFiles | test | public void removeGeneratedFiles() {
try {
String classFileName = ctxt.getClassFileName();
if (classFileName != null) {
File classFile = new File(classFileName);
if( log.isLoggable(Level.FINE) )
log.fine( "Deleting " + classFile );
... | java | {
"resource": ""
} |
q178127 | Compiler.initJavaCompiler | test | private void initJavaCompiler() throws JasperException {
boolean disablejsr199 = Boolean.TRUE.toString().equals(
System.getProperty("org.apache.jasper.compiler.disablejsr199"));
Double version =
Double.valueOf(System.getProperty("java.specification.version"));
if (!disab... | java | {
"resource": ""
} |
q178128 | Compiler.systemJarInWebinf | test | private boolean systemJarInWebinf(String path) {
if (path.indexOf("/WEB-INF/") < 0) {
return false;
}
Boolean useMyFaces = (Boolean) ctxt.getServletContext().
getAttribute("com.sun.faces.useMyFaces");
if (useMyFaces == null || !useMyFaces) {
for... | java | {
"resource": ""
} |
q178129 | Generator.quote | test | static String quote(char c) {
StringBuilder b = new StringBuilder();
b.append('\'');
if (c == '\'')
b.append('\\').append('\'');
else if (c == '\\')
b.append('\\').append('\\');
else if (c == '\n')
b.append('\\').append('n');
else if (... | java | {
"resource": ""
} |
q178130 | Generator.generateDeclarations | test | private void generateDeclarations(Node.Nodes page) throws JasperException {
class DeclarationVisitor extends Node.Visitor {
private boolean getServletInfoGenerated = false;
/*
* Generates getServletInfo() method that returns the value of the
* page directive'... | java | {
"resource": ""
} |
q178131 | Generator.compileTagHandlerPoolList | test | private void compileTagHandlerPoolList(Node.Nodes page)
throws JasperException {
class TagHandlerPoolVisitor extends Node.Visitor {
private Set<String> names = new HashSet<String>();
/*
* Constructor
*
* @param v Set of tag handler pool n... | java | {
"resource": ""
} |
q178132 | Generator.generateXmlProlog | test | private void generateXmlProlog(Node.Nodes page) {
/*
* An XML declaration is generated under the following conditions:
*
* - 'omit-xml-declaration' attribute of <jsp:output> action is set to
* "no" or "false"
* - JSP document without a <jsp:root>
*/
... | java | {
"resource": ""
} |
q178133 | Generator.genCommonPostamble | test | private void genCommonPostamble() {
// Append any methods that were generated in the buffer.
for (int i = 0; i < methodsBuffered.size(); i++) {
GenBuffer methodBuffer = methodsBuffered.get(i);
methodBuffer.adjustJavaLines(out.getJavaLine() - 1);
out.printMultiLn(metho... | java | {
"resource": ""
} |
q178134 | Generator.generatePostamble | test | private void generatePostamble(Node.Nodes page) {
out.popIndent();
out.printil("} catch (Throwable t) {");
out.pushIndent();
out.printil(
"if (!(t instanceof SkipPageException)){");
out.pushIndent();
out.printil("out = _jspx_out;");
out.printil("if (ou... | java | {
"resource": ""
} |
q178135 | Generator.generate | test | public static void generate(
ServletWriter out,
Compiler compiler,
Node.Nodes page)
throws JasperException {
Generator gen = new Generator(out, compiler);
if (gen.isPoolingEnabled) {
gen.compileTagHandlerPoolList(page);
}
if (gen.ctxt.isTagFi... | java | {
"resource": ""
} |
q178136 | Generator.generateTagHandlerAttributes | test | private void generateTagHandlerAttributes(TagInfo tagInfo)
throws JasperException {
if (tagInfo.hasDynamicAttributes()) {
out.printil(
"private java.util.HashMap _jspx_dynamic_attrs = new java.util.HashMap();");
}
// Declare attributes
TagAttributeIn... | java | {
"resource": ""
} |
q178137 | TransferServiceImpl.readProperties | test | private Map<MetaKey, String> readProperties ( final InputStream stream ) throws IOException
{
try
{
// wrap the input stream since we don't want the XML parser to close the stream while parsing
final Document doc = this.xmlToolsFactory.newDocumentBuilder ().parse ( new Filte... | java | {
"resource": ""
} |
q178138 | TransferServiceImpl.exportChannel | test | private void exportChannel ( final By by, final OutputStream stream ) throws IOException
{
final ZipOutputStream zos = new ZipOutputStream ( stream );
initExportFile ( zos );
this.channelService.accessRun ( by, ReadableChannel.class, channel -> {
putDataEntry ( zos, "names", m... | java | {
"resource": ""
} |
q178139 | Validator.validateXmlView | test | private static void validateXmlView(PageData xmlView, Compiler compiler)
throws JasperException {
StringBuilder errMsg = null;
ErrorDispatcher errDisp = compiler.getErrorDispatcher();
for (Iterator<TagLibraryInfo> iter =
compiler.getPageInfo().getTaglibs().iterator();
iter.... | java | {
"resource": ""
} |
q178140 | TagHandlerPool.get | test | public <T extends JspTag> JspTag get(Class<T> handlerClass)
throws JspException {
synchronized( this ) {
if (current >= 0) {
return handlers[current--];
}
}
// Out of sync block - there is no need for other threads to
// wait for us to... | java | {
"resource": ""
} |
q178141 | ELParser.parse | test | public static ELNode.Nodes parse(String expression) {
ELParser parser = new ELParser(expression);
while (parser.hasNextChar()) {
String text = parser.skipUntilEL();
if (text.length() > 0) {
parser.expr.add(new ELNode.Text(text));
}
ELNode.Nodes elexpr = parser.parseEL();
if (! elexpr.isEmpt... | java | {
"resource": ""
} |
q178142 | JspConfig.selectProperty | test | private JspPropertyGroup selectProperty(JspPropertyGroup prev,
JspPropertyGroup curr) {
if (prev == null) {
return curr;
}
if (prev.getExtension() == null) {
// exact match
return prev;
}
if (curr.get... | java | {
"resource": ""
} |
q178143 | JspConfig.isJspPage | test | public boolean isJspPage(String uri) throws JasperException {
init();
if (jspProperties == null) {
return false;
}
String uriPath = null;
int index = uri.lastIndexOf('/');
if (index >=0 ) {
uriPath = uri.substring(0, index+1);
}
S... | java | {
"resource": ""
} |
q178144 | ServletWriter.printComment | test | public void printComment(Mark start, Mark stop, char[] chars) {
if (start != null && stop != null) {
println("// from="+start);
println("// to="+stop);
}
if (chars != null)
for(int i = 0; i < chars.length;) {
printin();
... | java | {
"resource": ""
} |
q178145 | ServletWriter.printin | test | public void printin(String s) {
writer.print(SPACES.substring(0, indent));
writer.print(s);
} | java | {
"resource": ""
} |
q178146 | ServletWriter.printil | test | public void printil(String s) {
javaLine++;
writer.print(SPACES.substring(0, indent));
writer.println(s);
} | java | {
"resource": ""
} |
q178147 | ServletWriter.printMultiLn | test | public void printMultiLn(String s) {
int index = 0;
// look for hidden newlines inside strings
while ((index=s.indexOf('\n',index)) > -1 ) {
javaLine++;
index++;
}
writer.print(s);
} | java | {
"resource": ""
} |
q178148 | JspUtil.getExprInXml | test | public static String getExprInXml(String expression) {
String returnString;
int length = expression.length();
if (expression.startsWith(OPEN_EXPR)
&& expression.endsWith(CLOSE_EXPR)) {
returnString = expression.substring (1, length - 1);
} else {
... | java | {
"resource": ""
} |
q178149 | JspUtil.checkScope | test | public static void checkScope(String scope, Node n, ErrorDispatcher err)
throws JasperException {
if (scope != null && !scope.equals("page") && !scope.equals("request")
&& !scope.equals("session") && !scope.equals("application")) {
err.jspError(n, "jsp.error.invalid.scope", scope);
}
} | java | {
"resource": ""
} |
q178150 | JspUtil.escapeXml | test | public static String escapeXml(String s) {
if (s == null) return null;
StringBuilder sb = new StringBuilder();
for(int i=0; i<s.length(); i++) {
char c = s.charAt(i);
if (c == '<') {
sb.append("<");
} else if (c == '>') {
sb.... | java | {
"resource": ""
} |
q178151 | JspUtil.validateExpressions | test | public static void validateExpressions(Mark where,
String expressions,
FunctionMapper functionMapper,
ErrorDispatcher err)
throws JasperException {
try {
ELCo... | java | {
"resource": ""
} |
q178152 | JspUtil.getTagHandlerClassName | test | public static String getTagHandlerClassName(String path,
ErrorDispatcher err)
throws JasperException {
String className = null;
int begin = 0;
int index;
index = path.lastIndexOf(".tag");
if (index == -1) {
err.jspError("jsp.error.tagfi... | java | {
"resource": ""
} |
q178153 | JspUtil.makeJavaPackage | test | public static final String makeJavaPackage(String path) {
String classNameComponents[] = split(path,"/");
StringBuilder legalClassNames = new StringBuilder();
for (int i = 0; i < classNameComponents.length; i++) {
legalClassNames.append(makeJavaIdentifier(classNameComponents[i]));
... | java | {
"resource": ""
} |
q178154 | JspUtil.split | test | private static final String [] split(String path, String pat) {
ArrayList<String> comps = new ArrayList<String>();
int pos = path.indexOf(pat);
int start = 0;
while( pos >= 0 ) {
if(pos > start ) {
String comp = path.substring(start,pos);
comps... | java | {
"resource": ""
} |
q178155 | JspUtil.makeJavaIdentifier | test | public static final String makeJavaIdentifier(String identifier) {
StringBuilder modifiedIdentifier =
new StringBuilder(identifier.length());
if (!Character.isJavaIdentifierStart(identifier.charAt(0))) {
modifiedIdentifier.append('_');
}
for (int i = 0; i < ident... | java | {
"resource": ""
} |
q178156 | JspUtil.mangleChar | test | public static final String mangleChar(char ch) {
char[] result = new char[5];
result[0] = '_';
result[1] = Character.forDigit((ch >> 12) & 0xf, 16);
result[2] = Character.forDigit((ch >> 8) & 0xf, 16);
result[3] = Character.forDigit((ch >> 4) & 0xf, 16);
result[4] = Chara... | java | {
"resource": ""
} |
q178157 | JspUtil.isJavaKeyword | test | public static boolean isJavaKeyword(String key) {
int i = 0;
int j = javaKeywords.length;
while (i < j) {
int k = (i+j)/2;
int result = javaKeywords[k].compareTo(key);
if (result == 0) {
return true;
}
if (result < 0) {
... | java | {
"resource": ""
} |
q178158 | InstallableUnit.addProperty | test | private static void addProperty ( final Map<String, String> props, final String key, final String value )
{
if ( value == null )
{
return;
}
props.put ( key, value );
} | java | {
"resource": ""
} |
q178159 | Functions.modifier | test | public static String modifier ( final String prefix, final Modifier modifier )
{
if ( modifier == null )
{
return "";
}
String value = null;
switch ( modifier )
{
case DEFAULT:
value = "default";
break;
... | java | {
"resource": ""
} |
q178160 | Functions.metadata | test | public static SortedSet<String> metadata ( final Map<MetaKey, String> metadata, String namespace, String key )
{
final SortedSet<String> result = new TreeSet<> ();
if ( namespace.isEmpty () )
{
namespace = null;
}
if ( key.isEmpty () )
{
key ... | java | {
"resource": ""
} |
q178161 | DatabaseUserService.run | test | @Override
public void run () throws Exception
{
this.storageManager.modifyRun ( MODEL_KEY, UserWriteModel.class, users -> {
final Date timeout = new Date ( System.currentTimeMillis () - getTimeout () );
final Collection<UserEntity> updates = new LinkedList<> ();
fin... | java | {
"resource": ""
} |
q178162 | FileNames.getBasename | test | public static String getBasename ( final String name )
{
if ( name == null )
{
return null;
}
final String[] toks = name.split ( "/" );
if ( toks.length < 1 )
{
return name;
}
return toks[toks.length - 1];
} | java | {
"resource": ""
} |
q178163 | MetadataCache.put | test | public boolean put(Locator locator, String key, String value) throws CacheException {
if (value == null) return false;
Timer.Context cachePutTimerContext = MetadataCache.cachePutTimer.time();
boolean dbWrite = false;
try {
CacheKey cacheKey = new CacheKey(locator, key);
... | java | {
"resource": ""
} |
q178164 | MetadataCache.databaseLoad | test | private String databaseLoad(Locator locator, String key) throws CacheException {
try {
CacheKey cacheKey = new CacheKey(locator, key);
Map<String, String> metadata = io.getAllValues(locator);
if (metadata == null || metadata.isEmpty()) {
cache.put(cacheKey, NU... | java | {
"resource": ""
} |
q178165 | PreaggregateConversions.buildMetricsCollection | test | public static Collection<IMetric> buildMetricsCollection(AggregatedPayload payload) {
Collection<IMetric> metrics = new ArrayList<IMetric>();
metrics.addAll(PreaggregateConversions.convertCounters(payload.getTenantId(), payload.getTimestamp(), payload.getFlushIntervalMillis(), payload.getCounters()));
... | java | {
"resource": ""
} |
q178166 | PreaggregateConversions.resolveNumber | test | public static Number resolveNumber(Number n) {
if (n instanceof LazilyParsedNumber) {
try {
return n.longValue();
} catch (NumberFormatException ex) {
return n.doubleValue();
}
} else {
// already resolved.
retur... | java | {
"resource": ""
} |
q178167 | StringMetadataSerDes.writeToOutputStream | test | private static void writeToOutputStream(Object obj, CodedOutputStream out) throws IOException {
out.writeRawByte(STRING);
out.writeStringNoTag((String)obj);
} | java | {
"resource": ""
} |
q178168 | AbstractMetricsRW.getTtl | test | protected int getTtl(Locator locator, RollupType rollupType, Granularity granularity) {
return (int) TTL_PROVIDER.getTTL(locator.getTenantId(),
granularity,
rollupType).get().toSeconds();
} | java | {
"resource": ""
} |
q178169 | DLocatorIO.createPreparedStatements | test | private void createPreparedStatements() {
// create a generic select statement for retrieving from metrics_locator
Select.Where select = QueryBuilder
.select()
.all()
.from( CassandraModel.CF_METRICS_LOCATOR_NAME )
.where( eq ( KEY, bindM... | java | {
"resource": ""
} |
q178170 | Tracker.trackDelayedMetricsTenant | test | public void trackDelayedMetricsTenant(String tenantid, final List<Metric> delayedMetrics) {
if (isTrackingDelayedMetrics) {
String logMessage = String.format("[TRACKER][DELAYED METRIC] Tenant sending delayed metrics %s", tenantid);
log.info(logMessage);
// log individual del... | java | {
"resource": ""
} |
q178171 | Tracker.trackDelayedAggregatedMetricsTenant | test | public void trackDelayedAggregatedMetricsTenant(String tenantId, long collectionTimeMs, long delayTimeMs, List<String> delayedMetricNames) {
if (isTrackingDelayedMetrics) {
String logMessage = String.format("[TRACKER][DELAYED METRIC] Tenant sending delayed metrics %s", tenantId);
log.inf... | java | {
"resource": ""
} |
q178172 | AbstractSerDes.getUnversionedDoubleOrLong | test | protected Number getUnversionedDoubleOrLong(CodedInputStream in) throws IOException {
byte type = in.readRawByte();
if (type == Constants.B_DOUBLE)
return in.readDouble();
else
return in.readRawVarint64();
} | java | {
"resource": ""
} |
q178173 | AbstractSerDes.putUnversionedDoubleOrLong | test | protected void putUnversionedDoubleOrLong(Number number, CodedOutputStream out) throws IOException {
if (number instanceof Double) {
out.writeRawByte(Constants.B_DOUBLE);
out.writeDoubleNoTag(number.doubleValue());
} else {
out.writeRawByte(Constants.B_I64);
... | java | {
"resource": ""
} |
q178174 | Configuration.getAllProperties | test | public Map<Object, Object> getAllProperties() {
Map<Object, Object> map = new HashMap<Object, Object>();
for (Object key : defaultProps.keySet()) {
map.put(key, defaultProps.getProperty(key.toString()));
}
for (Object key : props.keySet()) {
map.put(key, props.ge... | java | {
"resource": ""
} |
q178175 | CloudFilesPublisher.createContainer | test | private void createContainer() {
String containerName = CONTAINER_DATE_FORMAT.format(new Date());
blobStore.createContainerInLocation(null, containerName);
lastContainerCreated = containerName;
} | java | {
"resource": ""
} |
q178176 | ScheduleContext.scheduleEligibleSlots | test | void scheduleEligibleSlots(long maxAgeMillis, long rollupDelayForMetricsWithShortDelay, long rollupWaitForMetricsWithLongDelay) {
long now = scheduleTime;
ArrayList<Integer> shardKeys = new ArrayList<Integer>(shardStateManager.getManagedShards());
Collections.shuffle(shardKeys);
for (in... | java | {
"resource": ""
} |
q178177 | ScheduleContext.clearFromRunning | test | void clearFromRunning(SlotKey slotKey) {
synchronized (runningSlots) {
runningSlots.remove(slotKey);
UpdateStamp stamp = shardStateManager.getUpdateStamp(slotKey);
shardStateManager.setAllCoarserSlotsDirtyForSlot(slotKey);
//When state gets set to "X", before it ... | java | {
"resource": ""
} |
q178178 | Emitter.on | test | public Emitter on(String event, Listener fn) {
ConcurrentLinkedQueue<Listener> callbacks = this.callbacks.get(event);
if (callbacks == null) {
callbacks = new ConcurrentLinkedQueue<Listener>();
ConcurrentLinkedQueue<Listener> _callbacks = this.callbacks.putIfAbsent(event, callbac... | java | {
"resource": ""
} |
q178179 | Emitter.once | test | public Emitter once(final String event, final Listener<T> fn) {
Listener on = new Listener<T>() {
@Override
public void call(T... args) {
Emitter.this.off(event, this);
fn.call(args);
}
};
this.onceCallbacks.put(fn, on);
... | java | {
"resource": ""
} |
q178180 | Emitter.off | test | public Emitter off(String event) {
ConcurrentLinkedQueue<Listener> callbacks = this.callbacks.remove(event);
if (callbacks != null) {
for (Listener fn : callbacks) {
this.onceCallbacks.remove(fn);
}
}
return this;
} | java | {
"resource": ""
} |
q178181 | Emitter.emit | test | public Future emit(String event, T... args) {
ConcurrentLinkedQueue<Listener> callbacks = this.callbacks.get(event);
if (callbacks != null) {
callbacks = new ConcurrentLinkedQueue<Listener>(callbacks);
for (Listener fn : callbacks) {
fn.call(args);
}
... | java | {
"resource": ""
} |
q178182 | Emitter.listeners | test | public List<Listener> listeners(String event) {
ConcurrentLinkedQueue<Listener> callbacks = this.callbacks.get(event);
return callbacks != null ?
new ArrayList<Listener>(callbacks) : new ArrayList<Listener>();
} | java | {
"resource": ""
} |
q178183 | RollupFile.getRemoteName | test | public String getRemoteName() {
Date time = new Date(timestamp);
String formattedTime = new SimpleDateFormat("yyyyMMdd_").format(time);
return formattedTime + System.currentTimeMillis() + "_" + Configuration.getInstance().getStringProperty(CloudfilesConfig.CLOUDFILES_HOST_UNIQUE_IDENTIFIER);
... | java | {
"resource": ""
} |
q178184 | RollupFile.append | test | public void append(RollupEvent rollup) throws IOException {
ensureOpen();
outputStream.write(serializer.toBytes(rollup));
outputStream.write('\n');
outputStream.flush();
} | java | {
"resource": ""
} |
q178185 | RollupFile.parseTimestamp | test | private static long parseTimestamp(String fileName) throws NumberFormatException {
String numberPart = fileName.substring(0, fileName.length() - 5);
return Long.parseLong(numberPart);
} | java | {
"resource": ""
} |
q178186 | HttpMetricsIngestionServer.startServer | test | public void startServer() throws InterruptedException {
RouteMatcher router = new RouteMatcher();
router.get("/v1.0", new DefaultHandler());
router.post("/v1.0/multitenant/experimental/metrics",
new HttpMultitenantMetricsIngestionHandler(processor, timeout, ENABLE_PER_TENANT_MET... | java | {
"resource": ""
} |
q178187 | RollupRunnable.getRollupComputer | test | public static Rollup.Type getRollupComputer(RollupType srcType, Granularity srcGran) {
switch (srcType) {
case COUNTER:
return Rollup.CounterFromCounter;
case TIMER:
return Rollup.TimerFromTimer;
case GAUGE:
return Rollup.GaugeF... | java | {
"resource": ""
} |
q178188 | IOContainer.fromConfig | test | public static synchronized IOContainer fromConfig() {
if ( FROM_CONFIG_INSTANCE == null ) {
String driver = configuration.getStringProperty(CoreConfig.CASSANDRA_DRIVER);
LOG.info(String.format("Using driver %s", driver));
boolean isRecordingDelayedMetrics = configuration.ge... | java | {
"resource": ""
} |
q178189 | ConfigTtlProvider.put | test | private boolean put(
ImmutableTable.Builder<Granularity, RollupType, TimeValue> ttlMapBuilder,
Configuration config,
Granularity gran,
RollupType rollupType,
TtlConfig configKey) {
int value;
try {
value = config.getIntegerProperty(configKey);
... | java | {
"resource": ""
} |
q178190 | OutputFormatter.computeMaximums | test | public static int [] computeMaximums(String[] headers, OutputFormatter... outputs) {
int[] max = new int[headers.length];
for (int i = 0; i < headers.length; i++)
max[i] = headers[i].length();
for (OutputFormatter output : outputs) {
max[0] = Math.max(output.host.length(... | java | {
"resource": ""
} |
q178191 | OutputFormatter.formatHeader | test | public static String formatHeader(int[] maximums, String[] headers) {
StringBuilder sb = new StringBuilder();
for (int i = 0; i < headers.length; i++)
sb = sb.append(formatIn(headers[i], maximums[i], false)).append(GAP);
return sb.toString();
} | java | {
"resource": ""
} |
q178192 | OutputFormatter.format | test | public static String[] format(int[] maximums, OutputFormatter... outputs) {
String[] formattedStrings = new String[outputs.length];
int pos = 0;
for (OutputFormatter output : outputs) {
StringBuilder sb = new StringBuilder();
sb = sb.append(formatIn(output.host, maximums[... | java | {
"resource": ""
} |
q178193 | ZKShardLockManager.registerMetrics | test | private void registerMetrics(final ObjectName nameObj, MetricRegistry reg) {
reg.register(MetricRegistry.name(ZKShardLockManager.class, "Lock Disinterested Time Millis"),
new JmxAttributeGauge(nameObj, "LockDisinterestedTimeMillis"));
reg.register(MetricRegistry.name(ZKShardLockManager.c... | java | {
"resource": ""
} |
q178194 | ThreadPoolBuilder.withName | test | public ThreadPoolBuilder withName(String name) {
// ensure we've got a spot to put the thread id.
if (!name.contains("%d")) {
name = name + "-%d";
}
nameMap.putIfAbsent(name, new AtomicInteger(0));
int id = nameMap.get(name).incrementAndGet();
this.poolName = ... | java | {
"resource": ""
} |
q178195 | MetricIndexData.add | test | public void add(String metricIndex, long docCount) {
final String[] tokens = metricIndex.split(METRIC_TOKEN_SEPARATOR_REGEX);
/**
*
* For the ES response shown in class description, for a baseLevel of 2,
* the data is classified as follows
*
* metricNamesWi... | java | {
"resource": ""
} |
q178196 | MetricIndexData.getCompleteMetricNames | test | private Set<String> getCompleteMetricNames(Map<String, MetricIndexDocCount> metricIndexMap) {
Set<String> completeMetricNames = new HashSet<String>();
for (Map.Entry<String, MetricIndexDocCount> entry : metricIndexMap.entrySet()) {
MetricIndexDocCount metricIndexDocCount = entry.getValue()... | java | {
"resource": ""
} |
q178197 | Token.getTokens | test | public static List<Token> getTokens(Locator locator) {
if (StringUtils.isEmpty(locator.getMetricName()) || StringUtils.isEmpty(locator.getTenantId()))
return new ArrayList<>();
String[] tokens = locator.getMetricName().split(Locator.METRIC_TOKEN_SEPARATOR_REGEX);
return IntStream.... | java | {
"resource": ""
} |
q178198 | DAbstractMetricIO.putAsync | test | public ResultSetFuture putAsync(Locator locator, long collectionTime, Rollup rollup, Granularity granularity, int ttl) {
Session session = DatastaxIO.getSession();
// we use batch statement here in case sub classes
// override the addRollupToBatch() and provide
// multiple statements
... | java | {
"resource": ""
} |
q178199 | Granularity.granularityFromPointsInInterval | test | public static Granularity granularityFromPointsInInterval(String tenantid, long from, long to, int points, String algorithm, long assumedIntervalMillis, Clock ttlComparisonClock) {
if (from >= to) {
throw new RuntimeException("Invalid interval specified for fromPointsInInterval");
}
... | java | {
"resource": ""
} |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.