Skip to content

Commit

Permalink
Merge branch 'sofastack:master' into feature/flexible_raft
Browse files Browse the repository at this point in the history
  • Loading branch information
1294566108 authored Dec 2, 2023
2 parents 7b2f0d5 + 2ea82d6 commit d7b9b94
Show file tree
Hide file tree
Showing 3 changed files with 40 additions and 9 deletions.
22 changes: 22 additions & 0 deletions .github/workflows/cloud_code_scan.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
name: Alipay Cloud Devops Codescan
on:
pull_request_target:
jobs:
stc: # Code security scanning
runs-on: ubuntu-latest
steps:
- name: codeScan
uses: layotto/alipay-cloud-devops-codescan@main
with:
parent_uid: ${{ secrets.ALI_PID }}
private_key: ${{ secrets.ALI_PK }}
scan_type: stc
sca: # Open source compliance scanning
runs-on: ubuntu-latest
steps:
- name: codeScan
uses: layotto/alipay-cloud-devops-codescan@main
with:
parent_uid: ${{ secrets.ALI_PID }}
private_key: ${{ secrets.ALI_PK }}
scan_type: sca
Original file line number Diff line number Diff line change
Expand Up @@ -236,7 +236,6 @@ public synchronized void shutdown() {
task.shutdownLatch = latch;
}));
}
doShutdown();
}

@Override
Expand Down Expand Up @@ -453,6 +452,7 @@ private long runApplyTask(final ApplyTask task, long maxCommittedIndex, final bo
case SHUTDOWN:
this.currTask = TaskType.SHUTDOWN;
shutdown = task.shutdownLatch;
doShutdown();
break;
case FLUSH:
this.currTask = TaskType.FLUSH;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,10 @@
*/
package io.grpc.internal;

import io.grpc.ServerCall;

import com.alipay.sofa.jraft.util.internal.ReferenceFieldUpdater;
import com.alipay.sofa.jraft.util.internal.Updaters;
import io.grpc.ForwardingServerCall;
import io.grpc.ServerCall;

/**
* Get grpc's server stream.
Expand All @@ -28,14 +28,23 @@
*/
public class ServerStreamHelper {

private static final ReferenceFieldUpdater<ServerCallImpl<?, ?>, ServerStream> STREAM_GETTER = Updaters
.newReferenceFieldUpdater(
ServerCallImpl.class,
"stream");
private static final ReferenceFieldUpdater<ServerCallImpl<?, ?>, ServerStream> STREAM_GETTER = Updaters
.newReferenceFieldUpdater(
ServerCallImpl.class,
"stream");

private static final ReferenceFieldUpdater<ForwardingServerCall.SimpleForwardingServerCall<?, ?>, ServerCall<?, ?>> SERVER_CALL_GETTER = Updaters
.newReferenceFieldUpdater(
ForwardingServerCall.SimpleForwardingServerCall.class,
"delegate");

public static ServerStream getServerStream(final ServerCall<?, ?> call) {
if (call instanceof ServerCallImpl) {
return STREAM_GETTER.get((ServerCallImpl<?, ?>) call);
ServerCall<?, ?> lastServerCall = call;
if (call instanceof ForwardingServerCall.SimpleForwardingServerCall) {
lastServerCall = SERVER_CALL_GETTER.get((ForwardingServerCall.SimpleForwardingServerCall<?, ?>) call);
}
if (lastServerCall instanceof ServerCallImpl) {
return STREAM_GETTER.get((ServerCallImpl<?, ?>) lastServerCall);
}
return null;
}
Expand Down

0 comments on commit d7b9b94

Please sign in to comment.