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

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


                    if (tuid != null && fi.FAULT_INJECTION) {
                        fi.checkFaultAndExit(
                           FaultInjection.FAULT_MSG_REMOTE_ACK_HOME_C_TXNCOMMIT_1_7,
                           null, 2, false);
                    }
                    Destination d=Destination.getDestination(ref.getDestinationUID());
                    d.removeMessage(ref.getSysMessageID(),
                      RemoveReason.ACKNOWLEDGED);
                }
            } catch (Exception ex) {
                logger.logStack(Logger.WARNING,
                       "Unable to process acknowledgement:["+id+","+uid+"]", ex);
View Full Code Here


            if (storeNeedsRestart) {
                // Now unload all the destinations that we've loaded so msgs can be routed correctly later on by the broker
                Iterator itr = dstLoadedSet.iterator();
                while (itr.hasNext()) {
                    Destination d = (Destination)itr.next();
                    d.sync(); // Sync changes to disk
                    d.unload(true);
                }
                dstLoadedSet = null;

                // Sync changes to txn tables
                tidList.sync(null);
View Full Code Here

            pkt.readPacket(dis);

            SysMessageID mid = pkt.getSysMessageID();

            // Make sure dst exists; autocreate if possible
            Destination dst = Destination.getDestination(
                pkt.getDestination(),
                pkt.getIsQueue() ? DestType.DEST_TYPE_QUEUE
                : DestType.DEST_TYPE_TOPIC, true, true);
            DestinationUID did = dst.getDestinationUID();

            // Load all msgs inorder to verify if any msgs are missing
            if (!dstLoadedSet.contains(dst)) {
                dst.load();
                dstLoadedSet.add(dst); // Keep track of what has been loaded
            }

            // Check to see if the msg is in the store
            MsgStore msgStore = getMsgStore();
            if (msgStore.containsMessage(did, mid)) {
                logger.log(logger.FORCE,
                    BrokerResources.I_REPLACE_MSG_TXNLOG, mid);
                msgStore.removeMessage(did, mid, false);
            } else {
                logger.log(logger.FORCE,
                    BrokerResources.I_RECONSTRUCT_MSG_TXNLOG, mid);
            }

            PacketReference pr =
                PacketReference.createReference(pkt, did, null);

            try {
                dst.routeNewMessage(pr);
            } catch (SelectorFormatException e) {
                // shouldn't happens
                throw new BrokerException(br.getString(
                    BrokerResources.E_ROUTE_RECONSTRUCTED_MSG_FAILED, mid), e);
            }
View Full Code Here

            }
            if (ref.getDestinationUID().isWildcard()) {
                dsts = Destination.findMatchingIDs(ref.getDestinationUID());
            } else {
                // ok, autocreate the destination if necessary
                Destination d = Destination.getDestination(
                    ref.getDestinationUID().getName(),
                    ref.getDestinationUID().isQueue() ? DestType.DEST_TYPE_QUEUE
                       : DestType.DEST_TYPE_TOPIC, true, true);
                if (d != null) {
                    dsts = new ArrayList();
                    dsts.add(d.getDestinationUID());
                }
            }
            if (dsts == null || dsts.isEmpty()) {
               ignoreVector.addAll(targetVector);
               targetVector.clear();
            } else {
                if (!exists && !targetVector.isEmpty()) {
                    ref.setNeverStore(true);
                    // OK .. we dont need to route .. its already happened
                    ref.store(targetVector);
                    boolean enforcelimit = false;
                    itr = dsts.iterator();
                    while (itr.hasNext()) {
                        DestinationUID did = (DestinationUID)itr.next();
                        Destination d = Destination.getDestination(did);
                        if (!hasflowcontrol) {
                            enforcelimit = true;
                        } else {
                            String k = ENFORCE_REMOTE_DEST_LIMIT_PROP+did.getLongString();
                            if (Globals.getConfig().getProperty(k) == null) {
                                enforcelimit = ENFORCE_REMOTE_DEST_LIMIT;
                            } else {
                                enforcelimit = Globals.getConfig().getBooleanProperty(k);
                            }
                        }
                        if (DEBUG) {
                            logger.log(logger.INFO, "Route remote message "+ref+ " sent from "+sender+
                                " to destination(s) "+did+" for consumer(s) "+targetVector+" hasflowcontrol="+
                                hasflowcontrol+", enforcelimit="+enforcelimit);
                        }
                        if ((Destination.CHECK_MSGS_RATE_FOR_ALL ||
                             !ref.getDestinationUID().isQueue()) && !ROUTE_REJECTED_REMOTE_MSG) {
                            Consumer cs = null;
                            Subscription sub = null;
                            Iterator csitr = targetVector.iterator();
                            while (csitr.hasNext()) {
                                cs = (Consumer)csitr.next();
                                sub = cs.getSubscription();
                                if (Destination.CHECK_MSGS_RATE_FOR_ALL ||
                                    (CHECK_MSGRATE_ON_ARRIVAL &&
                                     sub != null && sub.getShared() && !sub.isDurable())) {
                                    int ret = cs.checkIfMsgsInRateGTOutRate(d);
                                    if (ret == 0) {
                                        ignoreVector.addAll(targetVector);
                                        targetVector.clear();
                                        ignoreProps = ignoreUnroutableProp;
                                        break;
                                    }
                                }
                            }
                            if (targetVector.isEmpty()) {
                                break;
                            }
                        }
                        if (!d.queueMessage(ref, false, enforcelimit)) { // add to message count
                            ignoreVector.addAll(targetVector);
                            if (!ROUTE_REJECTED_REMOTE_MSG) {
                                targetVector.clear();
                            }
                            break;
                        } else {
                            cleanupDests.add(d);
                        }
                    }
                } else if (exists) {
                    ref.add(targetVector);
                }
            }
        } catch (IOException ex) {
            logger.logStack(logger.INFO,"Internal Exception ", ex);
            ignoreVector.addAll(targetVector);
            if (!ROUTE_REJECTED_REMOTE_MSG) {
                targetVector.clear();
                ignoreProps = ignoreUnroutableProp;
            }
        } catch (BrokerException ex) {
            // unable to store
            ignoreVector.addAll(targetVector);
            if (!ROUTE_REJECTED_REMOTE_MSG) {
                targetVector.clear();
                ignoreProps = ignoreUnroutableProp;
            }
        }

        if (targetVector.isEmpty()) {
            Destination d = null;
            itr = cleanupDests.iterator();
            while (itr.hasNext()) {
                try {
                    d = (Destination)itr.next();
                    d.removeMessage(ref.getSysMessageID(), null);
                } catch (Throwable e) {
                    Object[] args = { ref.getSysMessageID(),
                                      (sender == null ? "":sender),
                                      d, targetVector.toString(), e.toString() };
                    String emsg = Globals.getBrokerResources().getKString(
                                  BrokerResources.W_UNABLE_CLEANUP_REMOTE_MSG_ON_ROUTE, args);
                    if (DEBUG) {
                        logger.logStack(Logger.WARNING,  emsg, e);
                    } else {
                        logger.log(Logger.WARNING, emsg);
                    }
                }
            }
            cleanupDests.clear();
       }

        // Now deliver the message...
        String debugString = "\n";

        int i;
        for (i = 0; i < targetVector.size(); i++) {
            Consumer interest = (Consumer)targetVector.get(i);

            if (!interest.routeMessage(ref, false)) {
                // it disappeard on us, take care of it
               try {
                    if (ref.acknowledged(interest.getConsumerUID(),
                          interest.getStoredConsumerUID(), true, false)) {
                        if (dsts == null) continue;
                        itr = dsts.iterator();
                        while (itr.hasNext()) {
                            DestinationUID did = (DestinationUID)itr.next();
                            Destination d=Destination.getDestination(did);
                            d.removeRemoteMessage(ref.getSysMessageID(),
                                          RemoveReason.ACKNOWLEDGED, ref);
                        }
                    }
                } catch (Exception ex) {
                    logger.log(logger.INFO,"Internal error processing ack",
                           ex);
                }
            } else {
                ref.addRemoteConsumerUID(interest.getConsumerUID(),
                        interest.getConsumerUID().getConnectionUID());
            }



            if (DEBUG) {
                debugString = debugString +
                    "\t" + interest.getConsumerUID() + "\n";
            }
        }

        if (DEBUG) {
            logger.log(logger.DEBUGHIGH,
                "MessageBus: Delivering message to : {0}",
                debugString);
        }

        debugString = "\n";
        // Finally, send  ClusterGlobals.MB_MSG_IGNORED acks if any...
        Object o = null;
        ConsumerUID cuid = null;
        Consumer interest = null;
        for (i = 0; i < ignoreVector.size(); i++) {
            try {
                o = ignoreVector.get(i);
                if (o instanceof Consumer) {
                    cuid = ((Consumer)o).getConsumerUID();
                    interest = (Consumer)o;
                } else {
                    cuid = (ConsumerUID)o;
                    interest = Consumer.getConsumer(cuid);
                }
                if (interest != null && dsts != null && ignoreProps == ignoreUnroutableProp) {
                    long  msgoutt = 0, t = 0;
                    Destination d = null;
                    Iterator ditr = dsts.iterator();
                    while (ditr.hasNext()) {
                        d = Destination.findDestination((DestinationUID)ditr.next());
                        if (d == null)  {
                            continue;
View Full Code Here

                    // Destination table.
                    Destination[] dstArray = jdbcStore.getAllDestinations(brokerID);
                    for (int i = 0, len = dstArray.length; i < len; i++) {
                        DestinationUID did = dstArray[i].getDestinationUID();
                        Destination dst = bkrFS.getDestination(did);
                        if (dst == null) {
                            // Store the destination if not found
                            bkrFS.storeDestination(dstArray[i]false);
                        }
                    }
View Full Code Here

                    // Destination table.
                    Destination[] dstArray = bkrFS.getAllDestinations();
                    for (int i = 0, len = dstArray.length; i < len; i++) {
                        DestinationUID did = dstArray[i].getDestinationUID();
                        Destination dst = jdbcStore.getDestination(did);
                        if (dst == null) {
                            // Store the destination if not found
                            jdbcStore.storeDestination(dstArray[i], sessionID);
                        }
                    }
View Full Code Here

  }

  // put data in new store
  // migration done when the old data is read in
  Iterator itr = olddata.values().iterator();
  Destination dst = null;
  while (itr.hasNext()) {
      dst = (Destination)itr.next();
      dstMap.put(dst.getDestinationUID().toString(), dst);
  }
  olddata.close();

  if (Store.getDEBUG()) {
      logger.log(logger.DEBUG, "DestinationList: upgraded "+
View Full Code Here

  }

        if (clearMessages) {
            Iterator itr = dstMap.values().iterator();
            while (itr.hasNext()) {
                Destination dst = (Destination)itr.next();
                DestinationUID dstuid = dst.getDestinationUID();
                try {
                    parent.getMsgStore().releaseMessageDir(dstuid, sync);
                } catch (IOException e) {
                    // log error and continue
                    logger.log(logger.ERROR, br.X_RELEASE_MSGFILE_FAILED,
View Full Code Here

        DestinationUID did = null;
        Iterator itr = dlist.iterator();
        while (itr.hasNext()) {
           
        did = (DestinationUID)itr.next();
    Destination dst = Destination.getDestination(did, dtype, true, true);
    did = dst.getDestinationUID();

    // Load all msgs in order to verify if any msgs are missing
    if (!dstLoadedSet.contains(dst)) {
      dst.load();
      dstLoadedSet.add(dst); // Keep track of what has been loaded
    }

    // Check to see if the msg is in the store
View Full Code Here

      String msg = getPrefix() + " replaying acknowledged message "
          + messageAck;
      logger.log(Logger.INFO, msg);
    }
    // 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,
View Full Code Here

TOP

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

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.