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

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


            }
        }

  if (status != Status.OK)  {
      throw new BrokerException(errMsg);
  }
    }
View Full Code Here


    public HeartbeatService() throws Exception {
        fi = FaultInjection.getInjection();
        clsmgr = Globals.getClusterManager();
        if (clsmgr == null)  {
            throw new BrokerException("No cluster manager");
        }
        if (!clsmgr.isHA()) {
            throw new BrokerException("Non HA cluster");
        }
        initHeartbeat();
        clsmgr.addEventListener(this);

    }
View Full Code Here

        // first check if we have exceeded our maximum message count per txn
        if (published.size() < TransactionList.defaultProducerMaxMsgCnt) {
            published.add(id);
        } else {
            throw new BrokerException(
                Globals.getBrokerResources().getKString(
                    BrokerResources.X_TXN_PRODUCER_MAX_MESSAGE_COUNT_EXCEEDED,
                    TransactionList.defaultProducerMaxMsgCnt, tid),
                BrokerResources.X_TXN_PRODUCER_MAX_MESSAGE_COUNT_EXCEEDED,
                (Throwable) null,
View Full Code Here

                  "["+sysid+":"+id+","+sid+"]", tid), Status.CONFLICT);
            }
            l.add(id);
            cuidToStored.put(id, sid);
        } else {
            throw new BrokerException(
                Globals.getBrokerResources().getKString(
                    BrokerResources.X_TXN_CONSUMER_MAX_MESSAGE_COUNT_EXCEEDED,
                    TransactionList.defaultConsumerMaxMsgCnt, tid),
                BrokerResources.X_TXN_CONSUMER_MAX_MESSAGE_COUNT_EXCEEDED,
                (Throwable) null,
View Full Code Here

        ConsumerUID id, BrokerAddress addr) throws BrokerException {

        BrokerAddress ba = (BrokerAddress)sysidToAddr.get(sysid);
        if (ba != null && (!ba.equals(addr) ||
            !ba.getBrokerSessionUID().equals(addr.getBrokerSessionUID()))) {
            BrokerException bex = new BrokerException(
                "Message requeued:"+sysid, Status.GONE);
            bex.setRemoteConsumerUIDs(String.valueOf(id.longValue()));
            bex.setRemote(true);
            throw bex;
        }
        sysidToAddr.put(sysid, addr);
    }
View Full Code Here

    public synchronized ConsumerUID removeConsumedMessage(SysMessageID sysid,
        ConsumerUID id) throws BrokerException {

        List l = (List)consumed.get(sysid);
        if (l == null) {
            throw new BrokerException(Globals.getBrokerResources().getKString(
                      BrokerResources.X_CONSUMED_MSG_NOT_FOUND_IN_TXN,
                      "["+sysid+","+id+"]", tid.toString()));
        }
        l.remove(id);
        if (l.size() == 0) consumed.remove(sysid);
View Full Code Here

    public GPacket getGPacket(short protocol) throws BrokerException {
        assert ( protocol == ProtocolGlobals.G_TAKEOVER_COMPLETE ||
                 protocol == ProtocolGlobals.G_TAKEOVER_PENDING ||
                 protocol == ProtocolGlobals.G_TAKEOVER_ABORT );
        if (!Globals.getHAEnabled()) {
            throw new BrokerException(
                Globals.getBrokerResources().getKString(
                    BrokerResources.E_INTERNAL_BROKER_ERROR,
                    "Broker is not running in HA mode"));
        }

        if (pkt != null) {
            assert ( pkt.getType() == protocol );
           return pkt;
        }

        GPacket gp = GPacket.getInstance();
        gp.putProp("brokerID", brokerID);
        gp.putProp("storeSession", new Long(storeSession.longValue()));

        if (protocol == ProtocolGlobals.G_TAKEOVER_COMPLETE) {
            gp.setType(protocol);
            gp.setBit(gp.A_BIT, false);
            return gp;
        }

        HAClusteredBroker cb = (HAClusteredBroker)Globals.getClusterManager().getLocalBroker();
        if (protocol == ProtocolGlobals.G_TAKEOVER_PENDING) {
            gp.setType(ProtocolGlobals.G_TAKEOVER_PENDING);
            gp.setBit(gp.A_BIT, false);
            gp.putProp("brokerSession", new Long(brokerSession.longValue()));
            gp.putProp("brokerHost",  brokerHost);
            if (fromTaker) {
                taker = cb.getBrokerName();
                gp.putProp("taker", taker);
                gp.putProp("timestamp", new Long(cb.getHeartbeat()));
                gp.setBit(gp.A_BIT, true);
            } else if (timedout) {
                gp.putProp("timestamp", new Long(0));
            }
            gp.putProp("X", xid);
            return gp;
        }

        if (protocol == ProtocolGlobals.G_TAKEOVER_ABORT) {
            gp.setType(ProtocolGlobals.G_TAKEOVER_ABORT);
            if (fromTaker) {
            gp.putProp("taker", cb.getBrokerName());
            }
            gp.setBit(gp.A_BIT, false);
            gp.putProp("X", xid);
            return gp;
        }
        throw new BrokerException("Unknown protocol: "+protocol);
    }
View Full Code Here

        if (Globals.getMemManager() != null) {
            Globals.getMemManager().removeProducer();
        }
        Object o = producers.remove(pid);
        if (o == null)
            throw new BrokerException("Requested removal of "
              + " producer " + pid + " which is not associated with"
              + " connection " + getConnectionUID());
       
        Producer.destroyProducer(pid, reason);
    }
View Full Code Here

        throws BrokerException
    {
        synchronized(sessions) {
            Session s = (Session)sessions.remove(uid);
            if (s == null)
                throw new BrokerException("Requested removal of "
                 + " session " + uid + " which is not associated with"
                 + " connection " + getConnectionUID());
            if (lockToSession != null && s != null)
                lockToSession.remove(s.getSessionUID());
        }
View Full Code Here

  try  {
      HashMap destNameType = new HashMap();

      if ((destinationName == null) || (destinationType == null))  {
    throw new BrokerException("Destination name and type not specified");
      }

      Destination d = Destination.getDestination(destinationName,
      (destinationType.equals(DestinationType.QUEUE)));

      if (d == null)  {
    throw new BrokerException(rb.getString(rb.X_DESTINATION_NOT_FOUND,
                 destinationName));
      }

      if (getBody == null)  {
    getBody = Boolean.FALSE;
      }

      if (messageID != null)  {
    d.load();

          SysMessageID sysMsgID = SysMessageID.get(messageID);
                PacketReference  pr = getPacketReference(sysMsgID);

    if (pr != null)  {
        HashMap h = constructMessageInfo(sysMsgID,
            getBody.booleanValue(),
            destNameType);

        msgInfo.add(h);
    } else  {
        throw new BrokerException("Could not locate message "
          + messageID
          + " in destination "
          + destinationName);
    }
      } else  {
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.