Package org.hornetq.api.core

Examples of org.hornetq.api.core.HornetQException


   public void destroyDivert(SimpleString name) throws Exception
   {
      Binding binding = postOffice.getBinding(name);
      if (binding == null)
      {
         throw new HornetQException(HornetQException.INTERNAL_ERROR, "No binding for divert " + name);
      }
      if (!(binding instanceof DivertBinding))
      {
         throw new HornetQException(HornetQException.INTERNAL_ERROR, "Binding " + name + " is not a divert");
      }

      postOffice.removeBinding(name);
   }
View Full Code Here


      {
         public void onError(final int errorCode, final String errorMessage)
         {
            log.warn("Error processing IOCallback code = " + errorCode + " message = " + errorMessage);

            HornetQExceptionMessage exceptionMessage = new HornetQExceptionMessage(new HornetQException(errorCode,
                                                                                                        errorMessage));

            doConfirmAndResponse(confirmPacket, exceptionMessage, flush, closeChannel);
         }
View Full Code Here

         catch (Throwable t)
         {
            if (requiresResponse)
            {
               log.warn("Sending unexpected exception to the client", t);
               HornetQException hqe = new HornetQException(HornetQException.INTERNAL_ERROR);
               hqe.initCause(t);
               response = new HornetQExceptionMessage(hqe);
            }
            else
            {
               log.error("Caught unexpected exception", t);
View Full Code Here

            }
         }

         if (!isCompatible)
         {
            throw new HornetQException(HornetQException.IO_ERROR,
                                       "Journal files version mismatch. You should export the data from the previous version and import it as explained on the user's manual");
         }
      }

      int readUserVersion = bb.getInt();

      if (readUserVersion != userVersion)
      {
         throw new HornetQException(HornetQException.IO_ERROR, "Journal data belong to a different version");
      }

      long fileID = bb.getLong();

      fileFactory.releaseBuffer(bb);
View Full Code Here

                     " is not compatible with server version " +
                     version.getFullVersion() +
                     ". " +
                     "Please ensure all clients and servers are upgraded to the same version for them to " +
                     "interoperate properly");
            throw new HornetQException(HornetQException.INCOMPATIBLE_CLIENT_SERVER_VERSIONS,
                                       "Server and client versions incompatible");
         }

         if (!server.isStarted())
         {
            throw new HornetQException(HornetQException.SESSION_CREATION_REJECTED, "Server not started");
         }

         if (!server.checkActivate())
         {
            throw new HornetQException(HornetQException.SESSION_CREATION_REJECTED,
                                       "Server will not accept create session requests");
         }

         Channel channel = connection.getChannel(request.getSessionChannelID(), request.getWindowSize());

         ServerSession session = server.createSession(request.getName(),
                                                      request.getUsername(),
                                                      request.getPassword(),
                                                      request.getMinLargeMessageSize(),
                                                      connection,
                                                      request.isAutoCommitSends(),
                                                      request.isAutoCommitAcks(),
                                                      request.isPreAcknowledge(),
                                                      request.isXA(),
                                                      request.getDefaultAddress(),
                                                      new CoreSessionCallback(request.getName(),
                                                                              protocolManager,
                                                                              channel));

         session.setSessionContext(server.getStorageManager().newContext(server.getExecutorFactory().getExecutor()));

         ServerSessionPacketHandler handler = new ServerSessionPacketHandler(session,
                                                                             server.getStorageManager(),
                                                                             channel);
         channel.setHandler(handler);

         // TODO - where is this removed?
         protocolManager.addSessionHandler(request.getName(), handler);

         response = new CreateSessionResponseMessage(server.getVersion().getIncrementingVersion());
      }
      catch (HornetQException e)
      {
         log.error("Failed to create session ", e);
         response = new HornetQExceptionMessage((HornetQException)e);

         if (e.getCode() == HornetQException.INCOMPATIBLE_CLIENT_SERVER_VERSIONS)
         {
            incompatibleVersion = true;
         }
      }
      catch (Exception e)
      {
         log.error("Failed to create session ", e);

         HornetQPacketHandler.log.error("Failed to create session", e);

         response = new HornetQExceptionMessage(new HornetQException(HornetQException.INTERNAL_ERROR));
      }

      // send the exception to the client and destroy
      // the connection if the client and server versions
      // are not compatible
View Full Code Here

      }
      catch (Exception e)
      {
         HornetQPacketHandler.log.error("Failed to reattach session", e);

         response = new HornetQExceptionMessage(new HornetQException(HornetQException.INTERNAL_ERROR));
      }

      channel1.send(response);
   }
View Full Code Here

            response = new HornetQExceptionMessage((HornetQException)e);
         }
         else
         {
            HornetQPacketHandler.log.warn(e.getMessage(), e);
            response = new HornetQExceptionMessage(new HornetQException(HornetQException.INTERNAL_ERROR));
         }
      }

      channel1.send(response);
   }
View Full Code Here

   public void storeMessage(final ServerMessage message) throws Exception
   {
      if (message.getMessageID() <= 0)
      {
         // Sanity check only... this shouldn't happen unless there is a bug
         throw new HornetQException(HornetQException.ILLEGAL_STATE, "MessageId was not assigned to Message");
      }

      // Note that we don't sync, the add reference that comes immediately after will sync if appropriate

      if (message.isLargeMessage())
View Full Code Here

   public void storeMessageTransactional(final long txID, final ServerMessage message) throws Exception
   {
      if (message.getMessageID() <= 0)
      {
         throw new HornetQException(HornetQException.ILLEGAL_STATE, "MessageId was not assigned to Message");
      }

      if (message.isLargeMessage())
      {
         messageJournal.appendAddRecordTransactional(txID,
View Full Code Here

            if (!connection.checkDataReceived())
            {

               // We use a different thread to send the fail
               // but the exception has to be created here to preserve the stack trace
               final HornetQException me = HornetQClientMessageBundle.BUNDLE.connectionTimedOut(connection.getTransportConnection());

               cancelled = true;

               threadPool.execute(new Runnable()
               {
View Full Code Here

TOP

Related Classes of org.hornetq.api.core.HornetQException

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.