-
Notifications
You must be signed in to change notification settings - Fork 1.2k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix triple multi classloader switch problem (#1278)
* fix triple multi classloader switch problem * fix triple client and server log uniqueName without version info * fix triple client and server log uniqueName without version info * fix triple client and server log uniqueName without version info * add two uniqueId case * feat: tri test case 4 ark Co-authored-by: liujianjun.ljj <liujianjun.ljj@antgroup.com> Co-authored-by: 均源 <zhangminglun.zml@antgroup.com>
- Loading branch information
1 parent
e203f2b
commit 9eff2f6
Showing
12 changed files
with
598 additions
and
40 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
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
51 changes: 51 additions & 0 deletions
51
test/test-common/src/main/java/com/alipay/sofa/rpc/test/AnotherHelloServiceImpl.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,51 @@ | ||
/* | ||
* 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 com.alipay.sofa.rpc.test; | ||
|
||
/** | ||
* | ||
* @author <a href=mailto:zhanggeng.zg@antfin.com>GengZhang</a> | ||
*/ | ||
public class AnotherHelloServiceImpl implements HelloService { | ||
|
||
private int sleep; | ||
|
||
private String result; | ||
|
||
public AnotherHelloServiceImpl() { | ||
|
||
} | ||
|
||
public AnotherHelloServiceImpl(String result) { | ||
this.result = result; | ||
} | ||
|
||
public AnotherHelloServiceImpl(int sleep) { | ||
this.sleep = sleep; | ||
} | ||
|
||
@Override | ||
public String sayHello(String name, int age) { | ||
if (sleep > 0) { | ||
try { | ||
Thread.sleep(sleep); | ||
} catch (Exception ignore) { | ||
} | ||
} | ||
return result != null ? result : "hello " + name + " from server! age: " + age; | ||
} | ||
} |
58 changes: 58 additions & 0 deletions
58
test/test-integration/src/test/java/com/alipay/sofa/rpc/test/triple/GreeterImpl2.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,58 @@ | ||
/* | ||
* 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 com.alipay.sofa.rpc.test.triple; | ||
|
||
import io.grpc.examples.helloworld.HelloReply; | ||
import io.grpc.examples.helloworld.HelloRequest; | ||
import io.grpc.examples.helloworld.SofaGreeterTriple; | ||
import io.grpc.stub.StreamObserver; | ||
|
||
import java.time.LocalDateTime; | ||
import java.time.format.DateTimeFormatter; | ||
|
||
/** | ||
* @author Even | ||
* @date 2023/1/3 12:17 AM | ||
*/ | ||
public class GreeterImpl2 extends SofaGreeterTriple.GreeterImplBase { | ||
|
||
//Intentionally using unsupported format | ||
static final DateTimeFormatter[] datetimeFormatter = new DateTimeFormatter[] { DateTimeFormatter.ISO_DATE_TIME, | ||
DateTimeFormatter.ISO_LOCAL_DATE_TIME, | ||
DateTimeFormatter.BASIC_ISO_DATE }; | ||
|
||
@Override | ||
public void sayHello(HelloRequest req, StreamObserver<HelloReply> responseObserver) { | ||
HelloRequest.DateTime reqDateTime = req.getDateTime(); | ||
int i = 0; | ||
try { | ||
i = Integer.parseInt(reqDateTime.getTime()); | ||
} catch (Exception e) { | ||
//TODO: handle exception | ||
} | ||
LocalDateTime dt = LocalDateTime.now(); | ||
String dtStr = dt.format(datetimeFormatter[i % datetimeFormatter.length]); | ||
HelloRequest.DateTime rplyDateTime = HelloRequest.DateTime.newBuilder(reqDateTime) | ||
.setDate(dtStr).build(); | ||
HelloReply reply = HelloReply.newBuilder() | ||
.setMessage("Hello2 " + req.getName()) | ||
.setDateTime(rplyDateTime) | ||
.build(); | ||
responseObserver.onNext(reply); | ||
responseObserver.onCompleted(); | ||
} | ||
} |
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.