Skip to content
Snippets Groups Projects
Unverified Commit c091e699 authored by jimin's avatar jimin Committed by GitHub
Browse files

optimize: optimize some javadocs (#3664)

parent 5fac9798
No related branches found
No related tags found
No related merge requests found
Showing
with 135 additions and 75 deletions
......@@ -90,6 +90,7 @@ Seata 是一款开源的分布式事务解决方案,提供高性能和简单
- [[#3631](https://github.com/seata/seata/pull/3631)] 优化 运行 nacos-config.py 参数问题
- [[#3638](https://github.com/seata/seata/pull/3638)] 优化使用连表update和delete的SQL语法时错误提示
- [[#3662](https://github.com/seata/seata/pull/3662)] 更新gpg密钥对
- [[#3664](https://github.com/seata/seata/pull/3664)] 优化 javadoc
### test
......
......@@ -91,6 +91,7 @@
- [[#3631](https://github.com/seata/seata/pull/3631)] optimize nacos-config.py parameter
- [[#3638](https://github.com/seata/seata/pull/3638)] optimize the error when use update or delete with join in sql
- [[#3662](https://github.com/seata/seata/pull/3662)] update gpg key
- [[#3664](https://github.com/seata/seata/pull/3664)] optimize some javadocs
### test
......
......@@ -22,16 +22,16 @@ import java.util.zip.GZIPInputStream;
import java.util.zip.GZIPOutputStream;
/**
*
* @author lizhao
* The type Compress util.
*/
public class CompressUtil {
/**
* compress bytes
* @param src
* @return
* @throws IOException
* Compress byte [ ].
*
* @param src the src
* @return the byte [ ]
* @throws IOException the io exception
*/
public static byte[] compress(final byte[] src) throws IOException {
byte[] result;
......@@ -48,10 +48,11 @@ public class CompressUtil {
}
/**
* uncompress bytes
* @param src
* @return
* @throws IOException
* Uncompress byte [ ].
*
* @param src the src
* @return the byte [ ]
* @throws IOException the io exception
*/
public static byte[] uncompress(final byte[] src) throws IOException {
byte[] result;
......@@ -77,9 +78,10 @@ public class CompressUtil {
}
/**
* check magic
* @param bytes
* @return
* Is compress data boolean.
*
* @param bytes the bytes
* @return the boolean
*/
public static boolean isCompressData(byte[] bytes) {
if (bytes != null && bytes.length > 2) {
......
......@@ -54,33 +54,39 @@ public abstract class AbstractExceptionHandler {
void execute(T request, S response) throws TransactionException;
/**
* on Success
* On success.
*
* @param request
* @param response
* @param request the request
* @param response the response
*/
void onSuccess(T request, S response);
/**
* onTransactionException
*
* @param request
* @param response
* @param exception
* @param request the request
* @param response the response
* @param exception the exception
*/
void onTransactionException(T request, S response, TransactionException exception);
/**
* on other exception
*
* @param request
* @param response
* @param exception
* @param request the request
* @param response the response
* @param exception the exception
*/
void onException(T request, S response, Exception exception);
}
/**
* The type Abstract callback.
*
* @param <T> the type parameter
* @param <S> the type parameter
*/
public abstract static class AbstractCallback<T extends AbstractTransactionRequest, S extends AbstractTransactionResponse>
implements Callback<T, S> {
......@@ -107,6 +113,8 @@ public abstract class AbstractExceptionHandler {
/**
* Exception handle template.
*
* @param <T> the type parameter
* @param <S> the type parameter
* @param callback the callback
* @param request the request
* @param response the response
......
......@@ -19,8 +19,6 @@ import java.util.List;
/**
* The interface Locker.
*
* @author zhangsen
*/
public interface Locker {
......@@ -33,7 +31,7 @@ public interface Locker {
boolean acquireLock(List<RowLock> rowLock) ;
/**
* Un lock boolean.
* Release lock boolean.
*
* @param rowLock the row lock
* @return the boolean
......@@ -41,19 +39,19 @@ public interface Locker {
boolean releaseLock(List<RowLock> rowLock);
/**
* Un lock boolean.
* Release lock boolean.
*
* @param xid the xid
* @param branchId the branchId
* @param xid the xid
* @param branchId the branch id
* @return the boolean
*/
boolean releaseLock(String xid, Long branchId);
/**
* Un lock boolean.
* Release lock boolean.
*
* @param xid the xid
* @param branchIds the branchIds
* @param xid the xid
* @param branchIds the branch ids
* @return the boolean
*/
boolean releaseLock(String xid, List<Long> branchIds);
......@@ -67,9 +65,7 @@ public interface Locker {
boolean isLockable(List<RowLock> rowLock);
/**
* Clean all locks boolean.
*
* @return the boolean
* Clean all locks.
*/
void cleanAllLocks();
}
......
......@@ -41,7 +41,7 @@ public interface Resource {
/**
* get resource type, AT, TCC, SAGA and XA
*
* @return
* @return branch type
*/
BranchType getBranchType();
......
......@@ -41,7 +41,7 @@ public interface ResourceManager extends ResourceManagerInbound, ResourceManager
/**
* Get all resources managed by this manager.
*
* @return resourceId -> Resource Map
* @return resourceId -- Resource Map
*/
Map<String, Resource> getManagedResources();
......
......@@ -16,13 +16,14 @@
package io.seata.core.protocol;
/**
* @author zhangsen
* The interface Message type aware.
*/
public interface MessageTypeAware {
/**
* return the message type
* @return
* Gets type code.
*
* @return the type code
*/
short getTypeCode();
......
......@@ -45,6 +45,11 @@ public class Version {
}
/**
* Gets current.
*
* @return the current
*/
public static String getCurrent() {
return CURRENT;
}
......@@ -73,7 +78,6 @@ public class Version {
* Check version string.
*
* @param version the version
* @return the string
* @throws IncompatibleVersionException the incompatible version exception
*/
public static void checkVersion(String version) throws IncompatibleVersionException {
......
......@@ -40,7 +40,7 @@ public interface RemotingClient {
*
* @param msg transaction message {@link io.seata.core.protocol}
* @return server result message
* @throws TimeoutException
* @throws TimeoutException TimeoutException
*/
Object sendSyncRequest(Object msg) throws TimeoutException;
......@@ -50,7 +50,7 @@ public interface RemotingClient {
* @param channel client channel
* @param msg transaction message {@link io.seata.core.protocol}
* @return server result message
* @throws TimeoutException
* @throws TimeoutException TimeoutException
*/
Object sendSyncRequest(Channel channel, Object msg) throws TimeoutException;
......
......@@ -38,7 +38,7 @@ public interface RemotingServer {
* @param clientId rm client id
* @param msg transaction message {@link io.seata.core.protocol}
* @return client result message
* @throws TimeoutException
* @throws TimeoutException TimeoutException
*/
Object sendSyncRequest(String resourceId, String clientId, Object msg) throws TimeoutException;
......@@ -48,7 +48,7 @@ public interface RemotingServer {
* @param channel client channel
* @param msg transaction message {@link io.seata.core.protocol}
* @return client result message
* @throws TimeoutException
* @throws TimeoutException TimeoutException
*/
Object sendSyncRequest(Channel channel, Object msg) throws TimeoutException;
......
......@@ -25,13 +25,30 @@ import java.util.Map;
*/
public interface HttpExecutor {
/**
* Execute post k.
*
* @param <T> the type parameter
* @param <K> the type parameter
* @param host the host
* @param path the path
* @param paramObject the param object
* @param returnType the return type
* @return the k
* @throws IOException the io exception
*/
<T, K> K executePost(String host, String path, T paramObject, Class<K> returnType) throws IOException;
/**
* get method only support param type of Map<String,String>
*
* @return K
* @param <K> the type parameter
* @param host the host
* @param path the path
* @param paramObject the param object
* @param returnType the return type
* @return K k
* @throws IOException the io exception
*/
<K> K executeGet(String host, String path, Map<String, String> paramObject, Class<K> returnType) throws IOException;
......
......@@ -45,6 +45,9 @@ public final class ColumnUtils {
* mysql series escape
*/
MYSQL('`');
/**
* The Value.
*/
public final char value;
Escape(char value) {
......@@ -57,7 +60,7 @@ public final class ColumnUtils {
*
* @param cols the cols
* @param dbType the db type
* @return
* @return list
*/
public static List<String> delEscape(List<String> cols, String dbType) {
// sql standard
......@@ -96,7 +99,7 @@ public final class ColumnUtils {
*
* @param colName the column name
* @param dbType the db type
* @return
* @return string string
*/
public static String delEscape(String colName, String dbType) {
String newColName = delEscape(colName, Escape.STANDARD);
......@@ -111,7 +114,7 @@ public final class ColumnUtils {
*
* @param colName the column name
* @param escape the escape
* @return
* @return string string
*/
public static String delEscape(String colName, Escape escape) {
if (colName == null || colName.isEmpty()) {
......@@ -156,7 +159,7 @@ public final class ColumnUtils {
*
* @param cols the column name list
* @param dbType the db type
* @return
* @return list list
*/
public static List<String> addEscape(List<String> cols, String dbType) {
if (CollectionUtils.isEmpty(cols)) {
......
......@@ -97,6 +97,8 @@ public class ConnectionProxy extends AbstractConnectionProxy {
/**
* get global lock requires flag
*
* @return the boolean
*/
public boolean isGlobalLockRequire() {
return context.isGlobalLockRequire();
......@@ -128,6 +130,7 @@ public class ConnectionProxy extends AbstractConnectionProxy {
* Lock query.
*
* @param lockKeys the lock keys
* @return the boolean
* @throws SQLException the sql exception
*/
public boolean lockQuery(String lockKeys) throws SQLException {
......@@ -283,7 +286,7 @@ public class ConnectionProxy extends AbstractConnectionProxy {
/**
* change connection autoCommit to false by seata
*
* @throws SQLException
* @throws SQLException the sql exception
*/
public void changeAutoCommit() throws SQLException {
getContext().setAutoCommitChanged(true);
......
......@@ -47,11 +47,11 @@ public class DataCompareUtils {
}
/**
* Is field equals.
* Is field equals result.
*
* @param f0 the f0
* @param f1 the f1
* @return the Result<Boolean>
* @param f0 the f 0
* @param f1 the f 1
* @return the result
*/
public static Result<Boolean> isFieldEquals(Field f0, Field f1) {
if (f0 == null) {
......@@ -111,11 +111,11 @@ public class DataCompareUtils {
}
/**
* Is image equals.
* Is records equals result.
*
* @param beforeImage the before image
* @param afterImage the after image
* @return Result<Boolean>
* @return the result
*/
public static Result<Boolean> isRecordsEquals(TableRecords beforeImage, TableRecords afterImage) {
if (beforeImage == null) {
......@@ -137,14 +137,13 @@ public class DataCompareUtils {
}
}
/**
* Is rows equals.
* Is rows equals result.
*
* @param tableMetaData the table meta data
* @param oldRows the old rows
* @param newRows the new rows
* @return the Result<Boolean>
* @return the result
*/
public static Result<Boolean> isRowsEquals(TableMeta tableMetaData, List<Row> oldRows, List<Row> newRows) {
if (!CollectionUtils.isSizeEquals(oldRows, newRows)) {
......@@ -182,6 +181,13 @@ public class DataCompareUtils {
return Result.ok();
}
/**
* Row list to map map.
*
* @param rowList the row list
* @param primaryKeyList the primary key list
* @return the map
*/
public static Map<String, Map<String, Field>> rowListToMap(List<Row> rowList, List<String> primaryKeyList) {
// {value of primaryKey, value of all columns}
Map<String, Map<String, Field>> rowMap = new HashMap<>();
......
......@@ -95,10 +95,10 @@ public class SqlGenerateUtils {
/**
* set parameter for PreparedStatement, this is only used in pk sql.
*
* @param pkRowsList
* @param pkColumnNameList
* @param pst
* @throws SQLException
* @param pkRowsList pkRowsList
* @param pkColumnNameList pkColumnNameList
* @param pst preparedStatement
* @throws SQLException SQLException
*/
public static void setParamForPk(List<Map<String, Field>> pkRowsList, List<String> pkColumnNameList,
PreparedStatement pst) throws SQLException {
......@@ -116,7 +116,8 @@ public class SqlGenerateUtils {
/**
* each pk is a condition.the result will like :" id =? and userCode =?"
*
* @param pkNameList
* @param pkNameList pkNameList
* @param dbType dbType
* @return return where condition sql string.the sql can just search one related record.
*/
public static String buildWhereConditionByPKs(List<String> pkNameList, String dbType) {
......
......@@ -243,6 +243,10 @@ public abstract class BaseInsertExecutor<T, S extends Statement> extends Abstrac
/**
* the modify for test
*
* @param expr the expr
* @return the pk values by sequence
* @throws SQLException the sql exception
*/
protected List<Object> getPkValuesBySequence(SqlSequenceExpr expr) throws SQLException {
List<Object> pkValues = null;
......@@ -273,8 +277,9 @@ public abstract class BaseInsertExecutor<T, S extends Statement> extends Abstrac
* check pk values for multi Pk
* At most one null per row.
* Method is not allowed.
* @param pkValues
* @return
*
* @param pkValues the pk values
* @return boolean
*/
protected boolean checkPkValuesForMultiPk(Map<String, List<Object>> pkValues) {
Set<String> pkNames = pkValues.keySet();
......@@ -304,6 +309,13 @@ public abstract class BaseInsertExecutor<T, S extends Statement> extends Abstrac
return true;
}
/**
* Check pk values boolean.
*
* @param pkValues the pk values
* @param ps the ps
* @return the boolean
*/
protected boolean checkPkValues(Map<String, List<Object>> pkValues, boolean ps) {
Set<String> pkNames = pkValues.keySet();
if (pkNames.size() == 1) {
......@@ -315,7 +327,7 @@ public abstract class BaseInsertExecutor<T, S extends Statement> extends Abstrac
/**
* check pk values for single pk
* @param pkValues
* @param pkValues pkValues
* @param ps true: is prepared statement. false: normal statement.
* @return true: support. false: not support.
*/
......
......@@ -242,11 +242,11 @@ public abstract class BaseTransactionalExecutor<T, S extends Statement> implemen
return CollectionUtils.toUpperList(getTableMeta().getPrimaryKeyOnlyName()).contains(newColumnName.toUpperCase());
}
/**
* get standard pk column name from user sql column name
*
* @return
* @param userColumnName the user column name
* @return standard pk column name
*/
protected String getStandardPkColumnName(String userColumnName) {
String newUserColumnName = ColumnUtils.delEscape(userColumnName, getDbType());
......@@ -371,7 +371,7 @@ public abstract class BaseTransactionalExecutor<T, S extends Statement> implemen
*
* @param pkValuesMap the pkValuesMap
* @return return TableRecords;
* @throws SQLException
* @throws SQLException the sql exception
*/
protected TableRecords buildTableRecords(Map<String, List<Object>> pkValuesMap) throws SQLException {
List<String> pkColumnNameList = getTableMeta().getPrimaryKeyOnlyName();
......@@ -408,7 +408,7 @@ public abstract class BaseTransactionalExecutor<T, S extends Statement> implemen
/**
* get db type
*
* @return
* @return db type
*/
protected String getDbType() {
return statementProxy.getConnectionProxy().getDbType();
......
......@@ -20,6 +20,9 @@ import java.util.List;
import java.util.Map;
/**
* The interface Insert executor.
*
* @param <T> the type parameter
* @author jsbxyyx
*/
public interface InsertExecutor<T> extends Executor<T> {
......@@ -28,15 +31,15 @@ public interface InsertExecutor<T> extends Executor<T> {
* get primary key values.
*
* @return The primary key value.
* @throws SQLException
* @throws SQLException the sql exception
*/
Map<String, List<Object>> getPkValues() throws SQLException;
/**
* get primary key values by insert column.
*
* @return
* @throws SQLException
* @return pk values by column
* @throws SQLException the sql exception
*/
Map<String, List<Object>> getPkValuesByColumn() throws SQLException;
......
......@@ -45,6 +45,8 @@ import java.util.ArrayList;
import java.util.concurrent.ConcurrentHashMap;
/**
* The type My sql insert executor.
*
* @author jsbxyyx
*/
@LoadLevel(name = JdbcConstants.MYSQL, scope = Scope.PROTOTYPE)
......
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment