Skip to content

Commit 531d1c0

Browse files
dbl-xQilongZhang
authored andcommitted
Release/1.5.1 (sofastack#91)
Release/1.5.1
1 parent 5e246ce commit 531d1c0

File tree

56 files changed

+352
-372
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

56 files changed

+352
-372
lines changed

README.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
[![Build Status](https://travis-ci.org/alipay/sofa-bolt.svg?branch=master)](https://travis-ci.org/alipay/sofa-bolt)
44
[![Coverage Status](https://codecov.io/gh/alipay/sofa-bolt/branch/master/graph/badge.svg)](https://codecov.io/gh/alipay/sofa-bolt)
55
![license](https://img.shields.io/badge/license-Apache--2.0-green.svg)
6-
![version](https://img.shields.io/badge/bolt-1.5.0-blue.svg)
6+
![version](https://img.shields.io/badge/bolt-1.5.1-blue.svg)
77

88
# 1. 介绍
99
SOFABolt 是蚂蚁金融服务集团开发的一套基于 Netty 实现的网络通信框架。

pom.xml

+1-1
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@
2222
<modelVersion>4.0.0</modelVersion>
2323
<groupId>com.alipay.sofa</groupId>
2424
<artifactId>bolt</artifactId>
25-
<version>1.5.0</version>
25+
<version>1.5.1</version>
2626
<packaging>jar</packaging>
2727

2828
<name>${project.groupId}:${project.artifactId}</name>

src/main/java/com/alipay/remoting/AbstractRemotingServer.java

+4-16
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,6 @@ public abstract class AbstractRemotingServer extends AbstractConfigurableInstanc
3737
private static final Logger logger = BoltLoggerFactory.getLogger("CommonDefault");
3838

3939
private AtomicBoolean started = new AtomicBoolean(false);
40-
private AtomicBoolean inited = new AtomicBoolean(false);
4140
private String ip;
4241
private int port;
4342

@@ -53,25 +52,15 @@ public AbstractRemotingServer(String ip, int port) {
5352

5453
@Override
5554
public void init() {
56-
if (inited.compareAndSet(false, true)) {
57-
try {
58-
doInit();
59-
} catch (Throwable t) {
60-
inited.set(false);
61-
this.stop(); // do stop to ensure close resources created during doInit()
62-
throw new IllegalStateException("ERROR: Failed to init the Server!", t);
63-
}
64-
} else {
65-
String warnMsg = "WARN: The server has already inited, you can call start() method to finish starting a server!";
66-
logger.warn(warnMsg);
67-
}
55+
// Do not call this method, it will be removed in the next version
6856
}
6957

7058
@Override
7159
public boolean start() {
7260
if (started.compareAndSet(false, true)) {
7361
try {
74-
init(); // init server by default, so user can just call start method and complete two procedures: init and start.
62+
doInit();
63+
7564
logger.warn("Prepare to start server on port {} ", port);
7665
if (doStart()) {
7766
logger.warn("Server started on port {}", port);
@@ -81,7 +70,6 @@ public boolean start() {
8170
return false;
8271
}
8372
} catch (Throwable t) {
84-
started.set(false);
8573
this.stop();// do stop to ensure close resources created during doInit()
8674
throw new IllegalStateException("ERROR: Failed to start the Server!", t);
8775
}
@@ -94,7 +82,7 @@ public boolean start() {
9482

9583
@Override
9684
public boolean stop() {
97-
if (inited.compareAndSet(true, false) || started.compareAndSet(true, false)) {
85+
if (started.compareAndSet(true, false)) {
9886
return this.doStop();
9987
} else {
10088
throw new IllegalStateException("ERROR: The server has already stopped!");

src/main/java/com/alipay/remoting/CommandDecoder.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -36,5 +36,5 @@ public interface CommandDecoder {
3636
* @param out
3737
* @throws Exception
3838
*/
39-
public void decode(ChannelHandlerContext ctx, ByteBuf in, List<Object> out) throws Exception;
39+
void decode(ChannelHandlerContext ctx, ByteBuf in, List<Object> out) throws Exception;
4040
}

src/main/java/com/alipay/remoting/CommandEncoder.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,6 @@ public interface CommandEncoder {
3737
* @param out
3838
* @throws Exception
3939
*/
40-
public void encode(ChannelHandlerContext ctx, Serializable msg, ByteBuf out) throws Exception;
40+
void encode(ChannelHandlerContext ctx, Serializable msg, ByteBuf out) throws Exception;
4141

4242
}

src/main/java/com/alipay/remoting/CommandHandler.java

+4-4
Original file line numberDiff line numberDiff line change
@@ -32,26 +32,26 @@ public interface CommandHandler {
3232
* @param msg
3333
* @throws Exception
3434
*/
35-
public void handleCommand(RemotingContext ctx, Object msg) throws Exception;
35+
void handleCommand(RemotingContext ctx, Object msg) throws Exception;
3636

3737
/**
3838
* Register processor for command with specified code.
3939
*
4040
* @param cmd
4141
* @param processor
4242
*/
43-
public void registerProcessor(CommandCode cmd, RemotingProcessor<?> processor);
43+
void registerProcessor(CommandCode cmd, RemotingProcessor<?> processor);
4444

4545
/**
4646
* Register default executor for the handler.
4747
*
4848
* @param executor
4949
*/
50-
public void registerDefaultExecutor(ExecutorService executor);
50+
void registerDefaultExecutor(ExecutorService executor);
5151

5252
/**
5353
* Get default executor for the handler.
5454
*/
55-
public ExecutorService getDefaultExecutor();
55+
ExecutorService getDefaultExecutor();
5656

5757
}

src/main/java/com/alipay/remoting/ConnectionHeartbeatManager.java

+2-2
Original file line numberDiff line numberDiff line change
@@ -29,12 +29,12 @@ public interface ConnectionHeartbeatManager {
2929
*
3030
* @param connection
3131
*/
32-
public void disableHeartbeat(Connection connection);
32+
void disableHeartbeat(Connection connection);
3333

3434
/**
3535
* enable heart beat for a certain connection
3636
*
3737
* @param connection
3838
*/
39-
public void enableHeartbeat(Connection connection);
39+
void enableHeartbeat(Connection connection);
4040
}

src/main/java/com/alipay/remoting/ConnectionSelectStrategy.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -31,5 +31,5 @@ public interface ConnectionSelectStrategy {
3131
* @param conns
3232
* @return
3333
*/
34-
public Connection select(List<Connection> conns);
34+
Connection select(List<Connection> conns);
3535
}

src/main/java/com/alipay/remoting/CustomSerializer.java

+13-19
Original file line numberDiff line numberDiff line change
@@ -37,8 +37,8 @@ public interface CustomSerializer {
3737
* @return
3838
* @throws CodecException
3939
*/
40-
public <T extends RequestCommand> boolean serializeHeader(T request, InvokeContext invokeContext)
41-
throws SerializationException;
40+
<T extends RequestCommand> boolean serializeHeader(T request, InvokeContext invokeContext)
41+
throws SerializationException;
4242

4343
/**
4444
* Serialize the header of ResponseCommand.
@@ -47,8 +47,7 @@ public <T extends RequestCommand> boolean serializeHeader(T request, InvokeConte
4747
* @return
4848
* @throws CodecException
4949
*/
50-
public <T extends ResponseCommand> boolean serializeHeader(T response)
51-
throws SerializationException;
50+
<T extends ResponseCommand> boolean serializeHeader(T response) throws SerializationException;
5251

5352
/**
5453
* Deserialize the header of RequestCommand.
@@ -57,8 +56,7 @@ public <T extends ResponseCommand> boolean serializeHeader(T response)
5756
* @return
5857
* @throws CodecException
5958
*/
60-
public <T extends RequestCommand> boolean deserializeHeader(T request)
61-
throws DeserializationException;
59+
<T extends RequestCommand> boolean deserializeHeader(T request) throws DeserializationException;
6260

6361
/**
6462
* Deserialize the header of ResponseCommand.
@@ -68,9 +66,8 @@ public <T extends RequestCommand> boolean deserializeHeader(T request)
6866
* @return
6967
* @throws CodecException
7068
*/
71-
public <T extends ResponseCommand> boolean deserializeHeader(T response,
72-
InvokeContext invokeContext)
73-
throws DeserializationException;
69+
<T extends ResponseCommand> boolean deserializeHeader(T response, InvokeContext invokeContext)
70+
throws DeserializationException;
7471

7572
/**
7673
* Serialize the content of RequestCommand.
@@ -80,9 +77,8 @@ public <T extends ResponseCommand> boolean deserializeHeader(T response,
8077
* @return
8178
* @throws CodecException
8279
*/
83-
public <T extends RequestCommand> boolean serializeContent(T request,
84-
InvokeContext invokeContext)
85-
throws SerializationException;
80+
<T extends RequestCommand> boolean serializeContent(T request, InvokeContext invokeContext)
81+
throws SerializationException;
8682

8783
/**
8884
* Serialize the content of ResponseCommand.
@@ -91,8 +87,7 @@ public <T extends RequestCommand> boolean serializeContent(T request,
9187
* @return
9288
* @throws CodecException
9389
*/
94-
public <T extends ResponseCommand> boolean serializeContent(T response)
95-
throws SerializationException;
90+
<T extends ResponseCommand> boolean serializeContent(T response) throws SerializationException;
9691

9792
/**
9893
* Deserialize the content of RequestCommand.
@@ -101,8 +96,8 @@ public <T extends ResponseCommand> boolean serializeContent(T response)
10196
* @return
10297
* @throws CodecException
10398
*/
104-
public <T extends RequestCommand> boolean deserializeContent(T request)
105-
throws DeserializationException;
99+
<T extends RequestCommand> boolean deserializeContent(T request)
100+
throws DeserializationException;
106101

107102
/**
108103
* Deserialize the content of ResponseCommand.
@@ -112,7 +107,6 @@ public <T extends RequestCommand> boolean deserializeContent(T request)
112107
* @return
113108
* @throws CodecException
114109
*/
115-
public <T extends ResponseCommand> boolean deserializeContent(T response,
116-
InvokeContext invokeContext)
117-
throws DeserializationException;
110+
<T extends ResponseCommand> boolean deserializeContent(T response, InvokeContext invokeContext)
111+
throws DeserializationException;
118112
}

src/main/java/com/alipay/remoting/InvokeCallback.java

+3-3
Original file line numberDiff line numberDiff line change
@@ -31,20 +31,20 @@ public interface InvokeCallback {
3131
*
3232
* @param result
3333
*/
34-
public void onResponse(final Object result);
34+
void onResponse(final Object result);
3535

3636
/**
3737
* Exception caught.
3838
*
3939
* @param e
4040
*/
41-
public void onException(final Throwable e);
41+
void onException(final Throwable e);
4242

4343
/**
4444
* User defined executor.
4545
*
4646
* @return
4747
*/
48-
public Executor getExecutor();
48+
Executor getExecutor();
4949

5050
}

src/main/java/com/alipay/remoting/InvokeCallbackListener.java

+2-2
Original file line numberDiff line numberDiff line change
@@ -28,12 +28,12 @@ public interface InvokeCallbackListener {
2828
*
2929
* @param future
3030
*/
31-
public void onResponse(final InvokeFuture future);
31+
void onResponse(final InvokeFuture future);
3232

3333
/**
3434
* Get the remote address.
3535
*
3636
* @return
3737
*/
38-
public String getRemoteAddress();
38+
String getRemoteAddress();
3939
}

0 commit comments

Comments
 (0)