Hi,
I'm trying to get JPoller (http://sourceforge.net/projects/jpoller) working with JBoss 4.0.5 and have run into a problem. It appears that the preRegister() is not being called when I set the poller up to run as a MBean.
We have configured it to use a factory to generate the PollManagers:
<mbean code="org.sadun.util.polling.ManagedDirectoryPoller" name="user:service=DirectoryPoller"> <attribute name="Verbose">true</attribute> <attribute name="PollInterval">1000</attribute> <attribute name="StartBySleeping">true</attribute> <attribute name="ControlledDirectories">c:\download\spurwing</attribute> <attribute name="PollManagerFactoryClass">com.synyati.spurwing.download.SpurwingPollManagerFactory</attribute> </mbean>
public class ManagedDirectoryPoller extends DirectoryPoller implements ManagedDirectoryPollerMBean, MBeanRegistration, NotificationListener, NotificationBroadcaster { ...
public ObjectName preRegister(MBeanServer server, ObjectName name) throws Exception { pollerMBeanName=name; return name; }
public void setPollManagerFactoryClass(String newFactoryClsName) throws InstantiationException, IllegalAccessException, ClassNotFoundException { ... if (pollerMBeanName==null) throw new RuntimeException("PreRegister hasn't been called on this bean - poller bean name is null"); ...