repo stringlengths 7 58 | path stringlengths 12 218 | func_name stringlengths 3 140 | original_string stringlengths 73 34.1k | language stringclasses 1
value | code stringlengths 73 34.1k | code_tokens list | docstring stringlengths 3 16k | docstring_tokens list | sha stringlengths 40 40 | url stringlengths 105 339 | partition stringclasses 1
value |
|---|---|---|---|---|---|---|---|---|---|---|---|
apache/reef | lang/java/reef-io/src/main/java/org/apache/reef/io/network/impl/NetworkConnectionServiceMessageCodec.java | NetworkConnectionServiceMessageCodec.decode | @Override
public NetworkConnectionServiceMessage decode(final byte[] data) {
try (final ByteArrayInputStream bais = new ByteArrayInputStream(data)) {
try (final DataInputStream dais = new DataInputStream(bais)) {
final String connFactoryId = dais.readUTF();
final Identifier srcId = factory.g... | java | @Override
public NetworkConnectionServiceMessage decode(final byte[] data) {
try (final ByteArrayInputStream bais = new ByteArrayInputStream(data)) {
try (final DataInputStream dais = new DataInputStream(bais)) {
final String connFactoryId = dais.readUTF();
final Identifier srcId = factory.g... | [
"@",
"Override",
"public",
"NetworkConnectionServiceMessage",
"decode",
"(",
"final",
"byte",
"[",
"]",
"data",
")",
"{",
"try",
"(",
"final",
"ByteArrayInputStream",
"bais",
"=",
"new",
"ByteArrayInputStream",
"(",
"data",
")",
")",
"{",
"try",
"(",
"final",
... | Decodes a network connection service message from bytes.
@param data bytes
@return a message | [
"Decodes",
"a",
"network",
"connection",
"service",
"message",
"from",
"bytes",
"."
] | e2c47121cde21108a602c560cf76565a40d0e916 | https://github.com/apache/reef/blob/e2c47121cde21108a602c560cf76565a40d0e916/lang/java/reef-io/src/main/java/org/apache/reef/io/network/impl/NetworkConnectionServiceMessageCodec.java#L108-L149 | train |
apache/reef | lang/java/reef-experimental/src/main/java/org/apache/reef/experimental/parquet/ParquetReader.java | ParquetReader.createAvroSchema | private Schema createAvroSchema(final Configuration configuration, final MetadataFilter filter) throws IOException {
final ParquetMetadata footer = ParquetFileReader.readFooter(configuration, parquetFilePath, filter);
final AvroSchemaConverter converter = new AvroSchemaConverter();
final MessageType schema ... | java | private Schema createAvroSchema(final Configuration configuration, final MetadataFilter filter) throws IOException {
final ParquetMetadata footer = ParquetFileReader.readFooter(configuration, parquetFilePath, filter);
final AvroSchemaConverter converter = new AvroSchemaConverter();
final MessageType schema ... | [
"private",
"Schema",
"createAvroSchema",
"(",
"final",
"Configuration",
"configuration",
",",
"final",
"MetadataFilter",
"filter",
")",
"throws",
"IOException",
"{",
"final",
"ParquetMetadata",
"footer",
"=",
"ParquetFileReader",
".",
"readFooter",
"(",
"configuration",... | Retrieve avro schema from parquet file.
@param configuration Hadoop configuration.
@param filter Filter for Avro metadata.
@return avro schema from parquet file.
@throws IOException if the Avro schema couldn't be parsed from the parquet file. | [
"Retrieve",
"avro",
"schema",
"from",
"parquet",
"file",
"."
] | e2c47121cde21108a602c560cf76565a40d0e916 | https://github.com/apache/reef/blob/e2c47121cde21108a602c560cf76565a40d0e916/lang/java/reef-experimental/src/main/java/org/apache/reef/experimental/parquet/ParquetReader.java#L95-L100 | train |
apache/reef | lang/java/reef-experimental/src/main/java/org/apache/reef/experimental/parquet/ParquetReader.java | ParquetReader.serializeToDisk | public void serializeToDisk(final File file) throws IOException {
final DatumWriter datumWriter = new GenericDatumWriter<GenericRecord>();
final DataFileWriter fileWriter = new DataFileWriter<GenericRecord>(datumWriter);
final AvroParquetReader<GenericRecord> reader = createAvroReader();
fileWriter.crea... | java | public void serializeToDisk(final File file) throws IOException {
final DatumWriter datumWriter = new GenericDatumWriter<GenericRecord>();
final DataFileWriter fileWriter = new DataFileWriter<GenericRecord>(datumWriter);
final AvroParquetReader<GenericRecord> reader = createAvroReader();
fileWriter.crea... | [
"public",
"void",
"serializeToDisk",
"(",
"final",
"File",
"file",
")",
"throws",
"IOException",
"{",
"final",
"DatumWriter",
"datumWriter",
"=",
"new",
"GenericDatumWriter",
"<",
"GenericRecord",
">",
"(",
")",
";",
"final",
"DataFileWriter",
"fileWriter",
"=",
... | Serialize Avro data to a local file.
@param file Local destination file for serialization.
@throws IOException if the parquet file couldn't be parsed correctly. | [
"Serialize",
"Avro",
"data",
"to",
"a",
"local",
"file",
"."
] | e2c47121cde21108a602c560cf76565a40d0e916 | https://github.com/apache/reef/blob/e2c47121cde21108a602c560cf76565a40d0e916/lang/java/reef-experimental/src/main/java/org/apache/reef/experimental/parquet/ParquetReader.java#L116-L141 | train |
apache/reef | lang/java/reef-experimental/src/main/java/org/apache/reef/experimental/parquet/ParquetReader.java | ParquetReader.serializeToByteBuffer | public ByteBuffer serializeToByteBuffer() throws IOException {
final ByteArrayOutputStream stream = new ByteArrayOutputStream();
final Encoder encoder = EncoderFactory.get().binaryEncoder(stream, null);
final DatumWriter writer = new GenericDatumWriter<GenericRecord>();
writer.setSchema(createAvroSchema... | java | public ByteBuffer serializeToByteBuffer() throws IOException {
final ByteArrayOutputStream stream = new ByteArrayOutputStream();
final Encoder encoder = EncoderFactory.get().binaryEncoder(stream, null);
final DatumWriter writer = new GenericDatumWriter<GenericRecord>();
writer.setSchema(createAvroSchema... | [
"public",
"ByteBuffer",
"serializeToByteBuffer",
"(",
")",
"throws",
"IOException",
"{",
"final",
"ByteArrayOutputStream",
"stream",
"=",
"new",
"ByteArrayOutputStream",
"(",
")",
";",
"final",
"Encoder",
"encoder",
"=",
"EncoderFactory",
".",
"get",
"(",
")",
"."... | Serialize Avro data to a in-memory ByteBuffer.
@return A ByteBuffer that contains avro data.
@throws IOException if the parquet file couldn't be parsed correctly. | [
"Serialize",
"Avro",
"data",
"to",
"a",
"in",
"-",
"memory",
"ByteBuffer",
"."
] | e2c47121cde21108a602c560cf76565a40d0e916 | https://github.com/apache/reef/blob/e2c47121cde21108a602c560cf76565a40d0e916/lang/java/reef-experimental/src/main/java/org/apache/reef/experimental/parquet/ParquetReader.java#L148-L172 | train |
apache/reef | lang/java/reef-common/src/main/java/org/apache/reef/runtime/common/evaluator/task/TaskClientCodeException.java | TaskClientCodeException.getTaskId | public static String getTaskId(final Configuration config) {
try {
return Tang.Factory.getTang().newInjector(config).getNamedInstance(TaskConfigurationOptions.Identifier.class);
} catch (final InjectionException ex) {
throw new RuntimeException("Unable to determine task identifier. Giving up.", ex);... | java | public static String getTaskId(final Configuration config) {
try {
return Tang.Factory.getTang().newInjector(config).getNamedInstance(TaskConfigurationOptions.Identifier.class);
} catch (final InjectionException ex) {
throw new RuntimeException("Unable to determine task identifier. Giving up.", ex);... | [
"public",
"static",
"String",
"getTaskId",
"(",
"final",
"Configuration",
"config",
")",
"{",
"try",
"{",
"return",
"Tang",
".",
"Factory",
".",
"getTang",
"(",
")",
".",
"newInjector",
"(",
"config",
")",
".",
"getNamedInstance",
"(",
"TaskConfigurationOption... | Extracts a task id from the given configuration.
@param config
@return the task id in the given configuration.
@throws RuntimeException if the configuration can't be parsed. | [
"Extracts",
"a",
"task",
"id",
"from",
"the",
"given",
"configuration",
"."
] | e2c47121cde21108a602c560cf76565a40d0e916 | https://github.com/apache/reef/blob/e2c47121cde21108a602c560cf76565a40d0e916/lang/java/reef-common/src/main/java/org/apache/reef/runtime/common/evaluator/task/TaskClientCodeException.java#L56-L62 | train |
apache/reef | lang/java/reef-common/src/main/java/org/apache/reef/client/DriverLauncher.java | DriverLauncher.getLauncher | public static DriverLauncher getLauncher(final Configuration runtimeConfiguration) throws InjectionException {
return Tang.Factory.getTang()
.newInjector(runtimeConfiguration, CLIENT_CONFIG)
.getInstance(DriverLauncher.class);
} | java | public static DriverLauncher getLauncher(final Configuration runtimeConfiguration) throws InjectionException {
return Tang.Factory.getTang()
.newInjector(runtimeConfiguration, CLIENT_CONFIG)
.getInstance(DriverLauncher.class);
} | [
"public",
"static",
"DriverLauncher",
"getLauncher",
"(",
"final",
"Configuration",
"runtimeConfiguration",
")",
"throws",
"InjectionException",
"{",
"return",
"Tang",
".",
"Factory",
".",
"getTang",
"(",
")",
".",
"newInjector",
"(",
"runtimeConfiguration",
",",
"C... | Instantiate a launcher for the given Configuration.
@param runtimeConfiguration the resourcemanager configuration to be used
@return a DriverLauncher based on the given resourcemanager configuration
@throws InjectionException on configuration errors | [
"Instantiate",
"a",
"launcher",
"for",
"the",
"given",
"Configuration",
"."
] | e2c47121cde21108a602c560cf76565a40d0e916 | https://github.com/apache/reef/blob/e2c47121cde21108a602c560cf76565a40d0e916/lang/java/reef-common/src/main/java/org/apache/reef/client/DriverLauncher.java#L87-L91 | train |
apache/reef | lang/java/reef-common/src/main/java/org/apache/reef/client/DriverLauncher.java | DriverLauncher.close | @Override
public void close() {
synchronized (this) {
LOG.log(Level.FINER, "Close launcher: job {0} with status {1}", new Object[] {this.theJob, this.status});
if (this.status.isRunning()) {
this.status = LauncherStatus.FORCE_CLOSED;
}
if (null != this.theJob) {
this.theJob... | java | @Override
public void close() {
synchronized (this) {
LOG.log(Level.FINER, "Close launcher: job {0} with status {1}", new Object[] {this.theJob, this.status});
if (this.status.isRunning()) {
this.status = LauncherStatus.FORCE_CLOSED;
}
if (null != this.theJob) {
this.theJob... | [
"@",
"Override",
"public",
"void",
"close",
"(",
")",
"{",
"synchronized",
"(",
"this",
")",
"{",
"LOG",
".",
"log",
"(",
"Level",
".",
"FINER",
",",
"\"Close launcher: job {0} with status {1}\"",
",",
"new",
"Object",
"[",
"]",
"{",
"this",
".",
"theJob",... | Kills the running job. | [
"Kills",
"the",
"running",
"job",
"."
] | e2c47121cde21108a602c560cf76565a40d0e916 | https://github.com/apache/reef/blob/e2c47121cde21108a602c560cf76565a40d0e916/lang/java/reef-common/src/main/java/org/apache/reef/client/DriverLauncher.java#L96-L111 | train |
apache/reef | lang/java/reef-common/src/main/java/org/apache/reef/client/DriverLauncher.java | DriverLauncher.run | public LauncherStatus run(final Configuration driverConfig) {
this.reef.submit(driverConfig);
synchronized (this) {
while (!this.status.isDone()) {
try {
LOG.log(Level.FINE, "Wait indefinitely");
this.wait();
} catch (final InterruptedException ex) {
LOG.log(L... | java | public LauncherStatus run(final Configuration driverConfig) {
this.reef.submit(driverConfig);
synchronized (this) {
while (!this.status.isDone()) {
try {
LOG.log(Level.FINE, "Wait indefinitely");
this.wait();
} catch (final InterruptedException ex) {
LOG.log(L... | [
"public",
"LauncherStatus",
"run",
"(",
"final",
"Configuration",
"driverConfig",
")",
"{",
"this",
".",
"reef",
".",
"submit",
"(",
"driverConfig",
")",
";",
"synchronized",
"(",
"this",
")",
"{",
"while",
"(",
"!",
"this",
".",
"status",
".",
"isDone",
... | Run a job. Waits indefinitely for the job to complete.
@param driverConfig the configuration for the driver. See DriverConfiguration for details.
@return the state of the job after execution. | [
"Run",
"a",
"job",
".",
"Waits",
"indefinitely",
"for",
"the",
"job",
"to",
"complete",
"."
] | e2c47121cde21108a602c560cf76565a40d0e916 | https://github.com/apache/reef/blob/e2c47121cde21108a602c560cf76565a40d0e916/lang/java/reef-common/src/main/java/org/apache/reef/client/DriverLauncher.java#L119-L133 | train |
apache/reef | lang/java/reef-common/src/main/java/org/apache/reef/client/DriverLauncher.java | DriverLauncher.submit | public String submit(final Configuration driverConfig, final long waitTime) {
this.reef.submit(driverConfig);
this.waitForStatus(waitTime, LauncherStatus.SUBMITTED);
return this.jobId;
} | java | public String submit(final Configuration driverConfig, final long waitTime) {
this.reef.submit(driverConfig);
this.waitForStatus(waitTime, LauncherStatus.SUBMITTED);
return this.jobId;
} | [
"public",
"String",
"submit",
"(",
"final",
"Configuration",
"driverConfig",
",",
"final",
"long",
"waitTime",
")",
"{",
"this",
".",
"reef",
".",
"submit",
"(",
"driverConfig",
")",
";",
"this",
".",
"waitForStatus",
"(",
"waitTime",
",",
"LauncherStatus",
... | Submit REEF job asynchronously and do not wait for its completion.
@param driverConfig configuration of hte driver to submit to the RM.
@return ID of the new application. | [
"Submit",
"REEF",
"job",
"asynchronously",
"and",
"do",
"not",
"wait",
"for",
"its",
"completion",
"."
] | e2c47121cde21108a602c560cf76565a40d0e916 | https://github.com/apache/reef/blob/e2c47121cde21108a602c560cf76565a40d0e916/lang/java/reef-common/src/main/java/org/apache/reef/client/DriverLauncher.java#L141-L145 | train |
apache/reef | lang/java/reef-common/src/main/java/org/apache/reef/client/DriverLauncher.java | DriverLauncher.run | public LauncherStatus run(final Configuration driverConfig, final long timeOut) {
final long startTime = System.currentTimeMillis();
this.reef.submit(driverConfig);
this.waitForStatus(timeOut - System.currentTimeMillis() + startTime, LauncherStatus.COMPLETED);
if (System.currentTimeMillis() - startTi... | java | public LauncherStatus run(final Configuration driverConfig, final long timeOut) {
final long startTime = System.currentTimeMillis();
this.reef.submit(driverConfig);
this.waitForStatus(timeOut - System.currentTimeMillis() + startTime, LauncherStatus.COMPLETED);
if (System.currentTimeMillis() - startTi... | [
"public",
"LauncherStatus",
"run",
"(",
"final",
"Configuration",
"driverConfig",
",",
"final",
"long",
"timeOut",
")",
"{",
"final",
"long",
"startTime",
"=",
"System",
".",
"currentTimeMillis",
"(",
")",
";",
"this",
".",
"reef",
".",
"submit",
"(",
"drive... | Run a job with a waiting timeout after which it will be killed, if it did not complete yet.
@param driverConfig the configuration for the driver. See DriverConfiguration for details.
@param timeOut timeout on the job.
@return the state of the job after execution. | [
"Run",
"a",
"job",
"with",
"a",
"waiting",
"timeout",
"after",
"which",
"it",
"will",
"be",
"killed",
"if",
"it",
"did",
"not",
"complete",
"yet",
"."
] | e2c47121cde21108a602c560cf76565a40d0e916 | https://github.com/apache/reef/blob/e2c47121cde21108a602c560cf76565a40d0e916/lang/java/reef-common/src/main/java/org/apache/reef/client/DriverLauncher.java#L193-L209 | train |
apache/reef | lang/java/reef-common/src/main/java/org/apache/reef/client/DriverLauncher.java | DriverLauncher.setStatusAndNotify | public synchronized void setStatusAndNotify(final LauncherStatus newStatus) {
LOG.log(Level.FINEST, "Set status: {0} -> {1}", new Object[] {this.status, newStatus});
this.status = newStatus;
this.notify();
} | java | public synchronized void setStatusAndNotify(final LauncherStatus newStatus) {
LOG.log(Level.FINEST, "Set status: {0} -> {1}", new Object[] {this.status, newStatus});
this.status = newStatus;
this.notify();
} | [
"public",
"synchronized",
"void",
"setStatusAndNotify",
"(",
"final",
"LauncherStatus",
"newStatus",
")",
"{",
"LOG",
".",
"log",
"(",
"Level",
".",
"FINEST",
",",
"\"Set status: {0} -> {1}\"",
",",
"new",
"Object",
"[",
"]",
"{",
"this",
".",
"status",
",",
... | Update job status and notify the waiting thread. | [
"Update",
"job",
"status",
"and",
"notify",
"the",
"waiting",
"thread",
"."
] | e2c47121cde21108a602c560cf76565a40d0e916 | https://github.com/apache/reef/blob/e2c47121cde21108a602c560cf76565a40d0e916/lang/java/reef-common/src/main/java/org/apache/reef/client/DriverLauncher.java#L219-L223 | train |
apache/reef | lang/java/reef-bridge-java/src/main/java/org/apache/reef/util/logging/CLRBufferedLogHandler.java | CLRBufferedLogHandler.logAll | private void logAll() {
synchronized (this) {
final StringBuilder sb = new StringBuilder();
Level highestLevel = Level.FINEST;
for (final LogRecord record : this.logs) {
sb.append(formatter.format(record));
sb.append("\n");
if (record.getLevel().intValue() > highestLevel.in... | java | private void logAll() {
synchronized (this) {
final StringBuilder sb = new StringBuilder();
Level highestLevel = Level.FINEST;
for (final LogRecord record : this.logs) {
sb.append(formatter.format(record));
sb.append("\n");
if (record.getLevel().intValue() > highestLevel.in... | [
"private",
"void",
"logAll",
"(",
")",
"{",
"synchronized",
"(",
"this",
")",
"{",
"final",
"StringBuilder",
"sb",
"=",
"new",
"StringBuilder",
"(",
")",
";",
"Level",
"highestLevel",
"=",
"Level",
".",
"FINEST",
";",
"for",
"(",
"final",
"LogRecord",
"r... | Flushes the log buffer, logging each buffered log message using
the reef-bridge log function. | [
"Flushes",
"the",
"log",
"buffer",
"logging",
"each",
"buffered",
"log",
"message",
"using",
"the",
"reef",
"-",
"bridge",
"log",
"function",
"."
] | e2c47121cde21108a602c560cf76565a40d0e916 | https://github.com/apache/reef/blob/e2c47121cde21108a602c560cf76565a40d0e916/lang/java/reef-bridge-java/src/main/java/org/apache/reef/util/logging/CLRBufferedLogHandler.java#L131-L151 | train |
apache/reef | lang/java/reef-bridge-java/src/main/java/org/apache/reef/util/logging/CLRBufferedLogHandler.java | CLRBufferedLogHandler.getLevel | private int getLevel(final Level recordLevel) {
if (recordLevel.equals(Level.OFF)) {
return 0;
} else if (recordLevel.equals(Level.SEVERE)) {
return 1;
} else if (recordLevel.equals(Level.WARNING)) {
return 2;
} else if (recordLevel.equals(Level.ALL)) {
return 4;
} else {
... | java | private int getLevel(final Level recordLevel) {
if (recordLevel.equals(Level.OFF)) {
return 0;
} else if (recordLevel.equals(Level.SEVERE)) {
return 1;
} else if (recordLevel.equals(Level.WARNING)) {
return 2;
} else if (recordLevel.equals(Level.ALL)) {
return 4;
} else {
... | [
"private",
"int",
"getLevel",
"(",
"final",
"Level",
"recordLevel",
")",
"{",
"if",
"(",
"recordLevel",
".",
"equals",
"(",
"Level",
".",
"OFF",
")",
")",
"{",
"return",
"0",
";",
"}",
"else",
"if",
"(",
"recordLevel",
".",
"equals",
"(",
"Level",
".... | Returns the integer value of the log record's level to be used
by the CLR Bridge log function. | [
"Returns",
"the",
"integer",
"value",
"of",
"the",
"log",
"record",
"s",
"level",
"to",
"be",
"used",
"by",
"the",
"CLR",
"Bridge",
"log",
"function",
"."
] | e2c47121cde21108a602c560cf76565a40d0e916 | https://github.com/apache/reef/blob/e2c47121cde21108a602c560cf76565a40d0e916/lang/java/reef-bridge-java/src/main/java/org/apache/reef/util/logging/CLRBufferedLogHandler.java#L157-L169 | train |
apache/reef | lang/java/reef-webserver/src/main/java/org/apache/reef/webserver/ParsedHttpRequest.java | ParsedHttpRequest.getHeaderEntryList | public List<HeaderEntry> getHeaderEntryList() {
final List<HeaderEntry> list = new ArrayList<>();
final Iterator it = this.headers.entrySet().iterator();
while (it.hasNext()) {
final Map.Entry pair = (Map.Entry)it.next();
System.out.println(pair.getKey() + " = " + pair.getValue());
final H... | java | public List<HeaderEntry> getHeaderEntryList() {
final List<HeaderEntry> list = new ArrayList<>();
final Iterator it = this.headers.entrySet().iterator();
while (it.hasNext()) {
final Map.Entry pair = (Map.Entry)it.next();
System.out.println(pair.getKey() + " = " + pair.getValue());
final H... | [
"public",
"List",
"<",
"HeaderEntry",
">",
"getHeaderEntryList",
"(",
")",
"{",
"final",
"List",
"<",
"HeaderEntry",
">",
"list",
"=",
"new",
"ArrayList",
"<>",
"(",
")",
";",
"final",
"Iterator",
"it",
"=",
"this",
".",
"headers",
".",
"entrySet",
"(",
... | get http header as a list of HeaderEntry.
@return | [
"get",
"http",
"header",
"as",
"a",
"list",
"of",
"HeaderEntry",
"."
] | e2c47121cde21108a602c560cf76565a40d0e916 | https://github.com/apache/reef/blob/e2c47121cde21108a602c560cf76565a40d0e916/lang/java/reef-webserver/src/main/java/org/apache/reef/webserver/ParsedHttpRequest.java#L98-L112 | train |
apache/reef | lang/java/reef-common/src/main/java/org/apache/reef/runtime/common/evaluator/task/TaskRuntime.java | TaskRuntime.close | public void close(final byte[] message) {
LOG.log(Level.FINEST, "Triggering Task close.");
synchronized (this.heartBeatManager) {
if (this.currentStatus.isNotRunning()) {
LOG.log(Level.WARNING, "Trying to close a task that is in state: {0}. Ignoring.",
this.currentStatus.getState());
... | java | public void close(final byte[] message) {
LOG.log(Level.FINEST, "Triggering Task close.");
synchronized (this.heartBeatManager) {
if (this.currentStatus.isNotRunning()) {
LOG.log(Level.WARNING, "Trying to close a task that is in state: {0}. Ignoring.",
this.currentStatus.getState());
... | [
"public",
"void",
"close",
"(",
"final",
"byte",
"[",
"]",
"message",
")",
"{",
"LOG",
".",
"log",
"(",
"Level",
".",
"FINEST",
",",
"\"Triggering Task close.\"",
")",
";",
"synchronized",
"(",
"this",
".",
"heartBeatManager",
")",
"{",
"if",
"(",
"this"... | Close the Task. This calls the configured close handler.
@param message the optional message for the close handler or null if there none. | [
"Close",
"the",
"Task",
".",
"This",
"calls",
"the",
"configured",
"close",
"handler",
"."
] | e2c47121cde21108a602c560cf76565a40d0e916 | https://github.com/apache/reef/blob/e2c47121cde21108a602c560cf76565a40d0e916/lang/java/reef-common/src/main/java/org/apache/reef/runtime/common/evaluator/task/TaskRuntime.java#L189-L206 | train |
apache/reef | lang/java/reef-common/src/main/java/org/apache/reef/runtime/common/evaluator/task/TaskRuntime.java | TaskRuntime.suspend | public void suspend(final byte[] message) {
synchronized (this.heartBeatManager) {
if (this.currentStatus.isNotRunning()) {
LOG.log(Level.WARNING, "Trying to suspend a task that is in state: {0}. Ignoring.",
this.currentStatus.getState());
} else {
try {
this.suspen... | java | public void suspend(final byte[] message) {
synchronized (this.heartBeatManager) {
if (this.currentStatus.isNotRunning()) {
LOG.log(Level.WARNING, "Trying to suspend a task that is in state: {0}. Ignoring.",
this.currentStatus.getState());
} else {
try {
this.suspen... | [
"public",
"void",
"suspend",
"(",
"final",
"byte",
"[",
"]",
"message",
")",
"{",
"synchronized",
"(",
"this",
".",
"heartBeatManager",
")",
"{",
"if",
"(",
"this",
".",
"currentStatus",
".",
"isNotRunning",
"(",
")",
")",
"{",
"LOG",
".",
"log",
"(",
... | Suspend the Task. This calls the configured suspend handler.
@param message the optional message for the suspend handler or null if there none. | [
"Suspend",
"the",
"Task",
".",
"This",
"calls",
"the",
"configured",
"suspend",
"handler",
"."
] | e2c47121cde21108a602c560cf76565a40d0e916 | https://github.com/apache/reef/blob/e2c47121cde21108a602c560cf76565a40d0e916/lang/java/reef-common/src/main/java/org/apache/reef/runtime/common/evaluator/task/TaskRuntime.java#L213-L229 | train |
apache/reef | lang/java/reef-common/src/main/java/org/apache/reef/runtime/common/evaluator/task/TaskRuntime.java | TaskRuntime.deliver | public void deliver(final byte[] message) {
synchronized (this.heartBeatManager) {
if (this.currentStatus.isNotRunning()) {
LOG.log(Level.WARNING,
"Trying to send a message to a task that is in state: {0}. Ignoring.",
this.currentStatus.getState());
} else {
try {... | java | public void deliver(final byte[] message) {
synchronized (this.heartBeatManager) {
if (this.currentStatus.isNotRunning()) {
LOG.log(Level.WARNING,
"Trying to send a message to a task that is in state: {0}. Ignoring.",
this.currentStatus.getState());
} else {
try {... | [
"public",
"void",
"deliver",
"(",
"final",
"byte",
"[",
"]",
"message",
")",
"{",
"synchronized",
"(",
"this",
".",
"heartBeatManager",
")",
"{",
"if",
"(",
"this",
".",
"currentStatus",
".",
"isNotRunning",
"(",
")",
")",
"{",
"LOG",
".",
"log",
"(",
... | Deliver a message to the Task. This calls into the user supplied message handler.
@param message the message to be delivered. | [
"Deliver",
"a",
"message",
"to",
"the",
"Task",
".",
"This",
"calls",
"into",
"the",
"user",
"supplied",
"message",
"handler",
"."
] | e2c47121cde21108a602c560cf76565a40d0e916 | https://github.com/apache/reef/blob/e2c47121cde21108a602c560cf76565a40d0e916/lang/java/reef-common/src/main/java/org/apache/reef/runtime/common/evaluator/task/TaskRuntime.java#L236-L252 | train |
apache/reef | lang/java/reef-common/src/main/java/org/apache/reef/runtime/common/evaluator/task/TaskRuntime.java | TaskRuntime.closeTask | @SuppressWarnings("checkstyle:illegalcatch")
private void closeTask(final byte[] message) throws TaskCloseHandlerFailure {
LOG.log(Level.FINEST, "Invoking close handler.");
try {
this.fCloseHandler.get().onNext(new CloseEventImpl(message));
} catch (final Throwable throwable) {
throw new TaskC... | java | @SuppressWarnings("checkstyle:illegalcatch")
private void closeTask(final byte[] message) throws TaskCloseHandlerFailure {
LOG.log(Level.FINEST, "Invoking close handler.");
try {
this.fCloseHandler.get().onNext(new CloseEventImpl(message));
} catch (final Throwable throwable) {
throw new TaskC... | [
"@",
"SuppressWarnings",
"(",
"\"checkstyle:illegalcatch\"",
")",
"private",
"void",
"closeTask",
"(",
"final",
"byte",
"[",
"]",
"message",
")",
"throws",
"TaskCloseHandlerFailure",
"{",
"LOG",
".",
"log",
"(",
"Level",
".",
"FINEST",
",",
"\"Invoking close handl... | Calls the configured Task close handler and catches exceptions it may throw. | [
"Calls",
"the",
"configured",
"Task",
"close",
"handler",
"and",
"catches",
"exceptions",
"it",
"may",
"throw",
"."
] | e2c47121cde21108a602c560cf76565a40d0e916 | https://github.com/apache/reef/blob/e2c47121cde21108a602c560cf76565a40d0e916/lang/java/reef-common/src/main/java/org/apache/reef/runtime/common/evaluator/task/TaskRuntime.java#L289-L297 | train |
apache/reef | lang/java/reef-common/src/main/java/org/apache/reef/runtime/common/evaluator/task/TaskRuntime.java | TaskRuntime.deliverMessageToTask | @SuppressWarnings("checkstyle:illegalcatch")
private void deliverMessageToTask(final byte[] message) throws TaskMessageHandlerFailure {
try {
this.fMessageHandler.get().onNext(new DriverMessageImpl(message));
} catch (final Throwable throwable) {
throw new TaskMessageHandlerFailure(throwable);
... | java | @SuppressWarnings("checkstyle:illegalcatch")
private void deliverMessageToTask(final byte[] message) throws TaskMessageHandlerFailure {
try {
this.fMessageHandler.get().onNext(new DriverMessageImpl(message));
} catch (final Throwable throwable) {
throw new TaskMessageHandlerFailure(throwable);
... | [
"@",
"SuppressWarnings",
"(",
"\"checkstyle:illegalcatch\"",
")",
"private",
"void",
"deliverMessageToTask",
"(",
"final",
"byte",
"[",
"]",
"message",
")",
"throws",
"TaskMessageHandlerFailure",
"{",
"try",
"{",
"this",
".",
"fMessageHandler",
".",
"get",
"(",
")... | Calls the configured Task message handler and catches exceptions it may throw. | [
"Calls",
"the",
"configured",
"Task",
"message",
"handler",
"and",
"catches",
"exceptions",
"it",
"may",
"throw",
"."
] | e2c47121cde21108a602c560cf76565a40d0e916 | https://github.com/apache/reef/blob/e2c47121cde21108a602c560cf76565a40d0e916/lang/java/reef-common/src/main/java/org/apache/reef/runtime/common/evaluator/task/TaskRuntime.java#L302-L309 | train |
apache/reef | lang/java/reef-common/src/main/java/org/apache/reef/runtime/common/evaluator/task/TaskRuntime.java | TaskRuntime.suspendTask | @SuppressWarnings("checkstyle:illegalcatch")
private void suspendTask(final byte[] message) throws TaskSuspendHandlerFailure {
try {
this.fSuspendHandler.get().onNext(new SuspendEventImpl(message));
} catch (final Throwable throwable) {
throw new TaskSuspendHandlerFailure(throwable);
}
} | java | @SuppressWarnings("checkstyle:illegalcatch")
private void suspendTask(final byte[] message) throws TaskSuspendHandlerFailure {
try {
this.fSuspendHandler.get().onNext(new SuspendEventImpl(message));
} catch (final Throwable throwable) {
throw new TaskSuspendHandlerFailure(throwable);
}
} | [
"@",
"SuppressWarnings",
"(",
"\"checkstyle:illegalcatch\"",
")",
"private",
"void",
"suspendTask",
"(",
"final",
"byte",
"[",
"]",
"message",
")",
"throws",
"TaskSuspendHandlerFailure",
"{",
"try",
"{",
"this",
".",
"fSuspendHandler",
".",
"get",
"(",
")",
".",... | Calls the configured Task suspend handler and catches exceptions it may throw. | [
"Calls",
"the",
"configured",
"Task",
"suspend",
"handler",
"and",
"catches",
"exceptions",
"it",
"may",
"throw",
"."
] | e2c47121cde21108a602c560cf76565a40d0e916 | https://github.com/apache/reef/blob/e2c47121cde21108a602c560cf76565a40d0e916/lang/java/reef-common/src/main/java/org/apache/reef/runtime/common/evaluator/task/TaskRuntime.java#L314-L321 | train |
apache/reef | lang/java/reef-wake/wake/src/main/java/org/apache/reef/wake/remote/impl/RemoteReceiverEventHandler.java | RemoteReceiverEventHandler.onNext | @Override
public void onNext(final TransportEvent e) {
final RemoteEvent<byte[]> re = codec.decode(e.getData());
re.setLocalAddress(e.getLocalAddress());
re.setRemoteAddress(e.getRemoteAddress());
if (LOG.isLoggable(Level.FINER)) {
LOG.log(Level.FINER, "{0} {1}", new Object[]{e, re});
}
... | java | @Override
public void onNext(final TransportEvent e) {
final RemoteEvent<byte[]> re = codec.decode(e.getData());
re.setLocalAddress(e.getLocalAddress());
re.setRemoteAddress(e.getRemoteAddress());
if (LOG.isLoggable(Level.FINER)) {
LOG.log(Level.FINER, "{0} {1}", new Object[]{e, re});
}
... | [
"@",
"Override",
"public",
"void",
"onNext",
"(",
"final",
"TransportEvent",
"e",
")",
"{",
"final",
"RemoteEvent",
"<",
"byte",
"[",
"]",
">",
"re",
"=",
"codec",
".",
"decode",
"(",
"e",
".",
"getData",
"(",
")",
")",
";",
"re",
".",
"setLocalAddre... | Handles the event received from a remote node.
@param e the event | [
"Handles",
"the",
"event",
"received",
"from",
"a",
"remote",
"node",
"."
] | e2c47121cde21108a602c560cf76565a40d0e916 | https://github.com/apache/reef/blob/e2c47121cde21108a602c560cf76565a40d0e916/lang/java/reef-wake/wake/src/main/java/org/apache/reef/wake/remote/impl/RemoteReceiverEventHandler.java#L51-L61 | train |
apache/reef | lang/java/reef-tang/tang/src/main/java/org/apache/reef/tang/formats/ConfigurationModule.java | ConfigurationModule.setMultiple | public final <T> ConfigurationModule setMultiple(final Param<T> opt, final Iterable<String> values) {
ConfigurationModule c = deepCopy();
for (final String val : values) {
c = c.set(opt, val);
}
return c;
} | java | public final <T> ConfigurationModule setMultiple(final Param<T> opt, final Iterable<String> values) {
ConfigurationModule c = deepCopy();
for (final String val : values) {
c = c.set(opt, val);
}
return c;
} | [
"public",
"final",
"<",
"T",
">",
"ConfigurationModule",
"setMultiple",
"(",
"final",
"Param",
"<",
"T",
">",
"opt",
",",
"final",
"Iterable",
"<",
"String",
">",
"values",
")",
"{",
"ConfigurationModule",
"c",
"=",
"deepCopy",
"(",
")",
";",
"for",
"(",... | Binds a set of values to a Param using ConfigurationModule.
@param opt Target Param
@param values Values to bind to the Param
@param <T> type
@return the Configuration module | [
"Binds",
"a",
"set",
"of",
"values",
"to",
"a",
"Param",
"using",
"ConfigurationModule",
"."
] | e2c47121cde21108a602c560cf76565a40d0e916 | https://github.com/apache/reef/blob/e2c47121cde21108a602c560cf76565a40d0e916/lang/java/reef-tang/tang/src/main/java/org/apache/reef/tang/formats/ConfigurationModule.java#L164-L170 | train |
apache/reef | lang/java/reef-tang/tang/src/main/java/org/apache/reef/tang/formats/ConfigurationModule.java | ConfigurationModule.toConfigurationStringList | private static List<String> toConfigurationStringList(final Configuration c) {
final ConfigurationImpl conf = (ConfigurationImpl) c;
final List<String> l = new ArrayList<>();
for (final ClassNode<?> opt : conf.getBoundImplementations()) {
l.add(opt.getFullName()
+ '='
+ escape(conf... | java | private static List<String> toConfigurationStringList(final Configuration c) {
final ConfigurationImpl conf = (ConfigurationImpl) c;
final List<String> l = new ArrayList<>();
for (final ClassNode<?> opt : conf.getBoundImplementations()) {
l.add(opt.getFullName()
+ '='
+ escape(conf... | [
"private",
"static",
"List",
"<",
"String",
">",
"toConfigurationStringList",
"(",
"final",
"Configuration",
"c",
")",
"{",
"final",
"ConfigurationImpl",
"conf",
"=",
"(",
"ConfigurationImpl",
")",
"c",
";",
"final",
"List",
"<",
"String",
">",
"l",
"=",
"ne... | Convert Configuration to a list of strings formatted as "param=value".
@param c
@return | [
"Convert",
"Configuration",
"to",
"a",
"list",
"of",
"strings",
"formatted",
"as",
"param",
"=",
"value",
"."
] | e2c47121cde21108a602c560cf76565a40d0e916 | https://github.com/apache/reef/blob/e2c47121cde21108a602c560cf76565a40d0e916/lang/java/reef-tang/tang/src/main/java/org/apache/reef/tang/formats/ConfigurationModule.java#L342-L386 | train |
apache/reef | lang/java/reef-wake/wake/src/main/java/org/apache/reef/wake/impl/SyncStage.java | SyncStage.onNext | @Override
@SuppressWarnings("checkstyle:illegalcatch")
public void onNext(final T value) {
beforeOnNext();
try {
handler.onNext(value);
} catch (final Throwable t) {
if (errorHandler != null) {
errorHandler.onNext(t);
} else {
LOG.log(Level.SEVERE, name + " Exception fr... | java | @Override
@SuppressWarnings("checkstyle:illegalcatch")
public void onNext(final T value) {
beforeOnNext();
try {
handler.onNext(value);
} catch (final Throwable t) {
if (errorHandler != null) {
errorHandler.onNext(t);
} else {
LOG.log(Level.SEVERE, name + " Exception fr... | [
"@",
"Override",
"@",
"SuppressWarnings",
"(",
"\"checkstyle:illegalcatch\"",
")",
"public",
"void",
"onNext",
"(",
"final",
"T",
"value",
")",
"{",
"beforeOnNext",
"(",
")",
";",
"try",
"{",
"handler",
".",
"onNext",
"(",
"value",
")",
";",
"}",
"catch",
... | Invokes the handler for the event.
@param value the event | [
"Invokes",
"the",
"handler",
"for",
"the",
"event",
"."
] | e2c47121cde21108a602c560cf76565a40d0e916 | https://github.com/apache/reef/blob/e2c47121cde21108a602c560cf76565a40d0e916/lang/java/reef-wake/wake/src/main/java/org/apache/reef/wake/impl/SyncStage.java#L88-L103 | train |
apache/reef | lang/java/reef-common/src/main/java/org/apache/reef/runtime/common/driver/client/ClientConnection.java | ClientConnection.send | public synchronized void send(final ReefServiceProtos.JobStatusProto status) {
LOG.log(Level.FINEST, "Sending to client: status={0}", status.getState());
this.jobStatusHandler.onNext(status);
} | java | public synchronized void send(final ReefServiceProtos.JobStatusProto status) {
LOG.log(Level.FINEST, "Sending to client: status={0}", status.getState());
this.jobStatusHandler.onNext(status);
} | [
"public",
"synchronized",
"void",
"send",
"(",
"final",
"ReefServiceProtos",
".",
"JobStatusProto",
"status",
")",
"{",
"LOG",
".",
"log",
"(",
"Level",
".",
"FINEST",
",",
"\"Sending to client: status={0}\"",
",",
"status",
".",
"getState",
"(",
")",
")",
";"... | Send the given JobStatus to the client.
@param status | [
"Send",
"the",
"given",
"JobStatus",
"to",
"the",
"client",
"."
] | e2c47121cde21108a602c560cf76565a40d0e916 | https://github.com/apache/reef/blob/e2c47121cde21108a602c560cf76565a40d0e916/lang/java/reef-common/src/main/java/org/apache/reef/runtime/common/driver/client/ClientConnection.java#L56-L59 | train |
apache/reef | lang/java/reef-common/src/main/java/org/apache/reef/runtime/common/REEFEnvironment.java | REEFEnvironment.fromConfiguration | @SuppressWarnings("checkstyle:illegalcatch") // Catch throwable to feed it to error handler
public static REEFEnvironment fromConfiguration(
final UserCredentials hostUser, final Configuration... configurations) throws InjectionException {
final Configuration config = Configurations.merge(configurations);
... | java | @SuppressWarnings("checkstyle:illegalcatch") // Catch throwable to feed it to error handler
public static REEFEnvironment fromConfiguration(
final UserCredentials hostUser, final Configuration... configurations) throws InjectionException {
final Configuration config = Configurations.merge(configurations);
... | [
"@",
"SuppressWarnings",
"(",
"\"checkstyle:illegalcatch\"",
")",
"// Catch throwable to feed it to error handler",
"public",
"static",
"REEFEnvironment",
"fromConfiguration",
"(",
"final",
"UserCredentials",
"hostUser",
",",
"final",
"Configuration",
"...",
"configurations",
"... | Create a new REEF environment.
@param hostUser User credentials to use when registering REEF app with the Resource Manager.
This parameter may be required for Unmanaged AM mode. Can be null.
@param configurations REEF component (Driver or Evaluator) configuration.
If multiple configurations are provided, they will be m... | [
"Create",
"a",
"new",
"REEF",
"environment",
"."
] | e2c47121cde21108a602c560cf76565a40d0e916 | https://github.com/apache/reef/blob/e2c47121cde21108a602c560cf76565a40d0e916/lang/java/reef-common/src/main/java/org/apache/reef/runtime/common/REEFEnvironment.java#L81-L128 | train |
apache/reef | lang/java/reef-io/src/main/java/org/apache/reef/io/network/impl/NSConnection.java | NSConnection.write | @Override
public void write(final T message) {
this.link.write(new NSMessage<T>(this.srcId, this.destId, message));
} | java | @Override
public void write(final T message) {
this.link.write(new NSMessage<T>(this.srcId, this.destId, message));
} | [
"@",
"Override",
"public",
"void",
"write",
"(",
"final",
"T",
"message",
")",
"{",
"this",
".",
"link",
".",
"write",
"(",
"new",
"NSMessage",
"<",
"T",
">",
"(",
"this",
".",
"srcId",
",",
"this",
".",
"destId",
",",
"message",
")",
")",
";",
"... | Writes a message to the connection.
@param message a message of type T
@throws a network exception | [
"Writes",
"a",
"message",
"to",
"the",
"connection",
"."
] | e2c47121cde21108a602c560cf76565a40d0e916 | https://github.com/apache/reef/blob/e2c47121cde21108a602c560cf76565a40d0e916/lang/java/reef-io/src/main/java/org/apache/reef/io/network/impl/NSConnection.java#L103-L106 | train |
apache/reef | lang/java/reef-runtime-multi/src/main/java/org/apache/reef/runtime/multi/client/YarnMultiRuntimeMainConfigurationGeneratorImpl.java | YarnMultiRuntimeMainConfigurationGeneratorImpl.getMainConfiguration | @Override
public Configuration getMainConfiguration() {
return Tang.Factory.getTang().newConfigurationBuilder()
.bindImplementation(RuntimeClasspathProvider.class, YarnClasspathProvider.class)
.bindConstructor(org.apache.hadoop.yarn.conf.YarnConfiguration.class, YarnConfigurationConstruct... | java | @Override
public Configuration getMainConfiguration() {
return Tang.Factory.getTang().newConfigurationBuilder()
.bindImplementation(RuntimeClasspathProvider.class, YarnClasspathProvider.class)
.bindConstructor(org.apache.hadoop.yarn.conf.YarnConfiguration.class, YarnConfigurationConstruct... | [
"@",
"Override",
"public",
"Configuration",
"getMainConfiguration",
"(",
")",
"{",
"return",
"Tang",
".",
"Factory",
".",
"getTang",
"(",
")",
".",
"newConfigurationBuilder",
"(",
")",
".",
"bindImplementation",
"(",
"RuntimeClasspathProvider",
".",
"class",
",",
... | Generates configuration that allows multi runtime to run on Yarn.
MultiRuntimeMainConfigurationGenerator.
@return Instance of <code>Configuration</code> | [
"Generates",
"configuration",
"that",
"allows",
"multi",
"runtime",
"to",
"run",
"on",
"Yarn",
".",
"MultiRuntimeMainConfigurationGenerator",
"."
] | e2c47121cde21108a602c560cf76565a40d0e916 | https://github.com/apache/reef/blob/e2c47121cde21108a602c560cf76565a40d0e916/lang/java/reef-runtime-multi/src/main/java/org/apache/reef/runtime/multi/client/YarnMultiRuntimeMainConfigurationGeneratorImpl.java#L45-L52 | train |
apache/reef | lang/java/reef-utils/src/main/java/org/apache/reef/util/MultiAsyncToSync.java | MultiAsyncToSync.block | public boolean block(final long identifier, final Runnable asyncProcessor)
throws InterruptedException, InvalidIdentifierException {
final ComplexCondition call = allocate();
if (call.isHeldByCurrentThread()) {
throw new RuntimeException("release() must not be called on same thread as block() to ... | java | public boolean block(final long identifier, final Runnable asyncProcessor)
throws InterruptedException, InvalidIdentifierException {
final ComplexCondition call = allocate();
if (call.isHeldByCurrentThread()) {
throw new RuntimeException("release() must not be called on same thread as block() to ... | [
"public",
"boolean",
"block",
"(",
"final",
"long",
"identifier",
",",
"final",
"Runnable",
"asyncProcessor",
")",
"throws",
"InterruptedException",
",",
"InvalidIdentifierException",
"{",
"final",
"ComplexCondition",
"call",
"=",
"allocate",
"(",
")",
";",
"if",
... | Put the caller to sleep on a specific release identifier.
@param identifier The identifier required to awake the caller via the {@code release()} method.
@param asyncProcessor A {@code Runnable} object that initiates the asynchronous
processing associated with the call. This will occur inside the condition lock
to prev... | [
"Put",
"the",
"caller",
"to",
"sleep",
"on",
"a",
"specific",
"release",
"identifier",
"."
] | e2c47121cde21108a602c560cf76565a40d0e916 | https://github.com/apache/reef/blob/e2c47121cde21108a602c560cf76565a40d0e916/lang/java/reef-utils/src/main/java/org/apache/reef/util/MultiAsyncToSync.java#L83-L121 | train |
apache/reef | lang/java/reef-utils/src/main/java/org/apache/reef/util/MultiAsyncToSync.java | MultiAsyncToSync.release | public void release(final long identifier) throws InterruptedException, InvalidIdentifierException {
final ComplexCondition call = getSleeper(identifier);
if (call.isHeldByCurrentThread()) {
throw new RuntimeException("release() must not be called on same thread as block() to prevent deadlock");
}
... | java | public void release(final long identifier) throws InterruptedException, InvalidIdentifierException {
final ComplexCondition call = getSleeper(identifier);
if (call.isHeldByCurrentThread()) {
throw new RuntimeException("release() must not be called on same thread as block() to prevent deadlock");
}
... | [
"public",
"void",
"release",
"(",
"final",
"long",
"identifier",
")",
"throws",
"InterruptedException",
",",
"InvalidIdentifierException",
"{",
"final",
"ComplexCondition",
"call",
"=",
"getSleeper",
"(",
"identifier",
")",
";",
"if",
"(",
"call",
".",
"isHeldByCu... | Wake the caller sleeping on the specific identifier.
@param identifier The message identifier of the caller who should be released. | [
"Wake",
"the",
"caller",
"sleeping",
"on",
"the",
"specific",
"identifier",
"."
] | e2c47121cde21108a602c560cf76565a40d0e916 | https://github.com/apache/reef/blob/e2c47121cde21108a602c560cf76565a40d0e916/lang/java/reef-utils/src/main/java/org/apache/reef/util/MultiAsyncToSync.java#L127-L139 | train |
apache/reef | lang/java/reef-utils/src/main/java/org/apache/reef/util/MultiAsyncToSync.java | MultiAsyncToSync.allocate | private ComplexCondition allocate() {
final ComplexCondition call = freeQueue.poll();
return call != null ? call : new ComplexCondition(timeoutPeriod, timeoutUnits);
} | java | private ComplexCondition allocate() {
final ComplexCondition call = freeQueue.poll();
return call != null ? call : new ComplexCondition(timeoutPeriod, timeoutUnits);
} | [
"private",
"ComplexCondition",
"allocate",
"(",
")",
"{",
"final",
"ComplexCondition",
"call",
"=",
"freeQueue",
".",
"poll",
"(",
")",
";",
"return",
"call",
"!=",
"null",
"?",
"call",
":",
"new",
"ComplexCondition",
"(",
"timeoutPeriod",
",",
"timeoutUnits",... | Allocate a condition variable. May reuse existing ones.
@return A complex condition object. | [
"Allocate",
"a",
"condition",
"variable",
".",
"May",
"reuse",
"existing",
"ones",
"."
] | e2c47121cde21108a602c560cf76565a40d0e916 | https://github.com/apache/reef/blob/e2c47121cde21108a602c560cf76565a40d0e916/lang/java/reef-utils/src/main/java/org/apache/reef/util/MultiAsyncToSync.java#L145-L148 | train |
apache/reef | lang/java/reef-utils/src/main/java/org/apache/reef/util/MultiAsyncToSync.java | MultiAsyncToSync.addSleeper | private void addSleeper(final long identifier, final ComplexCondition call) {
if (sleeperMap.put(identifier, call) != null) {
throw new RuntimeException(String.format("Duplicate identifier [%d] in sleeper map", identifier));
}
} | java | private void addSleeper(final long identifier, final ComplexCondition call) {
if (sleeperMap.put(identifier, call) != null) {
throw new RuntimeException(String.format("Duplicate identifier [%d] in sleeper map", identifier));
}
} | [
"private",
"void",
"addSleeper",
"(",
"final",
"long",
"identifier",
",",
"final",
"ComplexCondition",
"call",
")",
"{",
"if",
"(",
"sleeperMap",
".",
"put",
"(",
"identifier",
",",
"call",
")",
"!=",
"null",
")",
"{",
"throw",
"new",
"RuntimeException",
"... | Atomically add a coll to the sleeper map.
@param identifier The unique call identifier.
@param call The call object to be added to the sleeper map. | [
"Atomically",
"add",
"a",
"coll",
"to",
"the",
"sleeper",
"map",
"."
] | e2c47121cde21108a602c560cf76565a40d0e916 | https://github.com/apache/reef/blob/e2c47121cde21108a602c560cf76565a40d0e916/lang/java/reef-utils/src/main/java/org/apache/reef/util/MultiAsyncToSync.java#L163-L167 | train |
apache/reef | lang/java/reef-utils/src/main/java/org/apache/reef/util/MultiAsyncToSync.java | MultiAsyncToSync.getSleeper | private ComplexCondition getSleeper(final long identifier) throws InvalidIdentifierException {
final ComplexCondition call = sleeperMap.get(identifier);
if (null == call) {
throw new InvalidIdentifierException(identifier);
}
return call;
} | java | private ComplexCondition getSleeper(final long identifier) throws InvalidIdentifierException {
final ComplexCondition call = sleeperMap.get(identifier);
if (null == call) {
throw new InvalidIdentifierException(identifier);
}
return call;
} | [
"private",
"ComplexCondition",
"getSleeper",
"(",
"final",
"long",
"identifier",
")",
"throws",
"InvalidIdentifierException",
"{",
"final",
"ComplexCondition",
"call",
"=",
"sleeperMap",
".",
"get",
"(",
"identifier",
")",
";",
"if",
"(",
"null",
"==",
"call",
"... | Get a reference to a sleeper with a specific identifier without removing
it from the sleeper map.
@param identifier The unique identifier of the sleeper to be retrieved.
@return The complex condition object associated with the input identifier.
@throws InvalidIdentifierException The sleeper map does not contain a call
... | [
"Get",
"a",
"reference",
"to",
"a",
"sleeper",
"with",
"a",
"specific",
"identifier",
"without",
"removing",
"it",
"from",
"the",
"sleeper",
"map",
"."
] | e2c47121cde21108a602c560cf76565a40d0e916 | https://github.com/apache/reef/blob/e2c47121cde21108a602c560cf76565a40d0e916/lang/java/reef-utils/src/main/java/org/apache/reef/util/MultiAsyncToSync.java#L177-L183 | train |
apache/reef | lang/java/reef-utils/src/main/java/org/apache/reef/util/MultiAsyncToSync.java | MultiAsyncToSync.removeSleeper | private void removeSleeper(final long identifier) throws InvalidIdentifierException {
final ComplexCondition call = sleeperMap.remove(identifier);
if (null == call) {
throw new InvalidIdentifierException(identifier);
}
} | java | private void removeSleeper(final long identifier) throws InvalidIdentifierException {
final ComplexCondition call = sleeperMap.remove(identifier);
if (null == call) {
throw new InvalidIdentifierException(identifier);
}
} | [
"private",
"void",
"removeSleeper",
"(",
"final",
"long",
"identifier",
")",
"throws",
"InvalidIdentifierException",
"{",
"final",
"ComplexCondition",
"call",
"=",
"sleeperMap",
".",
"remove",
"(",
"identifier",
")",
";",
"if",
"(",
"null",
"==",
"call",
")",
... | Remove the specified call from the sleeper map.
@param identifier The unique identifier of the call to be removed.
@throws InvalidIdentifierException The sleeper map does not contain a call
with the specified identifier. | [
"Remove",
"the",
"specified",
"call",
"from",
"the",
"sleeper",
"map",
"."
] | e2c47121cde21108a602c560cf76565a40d0e916 | https://github.com/apache/reef/blob/e2c47121cde21108a602c560cf76565a40d0e916/lang/java/reef-utils/src/main/java/org/apache/reef/util/MultiAsyncToSync.java#L191-L196 | train |
apache/reef | lang/java/reef-tang/tang/src/main/java/org/apache/reef/tang/implementation/java/InjectorImpl.java | InjectorImpl.parseBoundNamedParameter | @SuppressWarnings("unchecked")
private <T> T parseBoundNamedParameter(final NamedParameterNode<T> np) {
final T ret;
@SuppressWarnings("rawtypes")
final Set<Object> boundSet = c.getBoundSet((NamedParameterNode) np);
if (!boundSet.isEmpty()) {
final Set<T> ret2 = new MonotonicSet<>();
for ... | java | @SuppressWarnings("unchecked")
private <T> T parseBoundNamedParameter(final NamedParameterNode<T> np) {
final T ret;
@SuppressWarnings("rawtypes")
final Set<Object> boundSet = c.getBoundSet((NamedParameterNode) np);
if (!boundSet.isEmpty()) {
final Set<T> ret2 = new MonotonicSet<>();
for ... | [
"@",
"SuppressWarnings",
"(",
"\"unchecked\"",
")",
"private",
"<",
"T",
">",
"T",
"parseBoundNamedParameter",
"(",
"final",
"NamedParameterNode",
"<",
"T",
">",
"np",
")",
"{",
"final",
"T",
"ret",
";",
"@",
"SuppressWarnings",
"(",
"\"rawtypes\"",
")",
"fi... | Parse the bound value of np. When possible, this returns a cached instance.
@return null if np has not been bound.
@throws ParseException | [
"Parse",
"the",
"bound",
"value",
"of",
"np",
".",
"When",
"possible",
"this",
"returns",
"a",
"cached",
"instance",
"."
] | e2c47121cde21108a602c560cf76565a40d0e916 | https://github.com/apache/reef/blob/e2c47121cde21108a602c560cf76565a40d0e916/lang/java/reef-tang/tang/src/main/java/org/apache/reef/tang/implementation/java/InjectorImpl.java#L306-L369 | train |
apache/reef | lang/java/reef-wake/wake/src/main/java/org/apache/reef/wake/impl/PubSubEventHandler.java | PubSubEventHandler.subscribe | public void subscribe(final Class<? extends T> clazz, final EventHandler<? extends T> handler) {
lock.writeLock().lock();
try {
List<EventHandler<? extends T>> list = clazzToListOfHandlersMap.get(clazz);
if (list == null) {
list = new LinkedList<EventHandler<? extends T>>();
clazzToL... | java | public void subscribe(final Class<? extends T> clazz, final EventHandler<? extends T> handler) {
lock.writeLock().lock();
try {
List<EventHandler<? extends T>> list = clazzToListOfHandlersMap.get(clazz);
if (list == null) {
list = new LinkedList<EventHandler<? extends T>>();
clazzToL... | [
"public",
"void",
"subscribe",
"(",
"final",
"Class",
"<",
"?",
"extends",
"T",
">",
"clazz",
",",
"final",
"EventHandler",
"<",
"?",
"extends",
"T",
">",
"handler",
")",
"{",
"lock",
".",
"writeLock",
"(",
")",
".",
"lock",
"(",
")",
";",
"try",
"... | Subscribes an event handler for an event class type.
@param clazz an event class
@param handler an event handler | [
"Subscribes",
"an",
"event",
"handler",
"for",
"an",
"event",
"class",
"type",
"."
] | e2c47121cde21108a602c560cf76565a40d0e916 | https://github.com/apache/reef/blob/e2c47121cde21108a602c560cf76565a40d0e916/lang/java/reef-wake/wake/src/main/java/org/apache/reef/wake/impl/PubSubEventHandler.java#L66-L78 | train |
apache/reef | lang/java/reef-wake/wake/src/main/java/org/apache/reef/wake/impl/PubSubEventHandler.java | PubSubEventHandler.onNext | @Override
public void onNext(final T event) {
LOG.log(Level.FINEST, "Invoked for event: {0}", event);
lock.readLock().lock();
final List<EventHandler<? extends T>> list;
try {
list = clazzToListOfHandlersMap.get(event.getClass());
if (list == null) {
throw new WakeRuntimeException(... | java | @Override
public void onNext(final T event) {
LOG.log(Level.FINEST, "Invoked for event: {0}", event);
lock.readLock().lock();
final List<EventHandler<? extends T>> list;
try {
list = clazzToListOfHandlersMap.get(event.getClass());
if (list == null) {
throw new WakeRuntimeException(... | [
"@",
"Override",
"public",
"void",
"onNext",
"(",
"final",
"T",
"event",
")",
"{",
"LOG",
".",
"log",
"(",
"Level",
".",
"FINEST",
",",
"\"Invoked for event: {0}\"",
",",
"event",
")",
";",
"lock",
".",
"readLock",
"(",
")",
".",
"lock",
"(",
")",
";... | Invokes subscribed handlers for the event class type.
@param event an event
@throws WakeRuntimeException | [
"Invokes",
"subscribed",
"handlers",
"for",
"the",
"event",
"class",
"type",
"."
] | e2c47121cde21108a602c560cf76565a40d0e916 | https://github.com/apache/reef/blob/e2c47121cde21108a602c560cf76565a40d0e916/lang/java/reef-wake/wake/src/main/java/org/apache/reef/wake/impl/PubSubEventHandler.java#L86-L103 | train |
apache/reef | lang/java/reef-io/src/main/java/org/apache/reef/io/network/group/impl/utils/Utils.java | Utils.getGCM | public static GroupCommunicationMessage getGCM(final Message<GroupCommunicationMessage> msg) {
final Iterator<GroupCommunicationMessage> gcmIterator = msg.getData().iterator();
if (gcmIterator.hasNext()) {
final GroupCommunicationMessage gcm = gcmIterator.next();
if (gcmIterator.hasNext()) {
... | java | public static GroupCommunicationMessage getGCM(final Message<GroupCommunicationMessage> msg) {
final Iterator<GroupCommunicationMessage> gcmIterator = msg.getData().iterator();
if (gcmIterator.hasNext()) {
final GroupCommunicationMessage gcm = gcmIterator.next();
if (gcmIterator.hasNext()) {
... | [
"public",
"static",
"GroupCommunicationMessage",
"getGCM",
"(",
"final",
"Message",
"<",
"GroupCommunicationMessage",
">",
"msg",
")",
"{",
"final",
"Iterator",
"<",
"GroupCommunicationMessage",
">",
"gcmIterator",
"=",
"msg",
".",
"getData",
"(",
")",
".",
"itera... | Extract a group communication message object from a message.
@param msg
@return | [
"Extract",
"a",
"group",
"communication",
"message",
"object",
"from",
"a",
"message",
"."
] | e2c47121cde21108a602c560cf76565a40d0e916 | https://github.com/apache/reef/blob/e2c47121cde21108a602c560cf76565a40d0e916/lang/java/reef-io/src/main/java/org/apache/reef/io/network/group/impl/utils/Utils.java#L71-L82 | train |
apache/reef | lang/java/reef-examples/src/main/java/org/apache/reef/examples/hello/HelloREEFYarnUnmanagedAM.java | HelloREEFYarnUnmanagedAM.main | public static void main(final String[] args) throws InjectionException {
LOG.log(Level.FINE, "Launching Unmanaged AM: {0}", JAR_PATH);
try (final DriverLauncher client = DriverLauncher.getLauncher(RUNTIME_CONFIG)) {
final String appId = client.submit(DRIVER_CONFIG, 10000);
LOG.log(Level.INFO, "Jo... | java | public static void main(final String[] args) throws InjectionException {
LOG.log(Level.FINE, "Launching Unmanaged AM: {0}", JAR_PATH);
try (final DriverLauncher client = DriverLauncher.getLauncher(RUNTIME_CONFIG)) {
final String appId = client.submit(DRIVER_CONFIG, 10000);
LOG.log(Level.INFO, "Jo... | [
"public",
"static",
"void",
"main",
"(",
"final",
"String",
"[",
"]",
"args",
")",
"throws",
"InjectionException",
"{",
"LOG",
".",
"log",
"(",
"Level",
".",
"FINE",
",",
"\"Launching Unmanaged AM: {0}\"",
",",
"JAR_PATH",
")",
";",
"try",
"(",
"final",
"D... | Start Hello REEF job with Unmanaged Driver running locally in the same process.
@param args command line parameters. Not used.
@throws InjectionException configuration error. | [
"Start",
"Hello",
"REEF",
"job",
"with",
"Unmanaged",
"Driver",
"running",
"locally",
"in",
"the",
"same",
"process",
"."
] | e2c47121cde21108a602c560cf76565a40d0e916 | https://github.com/apache/reef/blob/e2c47121cde21108a602c560cf76565a40d0e916/lang/java/reef-examples/src/main/java/org/apache/reef/examples/hello/HelloREEFYarnUnmanagedAM.java#L61-L84 | train |
apache/reef | lang/java/reef-wake/wake/src/main/java/org/apache/reef/wake/rx/impl/RxThreadPoolStage.java | RxThreadPoolStage.onNext | @Override
public void onNext(final T value) {
beforeOnNext();
executor.submit(new Runnable() {
@Override
public void run() {
observer.onNext(value);
afterOnNext();
}
});
} | java | @Override
public void onNext(final T value) {
beforeOnNext();
executor.submit(new Runnable() {
@Override
public void run() {
observer.onNext(value);
afterOnNext();
}
});
} | [
"@",
"Override",
"public",
"void",
"onNext",
"(",
"final",
"T",
"value",
")",
"{",
"beforeOnNext",
"(",
")",
";",
"executor",
".",
"submit",
"(",
"new",
"Runnable",
"(",
")",
"{",
"@",
"Override",
"public",
"void",
"run",
"(",
")",
"{",
"observer",
"... | Provides the observer with the new value.
@param value the new value | [
"Provides",
"the",
"observer",
"with",
"the",
"new",
"value",
"."
] | e2c47121cde21108a602c560cf76565a40d0e916 | https://github.com/apache/reef/blob/e2c47121cde21108a602c560cf76565a40d0e916/lang/java/reef-wake/wake/src/main/java/org/apache/reef/wake/rx/impl/RxThreadPoolStage.java#L100-L111 | train |
apache/reef | lang/java/reef-wake/wake/src/main/java/org/apache/reef/wake/rx/impl/RxThreadPoolStage.java | RxThreadPoolStage.onError | @Override
public void onError(final Exception error) {
submitCompletion(new Runnable() {
@Override
public void run() {
observer.onError(error);
}
});
} | java | @Override
public void onError(final Exception error) {
submitCompletion(new Runnable() {
@Override
public void run() {
observer.onError(error);
}
});
} | [
"@",
"Override",
"public",
"void",
"onError",
"(",
"final",
"Exception",
"error",
")",
"{",
"submitCompletion",
"(",
"new",
"Runnable",
"(",
")",
"{",
"@",
"Override",
"public",
"void",
"run",
"(",
")",
"{",
"observer",
".",
"onError",
"(",
"error",
")",... | Notifies the observer that the provider has experienced an error
condition.
@param error the error | [
"Notifies",
"the",
"observer",
"that",
"the",
"provider",
"has",
"experienced",
"an",
"error",
"condition",
"."
] | e2c47121cde21108a602c560cf76565a40d0e916 | https://github.com/apache/reef/blob/e2c47121cde21108a602c560cf76565a40d0e916/lang/java/reef-wake/wake/src/main/java/org/apache/reef/wake/rx/impl/RxThreadPoolStage.java#L119-L129 | train |
apache/reef | lang/java/reef-wake/wake/src/main/java/org/apache/reef/wake/impl/ThreadPoolStage.java | ThreadPoolStage.onNext | @Override
@SuppressWarnings("checkstyle:illegalcatch")
public void onNext(final T value) {
beforeOnNext();
try {
executor.submit(new Runnable() {
@Override
public void run() {
try {
handler.onNext(value);
} catch (final Throwable t) {
if (er... | java | @Override
@SuppressWarnings("checkstyle:illegalcatch")
public void onNext(final T value) {
beforeOnNext();
try {
executor.submit(new Runnable() {
@Override
public void run() {
try {
handler.onNext(value);
} catch (final Throwable t) {
if (er... | [
"@",
"Override",
"@",
"SuppressWarnings",
"(",
"\"checkstyle:illegalcatch\"",
")",
"public",
"void",
"onNext",
"(",
"final",
"T",
"value",
")",
"{",
"beforeOnNext",
"(",
")",
";",
"try",
"{",
"executor",
".",
"submit",
"(",
"new",
"Runnable",
"(",
")",
"{"... | Handles the event using a thread in the thread pool.
@param value the event | [
"Handles",
"the",
"event",
"using",
"a",
"thread",
"in",
"the",
"thread",
"pool",
"."
] | e2c47121cde21108a602c560cf76565a40d0e916 | https://github.com/apache/reef/blob/e2c47121cde21108a602c560cf76565a40d0e916/lang/java/reef-wake/wake/src/main/java/org/apache/reef/wake/impl/ThreadPoolStage.java#L172-L202 | train |
apache/reef | lang/java/reef-runtime-local/src/main/java/org/apache/reef/runtime/local/client/DriverFiles.java | DriverFiles.fromJobSubmission | public static DriverFiles fromJobSubmission(
final JobSubmissionEvent jobSubmissionEvent,
final REEFFileNames fileNames) throws IOException {
final DriverFiles driverFiles = new DriverFiles(fileNames);
for (final FileResource frp : jobSubmissionEvent.getGlobalFileSet()) {
final File f = new ... | java | public static DriverFiles fromJobSubmission(
final JobSubmissionEvent jobSubmissionEvent,
final REEFFileNames fileNames) throws IOException {
final DriverFiles driverFiles = new DriverFiles(fileNames);
for (final FileResource frp : jobSubmissionEvent.getGlobalFileSet()) {
final File f = new ... | [
"public",
"static",
"DriverFiles",
"fromJobSubmission",
"(",
"final",
"JobSubmissionEvent",
"jobSubmissionEvent",
",",
"final",
"REEFFileNames",
"fileNames",
")",
"throws",
"IOException",
"{",
"final",
"DriverFiles",
"driverFiles",
"=",
"new",
"DriverFiles",
"(",
"fileN... | Instantiates an instance based on the given JobSubmissionProto.
@param jobSubmissionEvent the JobSubmissionProto to parse.
@return a DriverFiles instance pre-populated with the information from the given JobSubmissionProto.
@throws IOException | [
"Instantiates",
"an",
"instance",
"based",
"on",
"the",
"given",
"JobSubmissionProto",
"."
] | e2c47121cde21108a602c560cf76565a40d0e916 | https://github.com/apache/reef/blob/e2c47121cde21108a602c560cf76565a40d0e916/lang/java/reef-runtime-local/src/main/java/org/apache/reef/runtime/local/client/DriverFiles.java#L59-L84 | train |
apache/reef | lang/java/reef-runtime-local/src/main/java/org/apache/reef/runtime/local/client/DriverFiles.java | DriverFiles.addNamesTo | public ConfigurationModule addNamesTo(final ConfigurationModule input,
final OptionalParameter<String> globalFileField,
final OptionalParameter<String> globalLibField,
final OptionalParameter<String> ... | java | public ConfigurationModule addNamesTo(final ConfigurationModule input,
final OptionalParameter<String> globalFileField,
final OptionalParameter<String> globalLibField,
final OptionalParameter<String> ... | [
"public",
"ConfigurationModule",
"addNamesTo",
"(",
"final",
"ConfigurationModule",
"input",
",",
"final",
"OptionalParameter",
"<",
"String",
">",
"globalFileField",
",",
"final",
"OptionalParameter",
"<",
"String",
">",
"globalLibField",
",",
"final",
"OptionalParamet... | Fills out a ConfigurationModule.
@param input The ConfigurationModule to start with.
@param globalFileField the field on which to set() the global files.
@param globalLibField the field on which to set() the global libraries.
@param localFileField the field on which to set() the local files.
@param localLi... | [
"Fills",
"out",
"a",
"ConfigurationModule",
"."
] | e2c47121cde21108a602c560cf76565a40d0e916 | https://github.com/apache/reef/blob/e2c47121cde21108a602c560cf76565a40d0e916/lang/java/reef-runtime-local/src/main/java/org/apache/reef/runtime/local/client/DriverFiles.java#L170-L181 | train |
apache/reef | lang/java/reef-runtime-hdinsight/src/main/java/org/apache/reef/runtime/hdinsight/cli/LogFetcher.java | LogFetcher.downloadToTempFolder | private File downloadToTempFolder(final String applicationId)
throws URISyntaxException, StorageException, IOException {
final File outputFolder = Files.createTempDirectory("reeflogs-" + applicationId).toFile();
if (!outputFolder.exists() && !outputFolder.mkdirs()) {
LOG.log(Level.WARNING, "Failed t... | java | private File downloadToTempFolder(final String applicationId)
throws URISyntaxException, StorageException, IOException {
final File outputFolder = Files.createTempDirectory("reeflogs-" + applicationId).toFile();
if (!outputFolder.exists() && !outputFolder.mkdirs()) {
LOG.log(Level.WARNING, "Failed t... | [
"private",
"File",
"downloadToTempFolder",
"(",
"final",
"String",
"applicationId",
")",
"throws",
"URISyntaxException",
",",
"StorageException",
",",
"IOException",
"{",
"final",
"File",
"outputFolder",
"=",
"Files",
".",
"createTempDirectory",
"(",
"\"reeflogs-\"",
... | Downloads the logs to a local temp folder.
@param applicationId
@return
@throws URISyntaxException
@throws StorageException
@throws IOException | [
"Downloads",
"the",
"logs",
"to",
"a",
"local",
"temp",
"folder",
"."
] | e2c47121cde21108a602c560cf76565a40d0e916 | https://github.com/apache/reef/blob/e2c47121cde21108a602c560cf76565a40d0e916/lang/java/reef-runtime-hdinsight/src/main/java/org/apache/reef/runtime/hdinsight/cli/LogFetcher.java#L118-L136 | train |
apache/reef | lang/java/reef-io/src/main/java/org/apache/reef/io/network/naming/NameServerImpl.java | NameServerImpl.unregister | @Override
public void unregister(final Identifier id) {
LOG.log(Level.FINE, "id: " + id);
idToAddrMap.remove(id);
} | java | @Override
public void unregister(final Identifier id) {
LOG.log(Level.FINE, "id: " + id);
idToAddrMap.remove(id);
} | [
"@",
"Override",
"public",
"void",
"unregister",
"(",
"final",
"Identifier",
"id",
")",
"{",
"LOG",
".",
"log",
"(",
"Level",
".",
"FINE",
",",
"\"id: \"",
"+",
"id",
")",
";",
"idToAddrMap",
".",
"remove",
"(",
"id",
")",
";",
"}"
] | Unregisters an identifier locally.
@param id an identifier | [
"Unregisters",
"an",
"identifier",
"locally",
"."
] | e2c47121cde21108a602c560cf76565a40d0e916 | https://github.com/apache/reef/blob/e2c47121cde21108a602c560cf76565a40d0e916/lang/java/reef-io/src/main/java/org/apache/reef/io/network/naming/NameServerImpl.java#L146-L150 | train |
apache/reef | lang/java/reef-io/src/main/java/org/apache/reef/io/network/naming/NameServerImpl.java | NameServerImpl.lookup | @Override
public InetSocketAddress lookup(final Identifier id) {
LOG.log(Level.FINE, "id: {0}", id);
return idToAddrMap.get(id);
} | java | @Override
public InetSocketAddress lookup(final Identifier id) {
LOG.log(Level.FINE, "id: {0}", id);
return idToAddrMap.get(id);
} | [
"@",
"Override",
"public",
"InetSocketAddress",
"lookup",
"(",
"final",
"Identifier",
"id",
")",
"{",
"LOG",
".",
"log",
"(",
"Level",
".",
"FINE",
",",
"\"id: {0}\"",
",",
"id",
")",
";",
"return",
"idToAddrMap",
".",
"get",
"(",
"id",
")",
";",
"}"
] | Finds an address for an identifier locally.
@param id an identifier
@return an Internet socket address | [
"Finds",
"an",
"address",
"for",
"an",
"identifier",
"locally",
"."
] | e2c47121cde21108a602c560cf76565a40d0e916 | https://github.com/apache/reef/blob/e2c47121cde21108a602c560cf76565a40d0e916/lang/java/reef-io/src/main/java/org/apache/reef/io/network/naming/NameServerImpl.java#L158-L162 | train |
apache/reef | lang/java/reef-io/src/main/java/org/apache/reef/io/network/naming/NameServerImpl.java | NameServerImpl.lookup | @Override
public List<NameAssignment> lookup(final Iterable<Identifier> identifiers) {
LOG.log(Level.FINE, "identifiers");
final List<NameAssignment> nas = new ArrayList<>();
for (final Identifier id : identifiers) {
final InetSocketAddress addr = idToAddrMap.get(id);
LOG.log(Level.FINEST, "id... | java | @Override
public List<NameAssignment> lookup(final Iterable<Identifier> identifiers) {
LOG.log(Level.FINE, "identifiers");
final List<NameAssignment> nas = new ArrayList<>();
for (final Identifier id : identifiers) {
final InetSocketAddress addr = idToAddrMap.get(id);
LOG.log(Level.FINEST, "id... | [
"@",
"Override",
"public",
"List",
"<",
"NameAssignment",
">",
"lookup",
"(",
"final",
"Iterable",
"<",
"Identifier",
">",
"identifiers",
")",
"{",
"LOG",
".",
"log",
"(",
"Level",
".",
"FINE",
",",
"\"identifiers\"",
")",
";",
"final",
"List",
"<",
"Nam... | Finds addresses for identifiers locally.
@param identifiers an iterable of identifiers
@return a list of name assignments | [
"Finds",
"addresses",
"for",
"identifiers",
"locally",
"."
] | e2c47121cde21108a602c560cf76565a40d0e916 | https://github.com/apache/reef/blob/e2c47121cde21108a602c560cf76565a40d0e916/lang/java/reef-io/src/main/java/org/apache/reef/io/network/naming/NameServerImpl.java#L170-L182 | train |
apache/reef | lang/java/reef-runtime-yarn/src/main/java/org/apache/reef/runtime/yarn/client/YarnJobSubmissionHandler.java | YarnJobSubmissionHandler.getQueue | private String getQueue(final Configuration driverConfiguration) {
try {
return Tang.Factory.getTang().newInjector(driverConfiguration).getNamedInstance(JobQueue.class);
} catch (final InjectionException e) {
return this.defaultQueueName;
}
} | java | private String getQueue(final Configuration driverConfiguration) {
try {
return Tang.Factory.getTang().newInjector(driverConfiguration).getNamedInstance(JobQueue.class);
} catch (final InjectionException e) {
return this.defaultQueueName;
}
} | [
"private",
"String",
"getQueue",
"(",
"final",
"Configuration",
"driverConfiguration",
")",
"{",
"try",
"{",
"return",
"Tang",
".",
"Factory",
".",
"getTang",
"(",
")",
".",
"newInjector",
"(",
"driverConfiguration",
")",
".",
"getNamedInstance",
"(",
"JobQueue"... | Extracts the queue name from the driverConfiguration or return default if none is set.
@param driverConfiguration The drievr configuration
@return the queue name from the driverConfiguration or return default if none is set. | [
"Extracts",
"the",
"queue",
"name",
"from",
"the",
"driverConfiguration",
"or",
"return",
"default",
"if",
"none",
"is",
"set",
"."
] | e2c47121cde21108a602c560cf76565a40d0e916 | https://github.com/apache/reef/blob/e2c47121cde21108a602c560cf76565a40d0e916/lang/java/reef-runtime-yarn/src/main/java/org/apache/reef/runtime/yarn/client/YarnJobSubmissionHandler.java#L195-L201 | train |
apache/reef | lang/java/reef-common/src/main/java/org/apache/reef/runtime/common/evaluator/context/ContextRuntime.java | ContextRuntime.startTask | @SuppressWarnings("checkstyle:illegalcatch")
void startTask(final Configuration taskConfig) throws TaskClientCodeException {
synchronized (this.contextLifeCycle) {
if (this.task.isPresent() && this.task.get().hasEnded()) {
// clean up state
this.task = Optional.empty();
}
if (... | java | @SuppressWarnings("checkstyle:illegalcatch")
void startTask(final Configuration taskConfig) throws TaskClientCodeException {
synchronized (this.contextLifeCycle) {
if (this.task.isPresent() && this.task.get().hasEnded()) {
// clean up state
this.task = Optional.empty();
}
if (... | [
"@",
"SuppressWarnings",
"(",
"\"checkstyle:illegalcatch\"",
")",
"void",
"startTask",
"(",
"final",
"Configuration",
"taskConfig",
")",
"throws",
"TaskClientCodeException",
"{",
"synchronized",
"(",
"this",
".",
"contextLifeCycle",
")",
"{",
"if",
"(",
"this",
".",... | Launches a Task on this context.
@param taskConfig the configuration to be used for the task.
@throws org.apache.reef.runtime.common.evaluator.task.TaskClientCodeException If the Task cannot be instantiated
due to user code / configuration issues.
@throws IllegalStateException ... | [
"Launches",
"a",
"Task",
"on",
"this",
"context",
"."
] | e2c47121cde21108a602c560cf76565a40d0e916 | https://github.com/apache/reef/blob/e2c47121cde21108a602c560cf76565a40d0e916/lang/java/reef-common/src/main/java/org/apache/reef/runtime/common/evaluator/context/ContextRuntime.java#L234-L272 | train |
apache/reef | lang/java/reef-common/src/main/java/org/apache/reef/runtime/common/evaluator/context/ContextRuntime.java | ContextRuntime.close | void close() {
synchronized (this.contextLifeCycle) {
this.contextState = ReefServiceProtos.ContextStatusProto.State.DONE;
if (this.task.isPresent()) {
LOG.log(Level.WARNING, "Shutting down a task because the underlying context is being closed.");
this.task.get().close(null);
}
... | java | void close() {
synchronized (this.contextLifeCycle) {
this.contextState = ReefServiceProtos.ContextStatusProto.State.DONE;
if (this.task.isPresent()) {
LOG.log(Level.WARNING, "Shutting down a task because the underlying context is being closed.");
this.task.get().close(null);
}
... | [
"void",
"close",
"(",
")",
"{",
"synchronized",
"(",
"this",
".",
"contextLifeCycle",
")",
"{",
"this",
".",
"contextState",
"=",
"ReefServiceProtos",
".",
"ContextStatusProto",
".",
"State",
".",
"DONE",
";",
"if",
"(",
"this",
".",
"task",
".",
"isPresen... | Close this context. If there is a child context, this recursively closes it before closing this context. If
there is a Task currently running, that will be closed. | [
"Close",
"this",
"context",
".",
"If",
"there",
"is",
"a",
"child",
"context",
"this",
"recursively",
"closes",
"it",
"before",
"closing",
"this",
"context",
".",
"If",
"there",
"is",
"a",
"Task",
"currently",
"running",
"that",
"will",
"be",
"closed",
"."... | e2c47121cde21108a602c560cf76565a40d0e916 | https://github.com/apache/reef/blob/e2c47121cde21108a602c560cf76565a40d0e916/lang/java/reef-common/src/main/java/org/apache/reef/runtime/common/evaluator/context/ContextRuntime.java#L278-L300 | train |
apache/reef | lang/java/reef-examples/src/main/java/org/apache/reef/examples/hellohttp/HelloREEFHttp.java | HelloREEFHttp.runHelloReef | public static LauncherStatus runHelloReef(final Configuration runtimeConf, final int timeOut)
throws BindException, InjectionException {
final Configuration driverConf =
Configurations.merge(HelloREEFHttp.getDriverConfiguration(), getHTTPConfiguration());
return DriverLauncher.getLauncher(runtimeC... | java | public static LauncherStatus runHelloReef(final Configuration runtimeConf, final int timeOut)
throws BindException, InjectionException {
final Configuration driverConf =
Configurations.merge(HelloREEFHttp.getDriverConfiguration(), getHTTPConfiguration());
return DriverLauncher.getLauncher(runtimeC... | [
"public",
"static",
"LauncherStatus",
"runHelloReef",
"(",
"final",
"Configuration",
"runtimeConf",
",",
"final",
"int",
"timeOut",
")",
"throws",
"BindException",
",",
"InjectionException",
"{",
"final",
"Configuration",
"driverConf",
"=",
"Configurations",
".",
"mer... | Run Hello Reef with merged configuration.
@param runtimeConf
@param timeOut
@return
@throws BindException
@throws InjectionException | [
"Run",
"Hello",
"Reef",
"with",
"merged",
"configuration",
"."
] | e2c47121cde21108a602c560cf76565a40d0e916 | https://github.com/apache/reef/blob/e2c47121cde21108a602c560cf76565a40d0e916/lang/java/reef-examples/src/main/java/org/apache/reef/examples/hellohttp/HelloREEFHttp.java#L97-L102 | train |
apache/reef | lang/java/reef-wake/wake/src/main/java/org/apache/reef/wake/remote/transport/netty/NettyChannelHandler.java | NettyChannelHandler.channelActive | @Override
public void channelActive(final ChannelHandlerContext ctx) throws Exception {
this.channelGroup.add(ctx.channel());
this.listener.channelActive(ctx);
super.channelActive(ctx);
} | java | @Override
public void channelActive(final ChannelHandlerContext ctx) throws Exception {
this.channelGroup.add(ctx.channel());
this.listener.channelActive(ctx);
super.channelActive(ctx);
} | [
"@",
"Override",
"public",
"void",
"channelActive",
"(",
"final",
"ChannelHandlerContext",
"ctx",
")",
"throws",
"Exception",
"{",
"this",
".",
"channelGroup",
".",
"add",
"(",
"ctx",
".",
"channel",
"(",
")",
")",
";",
"this",
".",
"listener",
".",
"chann... | Handles the channel active event.
@param ctx the context object for this handler
@throws Exception | [
"Handles",
"the",
"channel",
"active",
"event",
"."
] | e2c47121cde21108a602c560cf76565a40d0e916 | https://github.com/apache/reef/blob/e2c47121cde21108a602c560cf76565a40d0e916/lang/java/reef-wake/wake/src/main/java/org/apache/reef/wake/remote/transport/netty/NettyChannelHandler.java#L78-L83 | train |
apache/reef | lang/java/reef-wake/wake/src/main/java/org/apache/reef/wake/remote/transport/netty/NettyChannelHandler.java | NettyChannelHandler.channelInactive | @Override
public void channelInactive(final ChannelHandlerContext ctx) throws Exception {
this.listener.channelInactive(ctx);
super.channelInactive(ctx);
} | java | @Override
public void channelInactive(final ChannelHandlerContext ctx) throws Exception {
this.listener.channelInactive(ctx);
super.channelInactive(ctx);
} | [
"@",
"Override",
"public",
"void",
"channelInactive",
"(",
"final",
"ChannelHandlerContext",
"ctx",
")",
"throws",
"Exception",
"{",
"this",
".",
"listener",
".",
"channelInactive",
"(",
"ctx",
")",
";",
"super",
".",
"channelInactive",
"(",
"ctx",
")",
";",
... | Handles the channel inactive event.
@param ctx the context object for this handler
@throws Exception | [
"Handles",
"the",
"channel",
"inactive",
"event",
"."
] | e2c47121cde21108a602c560cf76565a40d0e916 | https://github.com/apache/reef/blob/e2c47121cde21108a602c560cf76565a40d0e916/lang/java/reef-wake/wake/src/main/java/org/apache/reef/wake/remote/transport/netty/NettyChannelHandler.java#L91-L95 | train |
apache/reef | lang/java/reef-wake/wake/src/main/java/org/apache/reef/wake/remote/transport/netty/NettyChannelHandler.java | NettyChannelHandler.exceptionCaught | @Override
public void exceptionCaught(final ChannelHandlerContext ctx, final Throwable cause) {
final Channel channel = ctx.channel();
LOG.log(Level.INFO, "Unexpected exception from downstream. channel: {0} local: {1} remote: {2}",
new Object[]{channel, channel.localAddress(), channel.remoteAddress()... | java | @Override
public void exceptionCaught(final ChannelHandlerContext ctx, final Throwable cause) {
final Channel channel = ctx.channel();
LOG.log(Level.INFO, "Unexpected exception from downstream. channel: {0} local: {1} remote: {2}",
new Object[]{channel, channel.localAddress(), channel.remoteAddress()... | [
"@",
"Override",
"public",
"void",
"exceptionCaught",
"(",
"final",
"ChannelHandlerContext",
"ctx",
",",
"final",
"Throwable",
"cause",
")",
"{",
"final",
"Channel",
"channel",
"=",
"ctx",
".",
"channel",
"(",
")",
";",
"LOG",
".",
"log",
"(",
"Level",
"."... | Handles the exception event.
@param ctx the context object for this handler
@param cause the cause
@throws Exception | [
"Handles",
"the",
"exception",
"event",
"."
] | e2c47121cde21108a602c560cf76565a40d0e916 | https://github.com/apache/reef/blob/e2c47121cde21108a602c560cf76565a40d0e916/lang/java/reef-wake/wake/src/main/java/org/apache/reef/wake/remote/transport/netty/NettyChannelHandler.java#L104-L113 | train |
apache/reef | lang/java/reef-wake/wake/src/main/java/org/apache/reef/wake/remote/impl/RemoteEventDecoder.java | RemoteEventDecoder.decode | @Override
public RemoteEvent<T> decode(final byte[] data) {
final WakeMessagePBuf pbuf;
try {
pbuf = WakeMessagePBuf.parseFrom(data);
return new RemoteEvent<T>(null, null, pbuf.getSeq(), decoder.decode(pbuf.getData().toByteArray()));
} catch (final InvalidProtocolBufferException e) {
thr... | java | @Override
public RemoteEvent<T> decode(final byte[] data) {
final WakeMessagePBuf pbuf;
try {
pbuf = WakeMessagePBuf.parseFrom(data);
return new RemoteEvent<T>(null, null, pbuf.getSeq(), decoder.decode(pbuf.getData().toByteArray()));
} catch (final InvalidProtocolBufferException e) {
thr... | [
"@",
"Override",
"public",
"RemoteEvent",
"<",
"T",
">",
"decode",
"(",
"final",
"byte",
"[",
"]",
"data",
")",
"{",
"final",
"WakeMessagePBuf",
"pbuf",
";",
"try",
"{",
"pbuf",
"=",
"WakeMessagePBuf",
".",
"parseFrom",
"(",
"data",
")",
";",
"return",
... | Decodes a remote event from the byte array data.
@param data the byte array data
@return a remote event object
@throws RemoteRuntimeException | [
"Decodes",
"a",
"remote",
"event",
"from",
"the",
"byte",
"array",
"data",
"."
] | e2c47121cde21108a602c560cf76565a40d0e916 | https://github.com/apache/reef/blob/e2c47121cde21108a602c560cf76565a40d0e916/lang/java/reef-wake/wake/src/main/java/org/apache/reef/wake/remote/impl/RemoteEventDecoder.java#L51-L60 | train |
apache/reef | lang/java/reef-common/src/main/java/org/apache/reef/driver/restart/EvaluatorRestartInfo.java | EvaluatorRestartInfo.setEvaluatorRestartState | public boolean setEvaluatorRestartState(final EvaluatorRestartState to) {
if (this.evaluatorRestartState.isLegalTransition(to)) {
this.evaluatorRestartState = to;
return true;
}
return false;
} | java | public boolean setEvaluatorRestartState(final EvaluatorRestartState to) {
if (this.evaluatorRestartState.isLegalTransition(to)) {
this.evaluatorRestartState = to;
return true;
}
return false;
} | [
"public",
"boolean",
"setEvaluatorRestartState",
"(",
"final",
"EvaluatorRestartState",
"to",
")",
"{",
"if",
"(",
"this",
".",
"evaluatorRestartState",
".",
"isLegalTransition",
"(",
"to",
")",
")",
"{",
"this",
".",
"evaluatorRestartState",
"=",
"to",
";",
"re... | sets the current process of the restart. | [
"sets",
"the",
"current",
"process",
"of",
"the",
"restart",
"."
] | e2c47121cde21108a602c560cf76565a40d0e916 | https://github.com/apache/reef/blob/e2c47121cde21108a602c560cf76565a40d0e916/lang/java/reef-common/src/main/java/org/apache/reef/driver/restart/EvaluatorRestartInfo.java#L87-L95 | train |
apache/reef | lang/java/reef-examples-clr/src/main/java/org/apache/reef/examples/helloCLR/HelloDriver.java | HelloDriver.getCLRTaskConfiguration | private static Configuration getCLRTaskConfiguration(final String taskId) throws BindException {
final ConfigurationBuilder taskConfigurationBuilder = Tang.Factory.getTang()
.newConfigurationBuilder(loadClassHierarchy());
taskConfigurationBuilder.bind("Org.Apache.Reef.Tasks.TaskConfigurationOptions+Iden... | java | private static Configuration getCLRTaskConfiguration(final String taskId) throws BindException {
final ConfigurationBuilder taskConfigurationBuilder = Tang.Factory.getTang()
.newConfigurationBuilder(loadClassHierarchy());
taskConfigurationBuilder.bind("Org.Apache.Reef.Tasks.TaskConfigurationOptions+Iden... | [
"private",
"static",
"Configuration",
"getCLRTaskConfiguration",
"(",
"final",
"String",
"taskId",
")",
"throws",
"BindException",
"{",
"final",
"ConfigurationBuilder",
"taskConfigurationBuilder",
"=",
"Tang",
".",
"Factory",
".",
"getTang",
"(",
")",
".",
"newConfigu... | Makes a task configuration for the CLR Task.
@param taskId
@return task configuration for the CLR Task.
@throws BindException | [
"Makes",
"a",
"task",
"configuration",
"for",
"the",
"CLR",
"Task",
"."
] | e2c47121cde21108a602c560cf76565a40d0e916 | https://github.com/apache/reef/blob/e2c47121cde21108a602c560cf76565a40d0e916/lang/java/reef-examples-clr/src/main/java/org/apache/reef/examples/helloCLR/HelloDriver.java#L80-L90 | train |
apache/reef | lang/java/reef-examples-clr/src/main/java/org/apache/reef/examples/helloCLR/HelloDriver.java | HelloDriver.loadClassHierarchy | private static ClassHierarchy loadClassHierarchy() {
// TODO[JIRA REEF-400] The file should be created by AvroClassHierarchySerializer
try (final InputStream chin = new FileInputStream(HelloCLR.CLASS_HIERARCHY_FILENAME)) {
// TODO[JIRA REEF-400] Use AvroClassHierarchySerializer instead
final ClassHi... | java | private static ClassHierarchy loadClassHierarchy() {
// TODO[JIRA REEF-400] The file should be created by AvroClassHierarchySerializer
try (final InputStream chin = new FileInputStream(HelloCLR.CLASS_HIERARCHY_FILENAME)) {
// TODO[JIRA REEF-400] Use AvroClassHierarchySerializer instead
final ClassHi... | [
"private",
"static",
"ClassHierarchy",
"loadClassHierarchy",
"(",
")",
"{",
"// TODO[JIRA REEF-400] The file should be created by AvroClassHierarchySerializer",
"try",
"(",
"final",
"InputStream",
"chin",
"=",
"new",
"FileInputStream",
"(",
"HelloCLR",
".",
"CLASS_HIERARCHY_FIL... | Loads the class hierarchy.
@return | [
"Loads",
"the",
"class",
"hierarchy",
"."
] | e2c47121cde21108a602c560cf76565a40d0e916 | https://github.com/apache/reef/blob/e2c47121cde21108a602c560cf76565a40d0e916/lang/java/reef-examples-clr/src/main/java/org/apache/reef/examples/helloCLR/HelloDriver.java#L97-L109 | train |
apache/reef | lang/java/reef-examples-clr/src/main/java/org/apache/reef/examples/helloCLR/HelloDriver.java | HelloDriver.onNextCLR | void onNextCLR(final AllocatedEvaluator allocatedEvaluator) {
try {
allocatedEvaluator.setProcess(clrProcessFactory.newEvaluatorProcess());
final Configuration contextConfiguration = ContextConfiguration.CONF
.set(ContextConfiguration.IDENTIFIER, "HelloREEFContext")
.build();
... | java | void onNextCLR(final AllocatedEvaluator allocatedEvaluator) {
try {
allocatedEvaluator.setProcess(clrProcessFactory.newEvaluatorProcess());
final Configuration contextConfiguration = ContextConfiguration.CONF
.set(ContextConfiguration.IDENTIFIER, "HelloREEFContext")
.build();
... | [
"void",
"onNextCLR",
"(",
"final",
"AllocatedEvaluator",
"allocatedEvaluator",
")",
"{",
"try",
"{",
"allocatedEvaluator",
".",
"setProcess",
"(",
"clrProcessFactory",
".",
"newEvaluatorProcess",
"(",
")",
")",
";",
"final",
"Configuration",
"contextConfiguration",
"=... | Uses the AllocatedEvaluator to launch a CLR task.
@param allocatedEvaluator | [
"Uses",
"the",
"AllocatedEvaluator",
"to",
"launch",
"a",
"CLR",
"task",
"."
] | e2c47121cde21108a602c560cf76565a40d0e916 | https://github.com/apache/reef/blob/e2c47121cde21108a602c560cf76565a40d0e916/lang/java/reef-examples-clr/src/main/java/org/apache/reef/examples/helloCLR/HelloDriver.java#L116-L131 | train |
apache/reef | lang/java/reef-examples-clr/src/main/java/org/apache/reef/examples/helloCLR/HelloDriver.java | HelloDriver.onNextJVM | void onNextJVM(final AllocatedEvaluator allocatedEvaluator) {
try {
final Configuration contextConfiguration = ContextConfiguration.CONF
.set(ContextConfiguration.IDENTIFIER, "HelloREEFContext")
.build();
final Configuration taskConfiguration = TaskConfiguration.CONF
.set(... | java | void onNextJVM(final AllocatedEvaluator allocatedEvaluator) {
try {
final Configuration contextConfiguration = ContextConfiguration.CONF
.set(ContextConfiguration.IDENTIFIER, "HelloREEFContext")
.build();
final Configuration taskConfiguration = TaskConfiguration.CONF
.set(... | [
"void",
"onNextJVM",
"(",
"final",
"AllocatedEvaluator",
"allocatedEvaluator",
")",
"{",
"try",
"{",
"final",
"Configuration",
"contextConfiguration",
"=",
"ContextConfiguration",
".",
"CONF",
".",
"set",
"(",
"ContextConfiguration",
".",
"IDENTIFIER",
",",
"\"HelloRE... | Uses the AllocatedEvaluator to launch a JVM task.
@param allocatedEvaluator | [
"Uses",
"the",
"AllocatedEvaluator",
"to",
"launch",
"a",
"JVM",
"task",
"."
] | e2c47121cde21108a602c560cf76565a40d0e916 | https://github.com/apache/reef/blob/e2c47121cde21108a602c560cf76565a40d0e916/lang/java/reef-examples-clr/src/main/java/org/apache/reef/examples/helloCLR/HelloDriver.java#L138-L155 | train |
apache/reef | lang/java/reef-io/src/main/java/org/apache/reef/io/data/output/TaskOutputService.java | TaskOutputService.getServiceConfiguration | @Override
public Configuration getServiceConfiguration() {
final Configuration partialServiceConf = ServiceConfiguration.CONF
.set(ServiceConfiguration.SERVICES, taskOutputStreamProvider.getClass())
.set(ServiceConfiguration.ON_CONTEXT_STOP, ContextStopHandler.class)
.set(ServiceConfigura... | java | @Override
public Configuration getServiceConfiguration() {
final Configuration partialServiceConf = ServiceConfiguration.CONF
.set(ServiceConfiguration.SERVICES, taskOutputStreamProvider.getClass())
.set(ServiceConfiguration.ON_CONTEXT_STOP, ContextStopHandler.class)
.set(ServiceConfigura... | [
"@",
"Override",
"public",
"Configuration",
"getServiceConfiguration",
"(",
")",
"{",
"final",
"Configuration",
"partialServiceConf",
"=",
"ServiceConfiguration",
".",
"CONF",
".",
"set",
"(",
"ServiceConfiguration",
".",
"SERVICES",
",",
"taskOutputStreamProvider",
"."... | Provides a service configuration for the output service.
@return service configuration. | [
"Provides",
"a",
"service",
"configuration",
"for",
"the",
"output",
"service",
"."
] | e2c47121cde21108a602c560cf76565a40d0e916 | https://github.com/apache/reef/blob/e2c47121cde21108a602c560cf76565a40d0e916/lang/java/reef-io/src/main/java/org/apache/reef/io/data/output/TaskOutputService.java#L77-L92 | train |
apache/reef | lang/java/reef-bridge-client/src/main/java/org/apache/reef/bridge/client/LocalSubmissionFromCS.java | LocalSubmissionFromCS.fromSubmissionParameterFiles | static LocalSubmissionFromCS fromSubmissionParameterFiles(final File localJobSubmissionParametersFile,
final File localAppSubmissionParametersFile)
throws IOException {
final AvroLocalAppSubmissionParameters localAppSubmissionParameters;
final A... | java | static LocalSubmissionFromCS fromSubmissionParameterFiles(final File localJobSubmissionParametersFile,
final File localAppSubmissionParametersFile)
throws IOException {
final AvroLocalAppSubmissionParameters localAppSubmissionParameters;
final A... | [
"static",
"LocalSubmissionFromCS",
"fromSubmissionParameterFiles",
"(",
"final",
"File",
"localJobSubmissionParametersFile",
",",
"final",
"File",
"localAppSubmissionParametersFile",
")",
"throws",
"IOException",
"{",
"final",
"AvroLocalAppSubmissionParameters",
"localAppSubmission... | Takes the local job submission configuration file, deserializes it, and creates submission object. | [
"Takes",
"the",
"local",
"job",
"submission",
"configuration",
"file",
"deserializes",
"it",
"and",
"creates",
"submission",
"object",
"."
] | e2c47121cde21108a602c560cf76565a40d0e916 | https://github.com/apache/reef/blob/e2c47121cde21108a602c560cf76565a40d0e916/lang/java/reef-bridge-client/src/main/java/org/apache/reef/bridge/client/LocalSubmissionFromCS.java#L168-L192 | train |
apache/reef | lang/java/reef-bridge-proto-java/src/main/java/org/apache/reef/bridge/driver/common/grpc/GRPCUtils.java | GRPCUtils.toByteArray | public static byte[] toByteArray(final ByteString bs) {
return bs == null || bs.isEmpty() ? null : bs.toByteArray();
} | java | public static byte[] toByteArray(final ByteString bs) {
return bs == null || bs.isEmpty() ? null : bs.toByteArray();
} | [
"public",
"static",
"byte",
"[",
"]",
"toByteArray",
"(",
"final",
"ByteString",
"bs",
")",
"{",
"return",
"bs",
"==",
"null",
"||",
"bs",
".",
"isEmpty",
"(",
")",
"?",
"null",
":",
"bs",
".",
"toByteArray",
"(",
")",
";",
"}"
] | Converts ByteString to byte array.
@param bs ByteString
@return byte array or null if not present | [
"Converts",
"ByteString",
"to",
"byte",
"array",
"."
] | e2c47121cde21108a602c560cf76565a40d0e916 | https://github.com/apache/reef/blob/e2c47121cde21108a602c560cf76565a40d0e916/lang/java/reef-bridge-proto-java/src/main/java/org/apache/reef/bridge/driver/common/grpc/GRPCUtils.java#L47-L49 | train |
apache/reef | lang/java/reef-bridge-proto-java/src/main/java/org/apache/reef/bridge/driver/common/grpc/GRPCUtils.java | GRPCUtils.createExceptionInfo | public static ExceptionInfo createExceptionInfo(final ExceptionCodec exceptionCodec, final Throwable ex) {
return ExceptionInfo.newBuilder()
.setName(ex.getCause() != null ? ex.getCause().toString() : ex.toString())
.setMessage(StringUtils.isNotEmpty(ex.getMessage()) ? ex.getMessage() : ex.toString... | java | public static ExceptionInfo createExceptionInfo(final ExceptionCodec exceptionCodec, final Throwable ex) {
return ExceptionInfo.newBuilder()
.setName(ex.getCause() != null ? ex.getCause().toString() : ex.toString())
.setMessage(StringUtils.isNotEmpty(ex.getMessage()) ? ex.getMessage() : ex.toString... | [
"public",
"static",
"ExceptionInfo",
"createExceptionInfo",
"(",
"final",
"ExceptionCodec",
"exceptionCodec",
",",
"final",
"Throwable",
"ex",
")",
"{",
"return",
"ExceptionInfo",
".",
"newBuilder",
"(",
")",
".",
"setName",
"(",
"ex",
".",
"getCause",
"(",
")",... | Create exception info from exception object.
@param exceptionCodec to encode exception into bytes
@param ex exception object
@return ExceptionInfo | [
"Create",
"exception",
"info",
"from",
"exception",
"object",
"."
] | e2c47121cde21108a602c560cf76565a40d0e916 | https://github.com/apache/reef/blob/e2c47121cde21108a602c560cf76565a40d0e916/lang/java/reef-bridge-proto-java/src/main/java/org/apache/reef/bridge/driver/common/grpc/GRPCUtils.java#L66-L72 | train |
apache/reef | lang/java/reef-bridge-proto-java/src/main/java/org/apache/reef/bridge/driver/common/grpc/GRPCUtils.java | GRPCUtils.toEvaluatorDescriptorInfo | public static EvaluatorDescriptorInfo toEvaluatorDescriptorInfo(
final EvaluatorDescriptor descriptor) {
if (descriptor == null) {
return null;
}
EvaluatorDescriptorInfo.NodeDescriptorInfo nodeDescriptorInfo = descriptor.getNodeDescriptor() == null ? null :
EvaluatorDescriptorInfo.NodeDe... | java | public static EvaluatorDescriptorInfo toEvaluatorDescriptorInfo(
final EvaluatorDescriptor descriptor) {
if (descriptor == null) {
return null;
}
EvaluatorDescriptorInfo.NodeDescriptorInfo nodeDescriptorInfo = descriptor.getNodeDescriptor() == null ? null :
EvaluatorDescriptorInfo.NodeDe... | [
"public",
"static",
"EvaluatorDescriptorInfo",
"toEvaluatorDescriptorInfo",
"(",
"final",
"EvaluatorDescriptor",
"descriptor",
")",
"{",
"if",
"(",
"descriptor",
"==",
"null",
")",
"{",
"return",
"null",
";",
"}",
"EvaluatorDescriptorInfo",
".",
"NodeDescriptorInfo",
... | Create an evaluator descriptor info from an EvalautorDescriptor object.
@param descriptor object
@return EvaluatorDescriptorInfo | [
"Create",
"an",
"evaluator",
"descriptor",
"info",
"from",
"an",
"EvalautorDescriptor",
"object",
"."
] | e2c47121cde21108a602c560cf76565a40d0e916 | https://github.com/apache/reef/blob/e2c47121cde21108a602c560cf76565a40d0e916/lang/java/reef-bridge-proto-java/src/main/java/org/apache/reef/bridge/driver/common/grpc/GRPCUtils.java#L79-L99 | train |
apache/reef | lang/java/reef-bridge-proto-java/src/main/java/org/apache/reef/bridge/driver/common/grpc/GRPCUtils.java | GRPCUtils.toContextInfo | public static ContextInfo toContextInfo(final ContextBase context, final ExceptionInfo error) {
final ContextInfo.Builder builder = ContextInfo.newBuilder()
.setContextId(context.getId())
.setEvaluatorId(context.getEvaluatorId())
.setParentId(context.getParentId().orElse(""))
.setEva... | java | public static ContextInfo toContextInfo(final ContextBase context, final ExceptionInfo error) {
final ContextInfo.Builder builder = ContextInfo.newBuilder()
.setContextId(context.getId())
.setEvaluatorId(context.getEvaluatorId())
.setParentId(context.getParentId().orElse(""))
.setEva... | [
"public",
"static",
"ContextInfo",
"toContextInfo",
"(",
"final",
"ContextBase",
"context",
",",
"final",
"ExceptionInfo",
"error",
")",
"{",
"final",
"ContextInfo",
".",
"Builder",
"builder",
"=",
"ContextInfo",
".",
"newBuilder",
"(",
")",
".",
"setContextId",
... | Create a context info from a context object with an error.
@param context object
@param error info
@return context info | [
"Create",
"a",
"context",
"info",
"from",
"a",
"context",
"object",
"with",
"an",
"error",
"."
] | e2c47121cde21108a602c560cf76565a40d0e916 | https://github.com/apache/reef/blob/e2c47121cde21108a602c560cf76565a40d0e916/lang/java/reef-bridge-proto-java/src/main/java/org/apache/reef/bridge/driver/common/grpc/GRPCUtils.java#L116-L127 | train |
apache/reef | lang/java/reef-examples/src/main/java/org/apache/reef/examples/pool/JobDriver.java | JobDriver.getTaskConfiguration | private Configuration getTaskConfiguration(final String taskId) {
try {
return TaskConfiguration.CONF
.set(TaskConfiguration.IDENTIFIER, taskId)
.set(TaskConfiguration.TASK, SleepTask.class)
.build();
} catch (final BindException ex) {
LOG.log(Level.SEVERE, "Failed to c... | java | private Configuration getTaskConfiguration(final String taskId) {
try {
return TaskConfiguration.CONF
.set(TaskConfiguration.IDENTIFIER, taskId)
.set(TaskConfiguration.TASK, SleepTask.class)
.build();
} catch (final BindException ex) {
LOG.log(Level.SEVERE, "Failed to c... | [
"private",
"Configuration",
"getTaskConfiguration",
"(",
"final",
"String",
"taskId",
")",
"{",
"try",
"{",
"return",
"TaskConfiguration",
".",
"CONF",
".",
"set",
"(",
"TaskConfiguration",
".",
"IDENTIFIER",
",",
"taskId",
")",
".",
"set",
"(",
"TaskConfigurati... | Build a new Task configuration for a given task ID.
@param taskId Unique string ID of the task
@return Immutable task configuration object, ready to be submitted to REEF.
@throws RuntimeException that wraps BindException if unable to build the configuration. | [
"Build",
"a",
"new",
"Task",
"configuration",
"for",
"a",
"given",
"task",
"ID",
"."
] | e2c47121cde21108a602c560cf76565a40d0e916 | https://github.com/apache/reef/blob/e2c47121cde21108a602c560cf76565a40d0e916/lang/java/reef-examples/src/main/java/org/apache/reef/examples/pool/JobDriver.java#L114-L124 | train |
apache/reef | lang/java/reef-bridge-proto-java/src/main/java/org/apache/reef/bridge/driver/service/DriverStatusHTTPHandler.java | DriverStatusHTTPHandler.waitAndGetMessage | String waitAndGetMessage() {
synchronized (this) {
// Wait for a message to send.
while (this.statusMessagesToSend.isEmpty()) {
try {
this.wait();
} catch (final InterruptedException e) {
LOG.log(Level.FINE, "Interrupted. Ignoring.");
}
}
// Send ... | java | String waitAndGetMessage() {
synchronized (this) {
// Wait for a message to send.
while (this.statusMessagesToSend.isEmpty()) {
try {
this.wait();
} catch (final InterruptedException e) {
LOG.log(Level.FINE, "Interrupted. Ignoring.");
}
}
// Send ... | [
"String",
"waitAndGetMessage",
"(",
")",
"{",
"synchronized",
"(",
"this",
")",
"{",
"// Wait for a message to send.",
"while",
"(",
"this",
".",
"statusMessagesToSend",
".",
"isEmpty",
"(",
")",
")",
"{",
"try",
"{",
"this",
".",
"wait",
"(",
")",
";",
"}... | Waits for a status message to be available and returns it.
@return the first available status message. | [
"Waits",
"for",
"a",
"status",
"message",
"to",
"be",
"available",
"and",
"returns",
"it",
"."
] | e2c47121cde21108a602c560cf76565a40d0e916 | https://github.com/apache/reef/blob/e2c47121cde21108a602c560cf76565a40d0e916/lang/java/reef-bridge-proto-java/src/main/java/org/apache/reef/bridge/driver/service/DriverStatusHTTPHandler.java#L154-L168 | train |
apache/reef | lang/java/reef-runtime-yarn/src/main/java/org/apache/reef/runtime/yarn/client/UserCredentialSecurityTokenProvider.java | UserCredentialSecurityTokenProvider.addTokens | @Override
public void addTokens(final byte[] tokens) {
try (final DataInputBuffer buf = new DataInputBuffer()) {
buf.reset(tokens, tokens.length);
final Credentials credentials = new Credentials();
credentials.readTokenStorageStream(buf);
final UserGroupInformation ugi = UserGroupInform... | java | @Override
public void addTokens(final byte[] tokens) {
try (final DataInputBuffer buf = new DataInputBuffer()) {
buf.reset(tokens, tokens.length);
final Credentials credentials = new Credentials();
credentials.readTokenStorageStream(buf);
final UserGroupInformation ugi = UserGroupInform... | [
"@",
"Override",
"public",
"void",
"addTokens",
"(",
"final",
"byte",
"[",
"]",
"tokens",
")",
"{",
"try",
"(",
"final",
"DataInputBuffer",
"buf",
"=",
"new",
"DataInputBuffer",
"(",
")",
")",
"{",
"buf",
".",
"reset",
"(",
"tokens",
",",
"tokens",
"."... | Add serialized token to teh credentials.
@param tokens ByteBuffer containing token. | [
"Add",
"serialized",
"token",
"to",
"teh",
"credentials",
"."
] | e2c47121cde21108a602c560cf76565a40d0e916 | https://github.com/apache/reef/blob/e2c47121cde21108a602c560cf76565a40d0e916/lang/java/reef-runtime-yarn/src/main/java/org/apache/reef/runtime/yarn/client/UserCredentialSecurityTokenProvider.java#L72-L89 | train |
apache/reef | lang/java/reef-runtime-yarn/src/main/java/org/apache/reef/runtime/yarn/client/UserCredentialSecurityTokenProvider.java | UserCredentialSecurityTokenProvider.serializeToken | public static byte[] serializeToken(final Token<AMRMTokenIdentifier> token) {
try (final DataOutputBuffer dob = new DataOutputBuffer()) {
final Credentials credentials = new Credentials();
credentials.addToken(token.getService(), token);
credentials.writeTokenStorageToStream(dob);
return dob... | java | public static byte[] serializeToken(final Token<AMRMTokenIdentifier> token) {
try (final DataOutputBuffer dob = new DataOutputBuffer()) {
final Credentials credentials = new Credentials();
credentials.addToken(token.getService(), token);
credentials.writeTokenStorageToStream(dob);
return dob... | [
"public",
"static",
"byte",
"[",
"]",
"serializeToken",
"(",
"final",
"Token",
"<",
"AMRMTokenIdentifier",
">",
"token",
")",
"{",
"try",
"(",
"final",
"DataOutputBuffer",
"dob",
"=",
"new",
"DataOutputBuffer",
"(",
")",
")",
"{",
"final",
"Credentials",
"cr... | Helper method to serialize a security token.
@param token AM security token.
@return ByteBuffer that contains the token. It is compatible with addTokens() method. | [
"Helper",
"method",
"to",
"serialize",
"a",
"security",
"token",
"."
] | e2c47121cde21108a602c560cf76565a40d0e916 | https://github.com/apache/reef/blob/e2c47121cde21108a602c560cf76565a40d0e916/lang/java/reef-runtime-yarn/src/main/java/org/apache/reef/runtime/yarn/client/UserCredentialSecurityTokenProvider.java#L96-L106 | train |
apache/reef | lang/java/reef-examples/src/main/java/org/apache/reef/examples/hellohttp/HttpServerShellCmdHandler.java | HttpServerShellCmdHandler.onHttpRequest | @Override
public final synchronized void onHttpRequest(final ParsedHttpRequest parsedHttpRequest,
final HttpServletResponse response)
throws IOException, ServletException {
LOG.log(Level.INFO, "HttpServeShellCmdHandler in webserver onHttpRequest is called: {0}"... | java | @Override
public final synchronized void onHttpRequest(final ParsedHttpRequest parsedHttpRequest,
final HttpServletResponse response)
throws IOException, ServletException {
LOG.log(Level.INFO, "HttpServeShellCmdHandler in webserver onHttpRequest is called: {0}"... | [
"@",
"Override",
"public",
"final",
"synchronized",
"void",
"onHttpRequest",
"(",
"final",
"ParsedHttpRequest",
"parsedHttpRequest",
",",
"final",
"HttpServletResponse",
"response",
")",
"throws",
"IOException",
",",
"ServletException",
"{",
"LOG",
".",
"log",
"(",
... | it is called when receiving a http request.
@param parsedHttpRequest
@param response | [
"it",
"is",
"called",
"when",
"receiving",
"a",
"http",
"request",
"."
] | e2c47121cde21108a602c560cf76565a40d0e916 | https://github.com/apache/reef/blob/e2c47121cde21108a602c560cf76565a40d0e916/lang/java/reef-examples/src/main/java/org/apache/reef/examples/hellohttp/HttpServerShellCmdHandler.java#L98-L134 | train |
apache/reef | lang/java/reef-examples/src/main/java/org/apache/reef/examples/hellohttp/HttpServerShellCmdHandler.java | HttpServerShellCmdHandler.onHttpCallback | public final synchronized void onHttpCallback(final byte[] message) {
final long endTime = System.currentTimeMillis() + WAIT_TIMEOUT;
while (cmdOutput != null) {
final long waitTime = endTime - System.currentTimeMillis();
if (waitTime <= 0) {
break;
}
try {
wait(WAIT_TIM... | java | public final synchronized void onHttpCallback(final byte[] message) {
final long endTime = System.currentTimeMillis() + WAIT_TIMEOUT;
while (cmdOutput != null) {
final long waitTime = endTime - System.currentTimeMillis();
if (waitTime <= 0) {
break;
}
try {
wait(WAIT_TIM... | [
"public",
"final",
"synchronized",
"void",
"onHttpCallback",
"(",
"final",
"byte",
"[",
"]",
"message",
")",
"{",
"final",
"long",
"endTime",
"=",
"System",
".",
"currentTimeMillis",
"(",
")",
"+",
"WAIT_TIMEOUT",
";",
"while",
"(",
"cmdOutput",
"!=",
"null"... | called after shell command is completed.
@param message | [
"called",
"after",
"shell",
"command",
"is",
"completed",
"."
] | e2c47121cde21108a602c560cf76565a40d0e916 | https://github.com/apache/reef/blob/e2c47121cde21108a602c560cf76565a40d0e916/lang/java/reef-examples/src/main/java/org/apache/reef/examples/hellohttp/HttpServerShellCmdHandler.java#L141-L159 | train |
apache/reef | lang/java/reef-examples/src/main/java/org/apache/reef/examples/scheduler/client/SchedulerREEF.java | SchedulerREEF.runTaskScheduler | public static void runTaskScheduler(final Configuration runtimeConf, final String[] args)
throws InjectionException, IOException, ParseException {
final Tang tang = Tang.Factory.getTang();
final Configuration commandLineConf = CommandLine.parseToConfiguration(args, Retain.class);
// Merge the configur... | java | public static void runTaskScheduler(final Configuration runtimeConf, final String[] args)
throws InjectionException, IOException, ParseException {
final Tang tang = Tang.Factory.getTang();
final Configuration commandLineConf = CommandLine.parseToConfiguration(args, Retain.class);
// Merge the configur... | [
"public",
"static",
"void",
"runTaskScheduler",
"(",
"final",
"Configuration",
"runtimeConf",
",",
"final",
"String",
"[",
"]",
"args",
")",
"throws",
"InjectionException",
",",
"IOException",
",",
"ParseException",
"{",
"final",
"Tang",
"tang",
"=",
"Tang",
"."... | Run the Task scheduler. If '-retain true' option is passed via command line,
the scheduler reuses evaluators to submit new Tasks.
@param runtimeConf The runtime configuration (e.g. Local, YARN, etc)
@param args Command line arguments.
@throws InjectionException
@throws java.io.IOException | [
"Run",
"the",
"Task",
"scheduler",
".",
"If",
"-",
"retain",
"true",
"option",
"is",
"passed",
"via",
"command",
"line",
"the",
"scheduler",
"reuses",
"evaluators",
"to",
"submit",
"new",
"Tasks",
"."
] | e2c47121cde21108a602c560cf76565a40d0e916 | https://github.com/apache/reef/blob/e2c47121cde21108a602c560cf76565a40d0e916/lang/java/reef-examples/src/main/java/org/apache/reef/examples/scheduler/client/SchedulerREEF.java#L91-L102 | train |
apache/reef | lang/java/reef-applications/reef-vortex/src/main/java/org/apache/reef/vortex/examples/matmul/IdentityMatMulStart.java | IdentityMatMulStart.start | @Override
public void start(final VortexThreadPool vortexThreadPool) {
final List<Matrix<Double>> leftSplits = generateMatrixSplits(numRows, numColumns, divideFactor);
final Matrix<Double> right = generateIdentityMatrix(numColumns);
// Measure job finish time starting from here..
final double start =... | java | @Override
public void start(final VortexThreadPool vortexThreadPool) {
final List<Matrix<Double>> leftSplits = generateMatrixSplits(numRows, numColumns, divideFactor);
final Matrix<Double> right = generateIdentityMatrix(numColumns);
// Measure job finish time starting from here..
final double start =... | [
"@",
"Override",
"public",
"void",
"start",
"(",
"final",
"VortexThreadPool",
"vortexThreadPool",
")",
"{",
"final",
"List",
"<",
"Matrix",
"<",
"Double",
">",
">",
"leftSplits",
"=",
"generateMatrixSplits",
"(",
"numRows",
",",
"numColumns",
",",
"divideFactor"... | Perform a simple vector multiplication on Vortex. | [
"Perform",
"a",
"simple",
"vector",
"multiplication",
"on",
"Vortex",
"."
] | e2c47121cde21108a602c560cf76565a40d0e916 | https://github.com/apache/reef/blob/e2c47121cde21108a602c560cf76565a40d0e916/lang/java/reef-applications/reef-vortex/src/main/java/org/apache/reef/vortex/examples/matmul/IdentityMatMulStart.java#L59-L101 | train |
apache/reef | lang/java/reef-applications/reef-vortex/src/main/java/org/apache/reef/vortex/examples/matmul/IdentityMatMulStart.java | IdentityMatMulStart.generateRandomMatrix | private Matrix<Double> generateRandomMatrix(final int nRows, final int nColumns) {
final List<List<Double>> rows = new ArrayList<>(nRows);
final Random random = new Random();
for (int i = 0; i < nRows; i++) {
final List<Double> row = new ArrayList<>(nColumns);
for (int j = 0; j < nColumns; j++) ... | java | private Matrix<Double> generateRandomMatrix(final int nRows, final int nColumns) {
final List<List<Double>> rows = new ArrayList<>(nRows);
final Random random = new Random();
for (int i = 0; i < nRows; i++) {
final List<Double> row = new ArrayList<>(nColumns);
for (int j = 0; j < nColumns; j++) ... | [
"private",
"Matrix",
"<",
"Double",
">",
"generateRandomMatrix",
"(",
"final",
"int",
"nRows",
",",
"final",
"int",
"nColumns",
")",
"{",
"final",
"List",
"<",
"List",
"<",
"Double",
">",
">",
"rows",
"=",
"new",
"ArrayList",
"<>",
"(",
"nRows",
")",
"... | Generate a matrix with random values.
@param nRows number of matrix's rows.
@param nColumns number of matrix's columns.
@return Matrix that consists of random values. | [
"Generate",
"a",
"matrix",
"with",
"random",
"values",
"."
] | e2c47121cde21108a602c560cf76565a40d0e916 | https://github.com/apache/reef/blob/e2c47121cde21108a602c560cf76565a40d0e916/lang/java/reef-applications/reef-vortex/src/main/java/org/apache/reef/vortex/examples/matmul/IdentityMatMulStart.java#L109-L120 | train |
apache/reef | lang/java/reef-applications/reef-vortex/src/main/java/org/apache/reef/vortex/examples/matmul/IdentityMatMulStart.java | IdentityMatMulStart.generateIdentityMatrix | private Matrix<Double> generateIdentityMatrix(final int numDimension) {
final List<List<Double>> rows = new ArrayList<>(numDimension);
for (int i = 0; i < numDimension; i++) {
final List<Double> row = new ArrayList<>(numDimension);
for (int j = 0; j < numDimension; j++) {
final double value ... | java | private Matrix<Double> generateIdentityMatrix(final int numDimension) {
final List<List<Double>> rows = new ArrayList<>(numDimension);
for (int i = 0; i < numDimension; i++) {
final List<Double> row = new ArrayList<>(numDimension);
for (int j = 0; j < numDimension; j++) {
final double value ... | [
"private",
"Matrix",
"<",
"Double",
">",
"generateIdentityMatrix",
"(",
"final",
"int",
"numDimension",
")",
"{",
"final",
"List",
"<",
"List",
"<",
"Double",
">",
">",
"rows",
"=",
"new",
"ArrayList",
"<>",
"(",
"numDimension",
")",
";",
"for",
"(",
"in... | Generate an identity matrix.
@param numDimension number of rows and columns of the identity matrix.
@return Identity matrix. | [
"Generate",
"an",
"identity",
"matrix",
"."
] | e2c47121cde21108a602c560cf76565a40d0e916 | https://github.com/apache/reef/blob/e2c47121cde21108a602c560cf76565a40d0e916/lang/java/reef-applications/reef-vortex/src/main/java/org/apache/reef/vortex/examples/matmul/IdentityMatMulStart.java#L127-L138 | train |
apache/reef | lang/java/reef-io/src/main/java/org/apache/reef/io/network/group/impl/driver/TopologyFactory.java | TopologyFactory.getNewInstance | public Topology getNewInstance(final Class<? extends Name<String>> operatorName,
final Class<? extends Topology> topologyClass) throws InjectionException {
final Injector newInjector = injector.forkInjector();
newInjector.bindVolatileParameter(OperatorNameClass.class, operatorNa... | java | public Topology getNewInstance(final Class<? extends Name<String>> operatorName,
final Class<? extends Topology> topologyClass) throws InjectionException {
final Injector newInjector = injector.forkInjector();
newInjector.bindVolatileParameter(OperatorNameClass.class, operatorNa... | [
"public",
"Topology",
"getNewInstance",
"(",
"final",
"Class",
"<",
"?",
"extends",
"Name",
"<",
"String",
">",
">",
"operatorName",
",",
"final",
"Class",
"<",
"?",
"extends",
"Topology",
">",
"topologyClass",
")",
"throws",
"InjectionException",
"{",
"final"... | Instantiates a new Topology instance.
@param operatorName specified name of the operator
@param topologyClass specified topology type
@return Topology instance
@throws InjectionException | [
"Instantiates",
"a",
"new",
"Topology",
"instance",
"."
] | e2c47121cde21108a602c560cf76565a40d0e916 | https://github.com/apache/reef/blob/e2c47121cde21108a602c560cf76565a40d0e916/lang/java/reef-io/src/main/java/org/apache/reef/io/network/group/impl/driver/TopologyFactory.java#L63-L68 | train |
apache/reef | lang/java/reef-examples/src/main/java/org/apache/reef/examples/hello/HelloReefAzBatch.java | HelloReefAzBatch.main | public static void main(final String[] args) throws InjectionException, IOException {
final Configuration partialConfiguration = getEnvironmentConfiguration();
final Injector injector = Tang.Factory.getTang().newInjector(partialConfiguration);
final AzureBatchRuntimeConfigurationProvider runtimeConfigurati... | java | public static void main(final String[] args) throws InjectionException, IOException {
final Configuration partialConfiguration = getEnvironmentConfiguration();
final Injector injector = Tang.Factory.getTang().newInjector(partialConfiguration);
final AzureBatchRuntimeConfigurationProvider runtimeConfigurati... | [
"public",
"static",
"void",
"main",
"(",
"final",
"String",
"[",
"]",
"args",
")",
"throws",
"InjectionException",
",",
"IOException",
"{",
"final",
"Configuration",
"partialConfiguration",
"=",
"getEnvironmentConfiguration",
"(",
")",
";",
"final",
"Injector",
"i... | Start the Hello REEF job with the Azure Batch runtime.
@param args command line parameters.
@throws InjectionException configuration error.
@throws IOException | [
"Start",
"the",
"Hello",
"REEF",
"job",
"with",
"the",
"Azure",
"Batch",
"runtime",
"."
] | e2c47121cde21108a602c560cf76565a40d0e916 | https://github.com/apache/reef/blob/e2c47121cde21108a602c560cf76565a40d0e916/lang/java/reef-examples/src/main/java/org/apache/reef/examples/hello/HelloReefAzBatch.java#L73-L86 | train |
apache/reef | lang/java/reef-examples/src/main/java/org/apache/reef/examples/hellohttp/HttpShellJobDriver.java | HttpShellJobDriver.returnResults | private void returnResults() {
final StringBuilder sb = new StringBuilder();
for (final String result : this.results) {
sb.append(result);
}
this.results.clear();
LOG.log(Level.INFO, "Return results to the client:\n{0}", sb);
httpCallbackHandler.onNext(CODEC.encode(sb.toString()));
} | java | private void returnResults() {
final StringBuilder sb = new StringBuilder();
for (final String result : this.results) {
sb.append(result);
}
this.results.clear();
LOG.log(Level.INFO, "Return results to the client:\n{0}", sb);
httpCallbackHandler.onNext(CODEC.encode(sb.toString()));
} | [
"private",
"void",
"returnResults",
"(",
")",
"{",
"final",
"StringBuilder",
"sb",
"=",
"new",
"StringBuilder",
"(",
")",
";",
"for",
"(",
"final",
"String",
"result",
":",
"this",
".",
"results",
")",
"{",
"sb",
".",
"append",
"(",
"result",
")",
";",... | Construct the final result and forward it to the Client. | [
"Construct",
"the",
"final",
"result",
"and",
"forward",
"it",
"to",
"the",
"Client",
"."
] | e2c47121cde21108a602c560cf76565a40d0e916 | https://github.com/apache/reef/blob/e2c47121cde21108a602c560cf76565a40d0e916/lang/java/reef-examples/src/main/java/org/apache/reef/examples/hellohttp/HttpShellJobDriver.java#L113-L121 | train |
apache/reef | lang/java/reef-examples/src/main/java/org/apache/reef/examples/hellohttp/HttpShellJobDriver.java | HttpShellJobDriver.submit | private synchronized void submit(final String command) {
LOG.log(Level.INFO, "Submit command {0} to {1} evaluators. state: {2}",
new Object[]{command, this.contexts.size(), this.state});
assert this.state == State.READY;
this.expectCount = this.contexts.size();
this.state = State.WAIT_TASKS;
... | java | private synchronized void submit(final String command) {
LOG.log(Level.INFO, "Submit command {0} to {1} evaluators. state: {2}",
new Object[]{command, this.contexts.size(), this.state});
assert this.state == State.READY;
this.expectCount = this.contexts.size();
this.state = State.WAIT_TASKS;
... | [
"private",
"synchronized",
"void",
"submit",
"(",
"final",
"String",
"command",
")",
"{",
"LOG",
".",
"log",
"(",
"Level",
".",
"INFO",
",",
"\"Submit command {0} to {1} evaluators. state: {2}\"",
",",
"new",
"Object",
"[",
"]",
"{",
"command",
",",
"this",
".... | Submit command to all available evaluators.
@param command shell command to execute. | [
"Submit",
"command",
"to",
"all",
"available",
"evaluators",
"."
] | e2c47121cde21108a602c560cf76565a40d0e916 | https://github.com/apache/reef/blob/e2c47121cde21108a602c560cf76565a40d0e916/lang/java/reef-examples/src/main/java/org/apache/reef/examples/hellohttp/HttpShellJobDriver.java#L128-L138 | train |
apache/reef | lang/java/reef-examples/src/main/java/org/apache/reef/examples/hellohttp/HttpShellJobDriver.java | HttpShellJobDriver.requestEvaluators | private synchronized void requestEvaluators() {
assert this.state == State.INIT;
LOG.log(Level.INFO, "Schedule on {0} Evaluators.", this.numEvaluators);
this.evaluatorRequestor.newRequest()
.setMemory(128)
.setNumberOfCores(1)
.setNumber(this.numEvaluators)
.submit();
thi... | java | private synchronized void requestEvaluators() {
assert this.state == State.INIT;
LOG.log(Level.INFO, "Schedule on {0} Evaluators.", this.numEvaluators);
this.evaluatorRequestor.newRequest()
.setMemory(128)
.setNumberOfCores(1)
.setNumber(this.numEvaluators)
.submit();
thi... | [
"private",
"synchronized",
"void",
"requestEvaluators",
"(",
")",
"{",
"assert",
"this",
".",
"state",
"==",
"State",
".",
"INIT",
";",
"LOG",
".",
"log",
"(",
"Level",
".",
"INFO",
",",
"\"Schedule on {0} Evaluators.\"",
",",
"this",
".",
"numEvaluators",
"... | Request the evaluators. | [
"Request",
"the",
"evaluators",
"."
] | e2c47121cde21108a602c560cf76565a40d0e916 | https://github.com/apache/reef/blob/e2c47121cde21108a602c560cf76565a40d0e916/lang/java/reef-examples/src/main/java/org/apache/reef/examples/hellohttp/HttpShellJobDriver.java#L166-L176 | train |
apache/reef | lang/java/reef-bridge-java/src/main/java/org/apache/reef/javabridge/generic/JobDriver.java | JobDriver.submit | private void submit(final ActiveContext context) {
try {
LOG.log(Level.INFO, "Send task to context: {0}", new Object[]{context});
if (JobDriver.this.handlerManager.getActiveContextHandler() == 0) {
throw new RuntimeException("Active Context Handler not initialized by CLR.");
}
final ... | java | private void submit(final ActiveContext context) {
try {
LOG.log(Level.INFO, "Send task to context: {0}", new Object[]{context});
if (JobDriver.this.handlerManager.getActiveContextHandler() == 0) {
throw new RuntimeException("Active Context Handler not initialized by CLR.");
}
final ... | [
"private",
"void",
"submit",
"(",
"final",
"ActiveContext",
"context",
")",
"{",
"try",
"{",
"LOG",
".",
"log",
"(",
"Level",
".",
"INFO",
",",
"\"Send task to context: {0}\"",
",",
"new",
"Object",
"[",
"]",
"{",
"context",
"}",
")",
";",
"if",
"(",
"... | Submit a Task to a single Evaluator. | [
"Submit",
"a",
"Task",
"to",
"a",
"single",
"Evaluator",
"."
] | e2c47121cde21108a602c560cf76565a40d0e916 | https://github.com/apache/reef/blob/e2c47121cde21108a602c560cf76565a40d0e916/lang/java/reef-bridge-java/src/main/java/org/apache/reef/javabridge/generic/JobDriver.java#L330-L344 | train |
apache/reef | lang/java/reef-webserver/src/main/java/org/apache/reef/webserver/HttpServerReefEventHandler.java | HttpServerReefEventHandler.readFile | private static String readFile(final String fileName) throws IOException {
return new String(Files.readAllBytes(Paths.get(fileName)), StandardCharsets.UTF_8);
} | java | private static String readFile(final String fileName) throws IOException {
return new String(Files.readAllBytes(Paths.get(fileName)), StandardCharsets.UTF_8);
} | [
"private",
"static",
"String",
"readFile",
"(",
"final",
"String",
"fileName",
")",
"throws",
"IOException",
"{",
"return",
"new",
"String",
"(",
"Files",
".",
"readAllBytes",
"(",
"Paths",
".",
"get",
"(",
"fileName",
")",
")",
",",
"StandardCharsets",
".",... | read a file and output it as a String. | [
"read",
"a",
"file",
"and",
"output",
"it",
"as",
"a",
"String",
"."
] | e2c47121cde21108a602c560cf76565a40d0e916 | https://github.com/apache/reef/blob/e2c47121cde21108a602c560cf76565a40d0e916/lang/java/reef-webserver/src/main/java/org/apache/reef/webserver/HttpServerReefEventHandler.java#L98-L100 | train |
apache/reef | lang/java/reef-webserver/src/main/java/org/apache/reef/webserver/HttpServerReefEventHandler.java | HttpServerReefEventHandler.writeEvaluatorInfoJsonOutput | private void writeEvaluatorInfoJsonOutput(
final HttpServletResponse response, final List<String> ids) throws IOException {
try {
final EvaluatorInfoSerializer serializer =
Tang.Factory.getTang().newInjector().getInstance(EvaluatorInfoSerializer.class);
final AvroEvaluatorsInfo evaluator... | java | private void writeEvaluatorInfoJsonOutput(
final HttpServletResponse response, final List<String> ids) throws IOException {
try {
final EvaluatorInfoSerializer serializer =
Tang.Factory.getTang().newInjector().getInstance(EvaluatorInfoSerializer.class);
final AvroEvaluatorsInfo evaluator... | [
"private",
"void",
"writeEvaluatorInfoJsonOutput",
"(",
"final",
"HttpServletResponse",
"response",
",",
"final",
"List",
"<",
"String",
">",
"ids",
")",
"throws",
"IOException",
"{",
"try",
"{",
"final",
"EvaluatorInfoSerializer",
"serializer",
"=",
"Tang",
".",
... | Write Evaluator info as JSON format to HTTP Response. | [
"Write",
"Evaluator",
"info",
"as",
"JSON",
"format",
"to",
"HTTP",
"Response",
"."
] | e2c47121cde21108a602c560cf76565a40d0e916 | https://github.com/apache/reef/blob/e2c47121cde21108a602c560cf76565a40d0e916/lang/java/reef-webserver/src/main/java/org/apache/reef/webserver/HttpServerReefEventHandler.java#L237-L249 | train |
apache/reef | lang/java/reef-webserver/src/main/java/org/apache/reef/webserver/HttpServerReefEventHandler.java | HttpServerReefEventHandler.writeEvaluatorInfoWebOutput | private void writeEvaluatorInfoWebOutput(
final HttpServletResponse response, final List<String> ids) throws IOException {
for (final String id : ids) {
final EvaluatorDescriptor evaluatorDescriptor = this.reefStateManager.getEvaluators().get(id);
final PrintWriter writer = response.getWriter();... | java | private void writeEvaluatorInfoWebOutput(
final HttpServletResponse response, final List<String> ids) throws IOException {
for (final String id : ids) {
final EvaluatorDescriptor evaluatorDescriptor = this.reefStateManager.getEvaluators().get(id);
final PrintWriter writer = response.getWriter();... | [
"private",
"void",
"writeEvaluatorInfoWebOutput",
"(",
"final",
"HttpServletResponse",
"response",
",",
"final",
"List",
"<",
"String",
">",
"ids",
")",
"throws",
"IOException",
"{",
"for",
"(",
"final",
"String",
"id",
":",
"ids",
")",
"{",
"final",
"Evaluato... | Write Evaluator info on the Response so that to display on web page directly.
This is for direct browser queries. | [
"Write",
"Evaluator",
"info",
"on",
"the",
"Response",
"so",
"that",
"to",
"display",
"on",
"web",
"page",
"directly",
".",
"This",
"is",
"for",
"direct",
"browser",
"queries",
"."
] | e2c47121cde21108a602c560cf76565a40d0e916 | https://github.com/apache/reef/blob/e2c47121cde21108a602c560cf76565a40d0e916/lang/java/reef-webserver/src/main/java/org/apache/reef/webserver/HttpServerReefEventHandler.java#L255-L289 | train |
apache/reef | lang/java/reef-webserver/src/main/java/org/apache/reef/webserver/HttpServerReefEventHandler.java | HttpServerReefEventHandler.writeEvaluatorsJsonOutput | private void writeEvaluatorsJsonOutput(final HttpServletResponse response) throws IOException {
LOG.log(Level.INFO, "HttpServerReefEventHandler writeEvaluatorsJsonOutput is called");
try {
final EvaluatorListSerializer serializer =
Tang.Factory.getTang().newInjector().getInstance(EvaluatorListSe... | java | private void writeEvaluatorsJsonOutput(final HttpServletResponse response) throws IOException {
LOG.log(Level.INFO, "HttpServerReefEventHandler writeEvaluatorsJsonOutput is called");
try {
final EvaluatorListSerializer serializer =
Tang.Factory.getTang().newInjector().getInstance(EvaluatorListSe... | [
"private",
"void",
"writeEvaluatorsJsonOutput",
"(",
"final",
"HttpServletResponse",
"response",
")",
"throws",
"IOException",
"{",
"LOG",
".",
"log",
"(",
"Level",
".",
"INFO",
",",
"\"HttpServerReefEventHandler writeEvaluatorsJsonOutput is called\"",
")",
";",
"try",
... | Get all evaluator ids and send it back to response as JSON. | [
"Get",
"all",
"evaluator",
"ids",
"and",
"send",
"it",
"back",
"to",
"response",
"as",
"JSON",
"."
] | e2c47121cde21108a602c560cf76565a40d0e916 | https://github.com/apache/reef/blob/e2c47121cde21108a602c560cf76565a40d0e916/lang/java/reef-webserver/src/main/java/org/apache/reef/webserver/HttpServerReefEventHandler.java#L294-L307 | train |
apache/reef | lang/java/reef-webserver/src/main/java/org/apache/reef/webserver/HttpServerReefEventHandler.java | HttpServerReefEventHandler.writeEvaluatorsWebOutput | private void writeEvaluatorsWebOutput(final HttpServletResponse response) throws IOException {
LOG.log(Level.INFO, "HttpServerReefEventHandler writeEvaluatorsWebOutput is called");
final PrintWriter writer = response.getWriter();
writer.println("<h1>Evaluators:</h1>");
for (final Map.Entry<String, E... | java | private void writeEvaluatorsWebOutput(final HttpServletResponse response) throws IOException {
LOG.log(Level.INFO, "HttpServerReefEventHandler writeEvaluatorsWebOutput is called");
final PrintWriter writer = response.getWriter();
writer.println("<h1>Evaluators:</h1>");
for (final Map.Entry<String, E... | [
"private",
"void",
"writeEvaluatorsWebOutput",
"(",
"final",
"HttpServletResponse",
"response",
")",
"throws",
"IOException",
"{",
"LOG",
".",
"log",
"(",
"Level",
".",
"INFO",
",",
"\"HttpServerReefEventHandler writeEvaluatorsWebOutput is called\"",
")",
";",
"final",
... | Get all evaluator ids and send it back to response so that can be displayed on web.
@param response
@throws IOException | [
"Get",
"all",
"evaluator",
"ids",
"and",
"send",
"it",
"back",
"to",
"response",
"so",
"that",
"can",
"be",
"displayed",
"on",
"web",
"."
] | e2c47121cde21108a602c560cf76565a40d0e916 | https://github.com/apache/reef/blob/e2c47121cde21108a602c560cf76565a40d0e916/lang/java/reef-webserver/src/main/java/org/apache/reef/webserver/HttpServerReefEventHandler.java#L315-L338 | train |
apache/reef | lang/java/reef-webserver/src/main/java/org/apache/reef/webserver/HttpServerReefEventHandler.java | HttpServerReefEventHandler.writeDriverJsonInformation | private void writeDriverJsonInformation(final HttpServletResponse response) throws IOException {
LOG.log(Level.INFO, "HttpServerReefEventHandler writeDriverJsonInformation invoked.");
try {
final DriverInfoSerializer serializer =
Tang.Factory.getTang().newInjector().getInstance(DriverInfoSeria... | java | private void writeDriverJsonInformation(final HttpServletResponse response) throws IOException {
LOG.log(Level.INFO, "HttpServerReefEventHandler writeDriverJsonInformation invoked.");
try {
final DriverInfoSerializer serializer =
Tang.Factory.getTang().newInjector().getInstance(DriverInfoSeria... | [
"private",
"void",
"writeDriverJsonInformation",
"(",
"final",
"HttpServletResponse",
"response",
")",
"throws",
"IOException",
"{",
"LOG",
".",
"log",
"(",
"Level",
".",
"INFO",
",",
"\"HttpServerReefEventHandler writeDriverJsonInformation invoked.\"",
")",
";",
"try",
... | Write Driver Info as JSON string to Response. | [
"Write",
"Driver",
"Info",
"as",
"JSON",
"string",
"to",
"Response",
"."
] | e2c47121cde21108a602c560cf76565a40d0e916 | https://github.com/apache/reef/blob/e2c47121cde21108a602c560cf76565a40d0e916/lang/java/reef-webserver/src/main/java/org/apache/reef/webserver/HttpServerReefEventHandler.java#L343-L358 | train |
apache/reef | lang/java/reef-webserver/src/main/java/org/apache/reef/webserver/HttpServerReefEventHandler.java | HttpServerReefEventHandler.writeResponse | private void writeResponse(final HttpServletResponse response, final String data) throws IOException {
final byte[] outputBody = data.getBytes(StandardCharsets.UTF_8);
response.getOutputStream().write(outputBody);
} | java | private void writeResponse(final HttpServletResponse response, final String data) throws IOException {
final byte[] outputBody = data.getBytes(StandardCharsets.UTF_8);
response.getOutputStream().write(outputBody);
} | [
"private",
"void",
"writeResponse",
"(",
"final",
"HttpServletResponse",
"response",
",",
"final",
"String",
"data",
")",
"throws",
"IOException",
"{",
"final",
"byte",
"[",
"]",
"outputBody",
"=",
"data",
".",
"getBytes",
"(",
"StandardCharsets",
".",
"UTF_8",
... | Write a String to HTTP Response. | [
"Write",
"a",
"String",
"to",
"HTTP",
"Response",
"."
] | e2c47121cde21108a602c560cf76565a40d0e916 | https://github.com/apache/reef/blob/e2c47121cde21108a602c560cf76565a40d0e916/lang/java/reef-webserver/src/main/java/org/apache/reef/webserver/HttpServerReefEventHandler.java#L363-L366 | train |
apache/reef | lang/java/reef-webserver/src/main/java/org/apache/reef/webserver/HttpServerReefEventHandler.java | HttpServerReefEventHandler.writeDriverWebInformation | private void writeDriverWebInformation(final HttpServletResponse response) throws IOException {
LOG.log(Level.INFO, "HttpServerReefEventHandler writeDriverWebInformation invoked.");
final PrintWriter writer = response.getWriter();
writer.println("<h1>Driver Information:</h1>");
writer.println(String... | java | private void writeDriverWebInformation(final HttpServletResponse response) throws IOException {
LOG.log(Level.INFO, "HttpServerReefEventHandler writeDriverWebInformation invoked.");
final PrintWriter writer = response.getWriter();
writer.println("<h1>Driver Information:</h1>");
writer.println(String... | [
"private",
"void",
"writeDriverWebInformation",
"(",
"final",
"HttpServletResponse",
"response",
")",
"throws",
"IOException",
"{",
"LOG",
".",
"log",
"(",
"Level",
".",
"INFO",
",",
"\"HttpServerReefEventHandler writeDriverWebInformation invoked.\"",
")",
";",
"final",
... | Get driver information. | [
"Get",
"driver",
"information",
"."
] | e2c47121cde21108a602c560cf76565a40d0e916 | https://github.com/apache/reef/blob/e2c47121cde21108a602c560cf76565a40d0e916/lang/java/reef-webserver/src/main/java/org/apache/reef/webserver/HttpServerReefEventHandler.java#L371-L392 | train |
apache/reef | lang/java/reef-webserver/src/main/java/org/apache/reef/webserver/HttpServerReefEventHandler.java | HttpServerReefEventHandler.writeLines | private void writeLines(final HttpServletResponse response, final ArrayList<String> lines, final String header)
throws IOException {
LOG.log(Level.INFO, "HttpServerReefEventHandler writeLines is called");
final PrintWriter writer = response.getWriter();
writer.println("<h1>" + header + "</h1>");
... | java | private void writeLines(final HttpServletResponse response, final ArrayList<String> lines, final String header)
throws IOException {
LOG.log(Level.INFO, "HttpServerReefEventHandler writeLines is called");
final PrintWriter writer = response.getWriter();
writer.println("<h1>" + header + "</h1>");
... | [
"private",
"void",
"writeLines",
"(",
"final",
"HttpServletResponse",
"response",
",",
"final",
"ArrayList",
"<",
"String",
">",
"lines",
",",
"final",
"String",
"header",
")",
"throws",
"IOException",
"{",
"LOG",
".",
"log",
"(",
"Level",
".",
"INFO",
",",
... | Write lines in ArrayList to the response writer.
@param response
@param lines
@param header
@throws IOException | [
"Write",
"lines",
"in",
"ArrayList",
"to",
"the",
"response",
"writer",
"."
] | e2c47121cde21108a602c560cf76565a40d0e916 | https://github.com/apache/reef/blob/e2c47121cde21108a602c560cf76565a40d0e916/lang/java/reef-webserver/src/main/java/org/apache/reef/webserver/HttpServerReefEventHandler.java#L401-L414 | train |
apache/reef | lang/java/reef-wake/wake/src/main/java/org/apache/reef/wake/remote/transport/netty/NettyMessagingTransport.java | NettyMessagingTransport.close | @Override
public void close() {
LOG.log(Level.FINE, "Closing netty transport socket address: {0}", this.localAddress);
final ChannelGroupFuture clientChannelGroupFuture = this.clientChannelGroup.close();
final ChannelGroupFuture serverChannelGroupFuture = this.serverChannelGroup.close();
final Chann... | java | @Override
public void close() {
LOG.log(Level.FINE, "Closing netty transport socket address: {0}", this.localAddress);
final ChannelGroupFuture clientChannelGroupFuture = this.clientChannelGroup.close();
final ChannelGroupFuture serverChannelGroupFuture = this.serverChannelGroup.close();
final Chann... | [
"@",
"Override",
"public",
"void",
"close",
"(",
")",
"{",
"LOG",
".",
"log",
"(",
"Level",
".",
"FINE",
",",
"\"Closing netty transport socket address: {0}\"",
",",
"this",
".",
"localAddress",
")",
";",
"final",
"ChannelGroupFuture",
"clientChannelGroupFuture",
... | Closes all channels and releases all resources. | [
"Closes",
"all",
"channels",
"and",
"releases",
"all",
"resources",
"."
] | e2c47121cde21108a602c560cf76565a40d0e916 | https://github.com/apache/reef/blob/e2c47121cde21108a602c560cf76565a40d0e916/lang/java/reef-wake/wake/src/main/java/org/apache/reef/wake/remote/transport/netty/NettyMessagingTransport.java#L201-L229 | train |
apache/reef | lang/java/reef-wake/wake/src/main/java/org/apache/reef/wake/remote/transport/netty/NettyMessagingTransport.java | NettyMessagingTransport.get | public <T> Link<T> get(final SocketAddress remoteAddr) {
final LinkReference linkRef = this.addrToLinkRefMap.get(remoteAddr);
return linkRef != null ? (Link<T>) linkRef.getLink() : null;
} | java | public <T> Link<T> get(final SocketAddress remoteAddr) {
final LinkReference linkRef = this.addrToLinkRefMap.get(remoteAddr);
return linkRef != null ? (Link<T>) linkRef.getLink() : null;
} | [
"public",
"<",
"T",
">",
"Link",
"<",
"T",
">",
"get",
"(",
"final",
"SocketAddress",
"remoteAddr",
")",
"{",
"final",
"LinkReference",
"linkRef",
"=",
"this",
".",
"addrToLinkRefMap",
".",
"get",
"(",
"remoteAddr",
")",
";",
"return",
"linkRef",
"!=",
"... | Returns a link for the remote address if already cached; otherwise, returns null.
@param remoteAddr the remote address
@return a link if already cached; otherwise, null | [
"Returns",
"a",
"link",
"for",
"the",
"remote",
"address",
"if",
"already",
"cached",
";",
"otherwise",
"returns",
"null",
"."
] | e2c47121cde21108a602c560cf76565a40d0e916 | https://github.com/apache/reef/blob/e2c47121cde21108a602c560cf76565a40d0e916/lang/java/reef-wake/wake/src/main/java/org/apache/reef/wake/remote/transport/netty/NettyMessagingTransport.java#L336-L339 | train |
apache/reef | lang/java/reef-wake/wake/src/main/java/org/apache/reef/wake/remote/transport/netty/NettyMessagingTransport.java | NettyMessagingTransport.registerErrorHandler | @Override
public void registerErrorHandler(final EventHandler<Exception> handler) {
this.clientEventListener.registerErrorHandler(handler);
this.serverEventListener.registerErrorHandler(handler);
} | java | @Override
public void registerErrorHandler(final EventHandler<Exception> handler) {
this.clientEventListener.registerErrorHandler(handler);
this.serverEventListener.registerErrorHandler(handler);
} | [
"@",
"Override",
"public",
"void",
"registerErrorHandler",
"(",
"final",
"EventHandler",
"<",
"Exception",
">",
"handler",
")",
"{",
"this",
".",
"clientEventListener",
".",
"registerErrorHandler",
"(",
"handler",
")",
";",
"this",
".",
"serverEventListener",
".",... | Registers the exception event handler.
@param handler the exception event handler | [
"Registers",
"the",
"exception",
"event",
"handler",
"."
] | e2c47121cde21108a602c560cf76565a40d0e916 | https://github.com/apache/reef/blob/e2c47121cde21108a602c560cf76565a40d0e916/lang/java/reef-wake/wake/src/main/java/org/apache/reef/wake/remote/transport/netty/NettyMessagingTransport.java#L366-L370 | train |
apache/reef | lang/java/reef-wake/wake/src/main/java/org/apache/reef/wake/remote/impl/HandlerContainer.java | HandlerContainer.registerHandler | @SuppressWarnings("checkstyle:diamondoperatorforvariabledefinition")
public AutoCloseable registerHandler(
final RemoteIdentifier sourceIdentifier,
final Class<? extends T> messageType,
final EventHandler<? super T> theHandler) {
final Tuple2<RemoteIdentifier, Class<? extends T>> tuple =
... | java | @SuppressWarnings("checkstyle:diamondoperatorforvariabledefinition")
public AutoCloseable registerHandler(
final RemoteIdentifier sourceIdentifier,
final Class<? extends T> messageType,
final EventHandler<? super T> theHandler) {
final Tuple2<RemoteIdentifier, Class<? extends T>> tuple =
... | [
"@",
"SuppressWarnings",
"(",
"\"checkstyle:diamondoperatorforvariabledefinition\"",
")",
"public",
"AutoCloseable",
"registerHandler",
"(",
"final",
"RemoteIdentifier",
"sourceIdentifier",
",",
"final",
"Class",
"<",
"?",
"extends",
"T",
">",
"messageType",
",",
"final",... | Subscribe for events from a given source and message type.
@param sourceIdentifier An identifier of an event source.
@param messageType Java class of messages to dispatch.
@param theHandler Message handler.
@return A new subscription object that will cancel its subscription on .close() | [
"Subscribe",
"for",
"events",
"from",
"a",
"given",
"source",
"and",
"message",
"type",
"."
] | e2c47121cde21108a602c560cf76565a40d0e916 | https://github.com/apache/reef/blob/e2c47121cde21108a602c560cf76565a40d0e916/lang/java/reef-wake/wake/src/main/java/org/apache/reef/wake/remote/impl/HandlerContainer.java#L79-L95 | train |
apache/reef | lang/java/reef-wake/wake/src/main/java/org/apache/reef/wake/remote/impl/HandlerContainer.java | HandlerContainer.registerHandler | public AutoCloseable registerHandler(
final Class<? extends T> messageType,
final EventHandler<RemoteMessage<? extends T>> theHandler) {
this.msgTypeToHandlerMap.put(messageType, theHandler);
LOG.log(Level.FINER, "Add handler for class: {0}", messageType.getCanonicalName());
return new Subscr... | java | public AutoCloseable registerHandler(
final Class<? extends T> messageType,
final EventHandler<RemoteMessage<? extends T>> theHandler) {
this.msgTypeToHandlerMap.put(messageType, theHandler);
LOG.log(Level.FINER, "Add handler for class: {0}", messageType.getCanonicalName());
return new Subscr... | [
"public",
"AutoCloseable",
"registerHandler",
"(",
"final",
"Class",
"<",
"?",
"extends",
"T",
">",
"messageType",
",",
"final",
"EventHandler",
"<",
"RemoteMessage",
"<",
"?",
"extends",
"T",
">",
">",
"theHandler",
")",
"{",
"this",
".",
"msgTypeToHandlerMap... | Subscribe for events of a given message type.
@param messageType Java class of messages to dispatch.
@param theHandler Message handler.
@return A new subscription object that will cancel its subscription on .close() | [
"Subscribe",
"for",
"events",
"of",
"a",
"given",
"message",
"type",
"."
] | e2c47121cde21108a602c560cf76565a40d0e916 | https://github.com/apache/reef/blob/e2c47121cde21108a602c560cf76565a40d0e916/lang/java/reef-wake/wake/src/main/java/org/apache/reef/wake/remote/impl/HandlerContainer.java#L103-L112 | train |
apache/reef | lang/java/reef-wake/wake/src/main/java/org/apache/reef/wake/remote/impl/HandlerContainer.java | HandlerContainer.registerErrorHandler | public AutoCloseable registerErrorHandler(final EventHandler<Exception> theHandler) {
this.transport.registerErrorHandler(theHandler);
return new SubscriptionHandler<>(
new Exception("Token for finding the error handler subscription"), this.unsubscribeException);
} | java | public AutoCloseable registerErrorHandler(final EventHandler<Exception> theHandler) {
this.transport.registerErrorHandler(theHandler);
return new SubscriptionHandler<>(
new Exception("Token for finding the error handler subscription"), this.unsubscribeException);
} | [
"public",
"AutoCloseable",
"registerErrorHandler",
"(",
"final",
"EventHandler",
"<",
"Exception",
">",
"theHandler",
")",
"{",
"this",
".",
"transport",
".",
"registerErrorHandler",
"(",
"theHandler",
")",
";",
"return",
"new",
"SubscriptionHandler",
"<>",
"(",
"... | Specify handler for error messages.
@param theHandler Error handler.
@return A new subscription object that will cancel its subscription on .close() | [
"Specify",
"handler",
"for",
"error",
"messages",
"."
] | e2c47121cde21108a602c560cf76565a40d0e916 | https://github.com/apache/reef/blob/e2c47121cde21108a602c560cf76565a40d0e916/lang/java/reef-wake/wake/src/main/java/org/apache/reef/wake/remote/impl/HandlerContainer.java#L119-L123 | train |
apache/reef | lang/java/reef-wake/wake/src/main/java/org/apache/reef/wake/remote/impl/HandlerContainer.java | HandlerContainer.unsubscribe | public void unsubscribe(final Subscription<T> subscription) {
final T token = subscription.getToken();
LOG.log(Level.FINER, "RemoteManager: {0} token {1}", new Object[]{this.name, token});
if (token instanceof Exception) {
this.transport.registerErrorHandler(null);
} else if (token instanceof Tupl... | java | public void unsubscribe(final Subscription<T> subscription) {
final T token = subscription.getToken();
LOG.log(Level.FINER, "RemoteManager: {0} token {1}", new Object[]{this.name, token});
if (token instanceof Exception) {
this.transport.registerErrorHandler(null);
} else if (token instanceof Tupl... | [
"public",
"void",
"unsubscribe",
"(",
"final",
"Subscription",
"<",
"T",
">",
"subscription",
")",
"{",
"final",
"T",
"token",
"=",
"subscription",
".",
"getToken",
"(",
")",
";",
"LOG",
".",
"log",
"(",
"Level",
".",
"FINER",
",",
"\"RemoteManager: {0} to... | Unsubscribes a handler.
@param subscription
@throws org.apache.reef.wake.remote.exception.RemoteRuntimeException if the Subscription type is unknown.
@deprecated [REEF-1544] Prefer using SubscriptionHandler and the corresponding methods
instead of the old Subscription class. Remove method after release 0.16. | [
"Unsubscribes",
"a",
"handler",
"."
] | e2c47121cde21108a602c560cf76565a40d0e916 | https://github.com/apache/reef/blob/e2c47121cde21108a602c560cf76565a40d0e916/lang/java/reef-wake/wake/src/main/java/org/apache/reef/wake/remote/impl/HandlerContainer.java#L133-L146 | train |
apache/reef | lang/java/reef-wake/wake/src/main/java/org/apache/reef/wake/remote/impl/HandlerContainer.java | HandlerContainer.onNext | @Override
@SuppressWarnings("checkstyle:diamondoperatorforvariabledefinition")
public synchronized void onNext(final RemoteEvent<byte[]> value) {
LOG.log(Level.FINER, "RemoteManager: {0} value: {1}", new Object[] {this.name, value});
final T decodedEvent = this.codec.decode(value.getEvent());
final Cl... | java | @Override
@SuppressWarnings("checkstyle:diamondoperatorforvariabledefinition")
public synchronized void onNext(final RemoteEvent<byte[]> value) {
LOG.log(Level.FINER, "RemoteManager: {0} value: {1}", new Object[] {this.name, value});
final T decodedEvent = this.codec.decode(value.getEvent());
final Cl... | [
"@",
"Override",
"@",
"SuppressWarnings",
"(",
"\"checkstyle:diamondoperatorforvariabledefinition\"",
")",
"public",
"synchronized",
"void",
"onNext",
"(",
"final",
"RemoteEvent",
"<",
"byte",
"[",
"]",
">",
"value",
")",
"{",
"LOG",
".",
"log",
"(",
"Level",
".... | Dispatch message received from the remote to proper event handler.
@param value Remote message, encoded as byte[]. | [
"Dispatch",
"message",
"received",
"from",
"the",
"remote",
"to",
"proper",
"event",
"handler",
"."
] | e2c47121cde21108a602c560cf76565a40d0e916 | https://github.com/apache/reef/blob/e2c47121cde21108a602c560cf76565a40d0e916/lang/java/reef-wake/wake/src/main/java/org/apache/reef/wake/remote/impl/HandlerContainer.java#L183-L225 | train |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.