Examples of XASession


Examples of javax.jms.XASession

      {

         conn = cf.createXAConnection();

         //Create a session
         XASession sess1 = conn.createXASession();
         XAResource res1 = sess1.getXAResource();

         MessageProducer prod1 = sess1.createProducer(queue);

         tm.begin();

         Transaction tx1 = tm.getTransaction();
         tx1.enlistResource(res1);

         //Send a message
         prod1.send(sess1.createTextMessage("kangaroo1"));

         //suspend the tx
         Transaction suspended = tm.suspend();

         tm.begin();

         //Send another message in another tx using the same session
         Transaction tx2 = tm.getTransaction();
         tx2.enlistResource(res1);

         //Send a message
         prod1.send(sess1.createTextMessage("kangaroo2"));

         tx2.delistResource(res1, XAResource.TMSUCCESS);
        
         //commit this transaction
         tm.commit();
View Full Code Here

Examples of org.apache.jackrabbit.api.XASession

  public void testTransactionCommit() throws Exception {
    MockControl sfControl = MockControl.createControl(SessionFactory.class);
    final SessionFactory sf = (SessionFactory) sfControl.getMock();
    MockControl sessionControl = MockControl.createControl(XASession.class);
    final XASession session = (XASession) sessionControl.getMock();
    // create nice mock
    MockControl xaResControl = MockControl.createControl(XAResource.class);
    XAResource xaRes = (XAResource) xaResControl.getMock();

    sfControl.expectAndReturn(sf.getSession(), session);
    sessionControl.expectAndReturn(session.getXAResource(), xaRes);

    session.save();
    session.logout();

    /*
     * MockControl repositoryControl =
     * MockControl.createNiceControl(Repository.class); Repository
     * repository = (Repository) repositoryControl.getMock();
View Full Code Here

Examples of org.apache.jackrabbit.core.XASession

        createRepository();
        Credentials creds = cri.getCredentials();
        String workspace = cri.getWorkspace();

        try {
            XASession session = (XASession) getRepository().login(creds, workspace);
            log("Created session (" + session + ")");
            return session;
        } catch (RepositoryException e) {
            log("Failed to create session", e);
            ResourceException exception = new ResourceException(
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.