0

I have encountered a situation where I have a class (let's call this class "A") with a @Produce method.

In another class, if I initialize two objects from class "A". Event bus throws an exception that the producer class is already registered.

Is there any workaround for this? because I want to @Produce some functionality but also cannot avoid instantiation of the same class twice.

Farooq Arshed
  • 1,984
  • 2
  • 17
  • 26
  • are you registering the event bus in constructor of Class A ? – Basil jose Oct 18 '18 at 09:43
  • @Basiljose yes I am – Farooq Arshed Oct 18 '18 at 09:48
  • you can check whether object is already registered or not , have you tried it ? – Basil jose Oct 18 '18 at 10:08
  • @Basiljose Yes and since there are two instances of the same class. trying to produce it gives the following error. java.lang.IllegalArgumentException: Producer method for type class com.data.model.FilterDataModel found on type class com.data.filter.FormSpinnerComponent, but already registered by type class com.data.filter.FormSpinnerComponent. – Farooq Arshed Oct 18 '18 at 10:13

0 Answers0