The print writer is wrapped around a socket's output stream, so I'm going to guess and say that the socket's output buffer is full, and so the write/flush call will block until the buffer has enough room to accommodate the message being sent.
The print writer is wrapped around a socket's output stream, so I'm going to guess and say that the socket's output buffer is full, and so the write/flush call will block until the buffer has enough room to accommodate the message being sent. The socket send buffer may become full if data is being written to it faster than it can be transmitted to the client (or faster than the client can receive it). Edit: P.S.If you're having scalability problems, it may be due to using java.Io (which requires one thread per socket) instead of java.
Nio (in which case a single thread can detect and perform operations on those sockets which have pending data). Nio is intended to support applications which must scale to a large number of connections, but the programming model is more difficult.
Maybe you are right. My default buffer size is: 128 000 IN / 49 152 OUT. Is it enough?
How much is enough? – Reacen Jul 30 at 3:56 It's not so much about the buffer size, but about the rate you are writing to the socket, and the rate at which the data can be transmitted and received by the client. If the first rate is greater than the second, then the caller will always end up blocking/waiting.In this case, you might be trying to send too much data too quickly; reducing the update rate or the amount of data being sent could help.
– JimN Jul 30 at 4:02.
The reason is that your send() method is static, so all threads that write to any socket are being syncrhonized on the containing class object. Make it non-static, then only threads that are writing to the same socket will be synchronized.
Although the method looks like a utility method which doesn't share any resources, so no synchronization appears necessary. If more than one caller might manipulate a Player instance concurrently, then perhaps the callers should be responsible for synchronizing outside of the utility method, on some object such as the Player instance itself. – JimN Jul 30 at 3:53 You are right!
Thank you! The code is too big i'll have to change alot of things, but thank you. I hope it will fix the problem if it's just a threading problem.
– Reacen Jul 30 at 3:58.
I cant really gove you an answer,but what I can give you is a way to a solution, that is you have to find the anglde that you relate to or peaks your interest. A good paper is one that people get drawn into because it reaches them ln some way.As for me WW11 to me, I think of the holocaust and the effect it had on the survivors, their families and those who stood by and did nothing until it was too late.