• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

grpc / grpc-java / #19971

01 Sep 2025 07:40AM UTC coverage: 88.568% (+0.02%) from 88.547%
#19971

push

github

web-flow
allow java21 in jre matrix (#12281)

34692 of 39170 relevant lines covered (88.57%)

0.89 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

90.0
/../inprocess/src/main/java/io/grpc/inprocess/AnonymousInProcessSocketAddress.java
1
/*
2
 * Copyright 2021 The gRPC Authors
3
 *
4
 * Licensed under the Apache License, Version 2.0 (the "License");
5
 * you may not use this file except in compliance with the License.
6
 * You may obtain a copy of the License at
7
 *
8
 *     http://www.apache.org/licenses/LICENSE-2.0
9
 *
10
 * Unless required by applicable law or agreed to in writing, software
11
 * distributed under the License is distributed on an "AS IS" BASIS,
12
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
 * See the License for the specific language governing permissions and
14
 * limitations under the License.
15
 */
16

17
package io.grpc.inprocess;
18

19
import static com.google.common.base.Preconditions.checkState;
20

21
import com.google.errorprone.annotations.concurrent.GuardedBy;
22
import io.grpc.ExperimentalApi;
23
import java.io.IOException;
24
import java.io.NotSerializableException;
25
import java.io.ObjectOutputStream;
26
import java.net.SocketAddress;
27
import javax.annotation.Nullable;
28

29
/**
30
 * Custom SocketAddress class for {@link InProcessTransport}, for 
31
 * a server which can only be referenced via this address instance.
32
 */
33
@ExperimentalApi("https://github.com/grpc/grpc-java/issues/8626")
34
public final class AnonymousInProcessSocketAddress extends SocketAddress {
35
  private static final long serialVersionUID = -8567592561863414695L;
36

37
  @Nullable
38
  @GuardedBy("this")
39
  @SuppressWarnings("serial")
40
  private InProcessServer server;
41

42
  private void writeObject(ObjectOutputStream out) throws IOException {
43
    throw new NotSerializableException("AnonymousInProcessSocketAddress is not serializable");
×
44
  }
45

46
  /** Creates a new AnonymousInProcessSocketAddress. */
47
  public AnonymousInProcessSocketAddress() { }
1✔
48

49
  @Nullable
50
  synchronized InProcessServer getServer() {
51
    return server;
1✔
52
  }
53

54
  synchronized void setServer(InProcessServer server) throws IOException {
55
    if (this.server != null) {
1✔
56
      throw new IOException("Server instance already registered");
1✔
57
    }
58
    this.server = server;
1✔
59
  }
1✔
60

61
  synchronized void clearServer(InProcessServer server) {
62
    checkState(this.server == server);
1✔
63
    this.server = null;
1✔
64
  }
1✔
65
}
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2025 Coveralls, Inc