Package org.jboss.narayana.blacktie.jatmibroker.jab

Examples of org.jboss.narayana.blacktie.jatmibroker.jab.JABTransaction


  public synchronized JABResponse call(String serviceName, JABBuffer toSend,
      Transaction transaction, String bufferType, String bufferSubType)
      throws TransactionException, JABException {
    log.debug("call");

    JABTransaction tx = null;
    if (transaction != null) {
      tx = transaction.getJABTransaction();
    }

    JABServiceInvoker remoteService = new JABServiceInvoker(serviceName,
View Full Code Here


   */
  Transaction(JABConnection connection, JABSession session, int timeout)
      throws TransactionException {
    this.connection = connection;
    try {
      this.jabTransaction = new JABTransaction(session, timeout);
    } catch (Throwable e) {
      throw new TransactionException("Could not create the transaction: "
          + e.getMessage(), e);
    }
  }
View Full Code Here

    // for (Map.Entry e : attrs.getProperties().entrySet())
    // log.info(e.getKey() + " = " + e.getValue());

    try {
      return new JABTransaction(session, 5000);
    } catch (Exception e) {
      throw new JABException(e.getMessage(), e);
    }
  }
View Full Code Here

    byte[] args = "test=test1,tx=true".getBytes();
    X_OCTET buffer = (X_OCTET) connection.tpalloc("X_OCTET", null,
        args.length);
    buffer.setByteArray(args);

    JABTransaction transaction = startTx();
    Response response = connection.tpcall("TxEchoService", buffer, 0);
    String responseData = new String(
        ((X_OCTET) response.getBuffer()).getByteArray());
    transaction.commit();
    assertEquals("test=test1,tx=true", responseData);
  }
View Full Code Here

    byte[] args = "test=test4,tx=false".getBytes();
    X_OCTET buffer = (X_OCTET) connection.tpalloc("X_OCTET", null,
        args.length);
    buffer.setByteArray(args);

    JABTransaction transaction = startTx();
    Response response = connection.tpcall("TxEchoService", buffer, 0);
    String responseData = new String(
        ((X_OCTET) response.getBuffer()).getByteArray());
    transaction.commit();
    assertNotSame("test=test4,tx=false", responseData);
  }
View Full Code Here

      /*
       * First get the hierarchy from the bottom up.
       */

      java.util.Stack s = new java.util.Stack();
      JABTransaction nextLevel = act.parent();

      s.push(act);

      while (nextLevel != null) {
        s.push(nextLevel);

        nextLevel = nextLevel.parent();
      }

      /*
       * Now push the hierarchy onto the thread stack.
       */
 
View Full Code Here

  public static JABTransaction popAction(String threadId, boolean unregister)
      throws EmptyStackException {
    Stack txs = (Stack) _threadList.get();

    if (txs != null) {
      JABTransaction a = (JABTransaction) txs.pop();

      if ((a != null) && (unregister)) {
        a.removeChildThread(threadId);
      }

      if (txs.size() == 0) {
        _threadList.set(null);
      }
View Full Code Here

    _threadList.set(null);

    if (txs != null) {
      if (unregister) {
        while (!txs.empty()) {
          JABTransaction act = (JABTransaction) txs.pop();

          if (act != null) {
            act.removeChildThread(ThreadUtil.getThreadId(t));
          }
        }
      }
    }
  }
View Full Code Here

    String message = prompt("Enter a message to send");
    byte[] toSend = new byte[message.length() + 1];
    System.arraycopy(message.getBytes(), 0, toSend, 0, message.length());
    JABSessionAttributes jabSessionAttributes = new JABSessionAttributes();
    JABSession jabSession = new JABSession(jabSessionAttributes);
    JABTransaction transaction = new JABTransaction(jabSession, 5000);
    JABServiceInvoker jabService = new JABServiceInvoker("FOOAPP", jabSession,
        "X_OCTET", null);
    jabService.getRequest().setByteArray("X_OCTET", toSend);
    log.info("Calling call with input: " + message);
    jabService.call(null);
    log.info("Called call with output: "
        + new String(jabService.getResponse().getByteArray("X_OCTET")));
    transaction.commit();
    jabSession.closeSession();
  }
View Full Code Here

  public void test_tpcall_x_octet_with_tx() throws Exception {
    log.debug("JABTestCase::test_tpcall_x_octet_with_tx");
    runServer.tpadvertisetpcallXOctet();
    JABSessionAttributes jabSessionAttributes = new JABSessionAttributes();
    JABSession jabSession = new JABSession(jabSessionAttributes);
    JABTransaction transaction = new JABTransaction(jabSession, 5000);
    JABServiceInvoker jabService = new JABServiceInvoker(
        RunServer.getServiceNametpcallXOctet(), jabSession, "X_OCTET",
        null);
    jabService.getRequest().setByteArray("X_OCTET",
        "test_tpcall_x_octet".getBytes());
    log.debug("calling tpcall_x_octet with tx");
    jabService.call(transaction);
    log.debug("called tpcall_x_octet with tx, commiting ...");
    transaction.commit();
    log.debug("tpcall_x_octet commit ok");
    byte[] expected = new byte[60];
    System.arraycopy("tpcall_x_octet".getBytes(), 0, expected, 0, 14);
    byte[] received = jabService.getResponse().getByteArray("X_OCTET");
    assertTrue(Arrays.equals(expected, received));
View Full Code Here

TOP

Related Classes of org.jboss.narayana.blacktie.jatmibroker.jab.JABTransaction

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.