Package com.sun.messaging.jmq.jmsserver.core

Examples of com.sun.messaging.jmq.jmsserver.core.Destination


      Set dstLoadedSet) throws IOException, BrokerException {
    DestinationUID did = event.destUID;
    SysMessageID mid = event.sysMessageID;
   
    // Make sure dst exists; autocreate if possible
    Destination dst = Destination.getDestination(did.getName(), did
        .isQueue() ? DestType.DEST_TYPE_QUEUE
        : DestType.DEST_TYPE_TOPIC, true, true);

    // Load all msgs inorder to update consumer states
    if (!dstLoadedSet.contains(dst)) {
      dst.load();
      dstLoadedSet.add(dst); // Keep track of what has been loaded
    }

    logger.log(Logger.FORCE, Globals.getBrokerResources().getKString(
                   BrokerResources.I_RM_MSG_ON_REPLAY_MSG_REMOVAL, mid, dst));
        dst.removeMessage(mid, RemoveReason.REMOVED_OTHER);

    if (msgStore.containsMessage(did, mid)) {
      msgStore.removeMessage(did, mid, false);
    }
   
View Full Code Here


      //Destination dest = Destination.getDestination(destId);
      // make sure it is loaded
     
      int type = (destId.isQueue() ? DestType.DEST_TYPE_QUEUE
          : DestType.DEST_TYPE_TOPIC);
      Destination dest = Destination.getDestination(destId.getName(),
          type, true, true);
      dest.load();

      PacketReference pr = dest.getMessage(mid);
      if (pr == null) {
        // could have been acknowledged already?
       
        // TO DO check this further
        String msg = " could not find packet for replayed message ack "
            + txnAck + " dest " + destId + " in transaction " + tid;
        logger.log(Logger.WARNING, msg);
      } else {
        if (msgStore.containsMessage(destId, mid)) {
          logger
              .log(logger.FORCE,
                  BrokerResources.I_UPDATE_INT_STATE_TXNLOG,
                  iid, mid);
          // For Queue, ensure the stored ConsumerUID is 0 otherwise
          // use try using the correct value; see bug 6516160
          if (dest.isQueue() && iid.longValue() != 0) {
            msgStore.updateInterestState(destId, mid, PacketReference
                .getQueueUID(),
                Store.INTEREST_STATE_ACKNOWLEDGED, false);
          } else {
            msgStore.updateInterestState(destId, mid, iid,
View Full Code Here

            SysMessageID mid = new SysMessageID();
            mid.readID(dis); // SysMessageID
            ConsumerUID iid = new ConsumerUID(dis.readLong()); // ConsumerUID

            // Make sure dst exists; autocreate if possible
            Destination dst = Destination.getDestination(
                did.getName(),
                did.isQueue() ? DestType.DEST_TYPE_QUEUE
                : DestType.DEST_TYPE_TOPIC, true, true);

            // Load all msgs inorder to update consumer states
            if (!dstLoadedSet.contains(dst)) {
                dst.load();
                dstLoadedSet.add(dst); // Keep track of what has been loaded
            }

            if (msgStore.containsMessage(did, mid)) {
                logger.log(logger.FORCE,
                    BrokerResources.I_UPDATE_INT_STATE_TXNLOG, iid, mid);
                // For Queue, ensure the stored ConsumerUID is 0 otherwise
                // use try using the correct value; see bug 6516160
                if (dst.isQueue() && iid.longValue() != 0) {
                    msgStore.updateInterestState(did, mid, PacketReference.getQueueUID(),
                        Store.INTEREST_STATE_ACKNOWLEDGED, false);
                } else {
                    msgStore.updateInterestState(did, mid, iid,
                        Store.INTEREST_STATE_ACKNOWLEDGED, false);
View Full Code Here

            : DestType.DEST_TYPE_TOPIC);

        // make sure destination exists
        // ( it may have been removed on load if it just contained
        // messages in a transaction)
        Destination dest = Destination.getDestination(duid.getName(),
            type, true, true);

        Packet message = msg.getMessage();
        ConsumerUID[] iids = msg.getStoredInterests();
        //if (iids != null)
        if(false){
          int[] states = new int[iids.length];
          for (int i = 0; i < iids.length; i++) {
            states[i] = 0;
          }

          fileStore.storeMessage(duid, message, iids, states, true);
        } else {
          fileStore.storeMessage(duid, message, true);
        }
      }

      List<TransactionWorkMessageAck> consumedMsgs = work
          .getMessageAcknowledgments();
      Iterator<TransactionWorkMessageAck> consumedIter = consumedMsgs
          .iterator();
      while (consumedIter.hasNext()) {
        TransactionWorkMessageAck msgAck = consumedIter.next();
        if (DEBUG) {
          logger.log(Logger.DEBUG, getPrefix() + " convert consumed msg "+msgAck);
        }
        DestinationUID duid = msgAck.getDestUID();
        int type = (duid.isQueue() ? DestType.DEST_TYPE_QUEUE
            : DestType.DEST_TYPE_TOPIC);
        Destination dest = Destination.getDestination(duid.getName(),
            type, true, true);
        dest.load();
        SysMessageID mid = msgAck.getSysMessageID();
        ConsumerUID cid = msgAck.getConsumerID();
        boolean sync = true;
        boolean isLastAck = false;
        TransactionAcknowledgement txAck = new TransactionAcknowledgement(mid, cid, cid);
View Full Code Here

     * @throws BrokerException
     */
    public Destination getDestination( Connection conn, String destName )
        throws BrokerException {

        Destination dest = null;

        boolean myConn = false;
        PreparedStatement pstmt = null;
        ResultSet rs = null;
        Exception myex = null;
View Full Code Here

            list = new ArrayList( 100 );
        }

        while ( rs.next() ) {
            try {
                Destination dest = (Destination)Util.readObject( rs, 1 );
                if ( isSingleRow ) {
                    return dest;
                } else {
                    list.add( dest );
                }
View Full Code Here

          tempenum = null;
      }
        } else {
      // get next enumeration
      while (dstitr.hasNext()) {
          Destination dst = (Destination)dstitr.next();
          try {
        // got the next enumeration
            tempenum = messageEnumeration(
            dst.getDestinationUID());
        break;
          } catch (BrokerException e) {
        // log error and try to load messages for
        // the next destionation
        logger.log(logger.ERROR,
          br.X_LOAD_MESSAGES_FOR_DST_FAILED,
          dst.getDestinationUID(), e);
          }
      }
      if (tempenum == null) {
          // no more
          return false;
View Full Code Here

  try  {
      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 (messageID == null)  {
    throw new BrokerException("Message ID not specified");
      }

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

      if (pr != null)  {
                d.removeMessage(sysMsgID, RemoveReason.REMOVED_OTHER);
          logger.log(Logger.INFO, "Deleted from destination "
      + destinationName
      + " message with ID: "
      + messageID);
            } else  {
View Full Code Here

  try  {
      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 (messageID == null)  {
    throw new BrokerException("Message ID not specified");
      }

      if (messageBody == null)  {
    throw new BrokerException("New message body not specified");
      }

      d.load();

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

      if (pr != null)  {
    /*
     * Need to check if message types match
     */
                int oldPacketType = pr.getPacket().getPacketType();
    Integer newPacketType = (Integer)messageBody.get("MessageBodyType");

    if (oldPacketType != newPacketType.intValue())  {
        throw new BrokerException(
      "Existing message and new message types do not match.");
    }

    byte[] bytes = getBytesFromMessage(messageBody);

    newMsgID = d.replaceMessageString(sysMsgID, null,
          bytes);

    if (newMsgID == null)  {
        throw new BrokerException(
      "New message ID not returned as expected.");
View Full Code Here

            logger.log(Logger.ERROR, this.getClass().getName() + ": " + errMsg);
  } else  {
  try {
      if (destination != null) {
    // compact one destination
    Destination d = Destination.getDestination(destination,
          DestType.isQueue(type.intValue()));
    if (d != null) {
        if (d.isPaused()) {
      d.compact();
        } else {
      status = Status.ERROR;
      String msg = rb.getString(rb.E_DESTINATION_NOT_PAUSED);
      errMsg = rb.getString(rb.X_COMPACT_DST_EXCEPTION,
          destination, msg);
      logger.log(Logger.ERROR, errMsg);
        }
    } else {
        status = Status.ERROR;
        String subError = rb.getString(rb.E_NO_SUCH_DESTINATION,
        getDestinationType(type.intValue()),
        destination);
        errMsg = rb.getString(rb.X_COMPACT_DST_EXCEPTION,
        destination, subError);
        logger.log(Logger.ERROR, errMsg);
    }
      } else {
    Iterator itr = Destination.getAllDestinations();
    boolean docompact = true;
    while (itr.hasNext()) {
        // make sure all are paused
        Destination d = (Destination)itr.next();

        /*
         * Skip internal, admin, or temp destinations.
         * Skipping temp destinations may need to be
         * revisited.
         */
        if (d.isInternal() || d.isAdmin() || d.isTemporary())  {
      continue;
        }

        if (!d.isPaused()) {
      docompact = false;
      status = Status.ERROR;
      String msg = rb.getString(
          rb.E_SOME_DESTINATIONS_NOT_PAUSED);
      errMsg = rb.getString(rb.X_COMPACT_DSTS_EXCEPTION,
          msg);
      logger.log(Logger.ERROR, errMsg);
        }
    }

    if (docompact) {
        itr = Destination.getAllDestinations();
        while (itr.hasNext()) {
      Destination d = (Destination)itr.next();

      /*
       * Skip internal, admin, or temp destinations.
       * Skipping temp destinations may need to be
       * revisited.
       */
      if (d.isInternal() || d.isAdmin() || d.isTemporary())  {
          continue;
      }

      d.compact();
        }
    }
      }
        } catch (Exception e) {
            status = Status.ERROR;
View Full Code Here

TOP

Related Classes of com.sun.messaging.jmq.jmsserver.core.Destination

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.