I need to spawn N consumer threads, which process same InputStream concurrently, e.g - transform it somehow, calculate checksum or digital signature etc. These consumers do not
You can try some Java Messaging Service (JMS) implementation like Apache ActiveMQ.
In your case you'd need to create a so called Topic (see Topics vs. Queues). A topic is created by the producer, and is published to N consumers, which may run concurrently, with each consumer receiving exactly the same data.
Since you want to use InputStream
s there is a chapter on how to send messages are streams.
I suppose, typically, producers and consumers would be separate processes, probably running on different machines on the network. I think you can configure it to run completely in a single JVM, though. This would depend on the implementation of JMS. These are also quite famous: HornetQ by JBoss, RabbitMQ, and a whole bunch of others.