-
Notifications
You must be signed in to change notification settings - Fork 26.4k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Browse the repository at this point in the history
This reverts commit d6c9bf6.
- Loading branch information
Showing
64 changed files
with
425 additions
and
688 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
24 changes: 0 additions & 24 deletions
24
dubbo-cluster/src/main/java/org/apache/dubbo/rpc/cluster/filter/ClusterFilter.java
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
60 changes: 60 additions & 0 deletions
60
...main/java/org/apache/dubbo/rpc/cluster/interceptor/ConsumerContextClusterInterceptor.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,60 @@ | ||
/* | ||
* Licensed to the Apache Software Foundation (ASF) under one or more | ||
* contributor license agreements. See the NOTICE file distributed with | ||
* this work for additional information regarding copyright ownership. | ||
* The ASF licenses this file to You under the Apache License, Version 2.0 | ||
* (the "License"); you may not use this file except in compliance with | ||
* the License. You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
*/ | ||
package org.apache.dubbo.rpc.cluster.interceptor; | ||
|
||
import org.apache.dubbo.common.extension.Activate; | ||
import org.apache.dubbo.common.utils.NetUtils; | ||
import org.apache.dubbo.rpc.Invocation; | ||
import org.apache.dubbo.rpc.Result; | ||
import org.apache.dubbo.rpc.RpcContext; | ||
import org.apache.dubbo.rpc.RpcException; | ||
import org.apache.dubbo.rpc.RpcInvocation; | ||
import org.apache.dubbo.rpc.cluster.support.AbstractClusterInvoker; | ||
|
||
@Activate | ||
public class ConsumerContextClusterInterceptor implements ClusterInterceptor, ClusterInterceptor.Listener { | ||
|
||
@Override | ||
public void before(AbstractClusterInvoker<?> invoker, Invocation invocation) { | ||
RpcContext context = RpcContext.getContext(); | ||
context.setInvocation(invocation).setLocalAddress(NetUtils.getLocalHost(), 0); | ||
if (invocation instanceof RpcInvocation) { | ||
((RpcInvocation) invocation).setInvoker(invoker); | ||
} | ||
RpcContext.removeServerContext(); | ||
} | ||
|
||
@Override | ||
public void after(AbstractClusterInvoker<?> clusterInvoker, Invocation invocation) { | ||
RpcContext.removeContext(true); | ||
} | ||
|
||
@Override | ||
public Result intercept(AbstractClusterInvoker<?> clusterInvoker, Invocation invocation) throws RpcException { | ||
return clusterInvoker.invoke(invocation); | ||
} | ||
|
||
@Override | ||
public void onMessage(Result appResponse, AbstractClusterInvoker<?> invoker, Invocation invocation) { | ||
RpcContext.getServerContext().setObjectAttachments(appResponse.getObjectAttachments()); | ||
} | ||
|
||
@Override | ||
public void onError(Throwable t, AbstractClusterInvoker<?> invoker, Invocation invocation) { | ||
|
||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.