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

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


      *@param uid session to resume
      */
     public void resumeSession(SessionUID uid)
        throws BrokerException
     {
         Session ses = Session.getSession(uid);
         if (ses == null)
             throw new BrokerException("No session for " + uid);
         ses.resume("PROTOCOL");
     }
View Full Code Here


        switch (msg.getPacketType()) {
            case PacketType.START:
                if (suid != null) {
                    boolean bad = false;
                    Session s= Session.getSession(suid);
                    if (s != null && !s.getConnectionUID().equals(con.getConnectionUID()))
                        bad = true;
                    assert s != null;
                    // OK .. the client should never be sending us
                    // a bad session ID, but in reconnect it sometimes
                    // does
                    // handle it gracefully if the client does the
                    // wrong thing
                    if (s == null || bad ) {
                       logger.log(Logger.INFO,"Internal Error: received "
                                 + "bad session id " + suid
                                 + " when starting session");
                       if (bad) {
                           logger.log(logger.INFO,"Session " + suid +
                              " is bad because "
                             + " it is from a different connection "
                             + " [owning,current]=[" + s.getConnectionUID()
                             + "," + con.getConnectionUID() + "]");
                       }
                       status = Status.ERROR;
                       reason = "received bad session id " + suid +", session "+s+
                                " when starting session";
                    } else {
                        s.resume("START_STOP");
                    }
                } else {
                    con.startConnection();
                }
                break;
            case PacketType.STOP:
                if (suid != null) {
                    boolean bad = false;
                    Session s= Session.getSession(suid);
                    if (s != null && !s.getConnectionUID().equals(con.getConnectionUID()))
                        bad = true;
                    assert s != null;

                    // OK .. the client should never be sending us
                    // a bad session ID, but in reconnect it sometimes
                    // does
                    // handle it gracefully if the client does the
                    // wrong thing

                    if (s == null || bad) {
                       logger.log(Logger.INFO,"Internal Error: received "
                                 + "bad session id " + suid
                                 + " when stopping session");
                       if (bad) {
                           logger.log(logger.INFO,"Session " + suid +
                              " is bad because "
                             + " it is from a different connection "
                             + " [owning,current]=[" + s.getConnectionUID()
                             + "," + con.getConnectionUID() + "]");
                       }
                       status = Status.ERROR;
                       reason = "received bad session id " + suid +", session "+s+ 
                                " when stopping session";
                    } else {
                         s.pause("START_STOP");
                    }
                } else {
                    con.stopConnection();
                }
                Packet pkt = new Packet(con.useDirectBuffers());
View Full Code Here

    // added to fix CR 6879664
    synchronized (sessions) {
      Iterator itr = sessions.values().iterator();
      while (itr.hasNext()) {
        Session session = ((Session) itr.next());

        // 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

    }
    public void eventOccured(EventType type, Reason r, Object target, Object oldval, Object newval,
        Object userdata)
    {
        //a session has something to do
        Session s = (Session)target;
       
        if (!runningMsgs){
          // Connection is stopped so not sending messages to consumers
          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

  try  {
      int brokerAckMode;

      brokerAckMode = convertToBrokerAckMode(ackMode);

      Session s = protocol.createSession(brokerAckMode, cxn);
        new SessionListener(this, s); // create a thread
      sessionID = s.getSessionUID().longValue();
  } catch(BrokerException be)  {
      String errStr = "createSession: create session failed. Connection ID: "
      + connectionId
      + ", acknowledge mode: "
      + ackMode;
View Full Code Here

     */
    public JMSServiceReply addProducer(long connectionId, long sessionId,
            Destination dest) throws JMSServiceException  {

  JMSServiceReply reply;
  Session session;
  HashMap props = new HashMap();
  IMQConnection cxn;
  com.sun.messaging.jmq.jmsserver.core.Destination d;
  com.sun.messaging.jmq.jmsserver.core.Producer prd = null;
  long producerID = 0;
View Full Code Here

                                    throws JMSServiceException  {
  JMSServiceReply reply;
  IMQConnection cxn;
  HashMap props = new HashMap();
  com.sun.messaging.jmq.jmsserver.core.Destination d;
  Session session;
  com.sun.messaging.jmq.jmsserver.core.Consumer con;
  int size = 1000;
  long consumerID = 0;

        cxn = checkConnectionId(connectionId, "addConsumer");
View Full Code Here

    public JMSServiceReply deleteConsumer(long connectionId, long sessionId,
            long consumerId, String durableName, String clientId)
      throws JMSServiceException  {
  JMSServiceReply reply;
  IMQConnection cxn;
  Session session;
  HashMap props = new HashMap();
  com.sun.messaging.jmq.jmsserver.core.Consumer con;

        cxn = checkConnectionId(connectionId, "deleteConsumer");
        session = checkSessionId(sessionId, "deleteConsumer");
View Full Code Here

                        throws JMSServiceException  {
  JMSServiceReply reply;
  IMQConnection cxn;
  HashMap props = new HashMap();
  com.sun.messaging.jmq.jmsserver.core.Destination d;
  Session session;
  com.sun.messaging.jmq.jmsserver.core.Consumer con;
  int size = -1;

        cxn = checkConnectionId(connectionId, "setConsumerAsync");
        session = checkSessionId(sessionId, "setConsumerAsync");

  try  {
      ConsumerUID conUID = new ConsumerUID(consumerId);
      con = com.sun.messaging.jmq.jmsserver.core.Consumer.getConsumer(conUID);

            // register it as an asychronous listener
            SessionListener slistener = SessionListener.getListener(session.getSessionUID());
            slistener.setAsyncListener(con, consumer);
  } catch(Exception e)  {
      String errStr = "setConsumerAsync: Set Async consumer failed. Connection ID: "
      + connectionId
      + ", session ID: "
View Full Code Here

                    long consumerId, long timeout, boolean acknowledge,
                    long transactionId)
                        throws JMSServiceException  {
        JMSPacket msg = null;
  IMQConnection cxn;
  Session session;

        cxn = checkConnectionId(connectionId, "fetchMessage");
        session = checkSessionId(sessionId, "fetchMessage");

  SessionListener slistener = SessionListener.getListener(session.getSessionUID());
        ConsumerUID conUID;

  try  {
          conUID = new ConsumerUID(consumerId);
            msg = slistener.getNextConsumerPacket(conUID, timeout);
View Full Code Here

TOP

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

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.