Thanks Ted for the link. I got my issue there was an synchronization issue.
On Thu, Dec 28, 2017 at 8:57 AM, Ted Yu <yuzhih...@gmail.com> wrote: > Have you seen > https://examples.javacodegeeks.com/java-basics/exceptions/java-lang- > illegalmonitorstateexception-how-to-solve-illegalmonitorstateexception/ > ? > > You didn't include the whole code w.r.t. shadowKafkaProducer > If you need more help, please consider including more of your code. > > Cheers > > On Wed, Dec 27, 2017 at 5:32 AM, Debraj Manna <subharaj.ma...@gmail.com> > wrote: > > > Cross-posting from stackoverflow > > <https://stackoverflow.com/questions/47992916/kafka-client-throwing- > > illegalstateexception-on-calling-wait> > > > > Kafka Client 0.10.0.0 is throwing the below IllegalStateException > whenever > > I am calling wait() > > > > ERROR [2017-12-27 09:55:48] c.v.g.u.UploadHandler:[?:?:?] - [dw-199 - > > POST /collectortosaasservlet] - InterruptedException in producer.wait. > > for cloning > > java.lang.IllegalMonitorStateException: null > > at java.lang.Object.wait(Native Method) > > at java.lang.Object.wait(Object.java:502) > > at com.van.grid.uploadHandler.UploadHandler.stopCloning( > > UploadHandler.java:481) > > > > The relevant code looks like below > > > > shadowKafkaProducer = new > > KafkaProducer<>(kafkaShadowProdConf);...public void stopCloning() { > > logger.info("Going to stop cloning"); > > if(shadowKafkaProducer != null) { > > try { > > shadowKafkaProducer.wait(); > > } catch (Exception e) { > > logger.error("InterruptedException in producer.wait. > > for cloning", e); > > } > > shadowKafkaProducer.close(); > > shadowKafkaProducer = null; > > } > > logger.info("Stopped cloning"); > > } > > > > shadowKafkaProducer.wait() is line number 481 in the above stacktrace. > > > > Can someone let me know why is this exception thrown & can I ignore this? > > >