Package com.nokia.dempsy.messagetransport

Examples of com.nokia.dempsy.messagetransport.MessageTransportException


   @Override
   public Sender getSender(Destination destination) throws MessageTransportException
   {
      if (isStopped == true)
         throw new MessageTransportException("getSender called for the destination " + SafeString.valueOf(destination) +
               " on a stopped " + SafeString.valueOfClass(this));
     
      TcpSender sender;
      synchronized(senders)
      {
View Full Code Here


   {
      try { sendingQueue.put(messageBytes); }
      catch (InterruptedException e)
      {
         if (statsCollector != null) statsCollector.messageNotSent();
         throw new MessageTransportException("Failed to enqueue message to " + destination + ".",e);
      }
   }
View Full Code Here

   {
      try
      {
         InetAddress inetAddress = useLocalhost ? InetAddress.getLocalHost() : TcpTransport.getFirstNonLocalhostInetAddress();
         if (inetAddress == null)
            throw new MessageTransportException("Failed to set the Inet Address for this host. Is there a valid network interface?");
        
         return new TcpDestination(inetAddress, port);
      }
      catch(UnknownHostException e)
      {
         throw new MessageTransportException("Failed to identify the current hostname", e);
      }
      catch(SocketException e)
      {
         throw new MessageTransportException("Failed to identify the current hostname", e);
      }
   }
View Full Code Here

            serverSocket.bind(inetSocketAddress);
            destination.port = serverSocket.getLocalPort();
         }
         catch(IOException ioe)
         {
            throw new MessageTransportException("Cannot bind to port " +
                  (destination.isEphemeral() ? "(ephemeral port)" : destination.port),ioe);
         }
      }
   }
View Full Code Here

         @Override
         public Sender getSender(Destination destination) throws MessageTransportException
         {
            if (isStopped == true)
               throw new MessageTransportException("getSender called for the destination " + SafeString.valueOf(destination) +
                     " on a stopped " + SafeString.valueOfClass(this));

            PassthroughSender ret = (PassthroughSender)(((PassthroughDestination)destination).sender);
            ret.statsCollector = sc;
            return ret;
View Full Code Here

    */
   @Override
   public void send(byte[] messageBytes) throws MessageTransportException
   {
      if (shutdown.get())
         throw new MessageTransportException("send called on shutdown queue.");
     
      if (blocking)
      {
         while (true)
         {
            try { queue.put(messageBytes); if (statsCollector != null) statsCollector.messageSent(messageBytes); break; }
            catch (InterruptedException ie)
            {
               if (shutdown.get())
                  throw new MessageTransportException("Shutting down durring send.");
            }
         }
      }
      else
      {
         if (! queue.offer(messageBytes))
         {
            if (statsCollector != null) statsCollector.messageNotSent();
            if (overflowHandler != null)
               overflowHandler.overflow(messageBytes);
            else
               throw new MessageTransportException("Failed to queue message due to capacity.");
         }
         else
            if (statsCollector != null) statsCollector.messageSent(messageBytes);
      }
   }
View Full Code Here

TOP

Related Classes of com.nokia.dempsy.messagetransport.MessageTransportException

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.