Java Solaris Communities Sun Store Join SDN My Profile Why Join?
 
Bug Database
Bug Detail
Quick Lists
Top 25 Bugs
Top 25 RFE's
Recently Closed Bugs
Printable Page Printable Page


Bug Database
Bug ID: 4225965
Votes 19
Synopsis Select like feature for TCP/IP stack
Category java:classes_net
Reported Against 1.2 , 1.1.4 , 1.2beta2
Release Fixed
State 11-Closed, duplicate of 4313882, request for enhancement
Priority: 4-Low
Related Bugs 4094858 , 4313882
Submit Date 01-APR-1999
Description




I would like to have select like feature on top of TCP/IP
stack java implementation.

Why?
If I have one network card naturaly I want one thread to be
able to process all incoming/outgoing TCP/IP (UDP also) trafic.
This way I need the single high priority thread to work
(dedicated) on processing data to/from network card.

What Benefit?
Let's assume we have a system (PC) with 
1 netwok card and
4 hard disks.
Using ala select feature on TCP/IP stack I would be able to
serve (let's say) 50,000 simultaneous  customer /ip connection 
on the system with 6 threads only.
1 Thread (dedicated&internal), (I have no dirrect access to it),
  processes data to/from network card (high priority)
2 Thread is my basic application with caching capabilities
  + issuing requests for the thread #1 or to the threads #3-#6
3-6 Threads read data (files) from the disks #1#2#3#4

So, thread #2 waits on semaphore when has nothing to do, and
could be woken up from threads #3-#6 (naturaly, this would be
my application code) or from thread #1 (because it is designed
to work this way)

Let me repeat:
I have no access to the thread #1. I have an TCPSelectInterface Object only which is created to serve my specific network 
interface.

Requested features for TCPSelectInterface.
1) I wanna have several TCPSelectInterface objects serving on
single network interface. That is required because I can have
my thread #2 serving all ordinary "download html files" trafic
and thread pool of (let's say) 50 threads serving special 
request ala servlets.
1)a) I don't need TCPSelectInterface  customer  at all if my
special handling thread ("servlet" execution) uses only one
socket at all, so this special stealth thread #1 can block my
special handling thread if needed.
2) I should be able have and use 2 TCPSelectInterface objects
dedicated for different interfaces (let's say, network card and
loopback 1 thread for 1 interface) in the same thread 
(let's say thread #2)
3) Through TCPSelectInterface I should be able to check socket
status, should be able to query how many bytes i can write/read
from specified socket.
3)a) Through TCPSelectInterface I should be able to query how 
many bytes i can write/read from the network interface.
4) I should be able to read from TCPSelectInterface all data
and sockets' numbers which are available immediately without
blocking
4)a) I should be able to block my thread while waiting data
from "4)" requested feature. My thread should be waken up when
data from "4)" requested feature is available (if not waken
by any other thread).

I am aware now, that i can check socket and query how many bytes
are available for immediate read, but i'm not sure how to
implement write bytes to the socket which does not block thread
(or at least query socket for how many bytes i can write without
blocking).
Also, current TCP/IP stack implementation forces me to scan
all sockets for being able to see which socket has data for
immediate (non blocking) read, and which does not. So requested
feature "4)" is supposed to solve that problem.

I request this feature, because i'm almost sure, that this
feature requires some native code for implementation. 
If i do write my native code, i will get not compatible with
100% pure Java solution, which is not my aim.
(Review ID: 56377) 
======================================================================
Work Around
N/A
Evaluation
Probably as part of the NEW I/O design.

  xxxxx@xxxxx   2000-02-08
Comments
  
  Include a link with my name & email   

Submitted On 05-FEB-2000
haydens
This is the same as bug 4094858 (which was
submitted in 97!).


Submitted On 02-JAN-2001
gjayadevan
This would be a great feature to have for specially those 
of us with a programming background in UNIX.


Submitted On 10-APR-2001
adampr
I wish.



PLEASE NOTE: JDK6 is formerly known as Project Mustang