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

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


        }

        setPacketObject(true /* soft*/, newp);
        if (isStoredWithInterest) {
            int cnt = 0;
            ConsumerUID uids[] = null;
            int states[] = null;
            if (ackInfo != null) {
                synchronized(ackInfo) {
                    // ok count stored entries
                    Iterator itr = ackInfo.values().iterator();
View Full Code Here


    public static void ReplaceTest() {
try {
        DestinationUID duid = new DestinationUID("test", true);
        DestinationUID duid_t = new DestinationUID("test", false);
        ConsumerUID uid1 = new ConsumerUID(1);
        ConsumerUID uid2 = new ConsumerUID(2);
        ConsumerUID[] uids = {uid1,uid2};

        Consumer consumer1 = new Consumer(duid,null, false,queueUID);
        ArrayList queues = new ArrayList();
        queues.add(consumer1);
View Full Code Here

      iidMap = new HashMap(size);
      statearray = new int[size];

      for (int i = 0; i < size; i++) {
    ConsumerUID iid = new ConsumerUID(r.readLong());
    statearray[i] = r.readInt();

    // put in interest id map
    iidMap.put(iid, new Integer(i));
      }
View Full Code Here

  int size = dis.readInt();
  iidMap = new HashMap(size);
  statearray = new int[size];

  for (int i = 0; i < size; i++) {
      ConsumerUID iid = new ConsumerUID(dis.readLong());

      statearray[i] = dis.readInt();

      // put in interest id map
      iidMap.put(iid, new Integer(i));
View Full Code Here

              + storedmap.size());
    }
    HashSet loggedSet = new HashSet(loggedLength);
    for (int i = 0; i < loggedLength; i++) {

      ConsumerUID c = logged[i];
      loggedSet.add(c);
      if (!storedmap.containsKey(c)) {
        logger.log(Logger.WARNING,
            "stored interest does not contain logged interest. sysid= "
                + mid + " ConsumerUID=" + c);
View Full Code Here

      throws IOException, BrokerException {

 
    DestinationUID did = messageAck.getDestUID();
    SysMessageID mid = messageAck.getSysMessageID();
    ConsumerUID iid = messageAck.getConsumerID();
    if (Store.getDEBUG()) {
      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

    }
    for (int i = 0; i < txnAcks.length; i++) {
      TransactionAcknowledgement txnAck = txnAcks[i];
      DestinationUID destId = destIds[i];
      SysMessageID mid = txnAck.getSysMessageID();
      ConsumerUID iid = txnAck.getStoredConsumerUID();
     
      //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

     * @throws BrokerException if entry exists in the store already
     */
    public void insert( Connection conn, Consumer consumer, long createdTS )
        throws BrokerException {

        ConsumerUID consumerUID = consumer.getConsumerUID();
        String durableName = null;
        String clientID = null;
        if ( consumer instanceof Subscription ) {
            Subscription sub = (Subscription)consumer;
            durableName = sub.getDurableName();
            clientID = sub.getClientID();
        }

        boolean myConn = false;
        PreparedStatement pstmt = null;
        Exception myex = null;
        try {
            // Get a connection
            if ( conn == null ) {
                conn = DBManager.getDBManager().getConnection( true );
                myConn = true;
            }

            if ( checkConsumer( conn, consumer ) ) {
                throw new BrokerException(
                    br.getKString( BrokerResources.E_INTEREST_EXISTS_IN_STORE,
                    consumerUID ) );
            }

            pstmt = conn.prepareStatement( insertSQL );
            pstmt.setLong( 1, consumerUID.longValue() );
            Util.setObject( pstmt, 2, consumer );
            Util.setString( pstmt, 3, durableName );
            Util.setString( pstmt, 4, clientID );
            pstmt.setLong( 5, createdTS );
            pstmt.executeUpdate();
View Full Code Here

     * @throws BrokerException if entry does not exists in the store
     */
    public void delete( Connection conn, Consumer consumer )
        throws BrokerException {

        ConsumerUID consumerUID = consumer.getConsumerUID();

        boolean deleted = false;
        boolean myConn = false;
        PreparedStatement pstmt = null;
        Exception myex = null;
        try {
            // Get a connection
            if ( conn == null ) {
                conn = DBManager.getDBManager().getConnection( true );
                myConn = true;
            }

            pstmt = conn.prepareStatement( deleteSQL );
            pstmt.setLong( 1, consumerUID.longValue() );
            if ( pstmt.executeUpdate() > 0 ) {
                deleted = true;
            }
        } catch ( Exception e ) {
            myex = e;
View Full Code Here

     * @throws BrokerException
     */
    public boolean checkConsumer( Connection conn, Consumer consumer ) throws BrokerException {

        boolean found = false;
        ConsumerUID consumerUID = consumer.getConsumerUID();

        boolean myConn = false;
        PreparedStatement pstmt = null;
        ResultSet rs = null;
        Exception myex = null;
        try {
            // Get a connection
            if ( conn == null ) {
                conn = DBManager.getDBManager().getConnection( true );
                myConn = true;
            }

            pstmt = conn.prepareStatement( selectExistByIDSQL );
            pstmt.setLong( 1, consumerUID.longValue() );
            rs = pstmt.executeQuery();
            if ( rs.next() ) {
                found = true;
            }
        } catch ( Exception e ) {
View Full Code Here

TOP

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

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.