Package com.sun.messaging.jmq.jmsserver.util

Examples of com.sun.messaging.jmq.jmsserver.util.BrokerException


        while (itr.hasNext()) {
            SysMessageID sysid = (SysMessageID)itr.next();
            if (sysid == null) continue;
            PacketReference ref = Destination.get(sysid, false);
            if (checkRefRequeued(id, ref, sysid)) {
                BrokerException bex = new BrokerException(
                   Globals.getBrokerResources().getKString(
                   BrokerResources.X_MESSAGE_MAYBE_REROUTED, sysid)+
                   ", TUID="+id, Status.GONE);
                bex.setRemote(true);
                StringBuffer buf = new StringBuffer();
                List interests = (List)mcmap.get(sysid);
                for (int i = 0 ; i < interests.size(); i++) {
                    buf.append(String.valueOf(((ConsumerUID)interests.get(i)).longValue()));
                    buf.append(" ");
                }
            bex.setRemoteConsumerUIDs(buf.toString());
                throw bex;
            }
      if (ref == null) {
                throw new BrokerException(
                Globals.getBrokerResources().getKString(
                BrokerResources.X_MESSAGE_REF_GONE, sysid)+", TUID="+id, Status.CONFLICT);
            }
            BrokerAddress ba = ref.getAddress();
            if (ba == null) ba = Globals.getMyAddress();
View Full Code Here


        if (type == AutoRollbackType.NEVER || lifetime > 0) {
            // not supported
            status = Status.NOT_IMPLEMENTED;
            reason = "AutoRollbackType of NEVER not supported";
            throw new BrokerException(reason, status);
        } else if (xid != null && !sessionLess) {
            // not supported yet
            status = Status.NOT_IMPLEMENTED;
            reason = "XA transactions only supported on sessionless "
                      + "connections";
            throw new BrokerException(reason, status);
        } else if (xid == null && sessionLess) {
            // not supported yet
            status = Status.ERROR;
            reason = "non-XA transactions only supported on "
                              + " non-sessionless connections";
            throw new BrokerException(reason, status);

        } else {
    
            if (replay) {
                // do nothing it already happened
View Full Code Here

              }
              reason = ex.getMessage();
              if (ex instanceof BrokerException) {
                 status = ((BrokerException)ex).getStatusCode();
              }
              throw new BrokerException(reason, status);
          }
      }
View Full Code Here

        JMQXid xid = null;
        try {
            props = msg.getProperties();
            Long ttid = (Long)props.get("JMQTransactionID");
            if (ttid == null) {
                throw new BrokerException("Bad/Missing transaction id");
            }

            ByteBuffer body = msg.getMessageBodyByteBuffer();
            if (body != null) {
                JMQByteBufferInputStream  bbis = new JMQByteBufferInputStream(body);
                try {
                    xid = JMQXid.read(new DataInputStream(bbis));
                } catch (IOException e) {
                    logger.log(Logger.ERROR,
                           BrokerResources.E_INTERNAL_BROKER_ERROR,
                           "Could not decode xid from packet " +
                           PacketType.getString(msg.getPacketType())+":"+e);
                    BrokerException bex = new BrokerException(e.getMessage(), Status.BAD_REQUEST);
                    bex.initCause(e);
                    throw bex;
                }
            }
            long tid = ttid.longValue();
            if (tid != 0) {
                tuid = new TransactionUID(tid);
            } else if (xid != null) {
                tuid = translist.xidToUID(xid);
                if (tuid == null) {
                    String emsg = Globals.getBrokerResources().getKString(
                                          BrokerResources.W_UNKNOWN_XID, ""+xid,
                                          PacketType.getString(msg.getPacketType()));
                    logger.log(Logger.WARNING, emsg);
                    throw new BrokerException("Unknown XID "+xid, Status.NOT_FOUND);
                }
            } else {
                logger.log(Logger.ERROR,
                        BrokerResources.E_INTERNAL_BROKER_ERROR,
                        "No transaction ID in " +
                        PacketType.getString(msg.getPacketType()));
                throw new BrokerException("No transaction ID" , Status.BAD_REQUEST);
            }
            TransactionState ts = translist.retrieveState(tuid, true);
            if (ts == null) {
                status = Status.GONE;
            } else {
                int realstate = ts.getState();

                if (realstate != TransactionState.PREPARED) {
                    // LKS - XXX
                    // for now return GONE because it seems to work
                    // better for the client - revisit
    
                    throw new BrokerException("Transaction " + tuid +
                        " is not PREPARED " + ts, Status.GONE);
                }
                Hashtable m = translist.getTransactionMap(tuid, true);

                // write it to the body
View Full Code Here

        // We have to initiate the connection.
        try {
            PortMapperEntry pme = getRealRemotePort();
            if (pme == null) {
                throw new BrokerException(br.getKString(
                br.X_CLUSTER_CANNOT_GET_REMOTE_SERVICE_PORT, getRemoteString()));
            }
            if (!pme.getProtocol().equalsIgnoreCase(parent.getTransport())) {
                throw new BrokerException(br.getKString(BrokerResources.X_CLUSTER_TRANSPORT_MISMATCH,
                                          parent.getTransport(), pme.getProtocol()));
            }

            int remotePort = pme.getPort();
            String h = pme.getProperty("hostaddr");
View Full Code Here

            b = li.getAddress();
            if (l != null && b.getMQAddress().equals(l.self.getMQAddress())) {
                String args[] = { b.getHost().toString(),
                                  s.getInetAddress().toString(),
                                  l.self.toString() + " <---> " + b.toString() };
                throw new BrokerException(
                      br.getString(br.E_MBUS_BAD_ADDRESS, args));
            }
            if (l != null && b.equals(l.self)) {
                String args[] = { b.toShortString(),
                                  s.getInetAddress().toString(),
                                  l.self.toString() + " <---> " + b.toString() };
                logger.log(Logger.ERROR, br.getKString(br.E_MBUS_SAME_ADDRESS_AS_ME, args));
                Broker.getBroker().exit(1,
                       br.getString(br.E_MBUS_SAME_ADDRESS_AS_ME, args),
                       BrokerEvent.Type.FATAL_ERROR, null, false, true, false);
                throw new BrokerException(
                      br.getString(br.E_MBUS_SAME_ADDRESS_AS_ME, args));
            }
        } catch (BrokerException e) {
            logger.log(Logger.ERROR, br.getKString(
                   br.E_CLUSTER_BAD_ADDRESS_FROM,
View Full Code Here

                ConsumerUID intid = ((Consumer) consumers.get(i)).getConsumerUID();
                ClusterConsumerInfo.writeConsumerUID(intid, dos);
            }
            if (roPkt == null) roPkt = ref.getPacket();
            if (roPkt == null) {
                throw new BrokerException(Globals.getBrokerResources().getKString(
                          BrokerResources.X_NULL_PACKET_FROM_REF, ref.toString()));
            }
            roPkt.generateTimestamp(false);
            roPkt.generateSequenceNumber(false);
View Full Code Here

                docompact = false;
                String msg = rb.getString(
                        rb.E_SOME_DESTINATIONS_NOT_PAUSED);
                errMsg = rb.getString(rb.X_COMPACT_DSTS_EXCEPTION, msg);

    throw (new BrokerException(errMsg));
            }
        }

        if (docompact) {
            itr = Destination.getAllDestinations();
View Full Code Here

        }
    }
   
    public static void checkDestType(String type) throws BrokerException  {
  if (type == null)  {
      throw new BrokerException("Null destination type specified");
  }

  if (type.equals(DestinationType.QUEUE) ||
      type.equals(DestinationType.TOPIC))  {
     
      return;
  }

  BrokerResources rb = Globals.getBrokerResources();
  throw new BrokerException(rb.getString(rb.X_JMX_INVALID_DEST_TYPE_SPEC, type));
    }
View Full Code Here

    if (type.equals(DestinationType.QUEUE))  {
              err = rb.getString(rb.X_JMX_INVALID_CREATE_TIME_ATTR_SPEC_QUEUE, name);
    } else  {
              err = rb.getString(rb.X_JMX_INVALID_CREATE_TIME_ATTR_SPEC_TOPIC, name);
    }
    throw new BrokerException(err);
      }
  }
    }
View Full Code Here

TOP

Related Classes of com.sun.messaging.jmq.jmsserver.util.BrokerException

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.