Nimit Grover - 2009-08-17

Hi

The "instance of" used in the source code of ehcache jms replication provided by ehcahe is not working.

File Name is JMSCachePeer

private void handleObjectMessage(Message message) throws JMSException, RemoteException {
        ObjectMessage objectMessage = (ObjectMessage) message;
        Object object = objectMessage.getObject();

        //If a non-cache publisher sends an Element
        if (object instanceof Element) {
            /** some code **/
        } else if (object instanceof JMSEventMessage) {
            /** some code **/
        } else {
            /** some code **/
        }

Even though the object is of type JMSEventMessage, the control does not go in the second if. rather it goes in the last else.

The object.getClass().getName() and JMSEventMessage.class.getName() both give the same result which is net.sf.ehcache.distribution.jms.JMSEventMessage.

Even then i am getting a classcastexception when i do this:

JMSEventMessage jmsEventMessage = (JMSEventMessage) object;

If anyone has any input then please share.

Thanks in advance..

Regards,
Nimit Grover.