@@ -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 ) {
0 commit comments