Skip to content

Commit

Permalink
Move implements to sub package. (sofastack#28)
Browse files Browse the repository at this point in the history
  • Loading branch information
ujjboy authored Apr 18, 2018
1 parent 3ea59d6 commit ce55329
Show file tree
Hide file tree
Showing 18 changed files with 35 additions and 26 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.alipay.sofa.rpc.proxy;
package com.alipay.sofa.rpc.proxy.javassist;

import com.alipay.sofa.rpc.common.utils.ClassLoaderUtils;
import com.alipay.sofa.rpc.common.utils.ClassTypeUtils;
Expand All @@ -28,6 +28,7 @@
import com.alipay.sofa.rpc.log.Logger;
import com.alipay.sofa.rpc.log.LoggerFactory;
import com.alipay.sofa.rpc.message.MessageBuilder;
import com.alipay.sofa.rpc.proxy.Proxy;
import javassist.ClassPool;
import javassist.CtClass;
import javassist.CtConstructor;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.alipay.sofa.rpc.proxy;
package com.alipay.sofa.rpc.proxy.javassist;

import java.lang.reflect.InvocationHandler;
import java.lang.reflect.Method;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.alipay.sofa.rpc.proxy;
package com.alipay.sofa.rpc.proxy.jdk;

import com.alipay.sofa.rpc.core.exception.RpcErrorType;
import com.alipay.sofa.rpc.core.exception.SofaRpcException;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,11 +14,12 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.alipay.sofa.rpc.proxy;
package com.alipay.sofa.rpc.proxy.jdk;

import com.alipay.sofa.rpc.common.utils.ClassLoaderUtils;
import com.alipay.sofa.rpc.ext.Extension;
import com.alipay.sofa.rpc.invoke.Invoker;
import com.alipay.sofa.rpc.proxy.Proxy;

import java.lang.reflect.InvocationHandler;

Expand Down
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
jdk=com.alipay.sofa.rpc.proxy.JDKProxy
javassist=com.alipay.sofa.rpc.proxy.JavassistProxy
jdk=com.alipay.sofa.rpc.proxy.jdk.JDKProxy
javassist=com.alipay.sofa.rpc.proxy.javassist.JavassistProxy
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,11 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.alipay.sofa.rpc.proxy;
package com.alipay.sofa.rpc.proxy.javassist;

import com.alipay.sofa.rpc.proxy.AbstractTestClass;
import com.alipay.sofa.rpc.proxy.TestInterface;
import com.alipay.sofa.rpc.proxy.TestInvoker;
import org.junit.Assert;
import org.junit.Test;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,11 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.alipay.sofa.rpc.proxy;
package com.alipay.sofa.rpc.proxy.jdk;

import com.alipay.sofa.rpc.proxy.AbstractTestClass;
import com.alipay.sofa.rpc.proxy.TestInterface;
import com.alipay.sofa.rpc.proxy.TestInvoker;
import org.junit.Assert;
import org.junit.Test;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,9 @@
*/
package com.alipay.sofa.rpc.asynchain;

import com.alipay.sofa.rpc.client.bolt.AsyncSofaResponseCallback;
import com.alipay.sofa.rpc.context.RpcInvokeContext;
import com.alipay.sofa.rpc.core.request.RequestBase;
import com.alipay.sofa.rpc.message.bolt.BoltSendableResponseCallback;

import java.util.Random;

Expand All @@ -39,7 +39,7 @@ public ServiceBImpl(ServiceC serviceC) {

@Override
public int getInt(int num) {
RpcInvokeContext.getContext().setResponseCallback(new AsyncSofaResponseCallback() {
RpcInvokeContext.getContext().setResponseCallback(new BoltSendableResponseCallback() {
@Override
public void onAppResponse(Object appResponse, String methodName, RequestBase request) {
// 此时C-异步返回->B
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
import com.alipay.sofa.rpc.context.RpcRuntimeContext;
import com.alipay.sofa.rpc.log.Logger;
import com.alipay.sofa.rpc.log.LoggerFactory;
import com.alipay.sofa.rpc.message.BoltResponseFuture;
import com.alipay.sofa.rpc.message.bolt.BoltResponseFuture;
import com.alipay.sofa.rpc.test.EchoService;
import com.alipay.sofa.rpc.test.HelloService;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.alipay.sofa.rpc.message;
package com.alipay.sofa.rpc.message.bolt;

import com.alipay.remoting.InvokeCallback;
import com.alipay.sofa.rpc.client.ProviderInfo;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.alipay.sofa.rpc.message;
package com.alipay.sofa.rpc.message.bolt;

import com.alipay.remoting.InvokeCallback;
import com.alipay.sofa.rpc.client.ProviderInfo;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,11 +14,12 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.alipay.sofa.rpc.message;
package com.alipay.sofa.rpc.message.bolt;

import com.alipay.sofa.rpc.context.RpcRuntimeContext;
import com.alipay.sofa.rpc.core.invoke.SofaResponseCallback;
import com.alipay.sofa.rpc.core.request.SofaRequest;
import com.alipay.sofa.rpc.message.ResponseFuture;

import java.util.List;
import java.util.concurrent.ExecutionException;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.alipay.sofa.rpc.client.bolt;
package com.alipay.sofa.rpc.message.bolt;

import com.alipay.remoting.AsyncContext;
import com.alipay.sofa.rpc.context.BaggageResolver;
Expand All @@ -35,7 +35,7 @@
*
* @author <a href="mailto:[email protected]">GengZhang</a>
*/
public abstract class AsyncSofaResponseCallback<T> implements SendableResponseCallback<T> {
public abstract class BoltSendableResponseCallback<T> implements SendableResponseCallback<T> {

/**
* 请求对应的上下文
Expand All @@ -52,7 +52,7 @@ public abstract class AsyncSofaResponseCallback<T> implements SendableResponseCa
*/
private boolean sent;

public AsyncSofaResponseCallback() {
public BoltSendableResponseCallback() {
init();
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -50,10 +50,10 @@
import com.alipay.sofa.rpc.ext.Extension;
import com.alipay.sofa.rpc.log.Logger;
import com.alipay.sofa.rpc.log.LoggerFactory;
import com.alipay.sofa.rpc.message.BoltFutureInvokeCallback;
import com.alipay.sofa.rpc.message.BoltInvokerCallback;
import com.alipay.sofa.rpc.message.BoltResponseFuture;
import com.alipay.sofa.rpc.message.ResponseFuture;
import com.alipay.sofa.rpc.message.bolt.BoltFutureInvokeCallback;
import com.alipay.sofa.rpc.message.bolt.BoltInvokerCallback;
import com.alipay.sofa.rpc.message.bolt.BoltResponseFuture;
import com.alipay.sofa.rpc.transport.AbstractChannel;
import com.alipay.sofa.rpc.transport.ClientTransport;
import com.alipay.sofa.rpc.transport.ClientTransportConfig;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
*/
package com.alipay.sofa.rpc.test.async;

import com.alipay.sofa.rpc.client.bolt.AsyncSofaResponseCallback;
import com.alipay.sofa.rpc.message.bolt.BoltSendableResponseCallback;
import com.alipay.sofa.rpc.context.RpcInvokeContext;
import com.alipay.sofa.rpc.core.request.RequestBase;
import com.alipay.sofa.rpc.log.Logger;
Expand Down Expand Up @@ -44,7 +44,7 @@ public String sayHello(String name, int age) {
// 模拟A-->B-->C场景
RpcInvokeContext context = RpcInvokeContext.getContext();
context.setTimeout(2000);
context.setResponseCallback(new AsyncSofaResponseCallback() {
context.setResponseCallback(new BoltSendableResponseCallback() {
@Override
public void onAppResponse(Object appResponse, String methodName, RequestBase request) {
// 此时C-异步返回->B
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,9 @@
*/
package com.alipay.sofa.rpc.test.baggage;

import com.alipay.sofa.rpc.client.bolt.AsyncSofaResponseCallback;
import com.alipay.sofa.rpc.context.RpcInvokeContext;
import com.alipay.sofa.rpc.core.request.RequestBase;
import com.alipay.sofa.rpc.message.bolt.BoltSendableResponseCallback;

import java.util.concurrent.CountDownLatch;
import java.util.concurrent.TimeUnit;
Expand Down Expand Up @@ -50,7 +50,7 @@ public String hello() {
context.putResponseBaggage("respBaggageB_useful1", "在返A之前写入有用");
final CountDownLatch latch = new CountDownLatch(1);
try {
RpcInvokeContext.getContext().setResponseCallback(new AsyncSofaResponseCallback() {
RpcInvokeContext.getContext().setResponseCallback(new BoltSendableResponseCallback() {
@Override
public void onAppResponse(Object appResponse, String methodName, RequestBase request) {
// 返回一定要写在这里
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
import com.alipay.sofa.rpc.config.ServerConfig;
import com.alipay.sofa.rpc.core.exception.SofaRpcRuntimeException;
import com.alipay.sofa.rpc.invoke.Invoker;
import com.alipay.sofa.rpc.proxy.JDKProxy;
import com.alipay.sofa.rpc.proxy.jdk.JDKProxy;
import com.alipay.sofa.rpc.test.ActivelyDestroyTest;
import com.alipay.sofa.rpc.test.HelloService;
import com.alipay.sofa.rpc.test.HelloServiceImpl;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
import com.alipay.sofa.rpc.config.ServerConfig;
import com.alipay.sofa.rpc.core.exception.SofaRpcRuntimeException;
import com.alipay.sofa.rpc.invoke.Invoker;
import com.alipay.sofa.rpc.proxy.JDKProxy;
import com.alipay.sofa.rpc.proxy.jdk.JDKProxy;
import com.alipay.sofa.rpc.test.ActivelyDestroyTest;
import com.alipay.sofa.rpc.test.HelloService;
import com.alipay.sofa.rpc.test.HelloServiceImpl;
Expand Down

0 comments on commit ce55329

Please sign in to comment.