Merge branch 'apache-3.1' into apache-3.2
# Conflicts: # dubbo-remoting/dubbo-remoting-api/src/test/java/org/apache/dubbo/remoting/exchange/RequestTest.java
This commit is contained in:
commit
e026b5bb59
|
|
@ -18,6 +18,7 @@ package org.apache.dubbo.remoting.exchange;
|
|||
|
||||
import org.apache.dubbo.common.utils.StringUtils;
|
||||
|
||||
import java.util.concurrent.ThreadLocalRandom;
|
||||
import java.util.concurrent.atomic.AtomicLong;
|
||||
|
||||
import static org.apache.dubbo.common.constants.CommonConstants.HEARTBEAT_EVENT;
|
||||
|
|
@ -27,7 +28,7 @@ import static org.apache.dubbo.common.constants.CommonConstants.HEARTBEAT_EVENT;
|
|||
*/
|
||||
public class Request {
|
||||
|
||||
private static final AtomicLong INVOKE_ID = new AtomicLong(0);
|
||||
private static final AtomicLong INVOKE_ID = new AtomicLong(ThreadLocalRandom.current().nextLong());
|
||||
|
||||
private final long mId;
|
||||
|
||||
|
|
|
|||
|
|
@ -23,6 +23,8 @@ class RequestTest {
|
|||
|
||||
@Test
|
||||
void test() {
|
||||
Request requestStart = new Request();
|
||||
|
||||
Request request = new Request();
|
||||
request.setTwoWay(true);
|
||||
request.setBroken(true);
|
||||
|
|
@ -36,7 +38,7 @@ class RequestTest {
|
|||
Assertions.assertTrue(request.isEvent());
|
||||
Assertions.assertEquals(request.getVersion(), "1.0.0");
|
||||
Assertions.assertEquals(request.getData(), "data");
|
||||
Assertions.assertTrue(request.getId() >= 0);
|
||||
Assertions.assertEquals(requestStart.getId() + 1, request.getId());
|
||||
Assertions.assertEquals(1024, request.getPayload());
|
||||
|
||||
request.setHeartbeat(true);
|
||||
|
|
|
|||
|
|
@ -73,7 +73,7 @@ public interface ObjectInput extends DataInput {
|
|||
default Throwable readThrowable() throws IOException, ClassNotFoundException {
|
||||
Object obj = readObject();
|
||||
if (!(obj instanceof Throwable)) {
|
||||
throw new IOException("Response data error, expect Throwable, but get " + obj);
|
||||
throw new IOException("Response data error, expect Throwable, but get " + obj.getClass());
|
||||
}
|
||||
return (Throwable) obj;
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue