implementing asynchronous notifications
От | Andras Kadinger |
---|---|
Тема | implementing asynchronous notifications |
Дата | |
Msg-id | Pine.LNX.4.44.0504100511560.28671-100000@ns.surfnonstop.com обсуждение исходный текст |
Ответы |
Re: implementing asynchronous notifications
|
Список | pgsql-jdbc |
Greetings everyone, A Java beginner here, seeking the insight of more experienced. " A key limitation of the JDBC driver is that it cannot receive asynchronous notifications and must poll the backend to check if any notifications were issued." - http://jdbc.postgresql.org/documentation/80/listennotify.html I am looking forward to have that limitation lifted. When we are idle and not in a transaction, the backend actually sends us notifications right away; in this case there is no need for us to do polling with empty queries. Under unix you can get the fd from libpq, select() on it, and then process notifications by PQConsumeInput() and retrieve them with PQnotifies(). - see last paragraph at http://www.postgresql.org/docs/current/static/libpq-notify.html Does Java provide working infrastucture to implement this reliably? What's needed is a reliable way to detect that bytes have arrived on our connection socket. I am hoping java.net.Socket.getInputStream.available() could be used. Or even better the new select()-like functionality provided by java.nio since 1.4. Do these actually work? If java.nio does, would the impact of choosing java.nio, and thereby excluding pre-1.4 platforms, an acceptable way of conduct? Or is there infrastructure in the jdbc.postgresql.org project in place to allow us to preserve backwards-compatibility by simply omitting this feature from pre-1.4 builds? Thank you in advance, Best Regards, Andras
В списке pgsql-jdbc по дате отправления: