Package org.hornetq.api.core

Examples of org.hornetq.api.core.HornetQException


      }
      else
      {

         tx = newTransaction(xid);
         tx.markAsRollbackOnly(new HornetQException("Can't commit as a Failover happened during the operation"));

         if (isTrace)
         {
            HornetQServerLogger.LOGGER.trace("xastart into tx= " + tx);
         }
View Full Code Here


               targetPassword = codecInstance.decode(targetPassword);
            }
         }
         catch (Exception e)
         {
            throw new HornetQException(HornetQException.ILLEGAL_STATE, "Error decoding password using codec instance", e);
         }

      }
   }
View Full Code Here

      {
         throw new IllegalArgumentException("Factory does not exist");
      }
      if (registry.lookup(jndiBinding) != null)
      {
         throw new HornetQException(HornetQException.ADDRESS_EXISTS, "JNDI " + name +
                                                                     " is already being used by another connection factory");
      }
      boolean added = bindToJndi(jndiBinding, factory);
      if (added)
      {
View Full Code Here

   {
      List<String> jndi = connectionFactoryJNDI.get(name);

      if (jndi == null)
      {
         throw new HornetQException(HornetQException.INTERNAL_ERROR, "Connection Factory " + name + " doesn't exist");
      }

      String[] usedJNDI = jndi.toArray(new String[jndi.size()]);
     
      HornetQConnectionFactory realCF = internalCreateCFPOJO(cf);
View Full Code Here

                                                         .getDiscoveryGroupConfigurations()
                                                         .get(cfConfig.getDiscoveryGroupName());

         if (groupConfig == null)
         {
            throw new HornetQException(HornetQException.ILLEGAL_STATE,
                                       "Discovery Group '" + cfConfig.getDiscoveryGroupName() +
                                                "' doesn't exist on maing config");
         }

         if (cfConfig.isHA())
         {
            cf = HornetQJMSClient.createConnectionFactoryWithHA(groupConfig, cfConfig.getFactoryType());
         }
         else
         {
            cf = HornetQJMSClient.createConnectionFactoryWithoutHA(groupConfig, cfConfig.getFactoryType());
         }
      }
      else
      {
         if (cfConfig.getConnectorNames() == null || cfConfig.getConnectorNames().size() == 0)
         {
            throw new HornetQException(HornetQException.ILLEGAL_STATE,
                                       "Null Connector name passed to create ConnectionFactory");
         }

         TransportConfiguration[] configs = new TransportConfiguration[cfConfig.getConnectorNames().size()];

         int count = 0;
         for (String name : cfConfig.getConnectorNames())
         {
            TransportConfiguration connector = server.getConfiguration().getConnectorConfigurations().get(name);
            if (connector == null)
            {
               throw new HornetQException(HornetQException.ILLEGAL_STATE, "Connector '" + name +
                                                                          "' not found on the main configuration file");
            }
            correctInvalidNettyConnectorHost(connector);
            configs[count++] = connector;
         }
View Full Code Here

         throw e;
      }
      catch (Throwable e)
      {
         HornetQServerLogger.LOGGER.errorAckingMessage((Exception) e);
         HornetQException hqex = new HornetQIllegalStateException(e.getMessage());
         if (startedTransaction)
         {
            tx.rollback();
         }
         else
View Full Code Here

      if (conns != null)
      {
         for (CoreRemotingConnection conn : conns)
         {
            conn.fail(new HornetQException(HornetQException.INTERNAL_ERROR, "simulated connection failure"));
         }
      }
   }
View Full Code Here

   }

   public void connectionDestroyed(final Object connectionID)
   {
      handleConnectionFailure(connectionID,
                              new HornetQException(HornetQException.NOT_CONNECTED, "Channel disconnected"));
   }
View Full Code Here

                        return null;
                     }

                     if (theConnection == null)
                     {
                        throw new HornetQException(HornetQException.NOT_CONNECTED,
                                                   "Unable to connect to server using configuration " + connectorConfig);
                     }
                  }

                  channel1 = theConnection.getChannel(1, -1);

                  // Lock it - this must be done while the failoverLock is held
                  channel1.getLock().lock();

                  lock = channel1.getLock();
               } // We can now release the failoverLock

               // We now set a flag saying createSession is executing
               synchronized (exitLock)
               {
                  inCreateSession = true;
               }

               long sessionChannelID = theConnection.generateChannelID();

               Packet request = new CreateSessionMessage(name,
                                                         sessionChannelID,
                                                         clientVersion.getIncrementingVersion(),
                                                         username,
                                                         password,
                                                         minLargeMessageSize,
                                                         xa,
                                                         autoCommitSends,
                                                         autoCommitAcks,
                                                         preAcknowledge,
                                                         confWindowSize,
                                                         null);

               Packet pResponse;
               try
               {
                  pResponse = channel1.sendBlocking(request);
               }
               catch (HornetQException e)
               {
                  if (e.getCode() == HornetQException.INCOMPATIBLE_CLIENT_SERVER_VERSIONS)
                  {
                     theConnection.destroy();
                  }

                  if (e.getCode() == HornetQException.UNBLOCKED)
                  {
                     // This means the thread was blocked on create session and failover unblocked it
                     // so failover could occur

                     retry = true;

                     continue;
                  }
                  else
                  {
                     throw e;
                  }
               }

               CreateSessionResponseMessage response = (CreateSessionResponseMessage)pResponse;

               Channel sessionChannel = theConnection.getChannel(sessionChannelID, confWindowSize);

               ClientSessionInternal session = new ClientSessionImpl(this,
                                                                     name,
                                                                     username,
                                                                     password,
                                                                     xa,
                                                                     autoCommitSends,
                                                                     autoCommitAcks,
                                                                     preAcknowledge,
                                                                     blockOnAcknowledge,
                                                                     autoGroup,
                                                                     ackBatchSize,
                                                                     consumerWindowSize,
                                                                     consumerMaxRate,
                                                                     confWindowSize,
                                                                     producerWindowSize,
                                                                     producerMaxRate,
                                                                     blockOnNonDurableSend,
                                                                     blockOnDurableSend,
                                                                     cacheLargeMessageClient,
                                                                     minLargeMessageSize,
                                                                     initialMessagePacketSize,
                                                                     groupID,
                                                                     theConnection,
                                                                     response.getServerVersion(),
                                                                     sessionChannel,
                                                                     orderedExecutorFactory.getExecutor());

               sessions.add(session);

               ChannelHandler handler = new ClientSessionPacketHandler(session, sessionChannel);

               sessionChannel.setHandler(handler);

               return new DelegatingSession(session);
            }
            catch (Throwable t)
            {
               if (lock != null)
               {
                  lock.unlock();

                  lock = null;
               }

               if (t instanceof HornetQException)
               {
                  throw (HornetQException)t;
               }
               else
               {
                  HornetQException me = new HornetQException(HornetQException.INTERNAL_ERROR,
                                                             "Failed to create session", t);

                  throw me;
               }
            }
View Full Code Here

            {
               // Must be executed on new thread since cannot block the netty thread for a long time and fail can
               // cause reconnect loop
               public void run()
               {
                  conn.fail(new HornetQException(HornetQException.DISCONNECTED,
                                                 "The connection was disconnected because of server shutdown"));
               }
            });
         }
      }
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.