name
stringlengths 12
178
| code_snippet
stringlengths 8
36.5k
| score
float64 3.26
3.68
|
---|---|---|
hmily_SingletonHolder_register_rdh | /**
* register.
*
* @param <T>
* the type parameter
* @param clazz
* the clazz
* @param o
* the o
*/
public <T> void register(final Class<T> clazz, final Object o) {
SINGLES.put(clazz.getName(), o);
} | 3.26 |
hmily_NacosPassiveConfig_fileName_rdh | /**
* File name string.
*
* @return the string
*/
public String fileName() {
return (dataId + ".") + fileExtension;
} | 3.26 |
hmily_HmilyRepositoryFacade_removeHmilyParticipant_rdh | /**
* Remove hmily participant.
*
* @param participantId
* the participant id
*/
public void removeHmilyParticipant(final Long participantId) {
if (hmilyConfig.isPhyDeleted()) {
checkRows(hmilyRepository.removeHmilyParticipant(participantId));
} else {
updateHmilyParticipantStatus(participantId, HmilyActionEnum.DELETE.getCode());
}
} | 3.26 |
hmily_HmilyRepositoryFacade_findHmilyLockById_rdh | /**
* Find hmily lock by id.
*
* @param lockId
* lock id
* @return hmily lock
*/public Optional<HmilyLock> findHmilyLockById(final
String lockId) {
return hmilyRepository.findHmilyLockById(lockId);
} | 3.26 |
hmily_HmilyRepositoryFacade_findHmilyParticipant_rdh | /**
* Find hmily participant list.
*
* @param participantId
* the participant id
* @return the list
*/
public List<HmilyParticipant> findHmilyParticipant(final Long participantId) {
return hmilyRepository.findHmilyParticipant(participantId);
} | 3.26 |
hmily_HmilyRepositoryFacade_releaseHmilyLocks_rdh | /**
* Release hmily locks.
*
* @param locks
* locks
*/
public void releaseHmilyLocks(final Collection<HmilyLock> locks) {
checkRows(hmilyRepository.releaseHmilyLocks(locks), locks.size());
} | 3.26 |
hmily_HmilyRepositoryFacade_createHmilyParticipantUndo_rdh | /**
* Create hmily participant undo.
*
* @param undo
* the undo
*/
public void createHmilyParticipantUndo(final HmilyParticipantUndo undo) {
checkRows(hmilyRepository.createHmilyParticipantUndo(undo));
} | 3.26 |
hmily_HmilyRepositoryFacade_createHmilyParticipant_rdh | /**
* Create hmily participant.
*
* @param hmilyParticipant
* the hmily participant
*/
public void createHmilyParticipant(final HmilyParticipant hmilyParticipant) {
checkRows(hmilyRepository.createHmilyParticipant(hmilyParticipant));
} | 3.26 |
hmily_HmilyRepositoryFacade_removeHmilyParticipantUndo_rdh | /**
* Remove hmily participant undo.
*
* @param undoId
* the undo id
*/
public void removeHmilyParticipantUndo(final Long undoId) {
if (hmilyConfig.isPhyDeleted()) {
checkRows(hmilyRepository.removeHmilyParticipantUndo(undoId));
} else {
updateHmilyParticipantUndoStatus(undoId, HmilyActionEnum.DELETE.getCode());
}
} | 3.26 |
hmily_HmilyRepositoryFacade_updateHmilyParticipantStatus_rdh | /**
* Update hmily participant status.
*
* @param transId
* the trans id
* @param status
* the status
*/
public void updateHmilyParticipantStatus(final Long transId, final Integer status) {
checkRows(hmilyRepository.updateHmilyParticipantStatus(transId, status));
} | 3.26 |
hmily_HmilyRepositoryFacade_removeHmilyTransaction_rdh | /**
* Remove hmily transaction.
*
* @param transId
* the trans id
*/
public void removeHmilyTransaction(final Long transId) {
if (hmilyConfig.isPhyDeleted()) {
checkRows(hmilyRepository.removeHmilyTransaction(transId));
} else {
updateHmilyTransactionStatus(transId, HmilyActionEnum.DELETE.getCode());}
} | 3.26 |
hmily_HmilyRepositoryFacade_createHmilyTransaction_rdh | /**
* Create hmily transaction string.
*
* @param hmilyTransaction
* the hmily transaction
*/
public void createHmilyTransaction(final HmilyTransaction hmilyTransaction) {
checkRows(hmilyRepository.createHmilyTransaction(hmilyTransaction));
} | 3.26 |
hmily_HmilyRepositoryFacade_findUndoByParticipantId_rdh | /**
* Find undo by participant id list.
*
* @param participantId
* the participant id
* @return the list
*/
public List<HmilyParticipantUndo> findUndoByParticipantId(final Long participantId) {
return hmilyRepository.findHmilyParticipantUndoByParticipantId(participantId);
} | 3.26 |
hmily_HmilyRepositoryFacade_updateHmilyTransactionStatus_rdh | /**
* Update hmily transaction status int.
*
* @param transId
* the trans id
* @param status
* the status
*/
public void updateHmilyTransactionStatus(final Long transId,
final Integer status) {
checkRows(hmilyRepository.updateHmilyTransactionStatus(transId, status));
} | 3.26 |
hmily_HmilyRepositoryFacade_writeHmilyLocks_rdh | /**
* Write hmily locks.
*
* @param locks
* locks
*/
public void writeHmilyLocks(final Collection<HmilyLock> locks) {
int count = hmilyRepository.writeHmilyLocks(locks);
if (count != locks.size()) {
HmilyLock lock = locks.iterator().next();
throw new HmilyLockConflictException(String.format("current record [%s] has locked by transaction:[%s]",
lock.getLockId(), lock.getTransId()));
}
} | 3.26 |
hmily_BindData_of_rdh | /**
* Of bind data.
*
* @param <T>
* the type parameter
* @param type
* the type
* @param value
* the value
* @return the bind data
*/
public static <T> BindData<T> of(final DataType type, final Supplier<T> value) {
return new BindData<>(type, value);
} | 3.26 |
hmily_BindData_withValue_rdh | /**
* With value bind data.
*
* @param <T>
* the type parameter
* @param value
* the value
* @return the bind data
*/
public <T> BindData<T> withValue(final Supplier<T> value) {
return new BindData<>(this.type, value);
} | 3.26 |
hmily_HmilyRepositoryEventDispatcher_doDispatch_rdh | /**
* Do event dispatch.
*
* @param event
* the event
*/ public void doDispatch(final HmilyRepositoryEvent event) {
EventTypeEnum eventTypeEnum = EventTypeEnum.buildByCode(event.getType());
HmilyTransaction hmilyTransaction = event.getHmilyTransaction();
HmilyParticipant hmilyParticipant = event.getHmilyParticipant();
HmilyParticipantUndo hmilyParticipantUndo = event.getHmilyParticipantUndo();
switch (eventTypeEnum) {
case CREATE_HMILY_TRANSACTION :
HmilyRepositoryFacade.getInstance().createHmilyTransaction(event.getHmilyTransaction());
break;
case REMOVE_HMILY_TRANSACTION :
HmilyRepositoryFacade.getInstance().removeHmilyTransaction(hmilyTransaction.getTransId());
break;
case UPDATE_HMILY_TRANSACTION_STATUS :
HmilyRepositoryFacade.getInstance().updateHmilyTransactionStatus(hmilyTransaction.getTransId(), hmilyTransaction.getStatus());
break;
case CREATE_HMILY_PARTICIPANT :
HmilyRepositoryFacade.getInstance().createHmilyParticipant(event.getHmilyParticipant());
break;
case UPDATE_HMILY_PARTICIPANT_STATUS :
HmilyRepositoryFacade.getInstance().updateHmilyParticipantStatus(hmilyParticipant.getParticipantId(), hmilyParticipant.getStatus());
break;
case REMOVE_HMILY_PARTICIPANT :
HmilyRepositoryFacade.getInstance().removeHmilyParticipant(hmilyParticipant.getParticipantId());
break;
case CREATE_HMILY_PARTICIPANT_UNDO :
HmilyRepositoryFacade.getInstance().createHmilyParticipantUndo(hmilyParticipantUndo);
break;
case REMOVE_HMILY_PARTICIPANT_UNDO :
HmilyRepositoryFacade.getInstance().removeHmilyParticipantUndo(hmilyParticipantUndo.getUndoId());
break;
case WRITE_HMILY_LOCKS :
HmilyRepositoryFacade.getInstance().writeHmilyLocks(event.getHmilyLocks());
break;
case RELEASE_HMILY_LOCKS :HmilyRepositoryFacade.getInstance().releaseHmilyLocks(event.getHmilyLocks());
break;
default :
break;
}
} | 3.26 |
hmily_TransactionContext_getCoordinator_rdh | /**
* Gets coordinator.
*
* @return the coordinator
*/
public Coordinator getCoordinator() {
return
coordinator;
} | 3.26 |
hmily_TransactionContext_setCoordinator_rdh | /**
* Sets coordinator.
*
* @param coordinator
* the coordinator
*/
public void setCoordinator(final Coordinator coordinator) {
this.coordinator = coordinator;
} | 3.26 |
hmily_TransactionContext_setOneFinally_rdh | /**
* Sets one finally.
*
* @param oneFinally
* the one finally
*/
public void setOneFinally(final Finally oneFinally) {this.oneFinally = oneFinally;
} | 3.26 |
hmily_OrderServiceImpl_mockInventoryWithConfirmTimeout_rdh | /**
* 模拟在订单支付操作中,库存在Confirm阶段中的timeout
*
* @param count
* 购买数量
* @param amount
* 支付金额
* @return string
*/
@Override
public String mockInventoryWithConfirmTimeout(Integer count, BigDecimal amount) {
Order order =
saveOrder(count, amount);
paymentService.mockPaymentInventoryWithConfirmTimeout(order);
return "success";
} | 3.26 |
hmily_OrderServiceImpl_mockInventoryWithTryTimeout_rdh | /**
* 模拟在订单支付操作中,库存在try阶段中的timeout
*
* @param count
* 购买数量
* @param amount
* 支付金额
* @return string
*/
@Override
public String mockInventoryWithTryTimeout(Integer count, BigDecimal amount) {
Order order = saveOrder(count, amount);
return paymentService.mockPaymentInventoryWithTryTimeout(order);
} | 3.26 |
hmily_GrpcInvokeContext_getArgs_rdh | /**
* get args.
*
* @return args args
*/
public Object[] getArgs() {
return f0;} | 3.26 |
hmily_GrpcInvokeContext_setArgs_rdh | /**
* set args.
*
* @param args
* args
*/
public void setArgs(final Object[] args) {
this.f0 = args;
} | 3.26 |
hmily_DataSourceMetaDataLoader_load_rdh | /**
* Load data source meta data.
*
* @param dataSource
* data source
* @param databaseType
* database type
* @return datasource metadata
* @throws SQLException
* SQL exception
*/
public static DataSourceMetaData load(final DataSource dataSource, final DatabaseType databaseType) throws SQLException {
DataSourceMetaData result = new DataSourceMetaData();
try (MetaDataConnectionAdapter connectionAdapter = new MetaDataConnectionAdapter(databaseType, dataSource.getConnection())) {
for (String each : loadAllTableNames(connectionAdapter)) {Optional<TableMetaData> tableMetaData = TableMetaDataLoader.load(connectionAdapter, each, databaseType);
tableMetaData.ifPresent(meta -> result.getTableMetaDataMap().put(each, meta));
}
}
return result;} | 3.26 |
hmily_DeleteStatementAssembler_assembleHmilyDeleteStatement_rdh | /**
* Assemble Hmily delete statement.
*
* @param deleteStatement
* delete statement
* @param hmilyDeleteStatement
* hmily delete statement
* @return hmily delete statement
*/
public static HmilyDeleteStatement assembleHmilyDeleteStatement(final DeleteStatement deleteStatement, final HmilyDeleteStatement hmilyDeleteStatement) {
return hmilyDeleteStatement;
} | 3.26 |
hmily_FileUtils_readYAML_rdh | /**
* Read yaml string.
*
* @param yamlFile
* the yaml file
* @return the string
*/
@SneakyThrows
public static String readYAML(final String yamlFile) {return Files.readAllLines(Paths.get(ClassLoader.getSystemResource(yamlFile).toURI())).stream().filter(each -> !each.startsWith("#")).map(each -> each + System.lineSeparator()).collect(Collectors.joining());
} | 3.26 |
hmily_FileUtils_writeFile_rdh | /**
* Write file.
*
* @param fullFileName
* the full file name
* @param contents
* the contents
*/
public static void writeFile(final String fullFileName, final byte[] contents) {
try {
RandomAccessFile raf = new RandomAccessFile(fullFileName, "rw");try (FileChannel channel = raf.getChannel()) {
ByteBuffer buffer = ByteBuffer.allocate(contents.length);
buffer.put(contents);
buffer.flip();
while (buffer.hasRemaining()) {
channel.write(buffer);
}
channel.force(true);
}
} catch (IOException e) {
e.printStackTrace();
}
} | 3.26 |
hmily_MongoEntityConvert_convert_rdh | /**
* 转换mongo对象.
*
* @param entity
* mongo entity.
* @return hmily entity.
*/
public HmilyParticipantUndo convert(final UndoMongoEntity entity) {
HmilyParticipantUndo undo = new HmilyParticipantUndo();
undo.setUndoId(entity.getUndoId());
undo.setParticipantId(entity.getParticipantId());undo.setTransId(entity.getTransId());
undo.setResourceId(entity.getResourceId());
byte[] snapshotBytes = entity.getDataSnapshot();
try {HmilyDataSnapshot dataSnapshot = hmilySerializer.deSerialize(snapshotBytes, HmilyDataSnapshot.class);
undo.setDataSnapshot(dataSnapshot);
} catch (HmilySerializerException e) {
logger.error("mongo 存储序列化错误", e);
}
undo.setStatus(entity.getStatus());
return undo;
} | 3.26 |
hmily_MongoEntityConvert_m0_rdh | /**
* 转换mongo对象.
*
* @param entity
* mongo entity.
* @return hmily entity.
*/
public HmilyLock m0(final LockMongoEntity entity) {
return new HmilyLock(entity.getTransId(), entity.getParticipantId(), entity.getResourceId(), entity.getTargetTableName(), entity.getTargetTablePk());
} | 3.26 |
hmily_MongoEntityConvert_create_rdh | /**
* 转换mongo对象.
*
* @param lock
* hmily entity.
* @return mongo entity.
*/
public LockMongoEntity create(final HmilyLock lock) {
LockMongoEntity entity = new LockMongoEntity();
entity.setLockId(lock.getLockId());
entity.setTargetTableName(lock.getTargetTableName());
entity.setTargetTablePk(lock.getTargetTablePk());
entity.setResourceId(lock.getResourceId());
entity.setParticipantId(lock.getParticipantId());
entity.setTransId(lock.getTransId());
return entity;
} | 3.26 |
hmily_SofaHmilyOrderApplication_main_rdh | /**
* main.
*
* @param args
* args.
*/
public static void main(final String[] args) {
SpringApplication springApplication = new SpringApplication(SofaHmilyOrderApplication.class);
springApplication.run(args);
} | 3.26 |
hmily_HmilyXaResource_prepare_rdh | /**
* Prepare int.
*
* @return the int
* @throws XAException
* the xa exception
*/
public int prepare() throws XAException {
return this.prepare(this.xid);
} | 3.26 |
hmily_HmilyXaResource_forget_rdh | /**
* Forget.
*
* @throws XAException
* the xa exception
*/
public void forget() throws XAException {
this.forget(this.xid);
} | 3.26 |
hmily_HmilyXaResource_rollback_rdh | /**
* Rollback.
*
* @throws XAException
* the xa exception
*/
public void rollback() throws XAException {
this.rollback(this.xid);
} | 3.26 |
hmily_HmilyXaResource_start_rdh | /**
* Start.
*
* @param i
* the
* @throws XAException
* the xa exception
*/
public void start(final int i) throws XAException {
this.start(this.xid, i);
} | 3.26 |
hmily_HmilyXaResource_commit_rdh | /**
* Commit.
*
* @param b
* the b
* @throws XAException
* the xa exception
*/
public void commit(final boolean b) throws XAException {
this.commit(this.xid, b);
} | 3.26 |
hmily_HmilyXaResource_getXaResource_rdh | /**
* Gets xa resource.
*
* @return the xa resource
*/
public XAResource getXaResource() {
return xaResource;
} | 3.26 |
hmily_HmilyXaP6Datasource_m0_rdh | /**
* Gets hmily connection.
*
* @param xaConnection
* the connection
* @return the hmily connection
*/
private Connection m0(final XAConnection xaConnection) throws SQLException {
return new HmilyXaConnection(xaConnection);
} | 3.26 |
hmily_EtcdPassiveConfig_fileName_rdh | /**
* File name string.
*
* @return the string
*/
public String fileName() {
return (key +
".")
+ fileExtension;
} | 3.26 |
hmily_ZkPassiveConfig_fileName_rdh | /**
* File name string.
*
* @return the string
*/ public String fileName() {
return (path + ".") + fileExtension;} | 3.26 |
hmily_HmilyHashLoadBalance_select_rdh | /**
* Use load balancing to select invoker.
*
* @param invocation
* invocation
* @return Invoker
* @throws NoInvokerException
* NoInvokerException
*/
public Invoker<T> select(final InvokeContext invocation) throws NoInvokerException {
long
hash = Math.abs(StringUtils.convertLong(invocation.getAttachment(Constants.TARS_HASH), 0));
List<Invoker<T>> staticWeightInvokers = staticWeightInvokersCache;
if ((staticWeightInvokers != null) && (!staticWeightInvokers.isEmpty())) {
Invoker<T> invoker = staticWeightInvokers.get(((int) (hash % staticWeightInvokers.size())));
if (invoker.isAvailable()) {
return invoker;
}
ServantInvokerAliveStat stat = ServantInvokerAliveChecker.get(invoker.getUrl());
if (stat.isAlive() || ((stat.getLastRetryTime()
+ (config.getTryTimeInterval() * 1000)) < System.currentTimeMillis())) {
LOGGER.info("try to use inactive invoker|" + invoker.getUrl().toIdentityString());
stat.setLastRetryTime(System.currentTimeMillis());
return invoker;
}
}
List<Invoker<T>> sortedInvokers = sortedInvokersCache;
if ((sortedInvokers == null) || sortedInvokers.isEmpty()) {
throw new NoInvokerException("no such active connection invoker");
}
List<Invoker<T>> list = new ArrayList<Invoker<T>>();
for (Invoker<T> invoker : sortedInvokers) {
if (!invoker.isAvailable()) {
ServantInvokerAliveStat stat = ServantInvokerAliveChecker.get(invoker.getUrl());
if (stat.isAlive() || ((stat.getLastRetryTime() + (config.getTryTimeInterval() * 1000)) < System.currentTimeMillis())) {
list.add(invoker);
}
} else {
list.add(invoker);
}
}
// TODO When all is not available. Whether to randomly extract one
if (list.isEmpty()) {
throw new NoInvokerException(((config.getSimpleObjectName() + " try to select active invoker, size=") + sortedInvokers.size()) + ", no such active connection invoker");
}
Invoker<T> invoker = list.get(((int) (hash % list.size())));
if (!invoker.isAvailable()) {
LOGGER.info("try to use inactive invoker|" + invoker.getUrl().toIdentityString());
ServantInvokerAliveChecker.get(invoker.getUrl()).setLastRetryTime(System.currentTimeMillis()); }
return HmilyLoadBalanceUtils.doSelect(invoker, sortedInvokersCache);
} | 3.26 |
hmily_HmilyHashLoadBalance_refresh_rdh | /**
* Refresh local invoker.
*
* @param invokers
* invokers
*/
@Override
public void refresh(final Collection<Invoker<T>> invokers) {
LOGGER.info("{} try to refresh RoundRobinLoadBalance's invoker cache, size= {} ", config.getSimpleObjectName(), CollectionUtils.isEmpty(invokers) ? 0 : invokers.size());
if ((invokers == null) || invokers.isEmpty()) {
sortedInvokersCache = null;
staticWeightInvokersCache = null;
return;
}
List<Invoker<T>> sortedInvokersTmp = new ArrayList<Invoker<T>>(invokers);
Collections.sort(sortedInvokersTmp, comparator);
sortedInvokersCache = sortedInvokersTmp;
staticWeightInvokersCache = LoadBalanceHelper.buildStaticWeightList(sortedInvokersTmp, config);
LOGGER.info((((config.getSimpleObjectName() + " refresh HashLoadBalance's invoker cache done, staticWeightInvokersCache size=") + ((staticWeightInvokersCache == null) || staticWeightInvokersCache.isEmpty() ? 0 : staticWeightInvokersCache.size())) + ", sortedInvokersCache size=") + ((sortedInvokersCache
== null) || sortedInvokersCache.isEmpty() ? 0 : sortedInvokersCache.size()));
} | 3.26 |
hmily_HmilyTacTransactionManager_commit_rdh | /**
* Commit.
*
* @param currentTransaction
* the current transaction
*/
public void commit(final HmilyTransaction currentTransaction) {
log.debug("TAC-tm-commit ::: {}", currentTransaction);
if (Objects.isNull(currentTransaction)) {
return;
}
List<HmilyParticipant> hmilyParticipants = currentTransaction.getHmilyParticipants();
if (CollectionUtils.isEmpty(hmilyParticipants)) {
return;
}
List<Boolean> successList = Lists.newArrayList();
for (HmilyParticipant participant : hmilyParticipants) {
try {
if (participant.getRole() == HmilyRoleEnum.START.getCode()) {
HmilyTacLocalParticipantExecutor.confirm(participant);
} else {
HmilyReflector.executor(HmilyActionEnum.CONFIRMING, ExecutorTypeEnum.RPC, participant);
}
successList.add(true);
} catch (Throwable e) {
successList.add(false);
log.error("HmilyParticipant rollback exception :{} ", participant.toString());
} finally {
HmilyContextHolder.remove();
}
}
if (successList.stream().allMatch(e -> e)) {// remove global
HmilyRepositoryStorage.removeHmilyTransaction(currentTransaction);
}
} | 3.26 |
hmily_HmilyTacTransactionManager_rollback_rdh | /**
* Rollback.
*
* @param currentTransaction
* the current transaction
*/
public void rollback(final HmilyTransaction
currentTransaction) {
if (Objects.isNull(currentTransaction)) {
return;
}
log.debug("TAC-tm-rollback ::: {}", currentTransaction);
List<HmilyParticipant> hmilyParticipants = currentTransaction.getHmilyParticipants();
if (CollectionUtils.isEmpty(hmilyParticipants)) {
return;
}
List<Boolean> successList = Lists.newArrayList();
for (HmilyParticipant v8 : hmilyParticipants) {
try {
if (v8.getRole() == HmilyRoleEnum.START.getCode()) {
HmilyTacLocalParticipantExecutor.cancel(v8);
} else
{
HmilyReflector.executor(HmilyActionEnum.CANCELING, ExecutorTypeEnum.RPC, v8);
}
successList.add(true);
} catch (Throwable e) {
successList.add(false);
log.error("HmilyParticipant rollback exception :{} ", v8.toString());
} finally {HmilyContextHolder.remove();
}
}
if (successList.stream().allMatch(e -> e)) {
// remove global
HmilyRepositoryStorage.removeHmilyTransaction(currentTransaction);
}
} | 3.26 |
hmily_HmilyTacTransactionManager_begin_rdh | /**
* Begin hmily transaction.
*
* @param point
* proceeding join point
* @return the hmily transaction
*/
public HmilyTransaction begin(final ProceedingJoinPoint point) {
// 创建全局的事务,创建一个参与者
HmilyTransaction globalHmilyTransaction = createHmilyTransaction();
HmilyRepositoryStorage.createHmilyTransaction(globalHmilyTransaction);
final HmilyParticipant hmilyParticipant = buildHmilyParticipant(globalHmilyTransaction.getTransId());
HmilyRepositoryStorage.createHmilyParticipant(hmilyParticipant);
globalHmilyTransaction.registerParticipant(hmilyParticipant);
// save tacTransaction in threadLocal
HmilyTransactionHolder.getInstance().set(globalHmilyTransaction);
// set TacTransactionContext this context transfer remote
HmilyTransactionContext context = new HmilyTransactionContext();
// set action is try
context.setAction(HmilyActionEnum.TRYING.getCode());
context.setTransId(globalHmilyTransaction.getTransId());
context.setRole(HmilyRoleEnum.START.getCode());
context.setTransType(TransTypeEnum.TAC.name());
// set transaction isolation level
MethodSignature signature = ((MethodSignature) (point.getSignature()));
Method method = signature.getMethod();
final HmilyTAC hmilyTAC = method.getAnnotation(HmilyTAC.class);
context.setIsolationLevel(hmilyTAC.isolationLevel().getValue());
context.setLockRetryInterval(hmilyTAC.lockRetryInterval());
context.setLockRetryTimes(hmilyTAC.lockRetryTimes());
context.setParticipantId(hmilyParticipant.getParticipantId());
HmilyContextHolder.set(context);
log.debug("TAC-tm-begin ::: {}", globalHmilyTransaction);
return globalHmilyTransaction;
} | 3.26 |
hmily_HmilyTacTransactionManager_getInstance_rdh | /**
* Gets instance.
*
* @return the instance
*/
public static HmilyTacTransactionManager getInstance() {
return INSTANCE;
} | 3.26 |
hmily_HmilySQLComputeUtils_getAllColumns_rdh | /**
* Get all columns.
*
* @param segment
* hmily simple table segment
* @param tableName
* table name
* @return all table columns in asterisk way
*/
public static String getAllColumns(final HmilySimpleTableSegment segment, final String tableName) {
String result;
if (segment.getAlias().isPresent()) {
result = String.format("%s.*", segment.getAlias().get());
} else if (segment.getOwner().isPresent()) {
result = String.format("%s.%s.*", segment.getOwner(), tableName);
} else {
result = String.format("%s.*", tableName);
}
return result;
} | 3.26 |
hmily_HmilySQLComputeUtils_getAllPKColumns_rdh | /**
* Get all pk columns.
*
* @param segment
* hmily simple table segment
* @param tableName
* table name
* @param primaryKeyColumns
* primary key columns
* @return all table primary key columns in asterisk way
*/
public static String getAllPKColumns(final HmilySimpleTableSegment segment, final String tableName, final List<String>
primaryKeyColumns) {
StringBuilder pkNamesStr = new StringBuilder();
for (int i =
0; i < primaryKeyColumns.size(); i++) {
if (i > 0) {
pkNamesStr.append(" , ");
}
String pkName = null;
if (segment.getAlias().isPresent()) {pkName = String.format("%s.%s", segment.getAlias().get(), primaryKeyColumns.get(i));
} else if (segment.getOwner().isPresent()) {
pkName = String.format("%s.%s.%s", segment.getOwner(), tableName, primaryKeyColumns.get(i));
} else {pkName
= String.format("%s.%s", tableName, primaryKeyColumns.get(i));
}
pkNamesStr.append(pkName);
}
return pkNamesStr.toString();
} | 3.26 |
hmily_HmilyTransaction_registerParticipantList_rdh | /**
* Register participant list.
*
* @param hmilyParticipantList
* the hmily participant list
*/
public void registerParticipantList(final List<HmilyParticipant> hmilyParticipantList) {
hmilyParticipants.addAll(hmilyParticipantList);
} | 3.26 |
hmily_HmilyTransaction_registerParticipant_rdh | /**
* registerParticipant.
*
* @param hmilyParticipant
* {@linkplain HmilyParticipant}
*/
public void registerParticipant(final
HmilyParticipant hmilyParticipant) {if (Objects.nonNull(hmilyParticipant)) {
hmilyParticipants.add(hmilyParticipant);
}
} | 3.26 |
hmily_DisruptorProvider_onData_rdh | /**
* push data to disruptor queue.
*
* @param t
* the t
*/
public void onData(final T t) {
long v0 = ringBuffer.next();
try {
DataEvent<T> de = ringBuffer.get(v0);
de.setT(t);
ringBuffer.publish(v0);
} catch (Exception ex) {
logger.error("push data error:", ex);
}
} | 3.26 |
hmily_HmilyExecuteTemplate_rollback_rdh | /**
* Rollback.
*
* @param connection
* connection
*/
public void rollback(final Connection connection) {
if (check()) {
return;
}
List<HmilyUndoContext> contexts = HmilyUndoContextCacheManager.INSTANCE.get();
List<HmilyLock> locks = new LinkedList<>();
for (HmilyUndoContext context : contexts) {
locks.addAll(context.getHmilyLocks());
}
HmilyLockManager.INSTANCE.releaseLocks(locks);
clean(connection);
} | 3.26 |
hmily_HmilyExecuteTemplate_commit_rdh | /**
* Commit.
*
* @param connection
* the connection
*/
public void commit(final Connection connection) {
if (check()) {
return;
}
List<HmilyParticipantUndo> undoList = buildUndoList();
for (HmilyParticipantUndo undo
: undoList) {
HmilyParticipantUndoCacheManager.getInstance().cacheHmilyParticipantUndo(undo);
HmilyRepositoryStorage.createHmilyParticipantUndo(undo);
}
log.debug("TAC-persist-undo ::: {}", undoList);
clean(connection);
} | 3.26 |
hmily_HmilyExecuteTemplate_execute_rdh | /**
* Execute.
*
* @param sql
* SQL
* @param parameters
* parameters
* @param connectionInformation
* connection information
*/
public void execute(final String sql, final List<Object> parameters, final ConnectionInformation connectionInformation) {
if (check()) {
return;
}
HmilyStatement statement;
try {
statement = HmilySqlParserEngineFactory.newInstance().parser(sql, DatabaseTypes.INSTANCE.getDatabaseType());
log.debug("TAC-parse-sql ::: statement: {}", statement);
} catch (final Exception ex) {
return;
}
String resourceId = ResourceIdUtils.INSTANCE.getResourceId(connectionInformation.getUrl());
HmilySQLComputeEngine sqlComputeEngine = HmilySQLComputeEngineFactory.newInstance(statement);
HmilyTransactionContext transactionContext = HmilyContextHolder.get();int lockRetryInterval = transactionContext.getLockRetryInterval();
int lockRetryTimes = transactionContext.getLockRetryTimes();
// select SQL
if (statement instanceof HmilySelectStatement) {
if (IsolationLevelEnum.READ_COMMITTED.getValue() == transactionContext.getIsolationLevel()) {
// read committed level need check locks
executeSelect(sql, parameters, connectionInformation, sqlComputeEngine, resourceId, lockRetryInterval, lockRetryTimes);
}
return;
}
// update delete insert SQL
new HmilyLockRetryPolicy(lockRetryInterval, lockRetryTimes).execute(() -> {
HmilyDataSnapshot snapshot = sqlComputeEngine.execute(sql, parameters, connectionInformation.getConnection(), resourceId);
log.debug("TAC-compute-sql ::: {}", snapshot);
HmilyUndoContext undoContext = buildUndoContext(HmilyContextHolder.get(), snapshot, resourceId);
HmilyLockManager.INSTANCE.tryAcquireLocks(undoContext.getHmilyLocks());
log.debug("TAC-try-lock ::: {}", undoContext.getHmilyLocks());HmilyUndoContextCacheManager.INSTANCE.set(undoContext);
});
} | 3.26 |
hmily_HmilyExecuteTemplate_beforeSetAutoCommit_rdh | /**
* Sets auto commit.
*
* @param connection
* the connection
*/
public void beforeSetAutoCommit(final Connection connection) {
if
(check()) {
return;
}try {
boolean autoCommit = connection.getAutoCommit();
if (autoCommit) {
connection.setAutoCommit(false);
}
AutoCommitThreadLocal.INSTANCE.set(autoCommit);
} catch (SQLException e) {
e.printStackTrace();
}
} | 3.26 |
hmily_ColumnMetaDataLoader_load_rdh | /**
* Load column meta data list.
*
* @param connection
* connection
* @param tableNamePattern
* table name pattern
* @param databaseType
* database type
* @return column meta data list
* @throws SQLException
* SQL exception
*/
public static Collection<ColumnMetaData> load(final Connection connection, final String tableNamePattern, final DatabaseType databaseType) throws SQLException {
Collection<ColumnMetaData> result = new LinkedList<>();
Collection<String> primaryKeys = loadPrimaryKeys(connection, tableNamePattern);
List<String> columnNames = new ArrayList<>();
List<Integer> columnTypes = new ArrayList<>();
List<String> columnTypeNames = new ArrayList<>();
List<Boolean> isPrimaryKeys = new ArrayList<>();List<Boolean> isCaseSensitives = new ArrayList<>();
try (ResultSet resultSet = connection.getMetaData().getColumns(connection.getCatalog(), connection.getSchema(), tableNamePattern, "%"))
{
while (resultSet.next()) {
String tableName = resultSet.getString(TABLE_NAME);
if (Objects.equals(tableNamePattern, tableName)) {
String columnName = resultSet.getString(COLUMN_NAME);
columnTypes.add(resultSet.getInt(DATA_TYPE));
columnTypeNames.add(resultSet.getString(TYPE_NAME));
isPrimaryKeys.add(primaryKeys.contains(columnName));
columnNames.add(columnName);
}
}
}
try (ResultSet resultSet = connection.createStatement().executeQuery(generateEmptyResultSQL(tableNamePattern, databaseType))) {
for (String each : columnNames) {
isCaseSensitives.add(resultSet.getMetaData().isCaseSensitive(resultSet.findColumn(each)));
}
}
for (int i = 0; i < columnNames.size(); i++) {
result.add(new ColumnMetaData(columnNames.get(i), columnTypes.get(i), columnTypeNames.get(i), isPrimaryKeys.get(i), false, isCaseSensitives.get(i)));
}
return result;
} | 3.26 |
hmily_PropertyName_getInvalidChars_rdh | /**
* Gets invalid chars.
*
* @param elementValue
* the element value
* @return the invalid chars
*/
static List<Character> getInvalidChars(final CharSequence elementValue) {
List<Character> chars = new ArrayList<>();
for (int i = 0; i < elementValue.length(); i++) {
char ch = elementValue.charAt(i);
if (!isValidChar(ch, i)) { chars.add(ch);
}
}
return chars;
} | 3.26 |
hmily_PropertyName_isLastElementIndexed_rdh | /**
* 是否为最后一个元素.
*
* @return boolean. boolean
*/
public boolean isLastElementIndexed() {
int elementSize = getElementSize();
return (elementSize > 0) && m0(this.getElements()[elementSize - 1]);
} | 3.26 |
hmily_PropertyName_getLastElement_rdh | /**
* Gets last element.
*
* @return the last element
*/
public String getLastElement() {
int elementSize = getElementSize();
return elementSize != 0 ? getElement(elementSize - 1) : "";
} | 3.26 |
hmily_PropertyName_isValidElement_rdh | /**
* Is valid element boolean.
*
* @param elementValue
* the element value
* @return the boolean
*/
static boolean isValidElement(final CharSequence elementValue) {
for (int i = 0; i < elementValue.length(); i++) {
char ch = elementValue.charAt(i);
if (!isValidChar(ch, i)) {
return false;
}
}
return
true;
} | 3.26 |
hmily_PropertyName_chop_rdh | /**
* Return a new {@link PropertyName} by chopping this name to the given
* {@code size}. For example, {@code chop(1)} on the name {@code foo.bar} will return
* {@code foo}.
*
* @param size
* the size to chop
* @return the chopped name
*/
public PropertyName chop(final int size) {
if (size >= getElementSize()) {
return this;
}
String[] elements = new String[size];
System.arraycopy(this.elements, 0, elements, 0, size);
return new PropertyName(elements);
} | 3.26 |
hmily_PropertyName_isValidChar_rdh | /**
* Is valid char boolean.
*
* @param ch
* the ch
* @param index
* the index
* @return the boolean
*/
static boolean isValidChar(final char ch, final int index) {
return (isAlpha(ch) || isNumeric(ch)) || ((index != 0) && (ch == '-'));
} | 3.26 |
hmily_PropertyName_getElementSize_rdh | /**
* Gets element size.
*
* @return the element size
*/public int getElementSize() {
return this.elements.length;
} | 3.26 |
hmily_PropertyName_getElement_rdh | /**
* Gets element.
*
* @param index
* the index
* @return the element
*/
public String getElement(final int index) {
return getElements()[index];
} | 3.26 |
hmily_PropertyName_isIndexed_rdh | /**
* Whether the parameter of the index type list array.
*/
private boolean isIndexed(final int index) {
String element = getElement(index);
return
m0(element);
} | 3.26 |
hmily_PropertyName_append_rdh | /**
* Append property name.
*
* @param elementValue
* the element value
* @return the property name
*/
public PropertyName append(final String elementValue) {
if (elementValue == null) {
return this;
}
process(elementValue, (e, indexed) -> {
if (StringUtils.isBlank(e.get()) && LOGGER.isDebugEnabled()) {
LOGGER.debug("{} Did not find the corresponding property.", elementValue);
}
});
if (!m0(elementValue)) {
List<Character> invalidChars = ElementValidator.getInvalidChars(elementValue);
if (!invalidChars.isEmpty()) {
throw new ConfigException(("config property name " + elementValue) + " is not valid");
}
}
int length = this.elements.length;
String[] elements = new String[length + 1];
System.arraycopy(this.elements, 0, elements, 0, length);
elements[length] = elementValue;
return new PropertyName(elements);
} | 3.26 |
hmily_PropertyName_isNumericIndex_rdh | /**
* Return if the element in the name is indexed and numeric.
*
* @param elementIndex
* the index of the element
* @return {@code true} if the element is indexed and numeric
*/
public boolean isNumericIndex(final
int elementIndex) {
return isIndexed(elementIndex) && isNumeric(getElement(elementIndex));
} | 3.26 |
hmily_PropertyName_of_rdh | /**
* property key 转换为一个PropertyName对象.
*
* @param name
* name;
* @return this property name
*/
public static PropertyName of(final String name) {
return Optional.ofNullable(name).filter(n -> n.length() > 1).filter(n -> (n.charAt(0) != NAME_JOIN) && (n.charAt(n.length() - 1) !=
NAME_JOIN)).map(n -> {
List<String> elements = new ArrayList<>(16);
process(n, (e, indexed) -> {
String
element = e.get();
if (element.length() > 0) {
elements.add(element);
}
});
return new PropertyName(elements.toArray(new String[0]));
}).orElse(EMPTY);
} | 3.26 |
hmily_PropertyName_m0_rdh | /**
* Whether the parameter of the index type list array.
*/private
static boolean m0(final CharSequence element) {
return (element.charAt(0) == '[') && possibleIsIndexed(element);
} | 3.26 |
hmily_PropertyName_isEmpty_rdh | /**
* Is empty boolean.
*
* @return the boolean
*/
public boolean isEmpty() {
return this.getElementSize() == 0;} | 3.26 |
hmily_PropertyName_isAncestorOf_rdh | /**
* Determine if the node name of the pointing is a parent. If yes, return true.
*
* @param name
* name.
* @return boolean boolean
*/
public boolean isAncestorOf(final PropertyName name) {
if (this.getElements().length >= name.getElements().length) {
return false;
}
for (int v11 = 0; v11 < this.elements.length; v11++) {if (!Objects.equals(this.elements[v11], name.elements[v11])) {
return false;
}
}
return true;
} | 3.26 |
hmily_HmilyLock_getLockId_rdh | /**
* Get lock id.
*
* @return lock id
*/
public String getLockId() {
return Joiner.on(";;").join(resourceId, targetTableName, targetTablePk);
} | 3.26 |
hmily_HmilyReflector_executor_rdh | /**
* Executor object.
*
* @param action
* the action
* @param executorType
* the executor type
* @param hmilyParticipant
* the hmily participant
* @return the object
* @throws Exception
* the exception
*/
public static Object executor(final HmilyActionEnum action, final ExecutorTypeEnum executorType, final HmilyParticipant hmilyParticipant) throws Exception {setContext(action, hmilyParticipant);
if ((executorType == ExecutorTypeEnum.RPC) && (hmilyParticipant.getRole() != HmilyRoleEnum.START.getCode())) {
if (action == HmilyActionEnum.CONFIRMING) {
return executeRpc(hmilyParticipant.getConfirmHmilyInvocation());
} else {
return executeRpc(hmilyParticipant.getCancelHmilyInvocation());
}
} else if (action == HmilyActionEnum.CONFIRMING) {
return executeLocal(hmilyParticipant.getConfirmHmilyInvocation(), hmilyParticipant.getTargetClass(), hmilyParticipant.getConfirmMethod());
} else {
return executeLocal(hmilyParticipant.getCancelHmilyInvocation(), hmilyParticipant.getTargetClass(), hmilyParticipant.getCancelMethod());
}
} | 3.26 |
hmily_ReflectObject_provide_rdh | /**
* The type Reflect object.
*
* @author xiaoyu
*/public class ReflectObject implements ObjectProvide {
@Override
@SneakyThrows
public Object provide(final Class<?> clazz) {
return clazz.newInstance();
} | 3.26 |
hmily_HmilyFeignConfiguration_hmilyFeignInterceptor_rdh | /**
* The type Hmily spring cloud configuration.
*
* @author xiaoyu(Myth)
*/
@Configurationpublic class HmilyFeignConfiguration {
/**
* Hmily rest template interceptor request interceptor.
*
* @return the request interceptor
*/
@Bean
@Qualifier("hmilyFeignInterceptor")
public RequestInterceptor hmilyFeignInterceptor() {
return new HmilyFeignInterceptor();
} | 3.26 |
hmily_HmilyFeignConfiguration_hmilyHystrixConcurrencyStrategy_rdh | /**
* Hystrix concurrency strategy hystrix concurrency strategy.
*
* @return the hystrix concurrency strategy
*/
@Bean
@ConditionalOnProperty(name = "feign.hystrix.enabled")
public HystrixConcurrencyStrategy hmilyHystrixConcurrencyStrategy() {
return new HmilyHystrixConcurrencyStrategy();
} | 3.26 |
hmily_AutoCommitThreadLocal_remove_rdh | /**
* Remove.
*/
public void remove() {
CURRENT_LOCAL.remove();
} | 3.26 |
hmily_AutoCommitThreadLocal_set_rdh | /**
* Set.
*
* @param oldAutoCommit
* the old auto commit
*/
public void set(final boolean oldAutoCommit) {CURRENT_LOCAL.set(oldAutoCommit);
} | 3.26 |
hmily_ZookeeperRepository_nextPath_rdh | /**
* Next path string.
*
* @return the string
*/
public String nextPath() {
path = (path + "/") + f0[index];
index++;
return path;
} | 3.26 |
hmily_ZookeeperRepository_hasNext_rdh | /**
* Has next boolean.
*
* @return the boolean
*/public boolean hasNext() {
return index < f0.length;
} | 3.26 |
hmily_XaState_valueOf_rdh | /**
* Value of xa state.
*
* @param state
* the state
* @return the xa state
*/
public static XaState valueOf(final int state) {
return Arrays.stream(XaState.values()).filter(e -> e.getState() == state).findFirst().orElse(STATUS_UNKNOWN);
} | 3.26 |
hmily_HmilyPostgreSQLInsertStatement_getWithSegment_rdh | /**
* Get with segment.
*
* @return with segment.
*/
public Optional<HmilyWithSegment> getWithSegment() {
return Optional.ofNullable(withSegment);
} | 3.26 |
hmily_ConsistentHashSelector_md5_rdh | /**
* Md 5 byte [ ].
*
* @param value
* the value
* @return the byte [ ]
*/
private byte[] md5(final String value) {
MessageDigest md5;
try {
md5 = MessageDigest.getInstance("MD5");
} catch (NoSuchAlgorithmException e) {
throw new IllegalStateException(e.getMessage(), e);
}
md5.reset();
byte[] bytes;
bytes = value.getBytes(StandardCharsets.UTF_8);
md5.update(bytes);
return md5.digest();
} | 3.26 |
hmily_ConsistentHashSelector_selectForKey_rdh | /**
* Select for key singleton executor.
*
* @param hash
* the hash
* @return the singleton executor
*/
private SingletonExecutor selectForKey(final long hash) {
SingletonExecutor invoker;
Long key = hash;
if (!virtualInvokers.containsKey(key)) {
SortedMap<Long, SingletonExecutor> tailMap = virtualInvokers.tailMap(key);
if (tailMap.isEmpty()) {
key = virtualInvokers.firstKey();
} else {
key = tailMap.firstKey();}
}
invoker = virtualInvokers.get(key);
return invoker;
} | 3.26 |
hmily_ConsistentHashSelector_hash_rdh | /**
* Ketama is a hash algorithm.
*
* @param digest
* digest;
* @param number
* numerical;
* @return hash value ;
*/
private long hash(final byte[] digest, final int number) {
return
((((((long) (digest[3 + (number * 4)] & 0xff)) << 24) |
(((long) (digest[2 + (number * 4)] & 0xff)) << 16)) | (((long) (digest[1 + (number * 4)] & 0xff)) << 8)) | (digest[number * 4] & 0xff)) & 0xffffffffL;
} | 3.26 |
hmily_ConsistentHashSelector_select_rdh | /**
* Select singleton executor.
*
* @param key
* the key
* @return the singleton executor
*/
public SingletonExecutor select(final String key) {
byte[] digest = md5(key);
return selectForKey(hash(digest, 0));
} | 3.26 |
hmily_GrpcHmilyContext_getHmilyClass_rdh | /**
* get hmilyClass conext.
*
* @return ThreadLocal
*/
public static ThreadLocal<GrpcInvokeContext> getHmilyClass() {
return hmilyClass;
} | 3.26 |
hmily_GrpcHmilyContext_removeAfterInvoke_rdh | /**
* remove hmily conext after invoke.
*/
public static void removeAfterInvoke() {
GrpcHmilyContext.getHmilyClass().remove();
} | 3.26 |
hmily_HmilyExpressionBuilder_extractAndPredicates_rdh | /**
* Extract and predicates.
*
* @return Or predicate segment.
*/
public HmilyOrPredicateSegment extractAndPredicates() {
HmilyOrPredicateSegment result = new HmilyOrPredicateSegment();
if (expression instanceof HmilyBinaryOperationExpression) {
String operator = ((HmilyBinaryOperationExpression) (expression)).getOperator();
Optional<HmilyLogicalOperator> logicalOperator = HmilyLogicalOperator.valueFrom(operator);
if (logicalOperator.isPresent() && (HmilyLogicalOperator.OR == logicalOperator.get())) {
HmilyExpressionBuilder leftBuilder = new HmilyExpressionBuilder(((HmilyBinaryOperationExpression) (expression)).getLeft());
HmilyExpressionBuilder rightBuilder = new HmilyExpressionBuilder(((HmilyBinaryOperationExpression) (expression)).getRight());
result.getHmilyAndPredicates().addAll(leftBuilder.extractAndPredicates().getHmilyAndPredicates());
result.getHmilyAndPredicates().addAll(rightBuilder.extractAndPredicates().getHmilyAndPredicates());
} else if (logicalOperator.isPresent() && (HmilyLogicalOperator.AND == logicalOperator.get())) {HmilyExpressionBuilder leftBuilder = new HmilyExpressionBuilder(((HmilyBinaryOperationExpression) (expression)).getLeft());
HmilyExpressionBuilder rightBuilder = new HmilyExpressionBuilder(((HmilyBinaryOperationExpression) (expression)).getRight());
for (HmilyAndPredicate eachLeft : leftBuilder.extractAndPredicates().getHmilyAndPredicates()) {
for (HmilyAndPredicate eachRight : rightBuilder.extractAndPredicates().getHmilyAndPredicates()) {
result.getHmilyAndPredicates().add(createAndPredicate(eachLeft, eachRight));
}
}
} else {
HmilyAndPredicate andPredicate = new HmilyAndPredicate();
andPredicate.getPredicates().add(expression);
result.getHmilyAndPredicates().add(andPredicate);
}
} else {
HmilyAndPredicate andPredicate = new HmilyAndPredicate();
andPredicate.getPredicates().add(expression);
result.getHmilyAndPredicates().add(andPredicate);
}
return result;
} | 3.26 |
hmily_MotanServerConfig_baseServiceConfig_rdh | /**
* Base service config basic service config bean.
*
* @return the basic service config bean
*/
@Bean
@ConfigurationProperties(prefix = "hmily.motan.server") public BasicServiceConfigBean baseServiceConfig() {
return new BasicServiceConfigBean();
} | 3.26 |
hmily_PropertyKey_isAvailable_rdh | /**
* Is available boolean.
*
* @param name
* the name
* @return the boolean
*/public boolean isAvailable(final PropertyName name) {
return propertyName.equals(name);
} | 3.26 |
hmily_ConfigLoaderServer_load_rdh | /**
* Load config.
*/
public static void load() {
// Start processing the associated parameters.
ConfigScan.scan();
ServerConfigLoader loader = new ServerConfigLoader();
loader.load(ConfigLoader.Context::new, (context, config) -> {
if (config != null) {
if (StringUtils.isNotBlank(config.getConfigMode())) {
String configMode = config.getConfigMode();
ConfigLoader<?> configLoader = ExtensionLoaderFactory.load(ConfigLoader.class, configMode);
log.info("Load the configuration【{}】information...", configMode);
configLoader.load(context, (contextAfter, configAfter) -> {
log.info("Configuration information: {}", configAfter);
});}
}
});
} | 3.26 |
hmily_SerializeEnum_acquire_rdh | /**
* Acquire serialize protocol serialize protocol enum.
*
* @param serialize
* the serialize protocol
* @return the serialize protocol enum
*/
public static SerializeEnum acquire(final String
serialize) {
Optional<SerializeEnum> serializeEnum = Arrays.stream(SerializeEnum.values()).filter(v -> Objects.equals(v.getSerialize(), serialize)).findFirst();
return serializeEnum.orElse(SerializeEnum.KRYO);
} | 3.26 |
hmily_HmilyDeleteStatement_getWhere_rdh | /**
* Get where.
*
* @return where segment
*/
public Optional<HmilyWhereSegment> getWhere() {
return Optional.ofNullable(where);
} | 3.26 |
hmily_PropertyKeyParse_isFrom_rdh | /**
* Is from boolean.
*
* @param from
* the from
* @return the boolean
*/
boolean isFrom(final T from) {
return Objects.equals(from, this.from);
} | 3.26 |
hmily_PropertyKeyParse_parse_rdh | /**
* Parse property key [ ].
*
* @param propertyName
* the property name
* @return the property key [ ]
*/
public PropertyKey[] parse(final String propertyName) {
// Use a local copy in case another thread changes things
LastKey<String> last = this.lastKeyStr;
if ((last != null) && last.isFrom(propertyName)) {
return last.getKeys();
}
PropertyKey[] mapping = m0(propertyName);
this.lastKeyStr = new LastKey<>(propertyName, mapping);
return mapping;
} | 3.26 |
hmily_SpringCloudXaAutoConfiguration_hmilyXaPostProcessor_rdh | /**
* Register {@link FeignBeanPostProcessor} Bean.
*
* @return {@link FeignBeanPostProcessor} Bean
*/
@Bean
public static FeignBeanPostProcessor hmilyXaPostProcessor() {
return new FeignBeanPostProcessor();
} | 3.26 |
hmily_GrpcHmilyConfiguration_grpcHmilyClient_rdh | /**
* add grpcHmilyClient.
*
* @return grpcHmilyClient
*/
@Bean
public GrpcHmilyClient grpcHmilyClient() {
return new
GrpcHmilyClient();
} | 3.26 |
Subsets and Splits