name stringlengths 12 178 | code_snippet stringlengths 8 36.5k | score float64 3.26 3.68 |
|---|---|---|
rocketmq-connect_WorkerConnector_awaitShutdown_rdh | /**
* Wait for this connector to finish shutting down.
*
* @param timeoutMs
* time in milliseconds to await shutdown
* @return true if successful, false if the timeout was reached
*/
public boolean awaitShutdown(long timeoutMs) {
try {
return shutdownLatch.await(timeoutMs,
TimeUnit.MILLISECONDS);
} catch (Inte... | 3.26 |
rocketmq-connect_WorkerConnector_m0_rdh | /**
* initialize connector
*/
public void m0() {
try {
if ((!isSourceConnector()) && (!isSinkConnector())) {
throw new ConnectException("Connector implementations must be a subclass of either SourceConnector or SinkConnector");
}log.debug("{} Initializing connector {}", this, connector... | 3.26 |
rocketmq-connect_WorkerConnector_getKeyValue_rdh | /**
* connector config
*
* @return */
public ConnectKeyValue getKeyValue() {
return keyValue;
} | 3.26 |
rocketmq-connect_WorkerConnector_reconfigure_rdh | /**
* reconfigure
*
* @param keyValue
*/
public void reconfigure(ConnectKeyValue keyValue) {
try {
this.keyValue = keyValue;
m0();
connector.stop();
connector.start(keyValue);
} catch (Throwable throwable) {
throw new ConnectException(throwable);
}} | 3.26 |
rocketmq-connect_RocketMQScheduledReporter_reportTimers_rdh | /**
* report timers
*
* @param timers
*/
private void reportTimers(SortedMap<MetricName, Timer> timers) {
timers.forEach((name, timer) -> {
send(name, timer.getMeanRate());
});} | 3.26 |
rocketmq-connect_RocketMQScheduledReporter_reportHistograms_rdh | /**
* report histograms
*
* @param histograms
*/
private void reportHistograms(SortedMap<MetricName, Double> histograms) {
histograms.forEach((name, value) -> {
send(name, value);
});
} | 3.26 |
rocketmq-connect_RocketMQScheduledReporter_reportCounters_rdh | /**
* report counters
*
* @param counters
*/
private void reportCounters(SortedMap<MetricName, Long> counters) {counters.forEach((name, value) -> {
send(name, Double.parseDouble(value.toString()));
});
} | 3.26 |
rocketmq-connect_RocketMQScheduledReporter_reportGauges_rdh | /**
* report gauges
*
* @param gauges
*/
private void reportGauges(SortedMap<MetricName, Object> gauges) {
gauges.forEach((name, value) -> {
send(name, Double.parseDouble(value.toString()));
});
} | 3.26 |
rocketmq-connect_WorkerSourceTask_convertTransformedRecord_rdh | /**
* Convert the source record into a producer record.
*/
protected Message convertTransformedRecord(final String topic, ConnectRecord record) {
if (record == null) {
return null;
}
Message sourceMessage
= new Message();
sourceMessage.setTopic(topic);
byte[] key = retryWithToleranceOp... | 3.26 |
rocketmq-connect_WorkerSourceTask_execute_rdh | /**
* execute poll and send record
*/
@Override
protected void execute() {
while (isRunning()) {
updateCommittableOffsets();
if (shouldPause()) {
onPause();
try {
// wait unpause
if
(awaitUnpause()) {
onResume();
}
continue;
} catch (InterruptedExcepti... | 3.26 |
rocketmq-connect_WorkerSourceTask_initializeAndStart_rdh | /**
* initinalize and start
*/
@Override
protected void initializeAndStart() {
try {
producer.start();
} catch (MQClientException e) {
log.error("{} Source task producer start failed!!", this);
throw new ConnectException(e);
}
sourceTask.init(sourceTaskContext);
sourceTask.start(taskConfig);
log.info("{} ... | 3.26 |
rocketmq-connect_WorkerSourceTask_sendRecord_rdh | /**
* Send list of sourceDataEntries to MQ.
*/
private Boolean sendRecord() throws InterruptedException {
int processed = 0;
final CalcSourceRecordWrite
counter = new CalcSourceRecordWrite(toSendRecord.size(), sourceTaskMetricsGroup);
for (ConnectRecord preTransformRecord : toSendRecord) {
retryWithToleranceOperator.... | 3.26 |
rocketmq-connect_WorkerSourceTask_maybeCreateAndGetTopic_rdh | /**
* maybe create and get topic
*
* @param record
* @return */
private String maybeCreateAndGetTopic(ConnectRecord record) {
String topic = overwriteTopicFromRecord(record);
if (StringUtils.isBlank(topic))
{
// topic from config
topic = taskConfig.getString(SourceConnectorConfig.CONNEC... | 3.26 |
rocketmq-connect_WorkerSourceTask_recordSent_rdh | /**
* send success record
*
* @param preTransformRecord
* @param sourceMessage
* @param result
*/
private void recordSent(ConnectRecord preTransformRecord, Message sourceMessage, SendResult result) {
commitTaskRecord(preTransformRecord, result);
} | 3.26 |
rocketmq-connect_TopicNameStrategy_subjectName_rdh | /**
* generate subject name
*
* @param topic
* @param isKey
* @return */
public static String subjectName(String topic, boolean isKey) {return isKey ? topic + "-key" : topic + "-value";
} | 3.26 |
rocketmq-connect_AvroDatumReaderFactory_get_rdh | /**
* Get avro datum factory
*
* @return */
public static AvroDatumReaderFactory get(boolean useSchemaReflection, boolean avroUseLogicalTypeConverters,
boolean useSpecificAvroReader, boolean avroReflectionAllowNull) {
return new AvroDatumReaderFactory(useSchemaReflection, avroUseLogicalTypeConverters, useSpeci... | 3.26 |
rocketmq-connect_MemoryStateManagementServiceImpl_stop_rdh | /**
* Stop dependent services (if needed)
*/@Override
public void stop() {
} | 3.26 |
rocketmq-connect_MemoryStateManagementServiceImpl_get_rdh | /**
* Get the current state of the connector.
*
* @param connector
* the connector name
* @return the state or null if there is none
*/
@Override
public synchronized ConnectorStatus get(String connector) {
return connectors.get(connector);
} | 3.26 |
rocketmq-connect_MemoryStateManagementServiceImpl_putSafe_rdh | /**
* Safely set the state of the connector to the given value. What is
* considered "safe" depends on the implementation, but basically it
* means that the store can provide higher assurance that another worker
* hasn't concurrently written any conflicting data.
*
* @param status
* the status of the connector... | 3.26 |
rocketmq-connect_MemoryStateManagementServiceImpl_getAll_rdh | /**
* Get the states of all tasks for the given connector.
*
* @param connector
* the connector name
* @return a map from task ids to their respective status
*/
@Override
public synchronized Collection<TaskStatus> getAll(String connector) {
return new HashSet<>(tasks.row(connector).values());
} | 3.26 |
rocketmq-connect_MemoryStateManagementServiceImpl_initialize_rdh | /**
* initialize cb config
*
* @param config
*/
@Overridepublic void initialize(WorkerConfig config, RecordConverter converter) {
this.tasks = new Table<>();
this.connectors = new ConcurrentHashMap<>();
} | 3.26 |
rocketmq-connect_MemoryStateManagementServiceImpl_put_rdh | /**
* Set the state of the connector to the given value.
*
* @param status
* the status of the task
*/
@Override
public synchronized void put(TaskStatus status) {
if (status.getState() == State.DESTROYED) {
tasks.remove(status.getId().connector(), status.getId().task());
} else {tasks.put(statu... | 3.26 |
rocketmq-connect_DebeziumTimeTypes_maybeBindDebeziumLogical_rdh | /**
* maybe bind debezium logical
*
* @param statement
* @param index
* @param schema
* @param value
* @param timeZone
* @return * @throws SQLException
*/
public static boolean maybeBindDebeziumLogical(PreparedStatement statement, int index, Schema schema, Object v... | 3.26 |
rocketmq-connect_RebalanceImpl_doRebalance_rdh | /**
* Distribute connectors and tasks according to the {@link RebalanceImpl#allocateConnAndTaskStrategy}.
*/
public void doRebalance() {
List<String> curAliveWorkers = clusterManagementService.getAllAliveWorkers();
if (curAliveWorkers != null) {
if (clusterManagementService instanceof ClusterManagemen... | 3.26 |
rocketmq-connect_RebalanceImpl_updateProcessConfigsInRebalance_rdh | /**
* Start all the connectors and tasks allocated to current process.
*
* @param allocateResult
*/
private void updateProcessConfigsInRebalance(ConnAndTaskConfigs allocateResult) {
try {
worker.startConnectors(allocateResult.getConnectorCo... | 3.26 |
rocketmq-connect_CassandraSinkTask_start_rdh | /**
* Remember always close the CqlSession according to
* https://docs.datastax.com/en/developer/java-driver/4.5/manual/core/
*
* @param props
*/
@Override
public void start(KeyValue props) {
try {
ConfigUtil.load(props, this.config);
cqlSession = DBUtils.initCqlSession(config);
... | 3.26 |
rocketmq-connect_JsonSchemaData_nonOptionalSchema_rdh | /**
* no optional schema
*
* @param schema
* @return */
private static Schema nonOptionalSchema(Schema schema) {
return new Schema(schema.getName(), schema.getFieldType(), false, schema.getDefaultValue(), schema.getVersion(), schema.getDoc(), FieldType.STRUCT.equals(schema.getFieldType()) ? schema.getFields() : n... | 3.26 |
rocketmq-connect_JsonSchemaData_toConnectSchema_rdh | /**
* to connect schema
*
* @param jsonSchema
* @param version
* @param forceOptional
* @return */
private Schema toConnectSchema(Schema jsonSchema, Integer version, boolean forceOptional) {
if (jsonSchema == null) {
return null;
}
final SchemaBuilder builder;
if (jsonSchema instanceof BooleanSchema) {
... | 3.26 |
rocketmq-connect_JsonSchemaData_m0_rdh | /**
* Convert connect data to json schema
*
* @param schema
* @param logicalValue
* @return */
public JsonNode m0(Schema schema, Object logicalValue) {
if (logicalValue == null) {
if (schema == null) {
// Any schema is valid and we don't have a defa... | 3.26 |
rocketmq-connect_JsonSchemaData_toConnectData_rdh | /**
* to connect data
*
* @param schema
* @param jsonValue
* @return */
public static Object toConnectData(Schema schema, JsonNode jsonValue) {
final FieldType schemaType;
if (schema != null)
{
schemaType = schema.getFieldType();
if ((jsonValue == null) || jsonValue.isNull()) {
if (schema.getDef... | 3.26 |
rocketmq-connect_JsonSchemaData_fromJsonSchema_rdh | /**
* from json schema
*
* @param schema
* @return */public Schema fromJsonSchema(Schema schema) {
return rawSchemaFromConnectSchema(schema);
} | 3.26 |
rocketmq-connect_JsonSchemaData_allOfToConnectSchema_rdh | /**
* all of to connect schema
*
* @param combinedSchema
* @param version
* @param forceOptional
* @return */
private Schema allOfToConnectSchema(CombinedSchema combinedSchema, Integer version, boolean forceOptional) {
ConstSchema constSchema = null;
EnumSchema enumSchema = null;
NumberSchema number... | 3.26 |
rocketmq-connect_ChangeCaseConfig_to_rdh | /**
* to
*
* @return */
public CaseFormat to() {
return this.to;
} | 3.26 |
rocketmq-connect_ChangeCaseConfig_from_rdh | /**
* from
*
* @return */
public CaseFormat from() {
return this.f0;
} | 3.26 |
rocketmq-connect_MemoryConfigManagementServiceImpl_resumeConnector_rdh | /**
* resume connector
*
* @param connectorName
*/
@Override
public void resumeConnector(String connectorName) {
if (!connectorKeyValueStore.containsKey(connectorName)) {
throw new ConnectException(("Connector [" + connectorName) + "] does not exist");
}
ConnectKeyValue config = connectorKeyValueStore.get(connecto... | 3.26 |
rocketmq-connect_MemoryConfigManagementServiceImpl_getConnectorConfigs_rdh | /**
* get all connector configs enabled
*
* @return */
@Override
public Map<String, ConnectKeyValue> getConnectorConfigs() {
return connectorKeyValueStore.getKVMap();
} | 3.26 |
rocketmq-connect_MemoryConfigManagementServiceImpl_pauseConnector_rdh | /**
* pause connector
*
* @param connectorName
*/
@Override
public void
pauseConnector(String connectorName) {
if (!connectorKeyValueStore.containsKey(connectorName)) {
throw new ConnectException(("Connector [" + connectorName) + "] does not exist");
}
ConnectKeyValue config = connectorKeyValueStore.get(connectorNa... | 3.26 |
rocketmq-connect_DelegatingClassLoader_pluginClassLoader_rdh | /**
* Retrieve the PluginClassLoader associated with a plugin class
*
* @param name
* @return */
public PluginClassLoader pluginClassLoader(String name) {
if (StringUtils.isEmpty(name) || StringUtils.isBlank(name)) {
return null;
}
if (!PluginUtils.shouldLoadInIsolation(name)) {
ret... | 3.26 |
rocketmq-connect_BrokerBasedLog_send_rdh | /**
* send data to all workers
*
* @param key
* @param value
* @param callback
*/
@Override
public void send(K key,
V value, Callback callback) {
try {Map.Entry<byte[], byte[]> encode = encode(key, value);
byte[] body = encode.getValue();
if (body.length > MAX_MESSAGE_SIZE) {
log.e... | 3.26 |
rocketmq-connect_BrokerBasedLog_prepare_rdh | /**
* Preparation before startup
*/
private void prepare() {
Set<String> consumerGroupSet = ConnectUtil.fetchAllConsumerGroupList(workerConfig);
if (!consumerGroupSet.contains(groupName)) {
log.info("Try to create group: {}!", groupName);
ConnectUtil.createSubGroup(workerConfig,
gro... | 3.26 |
rocketmq-connect_BrokerBasedLog_readToLogEnd_rdh | /**
* read to log end
*/
private void readToLogEnd()
throws MQClientException, MQBrokerException, RemotingException, InterruptedException {
if (!enabledCompactTopic) {
return;
}
Map<MessageQueue, TopicOffset> minAndMaxOffsets = ConnectUtil.offsetTopics(workerConfig, Lists.n... | 3.26 |
rocketmq-connect_DefaultJdbcRecordBinder_getSqlTypeForSchema_rdh | /**
* Dialects not supporting `setObject(index, null)` can override this method
* to provide a specific sqlType, as per the JDBC documentation
*
* @param schema
* the schema
* @return the SQL type
*/
protected Integer
getSqlTypeForSchema(Schema
schema) {
return null;
} | 3.26 |
rocketmq-connect_JdbcSinkConnector_taskConfigs_rdh | /**
* Returns a set of configurations for Tasks based on the current configuration,
* producing at most count configurations.
*
* @param maxTasks
* maximum number of configurations to generate
* @return configurations for Tasks
*/
@Override
public List<KeyValue> taskCon... | 3.26 |
rocketmq-connect_JdbcSinkConnector_m0_rdh | /**
* Should invoke before start the connector.
*
* @param config
* @return error message
*/
@Override
public void m0(KeyValue config) {
// do validate config
} | 3.26 |
rocketmq-connect_LocalPositionManagementServiceImpl_replicaOffsets_rdh | /**
* send change position
*/
private void replicaOffsets() {
while (true) {
// wait for the last send to complete
if (committing.get()) {
try {
sleep(1000);
continue;
} catch (InterruptedException e) {
}
}
synchronize(false);... | 3.26 |
rocketmq-connect_LocalPositionManagementServiceImpl_restorePosition_rdh | /**
* restore position
*/
protected void restorePosition() {set(PositionChange.ONLINE, new ExtendRecordPartition(null, new HashMap<>()), new RecordOffset(new HashMap<>()));
} | 3.26 |
rocketmq-connect_SourceOffsetCompute_sourcePartitions_rdh | /**
* source partitions
*
* @param tableId
* @param offsetSuffix
* @return */
public static Map<String, String> sourcePartitions(String prefix, TableId
tableId, String offsetSuffix) {
String fqn = ExpressionBuilder.create().append(tableId, QuoteMethod.NEVER).toString();
Map<String, String> partition = n... | 3.26 |
rocketmq-connect_SourceOffsetCompute_buildTablePartitions_rdh | /**
* build table partitions
*
* @param tableLoadMode
* @param queryMode
* @param tables
* @param dialect
* @return */
private static Map<String, RecordPartition> buildTablePartitions(TableLoadMode tableLoadMode,
QueryMode
queryMode, List<String> tables, DatabaseDialect dialect, String offsetSuffix,
String
to... | 3.26 |
rocketmq-connect_SourceOffsetCompute_initOffset_rdh | /**
* init and compute offset
*
* @return */
public static Map<String, Map<String, Object>> initOffset(JdbcSourceTaskConfig config, SourceTaskContext context, DatabaseDialect dialect, CachedConnectionProvider cachedConnectionProvider) {
List<String> tables = config.getTables();
String query = config.getQu... | 3.26 |
rocketmq-connect_KafkaSinkValueConverter_convertKafkaValue_rdh | /**
* convert value
*
* @param targetSchema
* @param originalValue
* @return */private Object convertKafkaValue(Schema targetSchema, Object originalValue) {
if (targetSchema
== null) {
if (originalValue == null) {
return null;
}
return or... | 3.26 |
rocketmq-connect_KafkaSinkValueConverter_convertStructValue_rdh | /**
* convert struct value
*
* @param toStruct
* @param originalStruct
*/
private void convertStructValue(Struct toStruct, Struct originalStruct) {
for (Field field : toStruct.schema().fields()) {
try {
Schema.Type type = field.schema().type();
Object value = originalStruct.get(... | 3.26 |
rocketmq-connect_JsonSchemaDeserializer_deserialize_rdh | /**
* deserialize
*
* @param topic
* @param isKey
* @param payload
* @return */
@Override
public JsonSchemaAndValue deserialize(String topic, boolean isKey, byte[] payload) {
if (payload == null) {
return null;}
ByteBuffer buffer = ByteBuffer.wrap(payload);
long
v1 = buffer.getLong();
... | 3.26 |
rocketmq-connect_FilePositionManagementServiceImpl_call_rdh | /**
* Computes a result, or throws an exception if unable to do so.
*
* @return computed result
* @throws Exception
* if unable to compute a result
*/
@Override
public Void call() {try
{
positionStore.persist();
if (callback != null) {
callback.onCompletion(null, null, null);
}
} catch (Exce... | 3.26 |
rocketmq-connect_MySqlDatabaseDialect_getSqlType_rdh | /**
* get sql type
*
* @param field
* @return */
@Override
protected String getSqlType(SinkRecordField field) {
switch (field.schemaType()) {
case INT8 :
return "TINYINT";
case INT32 :
return "INT";
case INT64 :
return "BIGINT";
case FLOAT32... | 3.26 |
rocketmq-connect_ConfigManagementService_configure_rdh | /**
* Configure class with the given key-value pairs
*
* @param config
* can be DistributedConfig or StandaloneConfig
*/
default void configure(WorkerConfig config) {
} | 3.26 |
rocketmq-connect_StateManagementService_persist_rdh | /**
* Persist all the configs in a store.
*/
default void persist() {
} | 3.26 |
rocketmq-connect_KafkaConnectAdaptorSource_transforms_rdh | /**
* convert transform
*
* @param record
*/
@Override
protected SourceRecord transforms(SourceRecord record) {
List<Transformation> transformations = transformationWrapper.transformations();Iterator transformationIterator = transformations.iterator();
while (transfor... | 3.26 |
rocketmq-connect_SRemParser_m0_rdh | /**
* SREM key member [member ...]
*/public class SRemParser extends AbstractCommandParser {
@Override
public KVEntry m0() {
return RedisEntry.newEntry(FieldType.ARRAY);
} | 3.26 |
rocketmq-connect_AbstractKafkaSourceConnector_taskConfigs_rdh | /**
* Returns a set of configurations for Tasks based on the current configuration,
* producing at most count configurations.
*
* @param maxTasks
* maximum number of configurations to generate
* @return configurations for Tasks
*/
@Override public List<KeyValue> taskConfigs(int maxTasks) {
List<Map<Str... | 3.26 |
rocketmq-connect_AbstractKafkaSourceConnector_start_rdh | /**
* Start the component
*
* @param config
* component context
*/
@Override
public void start(KeyValue
config) {
this.configValue = new ConnectKeyValue();
config.keySet().forEach(key -> {
this.configValue.put(key, config.getString(key));
});
setConnectorClass(configValue);
taskConfig... | 3.26 |
rocketmq-connect_AbstractKafkaSourceConnector_originalSinkConnector_rdh | /**
* try override start and stop
*
* @return */
protected SourceConnector originalSinkConnector() {
return sourceConnector;
} | 3.26 |
rocketmq-connect_ConverterConfig_type_rdh | /**
* Get the type of converter as defined by the {@link #TYPE_CONFIG} configuration.
*
* @return the converter type; never null
*/
public ConverterType type(KeyValue
config) {
return ConverterType.withName(config.getString(TYPE_CONFIG));
} | 3.26 |
rocketmq-connect_DebeziumSqlServerConnector_taskClass_rdh | /**
* Return the current connector class
*
* @return task implement class
*/
@Override
public Class<? extends Task> taskClass() {
return DebeziumSqlServerSource.class;
} | 3.26 |
rocketmq-connect_AbstractKafkaSinkConnector_taskConfigs_rdh | /**
* Returns a set of configurations for Tasks based on the current configuration,
* producing at most count configurations.
*
* @param maxTasks
* maximum number of configurations to generate
* @return configurations for Tasks
*/
@Override
public List<KeyValue> taskConfigs(int maxTasks) {
List<Map<Strin... | 3.26 |
rocketmq-connect_AbstractKafkaSinkConnector_originalSinkConnector_rdh | /**
* try override start and stop
*
* @return */
protected SinkConnector originalSinkConnector() {
return sinkConnector;
} | 3.26 |
rocketmq-connect_AbstractKafkaSinkConnector_stop_rdh | /**
* Stop the component.
*/
@Override
public void stop() {
if (sinkConnector != null) {
sinkConnector = null;
configValue = null;
taskConfig = null;
}} | 3.26 |
rocketmq-connect_AbstractKafkaSinkConnector_start_rdh | /**
* Start the component
*
* @param config
* component context
*/
@Override
public void start(KeyValue config) {
this.configValue = new ConnectKeyValue();
config.keySet().forEach(key -> {
this.configValue.put(key, config.getString(key));
});
setConnectorClass(configValue);
taskConfi... | 3.26 |
rocketmq-connect_Serde_configure_rdh | /**
* configs in key/value pairs
*
* @param configs
*/
default void configure(Map<String, ?> configs) {
// intentionally left blank
} | 3.26 |
rocketmq-connect_TimestampIncrementingQuerier_beginTimestampValue_rdh | /**
* get begin timestamp from offset topic
*
* @return */
@Override
public Timestamp beginTimestampValue() {
return offset.getTimestampOffset();} | 3.26 |
rocketmq-connect_TimestampIncrementingQuerier_endTimestampValue_rdh | // Get end timestamp from db
@Override
public Timestamp endTimestampValue(Timestamp beginTime) throws SQLException {
long endTimestamp;
final long currentDbTime = dialect.currentTimeOnDB(stmt.getConnection(), DateTimeUtils.getTimeZoneCalendar(timeZone)).getTime();
... | 3.26 |
rocketmq-connect_PatternFilter_filter_rdh | /**
* filter map
*
* @param record
* @param map
* @return */
R filter(R record, Map map) {for (Object field : map.keySet()) {
if (!this.fields.contains(field)) {
continue;
}
Object value = map.get(field);
if (value instanceof String) {
String input = ((Str... | 3.26 |
rocketmq-connect_MemoryClusterManagementServiceImpl_stop_rdh | /**
* Stop the cluster manager.
*/
@Override
public void stop()
{
} | 3.26 |
rocketmq-connect_MemoryClusterManagementServiceImpl_configure_rdh | /**
* Configure class with the given key-value pairs
*
* @param config
* can be DistributedConfig or StandaloneConfig
*/
@Override
public void configure(WorkerConfig config) {
this.config = ((StandaloneConfig) (config));
} | 3.26 |
rocketmq-connect_MemoryClusterManagementServiceImpl_getAllAliveWorkers_rdh | /**
* Get all alive workers in the cluster.
*
* @return */
@Override
public List<String> getAllAliveWorkers() {
return Collections.singletonList(this.config.getWorkerId());
} | 3.26 |
rocketmq-connect_MemoryClusterManagementServiceImpl_start_rdh | /**
* Start the cluster manager.
*/
@Override
public void start() {
} | 3.26 |
rocketmq-connect_HudiSinkTask_start_rdh | /**
* Remember always close the CqlSession according to
* https://docs.datastax.com/en/developer/java-driver/4.5/manual/core/
*
* @param props
*/
@Override
public void start(KeyValue props) {
try {
ConfigUtil.load(props, this.hudiConnectConfig);
log.info("init data source success");
} catc... | 3.26 |
rocketmq-connect_MqttSinkTask_start_rdh | /**
*
* @param props
*/
@Override
public void start(KeyValue props) {
try {
ConfigUtil.load(props, this.sinkConnectConfig);log.info("init data source success");
} catch (Exception e) {
log.error("Cannot start MQTT Sink Task because of configuration error{}", e);
}
try {
updater = new Updater(sinkConn... | 3.26 |
rocketmq-connect_RocketMQKafkaSinkTaskContext_convertToRecordPartition_rdh | /**
* convert to rocketmq record partition
*
* @param topicPartition
* @return */
public RecordPartition convertToRecordPartition(TopicPartition topicPartition) {
if (topicPartition != null) {
return new RecordPartition(Collections.singletonMap(topicPartition.topic(), topicPartition.partition()));
... | 3.26 |
rocketmq-connect_RocketMQKafkaSinkTaskContext_convertToTopicPartition_rdh | /**
* convert to kafka topic partition
*
* @param partitionMap
* @return */
public TopicPartition convertToTopicPartition(Map<String, ?> partitionMap) {
if (partitionMap.containsKey(TOPIC) && partitionMap.containsKey(QUEUE_ID)) {
return new TopicPartition(partitionMap.get(TOPIC).toString(), Integer.val... | 3.26 |
rocketmq-connect_RecordOffsetManagement_ack_rdh | /**
* Acknowledge this record; signals that its offset may be safely committed.
*/
public void ack() {
if (this.acked.compareAndSet(false, true)) {
messageAcked();
}
} | 3.26 |
rocketmq-connect_RecordOffsetManagement_pollOffsetWhile_rdh | /**
*
* @param submittedPositions
* @return */
private RecordOffset pollOffsetWhile(Deque<SubmittedPosition> submittedPositions) {
RecordOffset offset = null;
// Stop pulling if there is an uncommitted breakpoint
while (canCommitHead(submittedPositions)) {offset = submittedPositions.poll().getPosition().getOffset()... | 3.26 |
rocketmq-connect_RecordOffsetManagement_awaitAllMessages_rdh | /**
* await all messages
*
* @param timeout
* @param timeUnit
* @return */
public boolean awaitAllMessages(long timeout, TimeUnit timeUnit) {
// Create a new message drain latch as a local variable to avoid SpotBugs warnings about inconsistent synchronization
// on an instance variable when invoking Count... | 3.26 |
rocketmq-connect_RecordOffsetManagement_submitRecord_rdh | /**
* submit record
*
* @param position
* @return */
public SubmittedPosition submitRecord(RecordPosition
position) {
SubmittedPosition submittedPosition = new SubmittedPosition(position);
records.computeIfAbsent(position.getPartition(), e -> new LinkedList<>()).add(submittedPos... | 3.26 |
rocketmq-connect_RecordOffsetManagement_remove_rdh | /**
* remove record
*
* @return */
public boolean remove() {
Deque<SubmittedPosition> deque = records.get(position.getPartition());
if (deque == null) {
return false;
}
boolean result = deque.removeLastOccurrence(this);
if (deque.isEmpty()) {
records.remove(position.getPartition());
}
if (result) {
messageAcked();
... | 3.26 |
rocketmq-connect_Worker_allocatedTasks_rdh | /**
* get connectors
*
* @return */
public Map<String, List<ConnectKeyValue>> allocatedTasks() {
return latestTaskConfigs;
} | 3.26 |
rocketmq-connect_Worker_checkAndReconfigureConnectors_rdh | /**
* check and reconfigure connectors
*
* @param assigns
*/
private void checkAndReconfigureConnectors(Map<String, ConnectKeyValue> assigns) {
if ((assigns == null) || assigns.isEmpty()) {
return;
}
for (String connectName : assigns.keySet()) {
if (!connectors.containsKey(connectName)) {
// new
... | 3.26 |
rocketmq-connect_Worker_checkRunningTasks_rdh | /**
* check running task
*
* @param connectorConfig
*/
private void checkRunningTasks(Map<String, List<ConnectKeyValue>> connectorConfig) {
// STEP 1: check running tasks and put to error status
for (Runnable runnable : runningTasks) {
WorkerTask workerTask = ((WorkerTask) (runnable));
Strin... | 3.26 |
rocketmq-connect_Worker_checkStoppedTasks_rdh | /**
* check stopped tasks
*/
private void checkStoppedTasks() {
for (Runnable runnable : stoppedTasks)
{
WorkerTask workerTask = ((WorkerTask) (runnable));
Future future = taskToFutureMap.get(runn... | 3.26 |
rocketmq-connect_Worker_startTasks_rdh | /**
* Start a collection of tasks with the given configs. If a task is already started with the same configs, it will
* not start again. If a task is already started but not contained in the new configs, it will stop.
*
* @param taskConfigs
* @throws Exception
*/
public void startTasks(Map<String, List<ConnectKe... | 3.26 |
rocketmq-connect_Worker_stopConnector_rdh | /**
* Stop a connector managed by this worker.
*
* @param connName
* the connector name.
*/
private void stopConnector(String connName) {
WorkerConnector workerConnector = connectors.get(connName);
log.info("Stopping connector {}", connName);if (workerConnector == null) {
log.warn("Ignoring stop... | 3.26 |
rocketmq-connect_Worker_startTask_rdh | /**
* start task
*
* @param newTasks
* @throws Exception
*/
private void startTask(Map<String, List<ConnectKeyValue>> newTasks) throws Exception {
for (String connectorName : newTasks.keySet()) {
for (ConnectKeyValue v62 : newTasks.get(connectorName)) {
int taskId = v62.getInt(ConnectorCon... | 3.26 |
rocketmq-connect_Worker_checkAndStopConnectors_rdh | /**
* check and stop connectors
*
* @param assigns
*/private void checkAndStopConnectors(Collection<String> assigns) {
Set<String> connectors = this.connectors.keySet();
if (CollectionUtils.isEmpty(assigns)) {
// delete all
for (String connector : connecto... | 3.26 |
rocketmq-connect_Worker_stopConnectors_rdh | /**
* stop connectors
*
* @param ids
*/
private void stopConnectors(Collection<String> ids) {
for (String connectorName : ids) {
stopConnector(connectorName);
}} | 3.26 |
rocketmq-connect_Worker_stopAndAwaitConnector_rdh | /**
* Stop a connector that belongs to this worker and await its termination.
*
* @param connName
* the name of the connector to be stopped.
*/
public void stopAndAwaitConnector(String connName) {
stopConnector(connName);
awaitStopConnectors(Collections.singletonList(connName));
} | 3.26 |
rocketmq-connect_Worker_allocatedConnectors_rdh | /**
* get connectors
*
* @return */
public Set<String> allocatedConnectors() {
return new HashSet<>(connectors.keySet());
} | 3.26 |
rocketmq-connect_Worker_getWorkingTasks_rdh | /**
* Beaware that we are not creating a defensive copy of these tasks
* So developers should only use these references for read-only purposes.
* These variables should be immutable
*
* @return */
public Set<Runnable> getWorkingTasks() {
return runningTasks;
} | 3.26 |
rocketmq-connect_Worker_isNeedStop_rdh | /**
* check is need stop
*
* @param taskConfig
* @param keyValues
* @return */
private boolean
isNeedStop(ConnectKeyValue taskConfig, List<ConnectKeyValue> keyValues) {
if (CollectionUtils.isEmpty(keyValues)) {
return true;
}
for (ConnectKeyValue keyValue : keyValues) {
if (keyValue.eq... | 3.26 |
rocketmq-connect_Worker_startConnectors_rdh | /**
* assign connector
* <p>
* Start a collection of connectors with the given configs. If a connector is already started with the same configs,
* it will not start again. If a connector is already started but not contained in the new configs, it will stop.
*
* @param connectorConfigs
* @param connectController
... | 3.26 |
rocketmq-connect_Worker_maintainTaskState_rdh | /**
* maintain task state
*
* @throws Exception
*/
public void maintainTaskState() throws Exception {
Map<String, List<ConnectKeyValue>> connectorConfig = new HashMap<>();
synchronized(latestTaskConfigs) {
connectorConfig.putAll(latestTaskConfigs);
}
// STEP 0 cleaned error Stopped Task
... | 3.26 |
rocketmq-connect_Worker_checkAndNewConnectors_rdh | /**
* check and new connectors
*
* @param assigns
*/
private Map<String, ConnectKeyValue> checkAndNewConnectors(Map<String, ConnectKeyValue> assigns) {
if ((assigns == null) || assigns.isEmpty()) { return new HashMap<>();
}
Map<String, ConnectKeyValue> newConnectors = new HashMap<>();
... | 3.26 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.