Skip to content

Commit

Permalink
Release/1.5.1 (#91)
Browse files Browse the repository at this point in the history
Release/1.5.1
  • Loading branch information
dbl-x authored and QilongZhang committed Sep 13, 2018
1 parent 5e246ce commit 531d1c0
Show file tree
Hide file tree
Showing 56 changed files with 352 additions and 372 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
[![Build Status](https://travis-ci.org/alipay/sofa-bolt.svg?branch=master)](https://travis-ci.org/alipay/sofa-bolt)
[![Coverage Status](https://codecov.io/gh/alipay/sofa-bolt/branch/master/graph/badge.svg)](https://codecov.io/gh/alipay/sofa-bolt)
![license](https://img.shields.io/badge/license-Apache--2.0-green.svg)
![version](https://img.shields.io/badge/bolt-1.5.0-blue.svg)
![version](https://img.shields.io/badge/bolt-1.5.1-blue.svg)

# 1. 介绍
SOFABolt 是蚂蚁金融服务集团开发的一套基于 Netty 实现的网络通信框架。
Expand Down
2 changes: 1 addition & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
<modelVersion>4.0.0</modelVersion>
<groupId>com.alipay.sofa</groupId>
<artifactId>bolt</artifactId>
<version>1.5.0</version>
<version>1.5.1</version>
<packaging>jar</packaging>

<name>${project.groupId}:${project.artifactId}</name>
Expand Down
20 changes: 4 additions & 16 deletions src/main/java/com/alipay/remoting/AbstractRemotingServer.java
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,6 @@ public abstract class AbstractRemotingServer extends AbstractConfigurableInstanc
private static final Logger logger = BoltLoggerFactory.getLogger("CommonDefault");

private AtomicBoolean started = new AtomicBoolean(false);
private AtomicBoolean inited = new AtomicBoolean(false);
private String ip;
private int port;

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

@Override
public void init() {
if (inited.compareAndSet(false, true)) {
try {
doInit();
} catch (Throwable t) {
inited.set(false);
this.stop(); // do stop to ensure close resources created during doInit()
throw new IllegalStateException("ERROR: Failed to init the Server!", t);
}
} else {
String warnMsg = "WARN: The server has already inited, you can call start() method to finish starting a server!";
logger.warn(warnMsg);
}
// Do not call this method, it will be removed in the next version
}

@Override
public boolean start() {
if (started.compareAndSet(false, true)) {
try {
init(); // init server by default, so user can just call start method and complete two procedures: init and start.
doInit();

logger.warn("Prepare to start server on port {} ", port);
if (doStart()) {
logger.warn("Server started on port {}", port);
Expand All @@ -81,7 +70,6 @@ public boolean start() {
return false;
}
} catch (Throwable t) {
started.set(false);
this.stop();// do stop to ensure close resources created during doInit()
throw new IllegalStateException("ERROR: Failed to start the Server!", t);
}
Expand All @@ -94,7 +82,7 @@ public boolean start() {

@Override
public boolean stop() {
if (inited.compareAndSet(true, false) || started.compareAndSet(true, false)) {
if (started.compareAndSet(true, false)) {
return this.doStop();
} else {
throw new IllegalStateException("ERROR: The server has already stopped!");
Expand Down
2 changes: 1 addition & 1 deletion src/main/java/com/alipay/remoting/CommandDecoder.java
Original file line number Diff line number Diff line change
Expand Up @@ -36,5 +36,5 @@ public interface CommandDecoder {
* @param out
* @throws Exception
*/
public void decode(ChannelHandlerContext ctx, ByteBuf in, List<Object> out) throws Exception;
void decode(ChannelHandlerContext ctx, ByteBuf in, List<Object> out) throws Exception;
}
2 changes: 1 addition & 1 deletion src/main/java/com/alipay/remoting/CommandEncoder.java
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,6 @@ public interface CommandEncoder {
* @param out
* @throws Exception
*/
public void encode(ChannelHandlerContext ctx, Serializable msg, ByteBuf out) throws Exception;
void encode(ChannelHandlerContext ctx, Serializable msg, ByteBuf out) throws Exception;

}
8 changes: 4 additions & 4 deletions src/main/java/com/alipay/remoting/CommandHandler.java
Original file line number Diff line number Diff line change
Expand Up @@ -32,26 +32,26 @@ public interface CommandHandler {
* @param msg
* @throws Exception
*/
public void handleCommand(RemotingContext ctx, Object msg) throws Exception;
void handleCommand(RemotingContext ctx, Object msg) throws Exception;

/**
* Register processor for command with specified code.
*
* @param cmd
* @param processor
*/
public void registerProcessor(CommandCode cmd, RemotingProcessor<?> processor);
void registerProcessor(CommandCode cmd, RemotingProcessor<?> processor);

/**
* Register default executor for the handler.
*
* @param executor
*/
public void registerDefaultExecutor(ExecutorService executor);
void registerDefaultExecutor(ExecutorService executor);

/**
* Get default executor for the handler.
*/
public ExecutorService getDefaultExecutor();
ExecutorService getDefaultExecutor();

}
Original file line number Diff line number Diff line change
Expand Up @@ -29,12 +29,12 @@ public interface ConnectionHeartbeatManager {
*
* @param connection
*/
public void disableHeartbeat(Connection connection);
void disableHeartbeat(Connection connection);

/**
* enable heart beat for a certain connection
*
* @param connection
*/
public void enableHeartbeat(Connection connection);
void enableHeartbeat(Connection connection);
}
Original file line number Diff line number Diff line change
Expand Up @@ -31,5 +31,5 @@ public interface ConnectionSelectStrategy {
* @param conns
* @return
*/
public Connection select(List<Connection> conns);
Connection select(List<Connection> conns);
}
32 changes: 13 additions & 19 deletions src/main/java/com/alipay/remoting/CustomSerializer.java
Original file line number Diff line number Diff line change
Expand Up @@ -37,8 +37,8 @@ public interface CustomSerializer {
* @return
* @throws CodecException
*/
public <T extends RequestCommand> boolean serializeHeader(T request, InvokeContext invokeContext)
throws SerializationException;
<T extends RequestCommand> boolean serializeHeader(T request, InvokeContext invokeContext)
throws SerializationException;

/**
* Serialize the header of ResponseCommand.
Expand All @@ -47,8 +47,7 @@ public <T extends RequestCommand> boolean serializeHeader(T request, InvokeConte
* @return
* @throws CodecException
*/
public <T extends ResponseCommand> boolean serializeHeader(T response)
throws SerializationException;
<T extends ResponseCommand> boolean serializeHeader(T response) throws SerializationException;

/**
* Deserialize the header of RequestCommand.
Expand All @@ -57,8 +56,7 @@ public <T extends ResponseCommand> boolean serializeHeader(T response)
* @return
* @throws CodecException
*/
public <T extends RequestCommand> boolean deserializeHeader(T request)
throws DeserializationException;
<T extends RequestCommand> boolean deserializeHeader(T request) throws DeserializationException;

/**
* Deserialize the header of ResponseCommand.
Expand All @@ -68,9 +66,8 @@ public <T extends RequestCommand> boolean deserializeHeader(T request)
* @return
* @throws CodecException
*/
public <T extends ResponseCommand> boolean deserializeHeader(T response,
InvokeContext invokeContext)
throws DeserializationException;
<T extends ResponseCommand> boolean deserializeHeader(T response, InvokeContext invokeContext)
throws DeserializationException;

/**
* Serialize the content of RequestCommand.
Expand All @@ -80,9 +77,8 @@ public <T extends ResponseCommand> boolean deserializeHeader(T response,
* @return
* @throws CodecException
*/
public <T extends RequestCommand> boolean serializeContent(T request,
InvokeContext invokeContext)
throws SerializationException;
<T extends RequestCommand> boolean serializeContent(T request, InvokeContext invokeContext)
throws SerializationException;

/**
* Serialize the content of ResponseCommand.
Expand All @@ -91,8 +87,7 @@ public <T extends RequestCommand> boolean serializeContent(T request,
* @return
* @throws CodecException
*/
public <T extends ResponseCommand> boolean serializeContent(T response)
throws SerializationException;
<T extends ResponseCommand> boolean serializeContent(T response) throws SerializationException;

/**
* Deserialize the content of RequestCommand.
Expand All @@ -101,8 +96,8 @@ public <T extends ResponseCommand> boolean serializeContent(T response)
* @return
* @throws CodecException
*/
public <T extends RequestCommand> boolean deserializeContent(T request)
throws DeserializationException;
<T extends RequestCommand> boolean deserializeContent(T request)
throws DeserializationException;

/**
* Deserialize the content of ResponseCommand.
Expand All @@ -112,7 +107,6 @@ public <T extends RequestCommand> boolean deserializeContent(T request)
* @return
* @throws CodecException
*/
public <T extends ResponseCommand> boolean deserializeContent(T response,
InvokeContext invokeContext)
throws DeserializationException;
<T extends ResponseCommand> boolean deserializeContent(T response, InvokeContext invokeContext)
throws DeserializationException;
}
6 changes: 3 additions & 3 deletions src/main/java/com/alipay/remoting/InvokeCallback.java
Original file line number Diff line number Diff line change
Expand Up @@ -31,20 +31,20 @@ public interface InvokeCallback {
*
* @param result
*/
public void onResponse(final Object result);
void onResponse(final Object result);

/**
* Exception caught.
*
* @param e
*/
public void onException(final Throwable e);
void onException(final Throwable e);

/**
* User defined executor.
*
* @return
*/
public Executor getExecutor();
Executor getExecutor();

}
4 changes: 2 additions & 2 deletions src/main/java/com/alipay/remoting/InvokeCallbackListener.java
Original file line number Diff line number Diff line change
Expand Up @@ -28,12 +28,12 @@ public interface InvokeCallbackListener {
*
* @param future
*/
public void onResponse(final InvokeFuture future);
void onResponse(final InvokeFuture future);

/**
* Get the remote address.
*
* @return
*/
public String getRemoteAddress();
String getRemoteAddress();
}
Loading

0 comments on commit 531d1c0

Please sign in to comment.