Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.java.programmer > #39116
| From | Daniele Futtorovic <da.futt.news@laposte-dot-net.invalid> |
|---|---|
| Newsgroups | comp.lang.java.programmer |
| Subject | Re: read messages that are both async & sync from one inputstream |
| Date | 2019-08-20 19:58 +0200 |
| Organization | A noiseless patient Spider |
| Message-ID | <qjhcbk$2d1$1@dont-email.me> (permalink) |
| References | <e601f9ed-292b-4494-b6b3-0f32d6269c79@googlegroups.com> |
On 2019-08-20 17:35, mike wrote: > Hi, > > I have an application that sends/receives output from a product using NETCONF protocol. We basically have 3 types of messages: > > 1. Configuration messages which is a write/read ( synchronous) > 2. KeepAlive messages which is also a write/read ( synchronous ) Done every 10 seconds. > 3. Notification messages from the product read-only ( asynchronous ) > > All of then are running in separate threads. > > All output from product is read from an inputStream. The problem we are facing is that the notification messages are cut of for some reason. I can sometimes see that the KeepAlive read() gets the same message ( it checks the format of the message and decides it is not a KeepAlive response message but rather a notification. So looks like KeepAlive "eats" part of the message and then notification reader is reads what is left. > > Any ideas of how to solve this without the mess of multiple thread sync? > > //mike > You can't read with multiple threads from the same InputStream. And multiple thread sync is not a mess, it's art. You need a single-threaded read + multi-threaded dispatch. -- DF.
Back to comp.lang.java.programmer | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
read messages that are both async & sync from one inputstream mike <mikaelpetterson@hotmail.com> - 2019-08-20 08:35 -0700 Re: read messages that are both async & sync from one inputstream Eric Douglas <e.d.programmer@gmail.com> - 2019-08-20 08:53 -0700 Re: read messages that are both async & sync from one inputstream Eric Sosman <esosman@comcast-dot-net.invalid> - 2019-08-20 13:17 -0400 Re: read messages that are both async & sync from one inputstream Daniele Futtorovic <da.futt.news@laposte-dot-net.invalid> - 2019-08-20 19:58 +0200 Re: read messages that are both async & sync from one inputstream Eric Douglas <e.d.programmer@gmail.com> - 2019-08-20 11:04 -0700
csiph-web