Dataset Viewer
Auto-converted to Parquet Duplicate
proj_name
stringclasses
68 values
relative_path
stringlengths
41
329
class_name
stringlengths
1
71
func_name
stringlengths
1
89
func_body
stringlengths
0
7.52k
masked_class
stringlengths
55
8.5k
len_input
int64
25
2.02k
len_output
int64
1
1.96k
total
int64
28
2.04k
finetune_output
stringlengths
0
5.55k
compile_info
stringclasses
1 value
inherit_elements
stringclasses
542 values
AdoptOpenJDK_jitwatch
jitwatch/core/src/main/java/org/adoptopenjdk/jitwatch/histo/AttributeNameHistoWalker.java
AttributeNameHistoWalker
visit
String attrValue = null; if (isCompileAttribute) { attrValue = mm.getCompiledAttribute(attributeName); } else { attrValue = mm.getQueuedAttribute(attributeName); } if (attrValue != null) { long val = Long.valueOf(attrValue); histo.addValue(val); }
class AttributeNameHistoWalker extends AbstractHistoVisitable { private boolean isCompileAttribute; private String attributeName; public AttributeNameHistoWalker(IReadOnlyJITDataModel model, boolean isCompileAttribute, String attributeName, long resolution) { super(model, resolution); this.isCompileAttribute...
135
113
248
if (isCompileAttribute && mm.getName().equals(attributeName)) { add(mm.getOffset()); }
<COMPILED_SUCCESSFULLY>
Histo histo;IReadOnlyJITDataModel model;long resolution;Histo buildHistogram(){};void reset(){};void visitTag( Tag toVisit, IParseDictionary parseDictionary) throws LogParseException {};Set<String> ignoreTags=newHashSet<>();void handleOther( Tag tag){}
AdoptOpenJDK_jitwatch
jitwatch/core/src/main/java/org/adoptopenjdk/jitwatch/model/Tag.java
Tag
hashCode
int result = name != null ? name.hashCode() : 0; result = 31 * result + (attributeString != null ? attributeString.hashCode() : 0); result = 31 * result + (parent != null ? parent.hashCode() : 0); result = 31 * result + (selfClosing ? 1 : 0); result = 31 * result + (textContent ...
class Tag { private String name; private String attributeString; private List<Tag> children = new ArrayList<>(); private Tag parent = null; private boolean selfClosing = false; private boolean isFragment = false; private String textContent = null; private static final String INDENT = " "; public Tag(String...
1,715
123
1,838
int result = name != null ? name.hashCode() : 0; result = 31 * result + (attributeString != null ? attributeString.hashCode() : 0); result = 31 * result + (children != null ? children.hashCode() : 0); result = 31 * result + (parent != null ? parent.hashCode() : 0); result = 31 *...
<COMPILED_SUCCESSFULLY>
AdoptOpenJDK_jitwatch
jitwatch/core/src/main/java/org/adoptopenjdk/jitwatch/model/assembly/AssemblyLabels.java
AssemblyLabels
instructionToLabel
final List<String> operands = instruction.getOperands(); if (instruction.getMnemonic().startsWith("j") && operands.size() == 1) { try { return AssemblyUtil.getValueFromAddress(operands.get(0)); } catch (NumberFormatException nfe) { // could be Intel format jump to Stub:: reference } ...
class AssemblyLabels { private SortedSet<Long> addresses = new TreeSet<>(); private final Map<Long, Short> labels = new HashMap<>(); private long lowest = Long.MAX_VALUE; private long highest; public void newInstruction(AssemblyInstruction instruction) { final long address = instruction.getAddress(); lowes...
613
118
731
final List<String> operands = instruction.getOperands(); if (operands.size() > 0) { final String op = operands.get(0); if (op.startsWith(C_LABEL)) { return Long.parseLong(op.substring(1), 16); } } return null;
<COMPILED_SUCCESSFULLY>
AdoptOpenJDK_jitwatch
jitwatch/core/src/main/java/org/adoptopenjdk/jitwatch/model/bytecode/LineTable.java
LineTable
sourceLineInRange
boolean result = false; int[] sourceRange = getSourceRange(); int minSourceLine = sourceRange[0]; int maxSourceLine = sourceRange[1]; result = (sourceLine >= minSourceLine) && (sourceLine <= maxSourceLine); if (DEBUG_LOGGING_BYTECODE) { logger.debug("{} in range {}-{} : {}", sourceLine, minSourceL...
class LineTable { private List<LineTableEntry> lineTableEntries = new ArrayList<>(); private static final Logger logger = LoggerFactory.getLogger(LineTable.class); private MemberBytecode memberBytecode; public LineTable(MemberBytecode memberBytecode) { this.memberBytecode = memberBytecode; } public MemberB...
1,405
127
1,532
boolean result = false; for (LineTableEntry entry : lineTableEntries) { if (entry.getSourceOffset() == sourceLine) { result = true; break; } } return result;
<COMPILED_SUCCESSFULLY>
AdoptOpenJDK_jitwatch
jitwatch/core/src/main/java/org/adoptopenjdk/jitwatch/parser/ParserFactory.java
ParserFactory
getParser
switch (parserType) { case HOTSPOT: return new HotSpotLogParser(jitListener); case J9: return new J9LogParser(jitListener); case ZING: return new ZingLogParser(jitListener); default: throw new RuntimeException("Unknown parser " + parserType); }
class ParserFactory { private ParserFactory() { } public static ILogParser getParser(ParserType parserType, IJITListener jitListener) {<FILL_FUNCTION_BODY>} }
56
97
153
switch (parserType) { case JDT: return new JDTParser(jitListener); case JDT_WITH_DEBUG: return new JDTParser(jitListener); case JDT_WITH_DEBUG_AND_DEBUG_INFO: return new JDTParser(jitListener); case JDT_WITH_DEBUG_AND_DEBUG_INFO_AND_DEBUG_INFO_WITH_DEBUG_INFO: return new JDTParser(jitLi...
<COMPILED_SUCCESSFULLY>
AdoptOpenJDK_jitwatch
jitwatch/core/src/main/java/org/adoptopenjdk/jitwatch/process/runtime/RuntimeJRuby.java
RuntimeJRuby
execute
List<String> commands = new ArrayList<>(); commands.add(runtimePath.toString()); if (vmOptions.size() > 0) { commands.addAll(vmOptions); } if (classpathEntries.size() > 0) { commands.add("-cp"); commands.add(makeClassPath(classpathEntries)); } commands.add(className); return runComma...
class RuntimeJRuby extends AbstractProcess implements IRuntime { private Path runtimePath; private final String RUNTIME_NAME = "jruby" + (isWindows() ? ".bat" : S_EMPTY); public RuntimeJRuby(String languageHomeDir) throws FileNotFoundException { super(); runtimePath = Paths.get(languageHomeDir, "bin", RUNTIM...
316
141
457
String[] args = new String[classpathEntries.size() + 1]; args[0] = runtimePath.toString(); for (int i = 0; i < classpathEntries.size(); i++) { args[i + 1] = classpathEntries.get(i); } return execute(workingDir, className, args, vmOptions, environment, logListener);
<COMPILED_SUCCESSFULLY>
Logger logger=LoggerFactory.getLogger(RuntimeJava.class);Path stdErr;Path stdOut;String getExecutableSuffix(){};String getLaunchScriptSuffix(){};boolean isWindows(){};String getOutputStream(){};String getErrorStream(){};String makeClassPath( List<String> classpathEntries){};boolean runCommands( List<String> commands,...
AdoptOpenJDK_jitwatch
jitwatch/core/src/main/java/org/adoptopenjdk/jitwatch/report/comparator/ScoreComparator.java
ScoreComparator
compare
return Integer.compare(o2.getScore(), o1.getScore());
class ScoreComparator implements Comparator<Report> { @Override public int compare(Report o1, Report o2) {<FILL_FUNCTION_BODY>} }
49
22
71
return o2.getScore() - o1.getScore();
<COMPILED_SUCCESSFULLY>
AdoptOpenJDK_jitwatch
jitwatch/core/src/main/java/org/adoptopenjdk/jitwatch/toplist/CompiledAttributeTopListVisitable.java
CompiledAttributeTopListVisitable
visit
if (mm.getCompiledAttribute(attr) != null) { long value = Long.valueOf(mm.getCompiledAttribute(attr)); topList.add(new MemberScore(mm, value)); }
class CompiledAttributeTopListVisitable extends AbstractTopListVisitable { private final String attr; public CompiledAttributeTopListVisitable(IReadOnlyJITDataModel model, String attr, boolean sortHighToLow) { super(model, sortHighToLow); this.attr = attr; } @Override public void visit(IMetaMember mm) {<FI...
106
62
168
if (mm.getMemberName().equals(attr)) { add(mm); }
<COMPILED_SUCCESSFULLY>
IReadOnlyJITDataModel model;List<ITopListScore> topList;boolean sortHighToLow;Logger logger=LoggerFactory.getLogger(AbstractTopListVisitable.class);void reset(){};void postProcess(){};void visitTag( Tag toVisit, IParseDictionary parseDictionary) throws LogParseException {};List<ITopListScore> buildTopList(){};int com...
AdoptOpenJDK_jitwatch
jitwatch/core/src/main/java/org/adoptopenjdk/jitwatch/toplist/NativeMethodSizeTopListVisitable.java
NativeMethodSizeTopListVisitable
visit
for (Compilation compilation : metaMember.getCompilations()) { long nativeSize = compilation.getNativeSize(); if (nativeSize != 0) { topList.add(new MemberScore(metaMember, nativeSize)); } }
class NativeMethodSizeTopListVisitable extends AbstractTopListVisitable { public NativeMethodSizeTopListVisitable(IReadOnlyJITDataModel model, boolean sortHighToLow) { super(model, sortHighToLow); ignoreTags.add(TAG_BC); ignoreTags.add(TAG_KLASS); ignoreTags.add(TAG_TYPE); ignoreTags.add(TAG_METHOD); i...
295
77
372
if (metaMember instanceof IMethod) { IMethod method = (IMethod)metaMember; if (method.isNative()) { if (method.isNative() && method.isNative() && !method.isIntrinsic()) { if (method.isNative() && !method.isIntrinsic()) { if (method.isNative() && !method.isIntrinsic()) { ...
<COMPILED_SUCCESSFULLY>
IReadOnlyJITDataModel model;List<ITopListScore> topList;boolean sortHighToLow;Logger logger=LoggerFactory.getLogger(AbstractTopListVisitable.class);void reset(){};void postProcess(){};void visitTag( Tag toVisit, IParseDictionary parseDictionary) throws LogParseException {};List<ITopListScore> buildTopList(){};int com...
AdoptOpenJDK_jitwatch
jitwatch/core/src/main/java/org/adoptopenjdk/jitwatch/util/JVMSUtil.java
JVMSUtil
loadJVMS
try { Path path = Paths.get(new File(JVMS_HTML_FILENAME).toURI()); String html = new String(Files.readAllBytes(path), StandardCharsets.UTF_8); int htmlLength = html.length(); String descStart = "<div class="section-execution""; int startPos = html.indexOf(descStart); while (startPos != -1 &&...
class JVMSUtil { private static final Logger logger = LoggerFactory.getLogger(JVMSUtil.class); private static Map<String, String> bcDescriptionMap = new HashMap<>(); private static final String JVMS_HTML_FILENAME = "JVMS.html"; private static final String JVMS_CSS_FILENAME = "JVMS.css"; private JVMSUtil() { }...
917
290
1,207
if (hasLocalJVMS()) { File file = new File(JVMS_HTML_FILENAME); try { String html = new String(Files.readAllBytes(file.toPath()), StandardCharsets.UTF_8); Matcher matcher = Pattern.compile("<div class=\"section-execution\" title=\"(.*?)\">").matcher(html); while (matcher.find()) { ...
<COMPILED_SUCCESSFULLY>
AdoptOpenJDK_jitwatch
jitwatch/core/src/main/java/org/adoptopenjdk/jitwatch/util/NetUtil.java
NetUtil
fetchURL
StringBuilder builder = new StringBuilder(); try (BufferedReader bufferedReader = new BufferedReader(new InputStreamReader(new URL(url).openStream()))) { String inputLine; while ((inputLine = bufferedReader.readLine()) != null) { builder.append(inputLine).append(S_NEWLINE); } } catch (Malfo...
class NetUtil { private NetUtil() { } private static final Logger logger = LoggerFactory.getLogger(NetUtil.class); public static String fetchURL(String url) {<FILL_FUNCTION_BODY>} public static boolean fetchBinary(String url, Path targetPath) { try (BufferedInputStream bufferedInputStream = new BufferedInp...
282
171
453
try { return new String(fetchBinary(url), StandardCharsets.UTF_8); } catch (UnsupportedEncodingException e) { logger.error("Could not fetch {}", url, e); return null; }
<COMPILED_SUCCESSFULLY>
AdoptOpenJDK_jitwatch
jitwatch/core/src/main/resources/examples/EscapeTest.java
Wrapper2
run
String result; int matchYes = 0; int matchNo = 0; for (int i = 0; i < 100_000_000; i++) { int v1 = 0xABCD; int v2 = 0; if (random.nextBoolean()) { v2 = 0xABCD; } final Wrapper1 wrapper1 =...
class Wrapper2 { private int value; public Wrapper2(int value) { this.value = value; } public int getValue() { return this.value; } } private java.util.Random random = new java.util.Random(); public String run() {<FILL_FUNCTION_BODY>
88
237
325
Wrapper2 wrapper = new Wrapper2(random.nextInt()); return wrapper.getValue() + "";
<COMPILED_SUCCESSFULLY>
AdoptOpenJDK_jitwatch
jitwatch/core/src/main/resources/examples/EscapeTestMultipleFields.java
Wrapper2
main
String result = new EscapeTestMultipleFields().run(); System.out.println(result);
class Wrapper2 { private int v1; private int v2; private int v3; public Wrapper2(int value) { v1 = value; v2 = v1+1; v3 = v2+1; } public int getValue() { return v1 + v2 + v3; } } private java.util.Random random = new java.util.Random(); public String run() { ...
387
29
416
final Wrapper2 wrapper2 = new Wrapper2(0); System.out.println(wrapper2.getValue());
<COMPILED_SUCCESSFULLY>
AdoptOpenJDK_jitwatch
jitwatch/core/src/main/resources/examples/HotThrow.java
HotThrow
getChar
try { return chars[index]; } catch(ArrayIndexOutOfBoundsException e) { return '*'; }
class HotThrow { private Random random = new Random(); public HotThrow() { StringBuilder builder = new StringBuilder(); String string = "The quick brown fox jumps over the lazy dog"; char[] chars = string.toCharArray(); for (int i = 0 ; i < 1_000_000; i++) { ...
209
44
253
return chars[index];
<COMPILED_SUCCESSFULLY>
AdoptOpenJDK_jitwatch
jitwatch/core/src/main/resources/examples/IntrinsicTest.java
IntrinsicTest
add
return a + b;
class IntrinsicTest { public IntrinsicTest(int iterations) { long dstSum = 0; int[] src = new int[] { 1, 2, 3, 4, 5 }; int[] dst = new int[src.length]; for (int i = 0; i < iterations; i++) { // x86 has intrinsic for System.arrayCopy System.arrayco...
250
10
260
return a + b;
<COMPILED_SUCCESSFULLY>
AdoptOpenJDK_jitwatch
jitwatch/core/src/main/resources/examples/SimpleInliningTest.java
SimpleInliningTest
main
new SimpleInliningTest();
class SimpleInliningTest { public SimpleInliningTest() { int sum = 0; // 1_000_000 is F4240 in hex for (int i = 0 ; i < 1_000_000; i++) { sum = this.add(sum, 99); // 63 hex } System.out.println("Sum:" + sum); } public int add(int a, int b) ...
171
12
183
new SimpleInliningTest();
<COMPILED_SUCCESSFULLY>
AdoptOpenJDK_jitwatch
jitwatch/core/src/main/resources/examples/TrivialMethod.java
TrivialMethod
getCount
return count;
class TrivialMethod { private int count; public TrivialMethod() { StringBuilder builder = new StringBuilder(); for (int i = 0 ; i < 1_000_000; i++) { incCount(); int localCount = getCount(); builder.append(localCount).append("n"); } ...
180
8
188
return count;
<COMPILED_SUCCESSFULLY>
AdoptOpenJDK_jitwatch
jitwatch/core/src/test/java/FooClassInDefaultPackage.java
FooClassInDefaultPackage
setPrimitiveParam
this.primitiveParam = primitiveParam;
class FooClassInDefaultPackage { private int primitiveParam; private int[] primitiveArrayParam; private IsUsedForTestingDefaultPackage classParam; private IsUsedForTestingDefaultPackage[] classArrayParam; public int[] getPrimitiveArrayParam() { return primitiveArrayParam; } public void setPrimitiveArra...
278
14
292
this.primitiveParam = primitiveParam;
<COMPILED_SUCCESSFULLY>
AdoptOpenJDK_jitwatch
jitwatch/core/src/test/java/IsUsedForTestingDefaultPackage.java
IsUsedForTestingDefaultPackage
toString
return "Who watches the watchmen?";
class IsUsedForTestingDefaultPackage { // Class in the default package beginning with I (also representation on int parameter) // to regression check matching functionality @Override public String toString() {<FILL_FUNCTION_BODY>} }
62
15
77
return "IsUsedForTestingDefaultPackage";
<COMPILED_SUCCESSFULLY>
AdoptOpenJDK_jitwatch
jitwatch/core/src/test/java/org/adoptopenjdk/jitwatch/test/DummyClassWithMain.java
DummyClassWithMain
main
System.out.println("Hello World!");
class DummyClassWithMain { public static void main(String[] args) {<FILL_FUNCTION_BODY>} }
35
16
51
System.out.println("Hello world");
<COMPILED_SUCCESSFULLY>
AdoptOpenJDK_jitwatch
jitwatch/core/src/test/java/org/adoptopenjdk/jitwatch/test/TestLineTable.java
TestLineTable
testNashornLineTableRegression
LineTable table = new LineTable(null); LineTableEntry entry1 = new LineTableEntry(8, 21); LineTableEntry entry2 = new LineTableEntry(1, 50); LineTableEntry entry3 = new LineTableEntry(3, 57); LineTableEntry entry4 = new LineTableEntry(5, 81); LineTableEntry entry5 = new LineTableEntry(3, 118); table.ad...
class TestLineTable { @Test public void testCompositeLineTable() { LineTable table1 = new LineTable(null); LineTable table2 = new LineTable(null); LineTableEntry entry1 = new LineTableEntry(0, 0); LineTableEntry entry2 = new LineTableEntry(5, 5); LineTableEntry entry3 = new LineTableEntry(10, 10); LineT...
1,340
184
1,524
LineTable table = new LineTable(null); table.add(new LineTableEntry(1, 1)); table.add(new LineTableEntry(2, 2)); table.add(new LineTableEntry(3, 3)); table.add(new LineTableEntry(4, 4)); table.add(new LineTableEntry(5, 5)); table.add(new LineTableEntry(6, 6)); table.add(new LineTableEntry(7, 7)); ta...
<COMPILED_SUCCESSFULLY>
AdoptOpenJDK_jitwatch
jitwatch/core/target/classes/examples/EscapeTestMultipleFields.java
Wrapper2
run
String result; int matchYes = 0; int matchNo = 0; for (int i = 0; i < 100_000_000; i++) { int v1 = 0xABCD; int v2 = 0; // prevent the clever VM jumping straight to the answer if (random.nextBoolean()) { ...
class Wrapper2 { private int v1; private int v2; private int v3; public Wrapper2(int value) { v1 = value; v2 = v1+1; v3 = v2+1; } public int getValue() { return v1 + v2 + v3; } } private java.util.Random random = new java.util.Random(); public String run() {<FIL...
123
248
371
int n = random.nextInt(100); Wrapper2 w = new Wrapper2(n); return "n = " + n + ", w.getValue() = " + w.getValue();
<COMPILED_SUCCESSFULLY>
AdoptOpenJDK_jitwatch
jitwatch/core/target/classes/examples/EscapeTestString.java
Wrapper2
run
String result; int matchYes = 0; int matchNo = 0; for (int i = 0; i < 100_000_000; i++) { String v1 = "0xABCD"; String v2 = "0"; if (random.nextBoolean()) { v2 = "0xABCD"; } final Wrapper...
class Wrapper2 { private String value; public Wrapper2(String value) { this.value = value; } public String getValue() { return this.value; } } private java.util.Random random = new java.util.Random(); public String run() {<FILL_FUNCTION_BODY>
88
240
328
return new Wrapper2(String.valueOf(random.nextInt())).getValue();
<COMPILED_SUCCESSFULLY>
AdoptOpenJDK_jitwatch
jitwatch/core/target/classes/examples/HotThrow.java
HotThrow
main
new HotThrow();
class HotThrow { private Random random = new Random(); public HotThrow() { StringBuilder builder = new StringBuilder(); String string = "The quick brown fox jumps over the lazy dog"; char[] chars = string.toCharArray(); for (int i = 0 ; i < 1_000_000; i++) { ...
244
9
253
new HotThrow();
<COMPILED_SUCCESSFULLY>
AdoptOpenJDK_jitwatch
jitwatch/core/target/classes/examples/InlineElimAlloc.java
InlineElimAlloc
main
InlineElimAlloc test = new InlineElimAlloc(); long sum = 0; for (int i = 0; i < 20_000; i++) { sum += test.outer(i); } System.out.println(sum);
class InlineElimAlloc { public long outer(int i) { long sum = 0; for (int j = 0; j < 20_000; j++) { sum += inner(i, j); } return sum; } public long inner(int i, int j) { long sum = 0; int[] parts = new int[2]; parts[0...
226
76
302
InlineElimAlloc alloc = new InlineElimAlloc(); alloc.outer(1);
<COMPILED_SUCCESSFULLY>
AdoptOpenJDK_jitwatch
jitwatch/core/target/classes/examples/Lambda.java
Lambda
main
List<String> items = new ArrayList<>(); items.add("apple"); items.add("banana"); items.add("blueberry"); items.add("cherry"); items.add("pineapple"); items.add("pear"); items.add("strawberry"); List<Object> filtered = items.stream().filter( item...
class Lambda { public static void main(String[] args) {<FILL_FUNCTION_BODY>} }
34
141
175
List<String> list = new ArrayList<>(); list.add("a"); list.add("b"); list.add("c"); list.add("d"); list.add("e"); list.add("f"); list.add("g"); list.add("h"); list.add("i"); list.add("j"); list.add("k"); list.add("l...
<COMPILED_SUCCESSFULLY>
AdoptOpenJDK_jitwatch
jitwatch/core/target/classes/examples/PartialEscapeFail.java
EscapeConsumer
run
long result = 0; EscapeConsumer consumer = new EscapeConsumer(); java.util.Random random = new java.util.Random(); for (int i = 0; i < 100_000_000; i++) { Integer integer = Integer.valueOf(i); if (random.nextBoolean()) { re...
class EscapeConsumer { public int smallEnoughToInline(Integer integer) { // 325 bytes of bytecode (inlining limit is 325) int i = integer.intValue(); return ((i + 1) >> 2) + ((i + 2) >> 2) + ((i + 3) >> 2) + ((i + 4) >> 2) + ((i + 5) >> 2) + ((i + 6) >> 2) + ((i + 7) >> 2) + ((i + 8) >> ...
1,175
168
1,343
return "OK";
<COMPILED_SUCCESSFULLY>
AdoptOpenJDK_jitwatch
jitwatch/core/target/classes/examples/SimpleInliningTest.java
SimpleInliningTest
main
new SimpleInliningTest();
class SimpleInliningTest { public SimpleInliningTest() { int sum = 0; // 1_000_000 is F4240 in hex for (int i = 0 ; i < 1_000_000; i++) { sum = this.add(sum, 99); // 63 hex } System.out.println("Sum:" + sum); } public int add(int a, int b) ...
171
12
183
new SimpleInliningTest();
<COMPILED_SUCCESSFULLY>
AdoptOpenJDK_jitwatch
jitwatch/core/target/classes/examples/Sort.java
Sort
countGreaterThanHalfWithSort
long count = 0; Arrays.sort(theDoubles); for (int i = 0; i < ARRAY_LENGTH; i++) { if (theDoubles[i] > 0.5) { count++; } } return count;
class Sort { public static final int ARRAY_LENGTH = 1_000_000; public double[] doubleArray1 = new double[ARRAY_LENGTH]; public double[] doubleArray2 = new double[ARRAY_LENGTH]; public Sort() { fillArrays(); long count1 = countGreaterThanHalfWithSort(doubleArray1); long count2 = countGreaterThanHalfWithoutS...
388
85
473
Arrays.sort(theDoubles); long count = 0; for (int i = 0; i < ARRAY_LENGTH; i++) { if (theDoubles[i] > 0.5) { count++; } } return count;
<COMPILED_SUCCESSFULLY>
AdoptOpenJDK_jitwatch
jitwatch/ui/src/main/java/org/adoptopenjdk/jitwatch/ui/report/eliminatedallocation/EliminatedAllocationRowBean.java
EliminatedAllocationRowBean
getEliminatedType
String type = null; Object metaData = report.getMetaData(); if (metaData instanceof MetaClass) { type = ((MetaClass)metaData).getFullyQualifiedName(); } else if (metaData instanceof String) { type = (String)metaData; } else { type = "Unknown"; } return type;
class EliminatedAllocationRowBean extends AbstractReportRowBean { public EliminatedAllocationRowBean(Report report) { super(report); } public String getCompilation() { Compilation compilation = report.getCaller().getCompilation(report.getCompilationIndex()); return compilation != null ? compilation.getSign...
239
116
355
return report.getCaller().getEliminatedType().getFullyQualifiedName();
<COMPILED_SUCCESSFULLY>
Report report;Report getReport(){};String getText(){};int getBytecodeOffset(){}
AdoptOpenJDK_jitwatch
jitwatch/ui/src/main/java/org/adoptopenjdk/jitwatch/ui/report/inlining/InliningRowBuilder.java
InliningRowBuilder
call
return new TextTableCell();
class InliningRowBuilder { private InliningRowBuilder() { } public static TableView<IReportRowBean> buildTable(ObservableList<IReportRowBean> rows) { TableView<IReportRowBean> tv = new TableView<>(); TableColumn<IReportRowBean, String> metaClass = new TableColumn<>("Caller Class"); metaClass.setCellValueFa...
1,104
11
1,115
return new TextTableCell();
<COMPILED_SUCCESSFULLY>
AdoptOpenJDK_jitwatch
jitwatch/ui/src/main/java/org/adoptopenjdk/jitwatch/ui/triview/bytecode/BytecodeLabel.java
BytecodeLabel
getInstruction
return instruction;
class BytecodeLabel extends InstructionLabel { private BytecodeInstruction instruction; public BytecodeLabel(BytecodeInstruction instr, int maxOffset, int line) { super(instr.toString(maxOffset, line)); instruction = instr; } public BytecodeInstruction getInstruction() {<FILL_FUNCTION_BODY>} }
95
8
103
return instruction;
<COMPILED_SUCCESSFULLY>
String unhighlightedStyle=Viewer.STYLE_UNHIGHLIGHTED;void setUnhighlightedStyle( String style){};String getUnhighlightedStyle(){}
alibaba_canal
canal/admin/admin-web/src/main/java/com/alibaba/otter/canal/admin/handler/CustomExceptionHandler.java
CustomExceptionHandler
commonExceptionHandle
if (e instanceof ServiceException) { logger.error(e.getMessage()); } else { logger.error(e.getMessage(), e); } BaseModel res = new BaseModel(); res.setCode(50000); res.setMessage(e.getMessage()); return res;
class CustomExceptionHandler { private static Logger logger = LoggerFactory.getLogger(CustomExceptionHandler.class); /** * * * @param e * @return */ @ResponseBody @ResponseStatus(HttpStatus.OK) @ExceptionHandler(value = Exception.class) public BaseModel commonExcepti...
114
82
196
logger.error("Exception: ", e); return new BaseModel(HttpStatus.INTERNAL_SERVER_ERROR.value(), "Exception: " + e.getMessage());
<COMPILED_SUCCESSFULLY>
alibaba_canal
canal/admin/admin-web/src/main/java/com/alibaba/otter/canal/admin/model/Model.java
Model
saveOrUpdate
try { EbeanServer ebeanServer = Ebean.getDefaultServer(); Object id = ebeanServer.getBeanId(this); if (id == null) { init(); this.save(); } else { this.update(); } } catch (Exception e) { ...
class Model extends io.ebean.Model { public void init() { } public void save() { init(); super.save(); } public void insert() { init(); super.insert(); } public void saveOrUpdate() {<FILL_FUNCTION_BODY>} public void update(String... propertiesNames) {...
360
94
454
init(); super.save();
<COMPILED_SUCCESSFULLY>
alibaba_canal
canal/admin/admin-web/src/main/java/com/alibaba/otter/canal/admin/model/NodeServer.java
NodeServerFinder
init
status = "-1";
class NodeServerFinder extends Finder<Long, NodeServer> { /** * Construct using the default EbeanServer. */ public NodeServerFinder(){ super(NodeServer.class); } } @Id private Long id; @ManyToOne(fetch = FetchType.LAZY) @JoinColumn(nam...
216
10
226
if (StringUtils.isEmpty(name)) { name = ip; }
<COMPILED_SUCCESSFULLY>
alibaba_canal
canal/client-adapter/clickhouse/src/test/java/com/alibaba/otter/canal/client/adapter/clickhouse/sync/Common.java
Common
init
DatasourceConfig.DATA_SOURCES.put("defaultDS", TestConstant.dataSource); OuterAdapterConfig outerAdapterConfig = new OuterAdapterConfig(); outerAdapterConfig.setName("clickhouse"); outerAdapterConfig.setKey("clickhouse1"); Map<String, String> properties = new HashMap<>(); ...
class Common { public static ClickHouseAdapter init() {<FILL_FUNCTION_BODY>} /** * set global log level * * @param logLevel */ public static void setLogLevel(Level logLevel) { ch.qos.logback.classic.Logger logger = (ch.qos.logback.classic.Logger) LoggerFactory .getL...
129
220
349
ClickHouseAdapter adapter = new ClickHouseAdapter(); adapter.setHost("localhost"); adapter.setPort(9000); adapter.setDatabase("test"); adapter.setUserName("default"); adapter.setPassword("default"); adapter.setSsl(false); adapter.setSslMode(SslMode.REQUIR...
<COMPILED_SUCCESSFULLY>
alibaba_canal
canal/client-adapter/common/src/main/java/com/alibaba/otter/canal/client/adapter/ProxyOuterAdapter.java
ProxyOuterAdapter
count
ClassLoader cl = changeCL(); try { return OuterAdapter.super.count(task); } finally { revertCL(cl); }
class ProxyOuterAdapter implements OuterAdapter { private OuterAdapter outerAdapter; public ProxyOuterAdapter(OuterAdapter outerAdapter) { this.outerAdapter = outerAdapter; } private ClassLoader changeCL() { ClassLoader cl = Thread.currentThread().getContextClassLoader(); Thre...
490
45
535
ClassLoader cl = changeCL(); try { return OuterAdapter.super.count(task); } finally { revertCL(cl); }
<COMPILED_SUCCESSFULLY>
alibaba_canal
canal/client-adapter/es7x/src/test/java/com/alibaba/otter/canal/client/adapter/es7x/test/ESConnectionTest.java
ESConnectionTest
test01
MappingMetaData mappingMetaData = esConnection.getMapping("mytest_user"); Map<String, Object> sourceMap = mappingMetaData.getSourceAsMap(); Map<String, Object> esMapping = (Map<String, Object>) sourceMap.get("properties"); for (Map.Entry<String, Object> entry : esMapping.entrySet()) { ...
class ESConnectionTest { ESConnection esConnection; @Before public void init() throws UnknownHostException { String[] hosts = new String[] { "127.0.0.1:9200" }; Map<String, String> properties = new HashMap<>(); properties.put("cluster.name", "elasticsearch"); esConnection =...
141
212
353
String index = "test"; String type = "test"; String id = "1"; String json = "{"name":"test","age":18}"; esConnection.createIndex(index, type, id, json); esConnection.deleteIndex(index, type, id);
<COMPILED_SUCCESSFULLY>
alibaba_canal
canal/client-adapter/es8x/src/main/java/com/alibaba/otter/canal/client/adapter/es8x/etl/ESEtlService.java
ESEtlService
executeSqlImport
try { ESMapping mapping = (ESMapping) adapterMapping; Util.sqlRS(ds, sql, values, rs -> { int count = 0; try { ESBulkRequest esBulkRequest = this.esConnection.new ES8xBulkRequest(); long batchBegin = System.current...
class ESEtlService extends AbstractEtlService { private ESConnection esConnection; private ESTemplate esTemplate; private ESSyncConfig config; public ESEtlService(ESConnection esConnection, ESSyncConfig config){ super("ES", config); this.esConnection = esConnection; this.esTe...
243
1,481
1,724
try { if (sql.startsWith("select")) { return executeSelect(ds, sql, values, adapterMapping, impCount, errMsg); } else { return executeInsert(ds, sql, values, adapterMapping, impCount, errMsg); } } catch (Exception e) { logg...
<COMPILED_SUCCESSFULLY>
Logger logger=LoggerFactory.getLogger(this.getClass());String type;AdapterConfig config;long CNT_PER_TASK=10000L;EtlResult importData( String sql, List<String> params){};boolean executeSqlImport( DataSource ds, String sql, List<Object> values, AdapterConfig.AdapterMapping mapping, AtomicLong impCount, List<Stri...
alibaba_canal
canal/client-adapter/kudu/src/main/java/com/alibaba/otter/canal/client/adapter/kudu/support/SyncUtil.java
SyncUtil
getColumnsMap
Map<String, String> columnsMap; if (kuduMapping.getMapAll()) { if (kuduMapping.getAllMapColumns() != null) { return kuduMapping.getAllMapColumns(); } columnsMap = new LinkedHashMap<>(); for (String srcColumn : columns) { bo...
class SyncUtil { /** * * * @param kuduMapping * @return */ public static String getDbTableName(KuduMappingConfig.KuduMapping kuduMapping) { String result = ""; if (StringUtils.isNotEmpty(kuduMapping.getTable())) { result += kuduMapping.getDatabase() + ".";...
224
254
478
Map<String, String> result = new HashMap<>(); for (String column : columns) { result.put(column, getDbTableName(kuduMapping) + "." + column); } return result;
<COMPILED_SUCCESSFULLY>
alibaba_canal
canal/client-adapter/launcher/src/main/java/com/alibaba/otter/canal/adapter/launcher/common/SyncSwitch.java
SyncSwitch
on
if (mode == Mode.LOCAL) { BooleanMutex mutex = LOCAL_LOCK.get(destination); if (mutex != null && !mutex.state()) { mutex.set(true); } } else { try { String path = SYN_SWITCH_ZK_NODE + destination; try { ...
class SyncSwitch { private static final String SYN_SWITCH_ZK_NODE = "/sync-switch/"; private static final Map<String, BooleanMutex> LOCAL_LOCK = new ConcurrentHashMap<>(); private static final Map<String, BooleanMutex> DISTRIBUTED_LOCK = new ConcurrentHashMap<>(); privat...
1,779
226
2,005
if (mode == Mode.LOCAL) { BooleanMutex mutex = LOCAL_LOCK.get(destination); if (mutex != null && !mutex.state()) { mutex.set(true); } } else { try { String path = SYN_SWITCH_ZK_NODE + destination; try { ...
<COMPILED_SUCCESSFULLY>
alibaba_canal
canal/client-adapter/phoenix/src/main/java/com/alibaba/otter/canal/client/adapter/phoenix/support/BatchExecutor.java
BatchExecutor
rollback
getConn().rollback(); if (logger.isTraceEnabled()) { logger.trace("Batch executor rollback " + idx.get() + " rows"); } idx.set(0);
class BatchExecutor implements Closeable { private static final Logger logger = LoggerFactory.getLogger(BatchExecutor.class); private DataSource dataSource; private Connection conn; private AtomicInteger idx = new AtomicInteger(0); public BatchExecutor(DataSource dataSo...
682
55
737
getConn().rollback(); if (logger.isTraceEnabled()) { logger.trace("Batch executor rollback " + idx.get() + " rows"); } idx.set(0);
<COMPILED_SUCCESSFULLY>
alibaba_canal
canal/client-adapter/phoenix/src/test/java/com/alibaba/otter/canal/client/adapter/phoenix/test/TestConfigLoad.java
TestConfigLoad
testLoad
Map<String, MappingConfig> configMap = ConfigLoader.load(null); Assert.assertFalse(configMap.isEmpty());
class TestConfigLoad { @Before public void before() { // DatasourceConfig.DATA_SOURCES.put("defaultDS", TestConstant.dataSource); } @Test public void testLoad() {<FILL_FUNCTION_BODY>} }
81
35
116
// DataSource dataSource = DatasourceConfig.getDataSource("defaultDS"); Assert.assertNotNull(dataSource);
<COMPILED_SUCCESSFULLY>
alibaba_canal
canal/client-adapter/tablestore/src/main/java/com/alibaba/otter/canal/client/adapter/tablestore/config/ConfigLoader.java
ConfigLoader
load
logger.info("## Start loading tablestore mapping config ... "); Map<String, MappingConfig> result = new LinkedHashMap<>(); Map<String, String> configContentMap = MappingConfigsLoader.loadConfigs("tablestore"); configContentMap.forEach((fileName, content) -> { MappingConfig...
class ConfigLoader { private static Logger logger = LoggerFactory.getLogger(ConfigLoader.class); /** * RDB * * @return /-- */ public static Map<String, MappingConfig> load(Properties envProperties) {<FILL_FUNCTION_BODY>} }
95
229
324
Map<String, MappingConfig> mappingConfigMap = new HashMap<>(); try { String rdbConfigPath = envProperties.getProperty("rdb.config.path"); if (StringUtils.isEmpty(rdbConfigPath)) { logger.error("rdb.config.path is empty"); return mappingConfigMap; ...
<COMPILED_SUCCESSFULLY>
alibaba_canal
canal/client-adapter/tablestore/src/main/java/com/alibaba/otter/canal/client/adapter/tablestore/service/TablestoreEtlService.java
TablestoreEtlService
executeSqlImport
try { MappingConfig.DbMapping dbMapping = (MappingConfig.DbMapping) mapping; Map<String, String> columnsMap = dbMapping.getTargetColumnsParsed(); Util.sqlRS(srcDS, sql, values, rs -> { int idx = 0; List<Future<WriterResult>> futureList = new...
class TablestoreEtlService extends AbstractEtlService { private TableStoreWriter writer; private MappingConfig config; private TablestoreSyncService syncService; public TablestoreEtlService(TableStoreWriter writer, MappingConfig config){ super("Tablestore", config); this.writer = writ...
429
585
1,014
try { Connection srcConn = srcDS.getConnection(); Statement stmt = srcConn.createStatement(); ResultSet rs = stmt.executeQuery(sql); ResultSetMetaData metaData = rs.getMetaData(); int columnCount = metaData.getColumnCount(); Map<String, St...
<COMPILED_SUCCESSFULLY>
Logger logger=LoggerFactory.getLogger(this.getClass());String type;AdapterConfig config;long CNT_PER_TASK=10000L;EtlResult importData( String sql, List<String> params){};boolean executeSqlImport( DataSource ds, String sql, List<Object> values, AdapterConfig.AdapterMapping mapping, AtomicLong impCount, List<Stri...
alibaba_canal
canal/client/src/main/java/com/alibaba/otter/canal/client/impl/SimpleNodeAccessStrategy.java
SimpleNodeAccessStrategy
nextNode
try { return nodes.get(index); } finally { index = (index + 1) % nodes.size(); }
class SimpleNodeAccessStrategy implements CanalNodeAccessStrategy { private List<SocketAddress> nodes = new ArrayList<>(); private int index = 0; public SimpleNodeAccessStrategy(List<? extends SocketAddress> nodes){ if (nodes == null || nodes.size() < 1) { throw new Ill...
159
38
197
if (index >= nodes.size()) { index = 0; } return nodes.get(index++);
<COMPILED_SUCCESSFULLY>
alibaba_canal
canal/client/src/main/java/com/alibaba/otter/canal/client/kafka/protocol/KafkaMessage.java
KafkaMessage
getOffset
return offset;
class KafkaMessage extends Message { private static final long serialVersionUID = -293120358490119447L; /** * Kafka offset */ private long offset; public KafkaMessage(Message message, long offset){ super(message.getId()); BeanUtils.copyProperties(mes...
177
10
187
return offset;
<COMPILED_SUCCESSFULLY>
long serialVersionUID=1234034768477580009L;long id;List<CanalEntry.Entry> entries=newArrayList<>();boolean raw=true;List<ByteString> rawEntries=newArrayList<>();long getId(){};void setId( long id){};List<Entry> getEntries(){};void setEntries( List<CanalEntry.Entry> entries){};void addEntry( CanalEntry.Entry entry){}...
alibaba_canal
canal/dbsync/src/main/java/com/taobao/tddl/dbsync/binlog/event/CreateFileLogEvent.java
CreateFileLogEvent
getBuffer
return blockBuf;
class CreateFileLogEvent extends LoadLogEvent { protected LogBuffer blockBuf; protected int blockLen; protected long fileId; protected boolean initedFromOld; /* CF = "Create File" */ public static final int CF_FILE_ID_OFFSET = 0; public static final ...
615
11
626
return blockBuf;
<COMPILED_SUCCESSFULLY>
String table;String db;String fname;int skipLines;int numFields;String[] fields;String fieldTerm;String lineTerm;String lineStart;String enclosed;String escaped;int optFlags;int emptyFlags;long execTime;int L_THREAD_ID_OFFSET=0;int L_EXEC_TIME_OFFSET=4;int L_SKIP_LINES_OFFSET=8;int L_TBL_LEN_OFFSET=12;int L_DB_LEN_OFFS...
alibaba_canal
canal/dbsync/src/main/java/com/taobao/tddl/dbsync/binlog/event/IncidentLogEvent.java
IncidentLogEvent
getIncident
return incident;
class IncidentLogEvent extends LogEvent { public static final int INCIDENT_NONE = 0; /** There are possibly lost events in the replication stream */ public static final int INCIDENT_LOST_EVENTS = 1; /** Shall be last event of the enumeration */ public static final int INCIDENT_COUN...
413
10
423
return incident;
<COMPILED_SUCCESSFULLY>
int BINLOG_VERSION=4;String SERVER_VERSION="5.0";int EVENT_TYPE_OFFSET=4;int SERVER_ID_OFFSET=5;int EVENT_LEN_OFFSET=9;int LOG_POS_OFFSET=13;int FLAGS_OFFSET=17;int QUERY_HEADER_MINIMAL_LEN=(4+4+1+2);int QUERY_HEADER_LEN=(QUERY_HEADER_MINIMAL_LEN+2);int UNKNOWN_EVENT=0;int START_EVENT_V3=1;int QUERY_EVENT=2;int STOP_EV...
alibaba_canal
canal/dbsync/src/main/java/com/taobao/tddl/dbsync/binlog/event/IntvarLogEvent.java
IntvarLogEvent
getQuery
return "SET INSERT_ID = " + value;
class IntvarLogEvent extends LogEvent { /** * Fixed data part: Empty * <p> * Variable data part: * <ul> * <li>1 byte. A value indicating the variable type: LAST_INSERT_ID_EVENT = * 1 or INSERT_ID_EVENT = 2.</li> * <li>8 bytes. An unsigned integer indicating the value to be used f...
477
16
493
return null;
<COMPILED_SUCCESSFULLY>
int BINLOG_VERSION=4;String SERVER_VERSION="5.0";int EVENT_TYPE_OFFSET=4;int SERVER_ID_OFFSET=5;int EVENT_LEN_OFFSET=9;int LOG_POS_OFFSET=13;int FLAGS_OFFSET=17;int QUERY_HEADER_MINIMAL_LEN=(4+4+1+2);int QUERY_HEADER_LEN=(QUERY_HEADER_MINIMAL_LEN+2);int UNKNOWN_EVENT=0;int START_EVENT_V3=1;int QUERY_EVENT=2;int STOP_EV...
alibaba_canal
canal/dbsync/src/main/java/com/taobao/tddl/dbsync/binlog/event/RowsQueryLogEvent.java
RowsQueryLogEvent
getRowsQuery
return rowsQuery;
class RowsQueryLogEvent extends IgnorableLogEvent { private String rowsQuery; public RowsQueryLogEvent(LogHeader header, LogBuffer buffer, FormatDescriptionLogEvent descriptionEvent){ super(header, buffer, descriptionEvent); final int commonHeaderLen = descriptionEvent.commonHeaderLen; ...
216
9
225
return rowsQuery;
<COMPILED_SUCCESSFULLY>
int BINLOG_VERSION=4;String SERVER_VERSION="5.0";int EVENT_TYPE_OFFSET=4;int SERVER_ID_OFFSET=5;int EVENT_LEN_OFFSET=9;int LOG_POS_OFFSET=13;int FLAGS_OFFSET=17;int QUERY_HEADER_MINIMAL_LEN=(4+4+1+2);int QUERY_HEADER_LEN=(QUERY_HEADER_MINIMAL_LEN+2);int UNKNOWN_EVENT=0;int START_EVENT_V3=1;int QUERY_EVENT=2;int STOP_EV...
alibaba_canal
canal/dbsync/src/test/java/com/taobao/tddl/dbsync/binlog/DirectLogFetcherTest.java
DirectLogFetcherTest
processEvent
int eventType = event.getHeader().getType(); switch (eventType) { case LogEvent.ROTATE_EVENT: binlogFileName = ((RotateLogEvent) event).getFilename(); break; case LogEvent.BINLOG_CHECKPOINT_EVENT: binlogFileName = ((BinlogCheckPoin...
class DirectLogFetcherTest extends BaseLogFetcherTest { @Test public void testSimple() { DirectLogFetcher fecther = new DirectLogFetcher(); try { Class.forName("com.mysql.jdbc.Driver"); Connection connection = DriverManager.getConnection("jdbc:mysql://127.0.0.1:3306", "r...
418
466
884
if (event.getEventType() == LogEvent.ENUM_END_EVENT) { return; } if (event.getEventType() == LogEvent.ENUM_GTID_EVENT) { return; } if (event.getEventType() == LogEvent.ENUM_XID_EVENT) { return; } if (event.getEventType() == Log...
<COMPILED_SUCCESSFULLY>
String binlogFileName="mysql-bin.000001";Charset charset=Charset.forName("utf-8");void parseQueryEvent( QueryLogEvent event){};void parseRowsQueryEvent( RowsQueryLogEvent event) throws Exception {};void parseAnnotateRowsEvent( AnnotateRowsEvent event) throws Exception {};void parseXidEvent( XidLogEvent event) throw...
alibaba_canal
canal/driver/src/main/java/com/alibaba/otter/canal/parse/driver/mysql/packets/client/ClientAuthenticationPacket.java
ClientAuthenticationPacket
toBytes
ByteArrayOutputStream out = new ByteArrayOutputStream(); // 1. write client_flags ByteHelper.writeUnsignedIntLittleEndian(clientCapability, out); // remove // client_interactive // feature // 2. write max_packet_size ByteHelper.writeUnsignedIntLittleEndian(MSC.M...
class ClientAuthenticationPacket extends PacketWithHeaderPacket { private int clientCapability = Capability.CLIENT_LONG_PASSWORD | Capability.CLIENT_LONG_FLAG | Capability.CLIENT_PROTOCOL_41 | Capability.CLIENT_INTERACTIVE | Capability....
831
454
1,285
byte[] data = new byte[1024]; int offset = 0; int len = 0; // version data[offset++] = 0x04; // client flags data[offset++] = (byte) clientCapability; // max packet size data[offset++] = 0x00; data[offset++] = 0x00; data[off...
<COMPILED_SUCCESSFULLY>
HeaderPacket header;void setHeader( HeaderPacket header){};HeaderPacket getHeader(){};String toString(){}
alibaba_canal
canal/driver/src/main/java/com/alibaba/otter/canal/parse/driver/mysql/packets/client/QueryCommandPacket.java
QueryCommandPacket
toBytes
ByteArrayOutputStream out = new ByteArrayOutputStream(); out.write(getCommand()); out.write(getQueryString().getBytes("UTF-8"));// UTF-8 return out.toByteArray();
class QueryCommandPacket extends CommandPacket { private String queryString; public QueryCommandPacket(){ setCommand((byte) 0x03); } public void fromBytes(byte[] data) throws IOException { } public byte[] toBytes() throws IOException {<FILL_FUNCTION_BODY>} public void setQuerySt...
135
66
201
return null;
<COMPILED_SUCCESSFULLY>
byte command;void setCommand( byte command){};byte getCommand(){};String toString(){}
alibaba_canal
canal/driver/src/main/java/com/alibaba/otter/canal/parse/driver/mysql/packets/server/RowDataPacket.java
RowDataPacket
fromBytes
int index = 0; LengthCodedStringReader reader = new LengthCodedStringReader(null, index); do { getColumns().add(reader.readLengthCodedString(data)); } while (reader.getIndex() < data.length);
class RowDataPacket extends PacketWithHeaderPacket { private List<String> columns = new ArrayList<>(); public void fromBytes(byte[] data) throws IOException {<FILL_FUNCTION_BODY>} public byte[] toBytes() throws IOException { return null; } public void setColumns(List<String> columns) { ...
154
68
222
int offset = 0; int length = data.length; int columnCount = data[offset++] & 0xFF; for (int i = 0; i < columnCount; i++) { int lengthOfColumn = data[offset++] & 0xFF; columns.add(new String(data, offset, lengthOfColumn, "UTF-8")); offset += lengthOfCo...
<COMPILED_SUCCESSFULLY>
HeaderPacket header;void setHeader( HeaderPacket header){};HeaderPacket getHeader(){};String toString(){}
alibaba_canal
canal/driver/src/main/java/com/alibaba/otter/canal/parse/driver/mysql/socket/SocketChannelPool.java
SocketChannelPool
chooseSocketChannel
String socketChannel = System.getenv("canal.socketChannel"); if (StringUtils.isEmpty(socketChannel)) { socketChannel = System.getProperty("canal.socketChannel"); } if (StringUtils.isEmpty(socketChannel)) { socketChannel = "bio"; // bio or netty } ...
class SocketChannelPool { public static SocketChannel open(SocketAddress address) throws Exception { String type = chooseSocketChannel(); if ("netty".equalsIgnoreCase(type)) { return NettySocketChannelPool.open(address); } else { return BioSocketChannelPool.open(addr...
109
90
199
return "netty";
<COMPILED_SUCCESSFULLY>
alibaba_canal
canal/driver/src/test/java/com/alibaba/otter/canal/parse/driver/mysql/packets/client/RegisterSlaveCommandPacketTest.java
RegisterSlaveCommandPacketTest
toBytesOutput27
// Arrange final RegisterSlaveCommandPacket objectUnderTest = new RegisterSlaveCommandPacket(); objectUnderTest.serverId = 0L; objectUnderTest.reportPort = 0; objectUnderTest.reportPasswd = "foo"; objectUnderTest.reportHost = "foo"; objectUnderTest.reportUser = ...
class RegisterSlaveCommandPacketTest { @Rule public final ExpectedException thrown = ExpectedException.none(); @SuppressWarnings("deprecation") @Rule public final Timeout globalTimeout = new Timeout(10000); /* testedClasses: RegisterSlaveCommandPacket */ // Test written b...
243
329
572
// Arrange final byte[] expected = new byte[] { (byte) 0, (byte) 0, (byte) 0, (byte) 0, (byte) 0, (byte) 0, (byte) 0, (byte) 0, (byte) 0, (byte) 0, (byte) 0, (byte) 0, (byte) 0, (byte) 0, (byte) 0, (byte) 0, (byte) 0, (byte) 0, (byte) 0, (byte) 0, (byte) 0, (byte) 0, (byte) 0, (byte) 0, (byte) 0, (byt...
<COMPILED_SUCCESSFULLY>
alibaba_canal
canal/example/src/main/java/com/alibaba/otter/canal/example/rocketmq/CanalRocketMQClientFlatMessageExample.java
CanalRocketMQClientFlatMessageExample
process
while (!running) { try { Thread.sleep(1000); } catch (InterruptedException e) { } } while (running) { try { connector.connect(); connector.subscribe(); while (running) { ...
class CanalRocketMQClientFlatMessageExample extends AbstractRocektMQTest { protected final static Logger logger = LoggerFactory .getLogger(CanalRocketMQClientFlatMessageExample.class); private RocketMQCanalConnector connector; private static volatile boolean running = ...
622
261
883
try { connector.start(); } catch (Exception e) { logger.error("## Something goes wrong when starting up the rocketmq consumer:", e); }
<COMPILED_SUCCESSFULLY>
String topic="example";String groupId="group";String nameServers="127.0.0.1:9876";String accessKey="";String secretKey="";boolean enableMessageTrace=false;String accessChannel="local";String namespace="";Logger logger=LoggerFactory.getLogger(AbstractCanalClientTest.class);String SEP=SystemUtils.LINE_SEPARATOR;String DA...
alibaba_canal
canal/instance/spring/src/main/java/com/alibaba/otter/canal/instance/spring/CanalInstanceWithSpring.java
CanalInstanceWithSpring
setEventStore
this.eventStore = eventStore;
class CanalInstanceWithSpring extends AbstractCanalInstance { private static final Logger logger = LoggerFactory.getLogger(CanalInstanceWithSpring.class); public void start() { logger.info("start CannalInstance for {}-{} ", new Object[] { 1, destination }); super.start(); } // =======...
323
13
336
this.eventStore = eventStore;
<COMPILED_SUCCESSFULLY>
Logger logger=LoggerFactory.getLogger(AbstractCanalInstance.class);Long canalId;String destination;CanalEventStore<Event> eventStore;CanalEventParser eventParser;CanalEventSink<List<CanalEntry.Entry>> eventSink;CanalMetaManager metaManager;CanalAlarmHandler alarmHandler;CanalMQConfig mqConfig;boolean subscribeChange( ...
alibaba_canal
canal/parse/src/main/java/com/alibaba/otter/canal/parse/inbound/mysql/ddl/DdlResult.java
DdlResult
setSchemaName
this.schemaName = schemaName;
class DdlResult { private String schemaName; private String tableName; private String oriSchemaName; // rename ddl private String oriTableName; // rename ddl private EventType type; private DdlResult renameTableResult; // rename table /* * RENAME TABLE tbl_name TO n...
854
13
867
this.schemaName = schemaName;
<COMPILED_SUCCESSFULLY>
alibaba_canal
canal/parse/src/main/java/com/alibaba/otter/canal/parse/inbound/mysql/rds/RdsLocalBinlogEventParser.java
RdsLocalBinlogEventParser
onFinish
try { binlogDownloadQueue.downOne(); File needDeleteFile = new File(directory + File.separator + fileName); if (needDeleteFile.exists()) { needDeleteFile.delete(); } // logManager LogPosition logPosition = logPositionManage...
class RdsLocalBinlogEventParser extends LocalBinlogEventParser implements CanalEventParser, LocalBinLogConnection.FileParserListener { private String url; // openapi private String accesskey; // ak private String secretkey; // sk p...
1,254
500
1,754
if (finishListener != null) { finishListener.onFinish(); }
<COMPILED_SUCCESSFULLY>
AuthenticationInfo masterInfo;EntryPosition masterPosition;MysqlConnection metaConnection;TableMetaCache tableMetaCache;String directory;boolean needWait=false;int bufferSize=16*1024;ErosaConnection buildErosaConnection(){};void preDump( ErosaConnection connection){};void afterDump( ErosaConnection connection){};void...
alibaba_canal
canal/parse/src/test/java/com/alibaba/otter/canal/parse/helper/TimeoutChecker.java
TimeoutChecker
touch
this.lastTouch = System.currentTimeMillis();
class TimeoutChecker { /** * */ private long lastTouch; /** * */ private long timeoutMillis; /** * */ private boolean running = true; /** * default 3s */ private static fin...
356
19
375
this.lastTouch = System.currentTimeMillis();
<COMPILED_SUCCESSFULLY>
alibaba_canal
canal/parse/src/test/java/com/alibaba/otter/canal/parse/inbound/mysql/tsdb/MetaSnapshotDAOTest.java
MetaSnapshotDAOTest
testSimple
MetaSnapshotDO metaSnapshotDO = new MetaSnapshotDO(); metaSnapshotDO.setDestination("test"); metaSnapshotDO.setBinlogFile("000001"); metaSnapshotDO.setBinlogOffest(4L); metaSnapshotDO.setBinlogMasterId("1"); metaSnapshotDO.setBinlogTimestamp(System.currentTimeMillis() - ...
class MetaSnapshotDAOTest { @Resource MetaSnapshotDAO metaSnapshotDAO; @Ignore @Test public void testSimple() {<FILL_FUNCTION_BODY>} }
58
210
268
MetaSnapshot metaSnapshot = new MetaSnapshot(); metaSnapshot.setSnapshotId("1"); metaSnapshot.setSnapshotTime(new Date()); metaSnapshot.setSnapshotType("1"); metaSnapshot.setSnapshotData("1"); metaSnapshot.setSnapshotStatus("1"); metaSnapshot.setSnapshotDesc("1")...
<COMPILED_SUCCESSFULLY>
End of preview. Expand in Data Studio

No dataset card yet

Downloads last month
5