use of com.swiftmq.amqp.v100.generated.transport.definitions.Error in project swiftmq-ce by iitsoftware.
the class SessionHandler method sendDetach.
private void sendDetach(Handle handle, ErrorConditionIF condition, AMQPString description) {
DetachFrame detachFrame = new DetachFrame(channel);
detachFrame.setHandle(handle);
detachFrame.setClosed(AMQPBoolean.TRUE);
if (condition != null) {
Error error = new Error();
error.setCondition(condition);
if (description != null)
error.setDescription(description);
detachFrame.setError(error);
}
versionedConnection.send(detachFrame);
}
use of com.swiftmq.amqp.v100.generated.transport.definitions.Error in project swiftmq-ce by iitsoftware.
the class SessionHandler method visit.
public void visit(POSendEnd po) {
if (ctx.traceSpace.enabled)
ctx.traceSpace.trace(ctx.amqpSwiftlet.getName(), toString() + ", visit, po=" + po + " ...");
EndFrame frame = new EndFrame(channel);
if (po.getErrorCondition() != null) {
com.swiftmq.amqp.v100.generated.transport.definitions.Error error = new Error();
error.setCondition(po.getErrorCondition());
if (po.getDescription() != null)
error.setDescription(po.getDescription());
frame.setError(error);
}
versionedConnection.send(frame);
if (ctx.traceSpace.enabled)
ctx.traceSpace.trace(ctx.amqpSwiftlet.getName(), toString() + ", visit, po=" + po + " done");
}
use of com.swiftmq.amqp.v100.generated.transport.definitions.Error in project swiftmq-ce by iitsoftware.
the class AMQPHandler method visit.
public void visit(POSendClose po) {
if (ctx.traceSpace.enabled)
ctx.traceSpace.trace(ctx.amqpSwiftlet.getName(), toString() + ", visit, po=" + po + " ...");
CloseFrame frame = new CloseFrame(0);
if (po.getErrorCondition() != null) {
com.swiftmq.amqp.v100.generated.transport.definitions.Error error = new Error();
error.setCondition(po.getErrorCondition());
if (po.getDescription() != null)
error.setDescription(po.getDescription());
frame.setError(error);
connectionDisabled = true;
}
frame.setCallback(new AsyncCompletionCallback() {
public void done(boolean b) {
ctx.networkSwiftlet.getConnectionManager().removeConnection(versionedConnection.getConnection());
}
});
versionedConnection.send(frame);
closeFrameSent = true;
if (ctx.traceSpace.enabled)
ctx.traceSpace.trace(ctx.amqpSwiftlet.getName(), toString() + ", visit, po=" + po + " done");
}
use of com.swiftmq.amqp.v100.generated.transport.definitions.Error in project swiftmq-client by iitsoftware.
the class Rejected method decode.
private void decode() throws Exception {
List l = getValue();
AMQPType t = null;
int idx = 0;
// Factory : ./.
if (idx >= l.size())
return;
t = (AMQPType) l.get(idx++);
try {
if (t.getCode() != AMQPTypeDecoder.NULL)
error = new Error(((AMQPList) t).getValue());
} catch (ClassCastException e) {
throw new Exception("Invalid type of field 'error' in 'Rejected' type: " + e);
}
}
use of com.swiftmq.amqp.v100.generated.transport.definitions.Error in project swiftmq-client by iitsoftware.
the class SessionDispatcher method settleOutbound.
private void settleOutbound(long from, long to, boolean settled, DeliveryStateIF deliveryState) {
if (from <= to) {
long current = from;
while (current <= to) {
DeliveryMapping deliveryMapping = unsettledOutgoingDeliveries.remove(current);
if (deliveryMapping != null) {
deliveryMapping.link.getDeliveryMemory().deliverySettled(deliveryMapping.deliveryTag);
if (deliveryMapping.link.getWaitingPO() != null) {
POSendMessage po = (POSendMessage) deliveryMapping.link.getWaitingPO();
po.setSuccess(true);
po.setDeliveryState(deliveryState);
po.getSemaphore().notifySingleWaiter();
deliveryMapping.link.setWaitingPO(null);
}
// If there is a close waiting on that link, dispatch it when there are no more unsettled deliveries
if (deliveryMapping.link.getDeliveryMemory().getNumberUnsettled() == 0 && deliveryMapping.link.getWaitingClosePO() != null) {
dispatch(deliveryMapping.link.getWaitingClosePO());
deliveryMapping.link.setWaitingClosePO(null);
}
}
current++;
outgoingWindow++;
}
if (deliveryState != null) {
if (!settled && deliveryState instanceof Accepted) {
DispositionFrame dispoFrame = new DispositionFrame(mySession.getChannel());
dispoFrame.setRole(Role.SENDER);
dispoFrame.setFirst(new DeliveryNumber(from));
dispoFrame.setLast(new DeliveryNumber(to));
dispoFrame.setSettled(AMQPBoolean.TRUE);
dispoFrame.setState(new Accepted());
outboundHandler.send(dispoFrame);
}
}
} else {
// TODO: error
}
}
Aggregations