How can one look up how much direct memory is currently allocated (and may be allocated) by Java? As the evaluator of http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=4879883 mentions, Java maintains these buffers outside the normal Java heap.
...
I wanted to write a program which writes to multiple files simultaneously; thought it will be possible with one thread by using non-blocking mode. But FileChannel does not support non-blocking mode. Does anybody know why?
...
For example I have a file whose content is:
abcdefg
then i use the following code to read 'defg'.
ByteBuffer bb = ByteBuffer.allocate(4);
int read = channel.read(bb, 3);
assert(read == 4);
Because there's adequate data in the file so can I suppose so? Can I assume that the method returns a number less than limit of the given buffer...
I want to declare a variable which holds a class which implements a specific interface. Specifically, I'm trying to store a SocketChannel and a DatagramChannel in the same property so I can use them interchangeably. Both of these classes extend SelectableChannel and also implement ByteChannel, and I wish to call methods from both. I d...
I have one use-case where my multiple threads are writing data to same file channel (pooled), and each thread has offset in the file from where they can start writing till the length of the data to be written. So when I ask the file channel from pool it will open the channel in "rw" mode if it already not opened and will return that file...
Java netty can only take X number of request per second? With the selector approach is it true that it can be a bottleneck in terms of serving request per second? We find that when the traffic is high, clients are unable to connect through, resulting in a time out.
...
I have a single-threaded non-blocking socket IO server written in Java using nio.
When I have finished writing to a connection, I want to close it.
Does the closing of the channel mean blocking until all buffered writes have been acknowledged by the recipient?
It would be useful to know if, when asynchronously closing, it succeeded or...
I'm working on an Android application (in Java, obviously) and I recently updated my UDP reader code. In both versions, I set up some buffers and receive a UDP packet:
byte[] buf = new byte[10000];
short[] soundData = new short[1000];
DatagramPacket packet = new DatagramPacket (buf, buf.length);
socket.receive (packet);
In the initia...