Package org.jboss.narayana.blacktie.jatmibroker.xatmi

Examples of org.jboss.narayana.blacktie.jatmibroker.xatmi.ConnectionException


    toProcess.control = controlIOR;
    return toProcess;
  }

  public int determineTimeout(long flags) throws ConnectionException {
    throw new ConnectionException(Connection.TPEPROTO,
        "Tried to retrieve the cd on mom receiver");
  }
View Full Code Here


    throw new ConnectionException(Connection.TPEPROTO,
        "Tried to retrieve the cd on mom receiver");
  }

  public int getCd() throws ConnectionException {
    throw new ConnectionException(Connection.TPEPROTO,
        "Tried to retrieve the cd on mom receiver");
  }
View Full Code Here

    message.setCommand("CONNECT");
    message.setHeaders(headers);
    send(message, outputStream);
    Message received = receive(inputStream);
    if (received.getCommand().equals("ERROR")) {
      throw new ConnectionException(Connection.TPESYSTEM, new String(
          received.getBody()));
    }

    log.debug("Created socket: " + socket + " input: " + inputStream
        + "output: " + outputStream);
View Full Code Here

  public void send(Object replyTo, short rval, int rcode, byte[] data,
      int len, int correlationId, int flags, int ttl, String type,
      String subtype) throws ConnectionException {
    if (closed) {
      throw new ConnectionException(Connection.TPEPROTO, "Sender closed");
    }

    if (data == null) {
      data = new byte[1];
      len = 1;
    }
    if (len < 1) {
      throw new ConnectionException(Connection.TPEINVAL,
          "Length of buffer must be greater than 0");
    }

    log.debug("Sender sending: " + destinationName);
    Message message = new Message();

    message.setCommand("SEND");

    Map<String, String> headers = new HashMap<String, String>();
    try {
      String ior = JtsTransactionImple.getTransactionIOR();
      if (ior != null) {
        headers.put("messagecontrol", ior);
        log.debug("Sender sending IOR: " + ior);
      }
    } catch (Exception e) {
      throw new ConnectionException(Connection.TPETRAN, e.getMessage());
    }
    if (replyTo != null) {
      log.debug("Reply to: " + replyTo);
      headers.put("messagereplyto", (String) replyTo);
    }
    headers.put("servicename", destinationName);
    headers.put("messagecorrelationId", String.valueOf(correlationId));
    headers.put("messageflags", String.valueOf(flags));
    headers.put("messagerval", String.valueOf(rval));
    headers.put("messagercode", String.valueOf(rcode));
    headers.put("messagetype", type == null ? "" : type);
    headers.put("messagesubtype", subtype == null ? "" : subtype);

    if (ttl > 0) {
      headers.put("expires", String.valueOf(ttl));
            log.debug("EXPIRES: " + headers.get("expires"));
    }
    synchronized (StompSenderImpl.class) {
      headers.put("receipt", "send-J-" + counter);
            log.debug("RECEIPT: " + headers.get("receipt"));
      counter++;
    }
    headers.put("destination", destinationName);
    message.setHeaders(headers);

    byte[] toSend = new byte[len];
    if (data != null) {
      int min = Math.min(toSend.length, data.length);
      System.arraycopy(data, 0, toSend, 0, min);
      headers.put("content-length", String.valueOf(toSend.length));
    }
    message.setBody(toSend);

    Message ack;
    try {
      management.send(message, this.outputStream);
      ack = management.receive(this.inputStream);
    } catch (IOException e) {
      throw new ConnectionException(Connection.TPEOS, e.getMessage());
    }
    if (!ack.getCommand().equals("RECEIPT")) {
      log.error(new String(ack.getBody()));
      throw new ConnectionException(Connection.TPENOENT, new String(
          ack.getBody()));
    }
    log.debug("sent message");
  }
View Full Code Here

  }

  public void close() throws ConnectionException {
    log.debug("Sender closing: " + destinationName);
    if (closed) {
      throw new ConnectionException(Connection.TPEPROTO,
          "Sender already closed");
    }
    closed = true;
    try {
      log.debug("closing socket: " + socket);
      socket.close();
      log.debug("closed socket: " + socket);
      conversationalMap.remove(serviceName);
    } catch (Throwable t) {
      throw new ConnectionException(Connection.TPESYSTEM,
          "Could not send the message", t);
    }
  }
View Full Code Here

TOP

Related Classes of org.jboss.narayana.blacktie.jatmibroker.xatmi.ConnectionException

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.