use of com.sun.messaging.jmq.util.io.FilteringObjectInputStream in project openmq by eclipse-ee4j.
the class ClusterImpl method receiveBrokerInfo.
/**
* Receive and process the BROKER_INFO packet.
*/
private BrokerInfo receiveBrokerInfo(BrokerAddressImpl sender, byte[] pkt, String realRemote, BrokerLink l) {
ByteArrayInputStream bis = new ByteArrayInputStream(pkt);
BrokerInfo info = null;
try {
ObjectInputStream ois = new FilteringObjectInputStream(bis);
info = (BrokerInfo) ois.readObject();
info.setRealRemoteString(realRemote);
} catch (Exception e) {
logger.log(Logger.WARNING, br.W_MBUS_SERIALIZATION, sender);
if (l != null) {
l.shutdown();
}
return null;
}
Integer v = info.getClusterProtocolVersion();
if (v != null && v.intValue() >= ProtocolGlobals.VERSION_400) {
return info;
}
if (l != null) {
l.handshakeSent();
}
int status = cb.addBrokerInfo(info);
if (status == cb.ADD_BROKER_INFO_OK) {
return info;
}
if (status == cb.ADD_BROKER_INFO_RETRY) {
synchronized (brokerList) {
BrokerLink link = (BrokerLink) brokerList.get(sender);
if (link != null) {
link.closeConn();
}
}
} else if (status == cb.ADD_BROKER_INFO_BAN) {
synchronized (brokerList) {
BrokerLink link = (BrokerLink) brokerList.get(sender);
if (link != null) {
link.shutdown();
}
}
}
return null;
}
use of com.sun.messaging.jmq.util.io.FilteringObjectInputStream in project openmq by eclipse-ee4j.
the class RemoteTransaction2PPrepareEvent method readFromBytes.
@Override
public void readFromBytes(byte[] data) throws IOException, BrokerException {
ByteArrayInputStream bais = new ByteArrayInputStream(data);
DataInputStream dis = new DataInputStream(bais);
remoteTransaction = new RemoteTransaction();
dis.skip(2);
remoteTransaction.getTransactionDetails().readContent(dis);
int objectBodySize = dis.readInt();
byte[] objectBody = new byte[objectBodySize];
dis.read(objectBody);
ByteArrayInputStream bais2 = new ByteArrayInputStream(objectBody);
ObjectInputStream ois = new FilteringObjectInputStream(bais2);
try {
remoteTransaction.setTransactionState((TransactionState) ois.readObject());
remoteTransaction.setTxnHomeBroker((BrokerAddress) ois.readObject());
remoteTransaction.setTxnAcks((TransactionAcknowledgement[]) ois.readObject());
remoteTransaction.setDestIds((DestinationUID[]) ois.readObject());
} catch (ClassNotFoundException e) {
e.printStackTrace();
}
ois.close();
bais2.close();
dis.close();
bais.close();
}
use of com.sun.messaging.jmq.util.io.FilteringObjectInputStream in project openmq by eclipse-ee4j.
the class LocalTransaction2PPrepareEvent method readFromBytes.
@Override
void readFromBytes(byte[] data) throws IOException, BrokerException {
ByteArrayInputStream bais = new ByteArrayInputStream(data);
DataInputStream dis = new DataInputStream(bais);
localTransaction = new LocalTransaction();
dis.skip(2);
localTransaction.getTransactionDetails().readContent(dis);
TransactionWork work = new TransactionWork();
work.readWork(dis);
localTransaction.setTransactionWork(work);
// need to write transaction info here
int objectBodySize = dis.readInt();
byte[] objectBody = new byte[objectBodySize];
dis.read(objectBody);
ByteArrayInputStream bais2 = new ByteArrayInputStream(objectBody);
ObjectInputStream ois = new FilteringObjectInputStream(bais2);
try {
TransactionState ts = (TransactionState) ois.readObject();
localTransaction.setTransactionState(ts);
} catch (ClassNotFoundException e) {
e.printStackTrace();
}
ois.close();
bais2.close();
dis.close();
bais.close();
}
use of com.sun.messaging.jmq.util.io.FilteringObjectInputStream 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();
}
use of com.sun.messaging.jmq.util.io.FilteringObjectInputStream in project openmq by eclipse-ee4j.
the class DirectMapPacket method _getMessageBodyFromPacket.
/**
* Get the message body from the packet
*/
@Override
protected void _getMessageBodyFromPacket() throws JMSException {
try {
this.messageBody = super._getMessageBodyByteArray();
this.byteArrayInputStream = new ByteArrayInputStream(messageBody);
this.objectInputStream = new FilteringObjectInputStream(byteArrayInputStream);
this.map = (Map<String, Object>) objectInputStream.readObject();
} catch (Exception e) {
String errMsg = _lgrMID_EXC + ":MapMessage:Exception deserializing on deliver:" + e.getMessage();
_loggerJM.severe(errMsg);
JMSException jmse = new jakarta.jms.JMSException(errMsg);
jmse.initCause(e);
throw jmse;
}
}
Aggregations