Search in sources :

Example 6 with TransactionWork

use of com.sun.messaging.jmq.jmsserver.data.TransactionWork in project openmq by eclipse-ee4j.

the class ClusterTransaction2PPrepareEvent method readFromBytes.

@Override
public void readFromBytes(byte[] data) throws IOException, BrokerException {
    if (Store.getDEBUG()) {
        Globals.getLogger().log(Logger.DEBUG, getPrefix() + "readFromBytes");
    }
    ByteArrayInputStream bais = new ByteArrayInputStream(data);
    DataInputStream dis = new DataInputStream(bais);
    clusterTransaction = new ClusterTransaction();
    dis.skip(2);
    clusterTransaction.getTransactionDetails().readContent(dis);
    if (Store.getDEBUG()) {
        Globals.getLogger().log(Logger.DEBUG, getPrefix() + "read details " + clusterTransaction.getTransactionDetails());
    }
    TransactionWork work = new TransactionWork();
    work.readWork(dis);
    clusterTransaction.setTransactionWork(work);
    int objectBodySize = dis.readInt();
    byte[] objectBody = new byte[objectBodySize];
    dis.read(objectBody);
    ByteArrayInputStream bais2 = new ByteArrayInputStream(objectBody);
    ObjectInputStream ois = new FilteringObjectInputStream(bais2);
    try {
        clusterTransaction.setTransactionState((TransactionState) ois.readObject());
        clusterTransaction.setTransactionBrokers((TransactionBroker[]) ois.readObject());
    } catch (ClassNotFoundException e) {
        e.printStackTrace();
    }
    ois.close();
    bais2.close();
    dis.close();
    bais.close();
}
Also used : TransactionWork(com.sun.messaging.jmq.jmsserver.data.TransactionWork) ByteArrayInputStream(java.io.ByteArrayInputStream) TransactionBroker(com.sun.messaging.jmq.jmsserver.data.TransactionBroker) FilteringObjectInputStream(com.sun.messaging.jmq.util.io.FilteringObjectInputStream) DataInputStream(java.io.DataInputStream) ClusterTransaction(com.sun.messaging.jmq.jmsserver.data.ClusterTransaction) FilteringObjectInputStream(com.sun.messaging.jmq.util.io.FilteringObjectInputStream) ObjectInputStream(java.io.ObjectInputStream)

Aggregations

TransactionWork (com.sun.messaging.jmq.jmsserver.data.TransactionWork)6 LocalTransaction (com.sun.messaging.jmq.jmsserver.data.LocalTransaction)3 ByteArrayInputStream (java.io.ByteArrayInputStream)3 DataInputStream (java.io.DataInputStream)3 SysMessageID (com.sun.messaging.jmq.io.SysMessageID)2 ConsumerUID (com.sun.messaging.jmq.jmsserver.core.ConsumerUID)2 Destination (com.sun.messaging.jmq.jmsserver.core.Destination)2 DestinationList (com.sun.messaging.jmq.jmsserver.core.DestinationList)2 PacketReference (com.sun.messaging.jmq.jmsserver.core.PacketReference)2 TransactionBroker (com.sun.messaging.jmq.jmsserver.data.TransactionBroker)2 TransactionList (com.sun.messaging.jmq.jmsserver.data.TransactionList)2 TransactionWorkMessage (com.sun.messaging.jmq.jmsserver.data.TransactionWorkMessage)2 TransactionWorkMessageAck (com.sun.messaging.jmq.jmsserver.data.TransactionWorkMessageAck)2 AckEntryNotFoundException (com.sun.messaging.jmq.jmsserver.util.AckEntryNotFoundException)2 BrokerDownException (com.sun.messaging.jmq.jmsserver.util.BrokerDownException)2 BrokerException (com.sun.messaging.jmq.jmsserver.util.BrokerException)2 MaxConsecutiveRollbackException (com.sun.messaging.jmq.jmsserver.util.MaxConsecutiveRollbackException)2 CacheHashMap (com.sun.messaging.jmq.util.CacheHashMap)2 FilteringObjectInputStream (com.sun.messaging.jmq.util.io.FilteringObjectInputStream)2 SelectorFormatException (com.sun.messaging.jmq.util.selector.SelectorFormatException)2