Skip to content

Commit

Permalink
optimize: optimize some javadocs (apache#3664)
Browse files Browse the repository at this point in the history
  • Loading branch information
slievrly committed Apr 23, 2021
1 parent 5fac979 commit c091e69
Show file tree
Hide file tree
Showing 53 changed files with 289 additions and 204 deletions.
1 change: 1 addition & 0 deletions changes/1.5.0.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
1 change: 1 addition & 0 deletions changes/en-us/1.5.0.md
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
28 changes: 15 additions & 13 deletions common/src/main/java/io/seata/common/util/CompressUtil.java
Original file line number Diff line number Diff line change
Expand Up @@ -22,16 +22,16 @@
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;
Expand All @@ -48,10 +48,11 @@ public static byte[] compress(final byte[] src) throws IOException {
}

/**
* 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;
Expand All @@ -77,9 +78,10 @@ public static byte[] uncompress(final byte[] src) throws IOException {
}

/**
* 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) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -54,33 +54,39 @@ public interface Callback<T extends AbstractTransactionRequest, S extends Abstra
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> {

Expand All @@ -107,6 +113,8 @@ public void onException(T request, S response, Exception rex) {
/**
* 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
Expand Down
20 changes: 8 additions & 12 deletions core/src/main/java/io/seata/core/lock/Locker.java
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,6 @@

/**
* The interface Locker.
*
* @author zhangsen
*/
public interface Locker {

Expand All @@ -33,27 +31,27 @@ public interface Locker {
boolean acquireLock(List<RowLock> rowLock) ;

/**
* Un lock boolean.
* Release lock boolean.
*
* @param rowLock the row lock
* @return the boolean
*/
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);
Expand All @@ -67,9 +65,7 @@ public interface Locker {
boolean isLockable(List<RowLock> rowLock);

/**
* Clean all locks boolean.
*
* @return the boolean
* Clean all locks.
*/
void cleanAllLocks();
}
Expand Down
2 changes: 1 addition & 1 deletion core/src/main/java/io/seata/core/model/Resource.java
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ public interface Resource {
/**
* get resource type, AT, TCC, SAGA and XA
*
* @return
* @return branch type
*/
BranchType getBranchType();

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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();

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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();

Expand Down
6 changes: 5 additions & 1 deletion core/src/main/java/io/seata/core/protocol/Version.java
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,11 @@ private Version() {

}

/**
* Gets current.
*
* @return the current
*/
public static String getCurrent() {
return CURRENT;
}
Expand Down Expand Up @@ -73,7 +78,6 @@ public static String getChannelVersion(Channel c) {
* Check version string.
*
* @param version the version
* @return the string
* @throws IncompatibleVersionException the incompatible version exception
*/
public static void checkVersion(String version) throws IncompatibleVersionException {
Expand Down
4 changes: 2 additions & 2 deletions core/src/main/java/io/seata/core/rpc/RemotingClient.java
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand All @@ -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;

Expand Down
4 changes: 2 additions & 2 deletions core/src/main/java/io/seata/core/rpc/RemotingServer.java
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand All @@ -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;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,13 +25,30 @@
*/
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;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,9 @@ public enum Escape {
* mysql series escape
*/
MYSQL('`');
/**
* The Value.
*/
public final char value;

Escape(char value) {
Expand All @@ -57,7 +60,7 @@ public enum Escape {
*
* @param cols the cols
* @param dbType the db type
* @return
* @return list
*/
public static List<String> delEscape(List<String> cols, String dbType) {
// sql standard
Expand Down Expand Up @@ -96,7 +99,7 @@ public static List<String> delEscape(List<String> cols, Escape escape) {
*
* @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);
Expand All @@ -111,7 +114,7 @@ public static String delEscape(String colName, String dbType) {
*
* @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()) {
Expand Down Expand Up @@ -156,7 +159,7 @@ public static String delEscape(String colName, Escape escape) {
*
* @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)) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,8 @@ public void setGlobalLockRequire(boolean isLock) {

/**
* get global lock requires flag
*
* @return the boolean
*/
public boolean isGlobalLockRequire() {
return context.isGlobalLockRequire();
Expand Down Expand Up @@ -128,6 +130,7 @@ public void checkLock(String lockKeys) throws SQLException {
* Lock query.
*
* @param lockKeys the lock keys
* @return the boolean
* @throws SQLException the sql exception
*/
public boolean lockQuery(String lockKeys) throws SQLException {
Expand Down Expand Up @@ -283,7 +286,7 @@ public void rollback() throws SQLException {
/**
* change connection autoCommit to false by seata
*
* @throws SQLException
* @throws SQLException the sql exception
*/
public void changeAutoCommit() throws SQLException {
getContext().setAutoCommitChanged(true);
Expand Down
Loading

0 comments on commit c091e69

Please sign in to comment.