Skip to content

Commit 1d761a1

Browse files
committed
refactor(heartbeat): change visibility of PingResult
Make PingResult package-private to hide it from public API
1 parent 71e76f7 commit 1d761a1

2 files changed

Lines changed: 12 additions & 13 deletions

File tree

‎tarantool-pooling/src/main/java/io/tarantool/pool/availability/heartbeat/PingResult.java‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,11 +16,11 @@
1616
import io.tarantool.core.protocol.IProtoResponse;
1717
import io.tarantool.core.protocol.requests.IProtoConstant;
1818

19-
public final class PingResult {
19+
final class PingResult {
2020

2121
private static final Logger LOGGER = LoggerFactory.getLogger(PingResult.class);
2222

23-
public static boolean hasSuccessPingResult(IProtoResponse result, String identity) {
23+
static boolean hasSuccessPingResult(IProtoResponse result, String identity) {
2424
if (result == null) {
2525
LOGGER.trace("{}: ping response is null", identity);
2626
return false;

tarantool-pooling/src/test/java/io/tarantool/pool/unit/PingResultTest.java renamed to tarantool-pooling/src/test/java/io/tarantool/pool/availability/heartbeat/PingResultTest.java

Lines changed: 10 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
* All Rights Reserved.
44
*/
55

6-
package io.tarantool.pool.unit;
6+
package io.tarantool.pool.availability.heartbeat;
77

88
import java.io.IOException;
99
import java.util.stream.Stream;
@@ -21,7 +21,6 @@
2121
import io.tarantool.core.protocol.IProtoRawResponse;
2222
import io.tarantool.core.protocol.IProtoResponse;
2323
import io.tarantool.core.protocol.requests.IProtoConstant;
24-
import io.tarantool.pool.availability.heartbeat.PingResult;
2524

2625
class PingResultTest {
2726

@@ -73,22 +72,22 @@ final class IProtoResponses {
7372

7473
private IProtoResponses() {}
7574

76-
/** Заголовок обычного (не ошибочного) ответа: request type = 0 (IPROTO_OK). */
75+
/** Normal (non-error) response header: request type = 0 (IPROTO_OK). */
7776
private static final MapValue OK_HEADER =
7877
ValueFactory.newMap(
7978
ValueFactory.newInteger(IProtoConstant.IPROTO_REQUEST_TYPE), ValueFactory.newInteger(0));
8079

81-
/** Заголовок ошибочного ответа: 0x8000 | code. */
80+
/** Error response header: 0x8000 | code. */
8281
private static MapValue errorHeader(int code) {
8382
return ValueFactory.newMap(
8483
ValueFactory.newInteger(IProtoConstant.IPROTO_REQUEST_TYPE),
8584
ValueFactory.newInteger(IProtoConstant.IPROTO_ERROR_BASE + code));
8685
}
8786

8887
/**
89-
* Собирает ответ из заголовка и тела.
88+
* Builds a response from a header and a body.
9089
*
91-
* <p>Формат пакета: [заголовок][тело]; {@code headerSize} = длина заголовка.
90+
* <p>Packet format: [header][body]; {@code headerSize} = header length.
9291
*/
9392
static IProtoResponse response(MapValue header, Value body) {
9493
try (final MessageBufferPacker headerPacker = MessagePack.newDefaultBufferPacker();
@@ -109,20 +108,20 @@ static IProtoResponse response(MapValue header, Value body) {
109108
}
110109
}
111110

112-
/** Ответ без тела — как от {@code IPROTO_PING}. */
111+
/** Empty-body response, such as from {@code IPROTO_PING}. */
113112
static IProtoResponse emptyBody() {
114113
return response(OK_HEADER, ValueFactory.emptyMap());
115114
}
116115

117-
/** То же, но с произвольным числом элементов в DATA. */
116+
/** Same, but with an arbitrary number of elements in DATA. */
118117
static IProtoResponse dataArray(Value... values) {
119118
final ValueFactory.MapBuilder bodyBuilder = ValueFactory.newMapBuilder();
120119
bodyBuilder.put(
121120
ValueFactory.newInteger(IProtoConstant.IPROTO_DATA), ValueFactory.newArray(values));
122121
return response(OK_HEADER, bodyBuilder.build());
123122
}
124123

125-
/** Ответ-ошибка сервера. */
124+
/** Server error response. */
126125
static IProtoResponse error(int code, String message) {
127126
final MapValue body =
128127
ValueFactory.newMap(
@@ -133,7 +132,7 @@ static IProtoResponse error(int code, String message) {
133132
return response(errorHeader(code), body);
134133
}
135134

136-
/** Ответ без IPROTO_DATA — например, ответ на IPROTO_ID. */
135+
/** A response without IPROTO_DATA — for example, a response to IPROTO_ID. */
137136
static IProtoResponse withoutData() {
138137
return IProtoResponses.response(
139138
OK_HEADER,
@@ -142,7 +141,7 @@ static IProtoResponse withoutData() {
142141
ValueFactory.newInteger(IProtoConstant.IPROTO_FEATURES), ValueFactory.emptyArray()));
143142
}
144143

145-
/** IPROTO_DATA есть, но это не массив. */
144+
/** IPROTO_DATA is present, but it is not an array. */
146145
static IProtoResponse dataNotArray() {
147146
return IProtoResponses.response(
148147
OK_HEADER,

0 commit comments

Comments
 (0)