private void internalHandlerError(Exception e) { log.warn(e.getMessage(), e); ErrorCondition error = new ErrorCondition(); error.setCondition(AmqpError.INTERNAL_ERROR); error.setDescription("Unrecoverable error: " + (e.getMessage() == null ? e.getClass().getSimpleName() : e.getMessage())); connection.setCondition(error); connection.close(); flush(); }
public ErrorCondition newInstance(Object described) { List l = (List) described; ErrorCondition o = new ErrorCondition(); if(l.isEmpty()) { throw new DecodeException("The condition field cannot be omitted"); } switch(3 - l.size()) { case 0: o.setInfo( (Map) l.get( 2 ) ); case 1: o.setDescription( (String) l.get( 1 ) ); case 2: o.setCondition( (Symbol) l.get( 0 ) ); } return o; }
public ErrorCondition newInstance(Object described) { List l = (List) described; ErrorCondition o = new ErrorCondition(); if(l.isEmpty()) { throw new DecodeException("The condition field cannot be omitted"); } switch(3 - l.size()) { case 0: o.setInfo( (Map) l.get( 2 ) ); case 1: o.setDescription( (String) l.get( 1 ) ); case 2: o.setCondition( (Symbol) l.get( 0 ) ); } return o; }
public ErrorCondition newInstance(Object described) { List l = (List) described; ErrorCondition o = new ErrorCondition(); if(l.isEmpty()) { throw new DecodeException("The condition field cannot be omitted"); } switch(3 - l.size()) { case 0: o.setInfo( (Map) l.get( 2 ) ); case 1: o.setDescription( (String) l.get( 1 ) ); case 2: o.setCondition( (Symbol) l.get( 0 ) ); } return o; }
public ErrorCondition newInstance(Object described) { List l = (List) described; ErrorCondition o = new ErrorCondition(); if(l.isEmpty()) { throw new DecodeException("The condition field cannot be omitted"); } switch(3 - l.size()) { case 0: o.setInfo( (Map) l.get( 2 ) ); case 1: o.setDescription( (String) l.get( 1 ) ); case 2: o.setCondition( (Symbol) l.get( 0 ) ); } return o; }
private Rejected createRejected(Symbol amqpError, String message) { Rejected rejected = new Rejected(); ErrorCondition condition = new ErrorCondition(); condition.setCondition(amqpError); condition.setDescription(message); rejected.setError(condition); return rejected; }
ErrorCondition error = new ErrorCondition(); error.setCondition(AmqpError.INTERNAL_ERROR); error.setDescription("Unrecoverable error: " + (e.getMessage() == null ? e.getClass().getSimpleName() : e.getMessage())); connection.setCondition(error); connection.close();
private Rejected createRejected(Symbol amqpError, String message) { Rejected rejected = new Rejected(); ErrorCondition condition = new ErrorCondition(); condition.setCondition(amqpError); condition.setDescription(message); rejected.setError(condition); return rejected; }
private Rejected createRejected(Symbol amqpError, String message) { Rejected rejected = new Rejected(); ErrorCondition condition = new ErrorCondition(); condition.setCondition(amqpError); condition.setDescription(message); rejected.setError(condition); return rejected; }
public void processRemoteOpen(Endpoint endpoint, Task onComplete) { ErrorCondition condition = endpoint.getCondition(); condition.setCondition(Symbol.valueOf("error")); condition.setDescription("Not supported"); endpoint.close(); onComplete.run(); }
ErrorCondition condition = new ErrorCondition(); condition.setCondition(Symbol.getSymbol("proton:io")); condition.setDescription(ioException.getMessage()); transport.setCondition(condition); transport.close_tail();
private void rejectMessage(Delivery delivery, Symbol errorCondition, String errorMessage) { ErrorCondition condition = new ErrorCondition(); condition.setCondition(errorCondition); condition.setDescription(errorMessage); Rejected rejected = new Rejected(); rejected.setError(condition); afterIO(new IOCallback() { @Override public void done() { connection.runLater(() -> { delivery.disposition(rejected); delivery.settle(); connection.flush(); }); } @Override public void onError(int errorCode, String errorMessage) { } }); }
private void rejectMessage(Delivery delivery, Symbol errorCondition, String errorMessage) { ErrorCondition condition = new ErrorCondition(); condition.setCondition(errorCondition); condition.setDescription(errorMessage); Rejected rejected = new Rejected(); rejected.setError(condition); afterIO(new IOCallback() { @Override public void done() { connection.lock(); try { delivery.disposition(rejected); delivery.settle(); } finally { connection.unlock(); } connection.flush(); } @Override public void onError(int errorCode, String errorMessage) { } }); }
private void actualDelivery(Delivery delivery, Receiver receiver, ReadableBuffer data, Transaction tx) { try { sessionSPI.serverSend(this, tx, receiver, delivery, address, delivery.getMessageFormat(), data, routingContext); } catch (Exception e) { log.warn(e.getMessage(), e); Rejected rejected = new Rejected(); ErrorCondition condition = new ErrorCondition(); if (e instanceof ActiveMQSecurityException) { condition.setCondition(AmqpError.UNAUTHORIZED_ACCESS); } else { condition.setCondition(Symbol.valueOf("failed")); } connection.runLater(() -> { condition.setDescription(e.getMessage()); rejected.setError(condition); delivery.disposition(rejected); delivery.settle(); flow(); connection.flush(); }); } }
ErrorCondition condition = new ErrorCondition(); condition.setCondition(Symbol.valueOf("failed")); condition.setDescription(e.getMessage()); rejected.setError(condition); delivery.disposition(rejected);
@Override public void run(Selectable selectable) { Reactor reactor = selectable.getReactor(); Transport transport = ((SelectableImpl)selectable).getTransport(); int capacity = transport.capacity(); if (capacity > 0) { SocketChannel socketChannel = (SocketChannel)selectable.getChannel(); try { int n = socketChannel.read(transport.tail()); if (n == -1) { transport.close_tail(); } else { transport.process(); } } catch (IOException e) { ErrorCondition condition = new ErrorCondition(); condition.setCondition(Symbol.getSymbol("proton:io")); condition.setDescription(e.getMessage()); transport.setCondition(condition); transport.close_tail(); } } // (Comment from C code:) occasionally transport events aren't // generated when expected, so the following hack ensures we // always update the selector update(selectable); reactor.update(selectable); } };
@Override public void run(Selectable selectable) { Reactor reactor = selectable.getReactor(); Transport transport = ((SelectableImpl)selectable).getTransport(); int capacity = transport.capacity(); if (capacity > 0) { SocketChannel socketChannel = (SocketChannel)selectable.getChannel(); try { int n = socketChannel.read(transport.tail()); if (n == -1) { transport.close_tail(); } else { transport.process(); } } catch (IOException | TransportException e) { ErrorCondition condition = new ErrorCondition(); condition.setCondition(Symbol.getSymbol("proton:io")); condition.setDescription(e.getMessage()); transport.setCondition(condition); transport.close_tail(); } } // (Comment from C code:) occasionally transport events aren't // generated when expected, so the following hack ensures we // always update the selector update(selectable); reactor.update(selectable); } };
@Override public void run(Selectable selectable) { Reactor reactor = selectable.getReactor(); Transport transport = ((SelectableImpl)selectable).getTransport(); int pending = transport.pending(); if (pending > 0) { SocketChannel channel = (SocketChannel)selectable.getChannel(); try { int n = channel.write(transport.head()); if (n < 0) { transport.close_head(); } else { transport.pop(n); } } catch(IOException ioException) { ErrorCondition condition = new ErrorCondition(); condition.setCondition(Symbol.getSymbol("proton:io")); condition.setDescription(ioException.getMessage()); transport.setCondition(condition); transport.close_head(); } } int newPending = transport.pending(); if (newPending != pending) { update(selectable); reactor.update(selectable); } } };
@Override public void run(Selectable selectable) { Reactor reactor = selectable.getReactor(); Transport transport = ((SelectableImpl)selectable).getTransport(); int pending = transport.pending(); if (pending > 0) { SocketChannel channel = (SocketChannel)selectable.getChannel(); try { int n = channel.write(transport.head()); if (n < 0) { transport.close_head(); } else { transport.pop(n); } } catch(IOException ioException) { ErrorCondition condition = new ErrorCondition(); condition.setCondition(Symbol.getSymbol("proton:io")); condition.setDescription(ioException.getMessage()); transport.setCondition(condition); transport.close_head(); } } int newPending = transport.pending(); if (newPending != pending) { update(selectable); reactor.update(selectable); } } };
condition.setDescription(error.getException().getMessage()); rejected.setError(condition); delivery.disposition(rejected);