Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.java.programmer > #33270

Re: multithread client socket

Path csiph.com!eternal-september.org!feeder.eternal-september.org!mx02.eternal-september.org!.POSTED!not-for-mail
From Martin Gregorie <martin@address-in-sig.invalid>
Newsgroups comp.lang.java.programmer
Subject Re: multithread client socket
Date Wed, 2 Dec 2015 14:57:13 -0000 (UTC)
Organization A noiseless patient Spider
Lines 33
Message-ID <n3n0s9$8ml$3@dont-email.me> (permalink)
References <cd5afdca-ada8-4c3e-b1da-c29fc8f7442e@googlegroups.com> <n3ksvl$683$2@dont-email.me> <4ab5709a-0b5d-4f1b-8b50-139828b5b76e@googlegroups.com>
Mime-Version 1.0
Content-Type text/plain; charset=UTF-8
Content-Transfer-Encoding 8bit
Injection-Date Wed, 2 Dec 2015 14:57:13 -0000 (UTC)
Injection-Info mx02.eternal-september.org; posting-host="e5160e2be48f1ea550cf61512446f525"; logging-data="8917"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX18L2P5TOFY8AjGdnenQ2X+l9L+4DL1hRxU="
User-Agent Pan/0.139 (Sexual Chocolate; GIT bf56508 git://git.gnome.org/pan2)
Cancel-Lock sha1:rl+hsITQx3TqdeJn3bucbEwxBJ0=
Xref csiph.com comp.lang.java.programmer:33270

Show key headers only | View raw


On Tue, 01 Dec 2015 22:56:32 -0800, Philipp Kraus wrote:

> Am Dienstag, 1. Dezember 2015 20:41:11 UTC+1 schrieb Martin Gregorie:
> 
>> Have any server transactions finished before you get the error?
>> 
>> If the answer is 'No', then limit the size of the thread pool to
>> prevent the error and use a Queue to store pending requests that are
>> waiting for a thread to come available because this shows that requests
>> are arriving faster than the server can handle them.
> 
> Yes all transaction are finished correctly.
>
Even when you hit the limit and your client falls over?

You should able see how many Sockets are open when the client falls over 
by using a static volatile int that:

- is incremented each time a thread successfully opens a client socket

- is decremented each time a thread successfully closes a client socket

- gets its value written to stderr by the exception code triggered by 
  a client socket failing to open or close.
 
The effect on your code should be minimal since you'll already be 
catching IOExceptions thrown by Sockets.


-- 
martin@   | Martin Gregorie
gregorie. | Essex, UK
org       |

Back to comp.lang.java.programmer | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread


Thread

multithread client socket Philipp Kraus <philipp.kraus.flashpixx@gmail.com> - 2015-12-01 09:36 -0800
  Re: multithread client socket Knute Johnson <nospam@rabbitbrush.frazmtn.com> - 2015-12-01 10:12 -0800
  Re: multithread client socket Martin Gregorie <martin@address-in-sig.invalid> - 2015-12-01 19:38 +0000
    Re: multithread client socket Philipp Kraus <philipp.kraus.flashpixx@gmail.com> - 2015-12-01 22:56 -0800
      Re: multithread client socket Martin Gregorie <martin@address-in-sig.invalid> - 2015-12-02 14:57 +0000
        Re: multithread client socket Eric Sosman <esosman@comcast-dot-net.invalid> - 2015-12-02 10:54 -0500
          Re: multithread client socket Martin Gregorie <martin@address-in-sig.invalid> - 2015-12-02 19:18 +0000
          Re: multithread client socket Eric Douglas <e.d.programmer@gmail.com> - 2015-12-02 11:47 -0800
            Re: multithread client socket Eric Sosman <esosman@comcast-dot-net.invalid> - 2015-12-02 15:30 -0500
              Re: multithread client socket Eric Douglas <e.d.programmer@gmail.com> - 2015-12-02 12:57 -0800

csiph-web