Work at SourceForge, help us to make it a better place! We have an immediate need for a Support Technician in our San Francisco or Denver office.

Close

instanceof in JMSCachePeer not working.

Developers
2009-08-17
2013-05-14
  • Nimit Grover
    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.