Skip to content

Commit

Permalink
fix spell mistake and some test codes (#194)
Browse files Browse the repository at this point in the history
  • Loading branch information
cytnju authored and dbl-x committed Dec 6, 2019
1 parent 391317d commit 5ba99bf
Show file tree
Hide file tree
Showing 13 changed files with 52 additions and 53 deletions.
2 changes: 1 addition & 1 deletion src/main/java/com/alipay/remoting/ProtocolCode.java
Original file line number Diff line number Diff line change
Expand Up @@ -70,4 +70,4 @@ public int hashCode() {
public String toString() {
return "ProtocolVersion{" + "version=" + Arrays.toString(version) + '}';
}
}
}
28 changes: 14 additions & 14 deletions src/main/java/com/alipay/remoting/Url.java
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@

/**
* URL definition.
*
*
* @author xiaomin.cxm
* @version $Id: Url.java, v 0.1 Mar 11, 2016 6:01:59 PM xiaomin.cxm Exp $
*/
Expand Down Expand Up @@ -65,7 +65,7 @@ public class Url {

/**
* Constructor with originUrl
*
*
* @param originUrl
*/
protected Url(String originUrl) {
Expand All @@ -77,8 +77,8 @@ protected Url(String originUrl) {
* <ul>
* <li>Initialize ip:port as {@link Url#originUrl} </li>
* <li>Initialize {@link Url#originUrl} as {@link Url#uniqueKey} </li>
* </ul>
*
* </ul>
*
* @param ip
* @param port
*/
Expand All @@ -91,12 +91,12 @@ public Url(String ip, int port) {

/**
* Constructor with originUrl, ip and port
*
*
* <ul>
* <li>Initialize @param originUrl as {@link Url#originUrl} </li>
* <li>Initialize ip:port as {@link Url#uniqueKey} </li>
* </ul>
*
* </ul>
*
* @param originUrl
* @param ip
* @param port
Expand All @@ -110,13 +110,13 @@ public Url(String originUrl, String ip, int port) {

/**
* Constructor with originUrl, ip, port and properties
*
*
* <ul>
* <li>Initialize @param originUrl as {@link Url#originUrl} </li>
* <li>Initialize ip:port as {@link Url#uniqueKey} </li>
* <li>Initialize @param properties as {@link Url#properties} </li>
* </ul>
*
* </ul>
*
* @param originUrl
* @param ip
* @param port
Expand All @@ -129,13 +129,13 @@ public Url(String originUrl, String ip, int port, Properties properties) {

/**
* Constructor with originUrl, ip, port, uniqueKey and properties
*
*
* <ul>
* <li>Initialize @param originUrl as {@link Url#originUrl} </li>
* <li>Initialize @param uniqueKey as {@link Url#uniqueKey} </li>
* <li>Initialize @param properties as {@link Url#properties} </li>
* </ul>
*
*
* @param originUrl
* @param ip
* @param port
Expand All @@ -150,7 +150,7 @@ public Url(String originUrl, String ip, int port, String uniqueKey, Properties p

/**
* Get property value according to property key
*
*
* @param key property key
* @return property value
*/
Expand Down Expand Up @@ -253,7 +253,7 @@ public int hashCode() {

@Override
public String toString() {
StringBuilder sb = new StringBuilder();
StringBuilder sb = new StringBuilder(32);
sb.append("Origin url [").append(this.originUrl).append("], Unique key [")
.append(this.uniqueKey).append("].");
return sb.toString();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@

/**
* Listener which listens the Rpc invoke result, and then invokes the call back.
*
*
* @author jiangping
* @version $Id: RpcInvokeCallbackListener.java, v 0.1 2015-9-30 AM10:36:34 tao Exp $
*/
Expand All @@ -53,7 +53,7 @@ public RpcInvokeCallbackListener(String address) {
this.address = address;
}

/**
/**
* @see com.alipay.remoting.InvokeCallbackListener#onResponse(com.alipay.remoting.InvokeFuture)
*/
@Override
Expand All @@ -80,14 +80,14 @@ class CallbackTask implements Runnable {
String remoteAddress;

/**
*
*
*/
public CallbackTask(String remoteAddress, InvokeFuture future) {
this.remoteAddress = remoteAddress;
this.future = future;
}

/**
/**
* @see java.lang.Runnable#run()
*/
@Override
Expand Down Expand Up @@ -134,7 +134,7 @@ public void run() {
RpcResponseCommand resp = (RpcResponseCommand) response;
resp.deserialize();
Object ex = resp.getResponseObject();
if (ex != null && ex instanceof Throwable) {
if (ex instanceof Throwable) {
e = new InvokeServerException(msg, (Throwable) ex);
} else {
e = new InvokeServerException(msg);
Expand Down Expand Up @@ -191,7 +191,7 @@ public void run() {
} // end of run
}

/**
/**
* @see com.alipay.remoting.InvokeCallbackListener#getRemoteAddress()
*/
@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@

/**
* Resolve response object from response command.
*
*
* @author jiangping
* @version $Id: RpcResponseResolver.java, v 0.1 2015-10-8 PM2:47:29 tao Exp $
*/
Expand Down Expand Up @@ -151,7 +151,7 @@ private static Throwable toThrowable(ResponseCommand responseCommand) throws Cod
RpcResponseCommand resp = (RpcResponseCommand) responseCommand;
resp.deserialize();
Object ex = resp.getResponseObject();
if (ex != null && ex instanceof Throwable) {
if (ex instanceof Throwable) {
return (Throwable) ex;
}
return null;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,11 +23,11 @@

/**
* Extends this to process user defined request in ASYNC way.<br>
* If you want process reqeuest in SYNC way, please extends {@link SyncMutiInterestUserProcessor}.
* If you want process request in SYNC way, please extends {@link SyncMultiInterestUserProcessor}.
* @author muyun.cyt ([email protected]) 2018/7/5 11:19 AM
*/
public abstract class AsynMultiInterestUserProcessor<T> extends
AbstractMultiInterestUserProcessor<T> {
public abstract class AsyncMultiInterestUserProcessor<T> extends
AbstractMultiInterestUserProcessor<T> {
/**
* unsupported here!
*
Expand All @@ -36,7 +36,7 @@ public abstract class AsynMultiInterestUserProcessor<T> extends
@Override
public Object handleRequest(BizContext bizCtx, T request) throws Exception {
throw new UnsupportedOperationException(
"SYNC handle request is unsupported in AsynMultiInterestUserProcessor!");
"SYNC handle request is unsupported in AsyncMultiInterestUserProcessor!");
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,15 +21,15 @@

/**
* Extends this to process user defined request in ASYNC way.<br>
* If you want process reqeuest in SYNC way, please extends {@link SyncUserProcessor}.
*
* If you want process request in SYNC way, please extends {@link SyncUserProcessor}.
*
* @author xiaomin.cxm
* @version $Id: AsyncUserProcessor.java, v 0.1 May 16, 2016 8:18:03 PM xiaomin.cxm Exp $
*/
public abstract class AsyncUserProcessor<T> extends AbstractUserProcessor<T> {
/**
* unsupported here!
*
*
* @see com.alipay.remoting.rpc.protocol.UserProcessor#handleRequest(com.alipay.remoting.BizContext, java.lang.Object)
*/
@Override
Expand All @@ -49,4 +49,4 @@ public Object handleRequest(BizContext bizCtx, T request) throws Exception {
*/
@Override
public abstract String interest();
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -23,12 +23,12 @@

/**
* Extends this to process user defined request in SYNC way.<br>
* If you want process reqeuest in ASYNC way, please extends {@link AsynMultiInterestUserProcessor}.
* If you want process request in ASYNC way, please extends {@link AsyncMultiInterestUserProcessor}.
*
* @author muyun.cyt ([email protected]) 2018/7/5 11:19 AM
*/
public abstract class SyncMutiInterestUserProcessor<T> extends
AbstractMultiInterestUserProcessor<T> {
public abstract class SyncMultiInterestUserProcessor<T> extends
AbstractMultiInterestUserProcessor<T> {

/**
* @see com.alipay.remoting.rpc.protocol.UserProcessor#handleRequest(com.alipay.remoting.BizContext, java.lang.Object)
Expand All @@ -44,7 +44,7 @@ public abstract class SyncMutiInterestUserProcessor<T> extends
@Override
public void handleRequest(BizContext bizCtx, AsyncContext asyncCtx, T request) {
throw new UnsupportedOperationException(
"ASYNC handle request is unsupported in SyncMutiInterestUserProcessor!");
"ASYNC handle request is unsupported in SyncMultiInterestUserProcessor!");
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,8 @@

/**
* Extends this to process user defined request in SYNC way.<br>
* If you want process reqeuest in ASYNC way, please extends {@link AsyncUserProcessor}.
*
* If you want process request in ASYNC way, please extends {@link AsyncUserProcessor}.
*
* @author xiaomin.cxm
* @version $Id: SyncUserProcessor.java, v 0.1 May 19, 2016 2:47:21 PM xiaomin.cxm Exp $
*/
Expand All @@ -35,7 +35,7 @@ public abstract class SyncUserProcessor<T> extends AbstractUserProcessor<T> {

/**
* unsupported here!
*
*
* @see com.alipay.remoting.rpc.protocol.UserProcessor#handleRequest(com.alipay.remoting.BizContext, com.alipay.remoting.AsyncContext, java.lang.Object)
*/
@Override
Expand Down
6 changes: 4 additions & 2 deletions src/test/java/com/alipay/remoting/rpc/common/PortScan.java
Original file line number Diff line number Diff line change
Expand Up @@ -38,8 +38,10 @@ static public int select() {
ioe.printStackTrace();
} finally {
try {
ss.close();
logger.warn("Server socket close status: {}", ss.isClosed());
if (ss != null) {
ss.close();
logger.warn("Server socket close status: {}", ss.isClosed());
}
} catch (IOException e) {
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@

/**
* exception test
*
*
* @author xiaomin.cxm
* @version $Id: ExceptionTest.java, v 0.1 Apr 6, 2016 9:41:53 PM xiaomin.cxm Exp $
*/
Expand Down Expand Up @@ -82,7 +82,7 @@ public void stop() {
public void testSyncNoProcessor() {
server.registerUserProcessor(new SimpleServerUserProcessor());
try {
client.invokeSync(addr, new String("No processor for String now!"), 3000);
client.invokeSync(addr, "No processor for String now!", 3000);
} catch (Exception e) {
Assert.assertEquals(InvokeServerException.class, e.getClass());
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,17 +20,14 @@
import java.util.List;
import java.util.concurrent.ConcurrentHashMap;

import com.alipay.remoting.rpc.protocol.*;
import org.junit.Assert;
import org.junit.Before;
import org.junit.Test;

import com.alipay.remoting.BizContext;
import com.alipay.remoting.rpc.common.SimpleServerUserProcessor;
import com.alipay.remoting.rpc.protocol.MultiInterestUserProcessor;
import com.alipay.remoting.rpc.protocol.SyncMutiInterestUserProcessor;
import com.alipay.remoting.rpc.protocol.SyncUserProcessor;
import com.alipay.remoting.rpc.protocol.UserProcessor;
import com.alipay.remoting.rpc.protocol.UserProcessorRegisterHelper;
import com.alipay.remoting.rpc.protocol.SyncMultiInterestUserProcessor;
import com.alipay.remoting.rpc.userprocessor.multiinterestprocessor.SimpleServerMultiInterestUserProcessor;

/**
Expand Down Expand Up @@ -85,7 +82,7 @@ public String interest() {

@Test
public void testInterestEmptyException() {
MultiInterestUserProcessor userProcessor = new SyncMutiInterestUserProcessor() {
MultiInterestUserProcessor userProcessor = new SyncMultiInterestUserProcessor() {
@Override
public Object handleRequest(BizContext bizCtx, Object request) throws Exception {
return request;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,14 +32,14 @@
import com.alipay.remoting.InvokeContext;
import com.alipay.remoting.NamedThreadFactory;
import com.alipay.remoting.rpc.common.RequestBody;
import com.alipay.remoting.rpc.protocol.SyncMutiInterestUserProcessor;
import com.alipay.remoting.rpc.protocol.SyncMultiInterestUserProcessor;

/**
* @antuor muyun.cyt ([email protected]) 2018/7/5 11:20 AM
*/
public class SimpleClientMultiInterestUserProcessor
extends
SyncMutiInterestUserProcessor<MultiInterestBaseRequestBody> {
SyncMultiInterestUserProcessor<MultiInterestBaseRequestBody> {
/** logger */
private static final Logger logger = LoggerFactory
.getLogger(SimpleClientMultiInterestUserProcessor.class);
Expand Down Expand Up @@ -237,4 +237,4 @@ public List<String> multiInterest() {
list.add(RequestBodyC2.class.getName());
return list;
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -33,14 +33,14 @@
import com.alipay.remoting.InvokeContext;
import com.alipay.remoting.NamedThreadFactory;
import com.alipay.remoting.rpc.common.RequestBody;
import com.alipay.remoting.rpc.protocol.SyncMutiInterestUserProcessor;
import com.alipay.remoting.rpc.protocol.SyncMultiInterestUserProcessor;

/**
* @antuor muyun.cyt ([email protected]) 2018/7/5 11:20 AM
*/
public class SimpleServerMultiInterestUserProcessor
extends
SyncMutiInterestUserProcessor<MultiInterestBaseRequestBody> {
SyncMultiInterestUserProcessor<MultiInterestBaseRequestBody> {

/** logger */
private static final Logger logger = LoggerFactory
Expand Down

0 comments on commit 5ba99bf

Please sign in to comment.