Examples of IllegalStateException


Examples of hamsam.exception.IllegalStateException

    {
      NotificationServer ns = (NotificationServer) server;
      ns.changeStatus(code);
    }
    else
      throw new IllegalStateException("Not yet connected to MSN");
  }
View Full Code Here

Examples of hamsam.exception.IllegalStateException

   * @throws IllegalStateException if the protocol is not connected.
   */
  public void disconnect() throws IllegalStateException
  {
    if(!(server instanceof NotificationServer))
      throw new IllegalStateException("Not yet connected to MSN");

    server.shutdown();
    eventProcessor.disconnected();
  }
View Full Code Here

Examples of hamsam.exception.IllegalStateException

   * @throws IllegalStateException if the protocol is not connected to MSN yet.
   */
  private NotificationServer checkValidNotificationServer() throws IllegalStateException
  {
    if(!(server instanceof NotificationServer))
      throw new IllegalStateException("Not logged in yet - MSN");

    return (NotificationServer) server;
  }
View Full Code Here

Examples of java.lang.IllegalStateException

    /*
     * throw new IllegalStateException(
     * jtaLogger.logMesg.getString("com.arjuna.ats.internal.jta.transaction.jts.subordinate.invalidstate"));
     */

    throw new IllegalStateException();
  }
View Full Code Here

Examples of javax.jms.IllegalStateException

    if (logger.isLoggable(BasicLevel.DEBUG))
      logger.log(BasicLevel.DEBUG,
                 "ReliableTcpClient[" + identity + ',' + key + "].connect(" + reconnect + ')');

    if (status != INIT)
      throw new IllegalStateException("Connect: state error");

    long startTime = System.currentTimeMillis();
    long endTime = startTime;
    if (addresses.size() > 1) {
      // infinite retry in case of HA.
      endTime = Long.MAX_VALUE;
    } else {
      if (reconnect) {
        endTime += reconnectTimeout;
      } else {
        endTime += params.connectingTimer * 1000L;
      }
    }

    int attemptsC = 0;
    long nextSleep = 100;
    while (true) {
      if (status == CLOSE)
        throw new IllegalStateException("Closed connection");
      attemptsC++;
      for (int i = 0; i < addresses.size(); i++) {
        ServerAddress sa = (ServerAddress)addresses.elementAt(i);
        try {
          doConnect(sa.hostName, sa.port);
          setStatus(CONNECT);
          return;
        } catch (JMSSecurityException exc) {
          throw exc;
        } catch (UnknownHostException uhe) {
          if (logger.isLoggable(BasicLevel.DEBUG))
            logger.log(BasicLevel.DEBUG, "ReliableTcpClient.connect", uhe);
          IllegalStateException jmsExc = new IllegalStateException("Server's host is unknown: " + sa.hostName);
          jmsExc.setLinkedException(uhe);
          throw jmsExc;
        } catch (IOException ioe) {
          if (logger.isLoggable(BasicLevel.DEBUG))
            logger.log(BasicLevel.DEBUG, "ReliableTcpClient.connect", ioe);
          // continue
        } catch (JMSException jmse) {
          if (logger.isLoggable(BasicLevel.DEBUG))
            logger.log(BasicLevel.DEBUG, "ReliableTcpClient.connect", jmse);
          // continue
        } catch (Exception e) {
          if (logger.isLoggable(BasicLevel.DEBUG))
            logger.log(BasicLevel.DEBUG, "ReliableTcpClient.connect", e);
          // continue
        }
      }
      long currentTime = System.currentTimeMillis();

      if (logger.isLoggable(BasicLevel.DEBUG))
        logger.log(BasicLevel.DEBUG,
                   " -> currentTime = " + currentTime + ",endTime = " + endTime);

      // Keep on trying as long as timer is ok:
      if (currentTime < endTime) {
        if (logger.isLoggable(BasicLevel.DEBUG))
          logger.log(BasicLevel.DEBUG,
                     " -> retry connection " + identity + ',' + key);

        if (currentTime + nextSleep > endTime) {
          nextSleep = endTime - currentTime;   
        }     

        // Sleeping for a while:
        try {
          wait(nextSleep);
        } catch (InterruptedException intExc) {
          throw new IllegalStateException("Could not open the connection with " + addresses + ": interrupted");
        }         

        // Trying again!
        nextSleep = nextSleep * 2;
      } else {
        if (logger.isLoggable(BasicLevel.DEBUG))
          logger.log(BasicLevel.DEBUG,
                     " -> close connection " + identity + ',' + key);

        // If timer is over, throwing an IllegalStateException:
        long attemptsT = (System.currentTimeMillis() - startTime) / 1000;
        IllegalStateException jmsExc = new IllegalStateException("Could not connect to JMS server with "
            + addresses + " after " + attemptsC + " attempts during " + attemptsT
            + " secs: server is not listening or server protocol version is not compatible with client.");
        throw jmsExc;
      }
    }
View Full Code Here

Examples of javax.jms.IllegalStateException

      return (javax.jms.TopicConnection) o;
    } catch (javax.resource.spi.SecurityException exc) {
      throw new JMSSecurityException("Invalid user identification: " + exc);
    } catch (javax.resource.spi.CommException exc) {
      throw new IllegalStateException("Could not connect to the JORAM server: "
                                      + exc);
    } catch (javax.resource.ResourceException exc) {
      throw new JMSException("Could not create connection: " + exc);
    }
  }
View Full Code Here

Examples of javax.jms.IllegalStateException

      createConnectionConsumer(Topic topic,
                               String messageSelector,
                               ServerSessionPool sessionPool,
                               int maxMessages)
    throws JMSException {
    throw new IllegalStateException("Forbidden call on a component's "
                                    + "connection.");
  }
View Full Code Here

Examples of javax.jms.IllegalStateException

   */
  public void setMessageListener(javax.jms.MessageListener messageListener)
              throws JMSException
  {
    checkValidity();
    throw new IllegalStateException("Forbidden call on a component's session.");
  }
View Full Code Here

Examples of javax.jms.IllegalStateException

   * <code>IllegalStateException</code> instance.
   */
  public javax.jms.MessageListener getMessageListener() throws JMSException
  {
    checkValidity();
    throw new IllegalStateException("Forbidden call on a component's session.");
  }
View Full Code Here

Examples of javax.jms.IllegalStateException

   * <code>IllegalStateException</code> instance.
   */
  public void commit() throws JMSException
  {
    checkValidity();
    throw new IllegalStateException("Forbidden call on a component's session.");
  }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.