code: public static DestinationRef asRef( Destination destination ) throws JMSException
      {
          if (destination == null)
              return null;
              
          if (destination instanceof DestinationRef)
              return (DestinationRef)destination;
          
          if (destination instanceof Queue)
              return new QueueRef(((Queue)destination).getQueueName());
          
          if (destination instanceof Topic)
              return new TopicRef(((Topic)destination).getTopicName());
          
          throw new InvalidDestinationException("Unsupported destination type : "+destination,"INVALID_DESTINATION");
      }
docs: Make sure the given destination is a light-weight serializable destination reference