Package com.sun.messaging.jmq.io

Examples of com.sun.messaging.jmq.io.Packet


        }

  String destination = (String)cmd_props.get(MessageType.JMQ_DESTINATION);
  Integer destType = (Integer)cmd_props.get(MessageType.JMQ_DEST_TYPE);

  Packet reply = new Packet(con.useDirectBuffers());
  reply.setPacketType(PacketType.OBJECT_MESSAGE);
        int status = Status.OK;

        Vector v = new Vector();
        String errMsg = null;
View Full Code Here


                SysMessageID sysid = new SysMessageID();
                sysid.readID(is);

                PacketReference ref = Destination.get(sysid);

                Packet realp = (ref == null ?
                      null : ref.getPacket());

                if (ref != null && !ref.isInvalid() && realp != null) {
                    //XXX revisit if this should not be
                    // using a packet (queued instead)
                    Packet p = new Packet(con.useDirectBuffers());
                    p.fill(realp);
                    p.setConsumerID(id);
                    sentp[i] = p;

                }
            }
        } catch (Exception ex) {

            logger.logStack(Logger.ERROR,
                  Globals.getBrokerResources().getString(
                   BrokerResources.X_INTERNAL_EXCEPTION,
                  "\tackcnt = " + ackcount + "\n"
                 + PacketUtil.dumpPacket(msg) + "\n"
                 + "\t" + PacketUtil.dumpThrowable(ex)), ex);

            assert false ;
        }

        // OK .. time to set the lbit on the message
        int status = Status.OK;
        try {
            if (i > 0 ) {
                assert sentp[i -1] != null;
                sentp[i-1].setIsLast(true);

             } else {
                reason = "NOT FOUND";
                status= Status.NOT_FOUND;
             }
              

        } catch (Exception ex) {
            assert false;
            reason = ex.getMessage();
            status = Status.ERROR;
            if (ex instanceof BrokerException)
                status = ((BrokerException)ex).getStatusCode();
        }

        // do we need to create a reply packet each time ?

        Packet pkt = new Packet(con.useDirectBuffers());
        pkt.setConsumerID(msg.getConsumerID());
        pkt.setPacketType(PacketType.DELIVER_REPLY);
        Hashtable hash = new Hashtable();
        hash.put("JMQStatus", new Integer(status));
        if (reason != null)
            hash.put("JMQReason", reason);
        if (((IMQBasicConnection)con).getDumpPacket() ||
            ((IMQBasicConnection)con).getDumpOutPacket())
            hash.put("JMQReqID", msg.getSysMessageID().toString());


        pkt.setProperties(hash);
        con.sendControlMessage(pkt);


        // before 3.5, messages were queued on the connection
        // however -> this means that browsing a queue
View Full Code Here

    }
        }


  // Send reply
  Packet reply = new Packet(con.useDirectBuffers());
  reply.setPacketType(PacketType.OBJECT_MESSAGE);

  setProperties(reply,
      MessageType.UPDATE_DESTINATION_REPLY, status, errMsg);

  parent.sendReply(con, cmd_msg, reply);
View Full Code Here

            errMsg = getMessageFromException(ex);
            status = Status.ERROR;
        }
        }

  Packet reply = new Packet(con.useDirectBuffers());
  reply.setPacketType(PacketType.OBJECT_MESSAGE);

  setProperties(reply, MessageType.PURGE_DURABLE_REPLY,
    status, errMsg);
  parent.sendReply(con, cmd_msg, reply);
        return true;
View Full Code Here

        // Pull messages until not busy
        while (session.isBusy()) {
          // NOTE: this should work for queues because they require a
          // resume flow from the client
          Packet emptyPacket = new Packet();
          session.fillNextPacket(emptyPacket);
          // write packet
          writePacket(emptyPacket, false);
        }
View Full Code Here

          return;
        }
        // Pull messages until not busy
        while (s.isBusy()) {
//NOTE: this should work for queues because they require a resume flow from the client
            Packet emptyPacket = new Packet();
            s.fillNextPacket(emptyPacket);
            //write packet
            writePacket(emptyPacket, false);
        }
    }
View Full Code Here

   public void sendError(IMQConnection con, boolean sendack,
                         int pktype, long consumerID,
                         String emsg, int status) {
       if (sendack) {
            Packet pkt = new Packet(con.useDirectBuffers());
            pkt.setPacketType(pktype + 1);
            pkt.setConsumerID(consumerID);
            Hashtable hash = new Hashtable();
            hash.put("JMQStatus", new Integer(status));
            if (emsg != null) {
                hash.put("JMQReason", emsg);
            }
            pkt.setProperties(hash);
            con.sendControlMessage(pkt);
       }
   }
View Full Code Here

            if (DEBUG) {
                logger.log(Logger.DEBUG,
                    "DefaultHandler: replying to unknown packet type: " +
                    msg.getPacketType());
            }
            Packet pkt = new Packet(con.useDirectBuffers());
            pkt.setPacketType(msg.getPacketType() + 1);
            pkt.setConsumerID(msg.getConsumerID());
            Hashtable hash = new Hashtable();
            hash.put("JMQStatus", new Integer(Status.NOT_IMPLEMENTED));
            pkt.setProperties(hash);
            con.sendControlMessage(pkt);
  } else {
            // No 'A' bit. Silently ignore
            if (DEBUG) {
                logger.log(Logger.DEBUG,
View Full Code Here

  static void  handleSentMessages(TransactionList transactionList, TransactionWork txnWork) throws BrokerException
  {
    for (int i = 0; i < txnWork.numSentMessages(); i++) {

      TransactionWorkMessage msg = txnWork.getSentMessages().get(i);
      Packet packet = msg.getMessage();

      DestinationUID duid = msg.getDestUID();

      logger.log(Logger.DEBUG,
          " handleSentMessages: duid= "+duid);
           
      PacketReference pr = PacketReference.createReference(packet, duid,
          null);
      Destination d = Destination.getDestination(duid);
      if (d == null) {
        // Could be an auto-created dest that was reaped on load.
        // Lets recreate it here.
        try {
          int type = (duid.isQueue() ? DestType.DEST_TYPE_QUEUE
              : DestType.DEST_TYPE_TOPIC);
          d = Destination.getDestination(duid.getName(), type, true,
              true);
        } catch (IOException e) {
          throw new BrokerException("Could not recreate destination "
              + duid, e);
        }
      }
     
      // check it is loaded
      d.load();
     
      logger.log(Logger.DEBUG,
          " loadTransactions: processing prepared sent message "
              + packet.getMessageID()) ;

      // queue message
      boolean result = d.queueMessage(pr, true);

      // store (should not really be persisted as we are using txnLog)
View Full Code Here

            //params[2] = connectionId;
            _loggerOC.entering(_className, "constructor()", params);
        }
        //Use the default (i.e. using Direct ByteBuffer)
        this.ds = ds;
        this.pkt = new Packet();
        this._setDefaultValues();
    }
View Full Code Here

TOP

Related Classes of com.sun.messaging.jmq.io.Packet

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.