Set destinations = (Set)sc.invoke(serverPeerObjectName, "getDestinations", new Object[0], new String[0]);
Set destinations = (Set)sc.getAttribute(serverPeerObjectName, "Destinations");
   public void stopServerPeer() throws Exception   {      // if we don't find a ServerPeer instance registered under the serverPeerObjectName      // ObjectName, we assume that the server was already stopped and we silently exit      if (sc.query(serverPeerObjectName).isEmpty())      {         log.warn("ServerPeer already stopped");         return;      }      log.debug("stopping connection factories");      for(Iterator i = connFactoryObjectNames.iterator(); i.hasNext(); )      {         ObjectName on = (ObjectName)i.next();         sc.invoke(on, "stop", new Object[0], new String[0]);         sc.invoke(on, "destroy", new Object[0], new String[0]);         sc.unregisterService(on);      }      connFactoryObjectNames.clear();      log.debug("stopping all destinations");      Set destinations =         (Set)sc.invoke(serverPeerObjectName, "getDestinations", new Object[0], new String[0]);      for(Iterator i = destinations.iterator(); i.hasNext(); )      {         String name;         boolean isQueue = true;         Destination d = (Destination)i.next();         if (d instanceof Queue)         {            name = ((Queue)d).getQueueName();         }         else         {            isQueue = false;            name = ((Topic)d).getTopicName();         }         undeployDestination(isQueue, name);      }      log.debug("stopping JMS server");      sc.invoke(serverPeerObjectName, "stop", new Object[0], new String[0]);      sc.invoke(serverPeerObjectName, "destroy", new Object[0], new String[0]);      sc.unregisterService(serverPeerObjectName);      log.debug("stopping ServerPeer's plug-in dependencies");      sc.invoke(durableSubscriptionStoreObjectName, "stop", new Object[0], new String[0]);      sc.invoke(durableSubscriptionStoreObjectName, "destroy", new Object[0], new String[0]);      sc.unregisterService(durableSubscriptionStoreObjectName);      sc.invoke(messageStoreObjectName, "stop", new Object[0], new String[0]);      sc.invoke(messageStoreObjectName, "destroy", new Object[0], new String[0]);      sc.unregisterService(messageStoreObjectName);      sc.invoke(transactionLogObjectName, "stop", new Object[0], new String[0]);      sc.invoke(transactionLogObjectName, "destroy", new Object[0], new String[0]);      sc.unregisterService(transactionLogObjectName);      sc.invoke(threadPoolObjectName, "stop", new Object[0], new String[0]);      sc.invoke(threadPoolObjectName, "destroy", new Object[0], new String[0]);      sc.unregisterService(threadPoolObjectName);   }