Skip to content

Commit 9a572a5

Browse files
fix: replace Level.Invocation with Level.Trial (#778)
Signed-off-by: Anthony Petrov <anthony@swirldslabs.com>
1 parent 91572fb commit 9a572a5

3 files changed

Lines changed: 15 additions & 14 deletions

File tree

pbj-integration-tests/src/jmh/java/com/hedera/pbj/integration/jmh/grpc/PbjGrpcBench.java

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -125,12 +125,12 @@ void setup(int streamCount) {
125125
client = createClient(port.port(), splitEncodings);
126126
}
127127

128-
@Setup(Level.Invocation)
128+
@Setup(Level.Trial)
129129
public void setup() {
130130
setup(1);
131131
}
132132

133-
@TearDown(Level.Invocation)
133+
@TearDown(Level.Trial)
134134
public void tearDown() {
135135
try {
136136
client.close();
@@ -181,12 +181,12 @@ void setup(int streamCount) {
181181
client = createClient(port.port(), splitEncodings);
182182
}
183183

184-
@Setup(Level.Invocation)
184+
@Setup(Level.Trial)
185185
public void setup() {
186186
setup(streamCount);
187187
}
188188

189-
@TearDown(Level.Invocation)
189+
@TearDown(Level.Trial)
190190
public void tearDown() {
191191
try {
192192
client.close();

pbj-integration-tests/src/jmh/java/com/hedera/pbj/integration/jmh/grpc/block/TestBlockGrpcBench.java

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,8 @@
1010
import com.hedera.pbj.runtime.Codec;
1111
import com.hedera.pbj.runtime.grpc.GrpcClient;
1212
import com.hedera.pbj.runtime.grpc.Pipeline;
13+
import java.io.IOException;
1314
import java.io.UncheckedIOException;
14-
import java.net.SocketException;
1515
import java.util.Set;
1616
import java.util.concurrent.CountDownLatch;
1717
import java.util.concurrent.Flow;
@@ -97,7 +97,7 @@ public static class BenchState {
9797
PbjGrpcBench.ServerHandle server;
9898
TestBlockStreamerInterface.TestBlockStreamerClient client;
9999

100-
@Setup(Level.Invocation)
100+
@Setup(Level.Trial)
101101
public void setup() {
102102
final String[] splitEncodings = encodings.split(",");
103103
final PbjGrpcServiceConfig serviceConfig =
@@ -108,7 +108,7 @@ public void setup() {
108108
client = createClient(port.port(), splitEncodings);
109109
}
110110

111-
@TearDown(Level.Invocation)
111+
@TearDown(Level.Trial)
112112
public void tearDown() {
113113
try {
114114
client.close();
@@ -166,9 +166,10 @@ public void onSubscribe(Flow.Subscription subscription) {
166166
public void onError(Throwable throwable) {
167167
latch.countDown();
168168
if (throwable instanceof UncheckedIOException uioe
169-
&& uioe.getCause() instanceof SocketException se
170-
&& se.getMessage() != null
171-
&& se.getMessage().contains("Socket closed")) {
169+
&& uioe.getCause() instanceof IOException ioe
170+
&& ioe.getMessage() != null
171+
// We create this message in PbjGrpcCall. It's not localized. So the check is good:
172+
&& ioe.getMessage().contains("sendPing failed")) {
172173
// A streaming server may close its connection sometimes before
173174
// the client has received and processed all the replies. However, the client's
174175
// PbjGrpcCall may try and ping the server during the processing. This results in

pbj-integration-tests/src/jmh/java/com/hedera/pbj/integration/jmh/grpc/google/GoogleGrpcBench.java

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -101,12 +101,12 @@ void setup(int streamCount) {
101101
client = ClientHandle.createClient(port.port());
102102
}
103103

104-
@Setup(Level.Invocation)
104+
@Setup(Level.Trial)
105105
public void setup() {
106106
setup(1);
107107
}
108108

109-
@TearDown(Level.Invocation)
109+
@TearDown(Level.Trial)
110110
public void tearDown() {
111111
client.close();
112112
client = null;
@@ -135,12 +135,12 @@ void setup(int streamCount) {
135135
client = ClientHandle.createClient(port.port());
136136
}
137137

138-
@Setup(Level.Invocation)
138+
@Setup(Level.Trial)
139139
public void setup() {
140140
setup(streamCount);
141141
}
142142

143-
@TearDown(Level.Invocation)
143+
@TearDown(Level.Trial)
144144
public void tearDown() {
145145
client.close();
146146
client = null;

0 commit comments

Comments
 (0)