Skip to content

Commit 710c445

Browse files
author
Mark
committed
fixed synchronized in Connection
1 parent bd61954 commit 710c445

File tree

2 files changed

+5
-5
lines changed

2 files changed

+5
-5
lines changed

src/main/java/com/arangodb/internal/velocystream/Connection.java

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,7 @@ protected Connection(final String host, final Integer port, final Integer timeou
7171
this.sslContext = sslContext;
7272
}
7373

74-
public synchronized boolean isOpen() {
74+
public boolean isOpen() {
7575
return socket != null && socket.isConnected() && !socket.isClosed();
7676
}
7777

@@ -126,7 +126,7 @@ public synchronized void close() {
126126
}
127127
}
128128

129-
private void sendProtocolHeader() throws IOException {
129+
private synchronized void sendProtocolHeader() throws IOException {
130130
if (LOGGER.isDebugEnabled()) {
131131
LOGGER.debug(String.format("Send velocystream protocol header to %s", socket));
132132
}
@@ -162,7 +162,7 @@ protected synchronized void writeIntern(final Message message, final Collection<
162162
}
163163
}
164164

165-
private void writeChunkHead(final Chunk chunk) throws IOException {
165+
private synchronized void writeChunkHead(final Chunk chunk) throws IOException {
166166
final long messageLength = chunk.getMessageLength();
167167
final int headLength = messageLength > -1L ? ArangoDBConstants.CHUNK_MAX_HEADER_SIZE
168168
: ArangoDBConstants.CHUNK_MIN_HEADER_SIZE;
@@ -205,7 +205,7 @@ private ByteBuffer readBytes(final int len) throws IOException {
205205
return ByteBuffer.wrap(buf).order(ByteOrder.LITTLE_ENDIAN);
206206
}
207207

208-
protected void readBytesIntoBuffer(final byte[] buf, final int off, final int len) throws IOException {
208+
protected synchronized void readBytesIntoBuffer(final byte[] buf, final int off, final int len) throws IOException {
209209
for (int readed = 0; readed < len;) {
210210
final int read = inputStream.read(buf, off + readed, len - readed);
211211
if (read == -1) {

src/main/java/com/arangodb/internal/velocystream/ConnectionSync.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,7 @@ private ConnectionSync(final String host, final Integer port, final Integer time
8585
super(host, port, timeout, useSsl, sslContext);
8686
}
8787

88-
public synchronized Message write(final Message message, final Collection<Chunk> chunks) throws ArangoDBException {
88+
public Message write(final Message message, final Collection<Chunk> chunks) throws ArangoDBException {
8989
super.writeIntern(message, chunks);
9090
byte[] chunkBuffer = null;
9191
int off = 0;

0 commit comments

Comments
 (0)