public ActiveMQException createException(String msg) { return new ActiveMQException(msg + ", code:" + this); }
public static final void setJMSCorrelationIDAsBytes(Message message, final byte[] correlationID) throws ActiveMQException { if (correlationID == null || correlationID.length == 0) { throw new ActiveMQException("Please specify a non-zero length byte[]"); } message.putBytesProperty(CORRELATIONID_HEADER_NAME, correlationID); }
@Override public void run() { theConn.fail(new ActiveMQException(e.getMessage())); } });
/** * @throws ActiveMQException */ private void checkException() throws ActiveMQException { // it's not needed to copy it as we never set it back to null // once the exception is set, the controller is pretty much useless if (handledException != null) { if (handledException instanceof ActiveMQException) { ActiveMQException nestedException; // This is just to be user friendly and give the user a proper exception trace, // instead to just where it was canceled. if (handledException instanceof ActiveMQLargeMessageInterruptedException) { nestedException = new ActiveMQLargeMessageInterruptedException(handledException.getMessage()); } else { nestedException = new ActiveMQException(((ActiveMQException) handledException).getType(), handledException.getMessage()); } nestedException.initCause(handledException); throw nestedException; } else { throw new ActiveMQException(ActiveMQExceptionType.LARGE_MESSAGE_ERROR_BODY, "Error on saving LargeMessageBufferImpl", handledException); } } }
throw new ActiveMQException(ActiveMQExceptionType.ILLEGAL_STATE, "Invalid PasswordCodec value: " + codecDesc); codecInstance.init(props); } catch (Exception e) { throw new ActiveMQException("Fail to init codec", e, ActiveMQExceptionType.SECURITY_EXCEPTION);
@Override public void exceptionCaught(final ChannelHandlerContext ctx, final Throwable cause) throws Exception { if (!active) { return; } // We don't want to log this - since it is normal for this to happen during failover/reconnect // and we don't want to spew out stack traces in that event // The user has access to this exeception anyway via the ActiveMQException initial cause ActiveMQException me = new ActiveMQException(cause.getMessage()); me.initCause(cause); synchronized (listener) { try { listenerExecutor.execute(() -> listener.connectionException(channelId(ctx.channel()), me)); active = false; } catch (Exception ex) { ActiveMQClientLogger.LOGGER.errorCallingLifeCycleListener(ex); } } }
throw new ActiveMQException(e.getMessage());
throw new ActiveMQException(ActiveMQExceptionType.INCOMPATIBLE_CLIENT_SERVER_VERSIONS);
public static final void setJMSCorrelationIDAsBytes(Message message, final byte[] correlationID) throws ActiveMQException { if (correlationID == null || correlationID.length == 0) { throw new ActiveMQException("Please specify a non-zero length byte[]"); } message.putBytesProperty(CORRELATIONID_HEADER_NAME, correlationID); }
@Override public void run() { theConn.fail(new ActiveMQException(e.getMessage())); } });
public static final void setJMSCorrelationIDAsBytes(Message message, final byte[] correlationID) throws ActiveMQException { if (correlationID == null || correlationID.length == 0) { throw new ActiveMQException("Please specify a non-zero length byte[]"); } message.putBytesProperty(CORRELATIONID_HEADER_NAME, correlationID); }
public static final void setJMSCorrelationIDAsBytes(Message message, final byte[] correlationID) throws ActiveMQException { if (correlationID == null || correlationID.length == 0) { throw new ActiveMQException("Please specify a non-zero length byte[]"); } message.putBytesProperty(CORRELATIONID_HEADER_NAME, correlationID); }
@Override public void run() { theConn.fail(new ActiveMQException(e.getMessage())); } });
public static final void setJMSCorrelationIDAsBytes(Message message, final byte[] correlationID) throws ActiveMQException { if (correlationID == null || correlationID.length == 0) { throw new ActiveMQException("Please specify a non-zero length byte[]"); } message.putBytesProperty(CORRELATIONID_HEADER_NAME, correlationID); }
public byte[] getQueueIdFromName(String queueName) throws Exception { try { ClientMessage message = getQueueAttribute(queueName, "ID"); Number idObject = (Number) ManagementHelper.getResult(message); ByteBuffer byteBuffer = ByteBuffer.allocate(8); byteBuffer.putLong(idObject.longValue()); return byteBuffer.array(); } catch (Exception e) { throw new ActiveMQException("Error occured when looking up FQQN. Please ensure the FQQN exists.", e, ActiveMQExceptionType.ILLEGAL_STATE); } }
@Override public void run() { while (running.get()) { try { libaioContext.poll(); } catch (Throwable e) { ActiveMQJournalLogger.LOGGER.warn(e.getMessage(), e); onIOError(new ActiveMQException("Error on libaio poll"), e.getMessage(), null); } } } }
@Override public void duplicateSessionMetadataFailure(ServerSession session, String key, String data) throws ActiveMQException { //count number of times method called duplicateCount.incrementAndGet(); if (data.equals("valid2")) { throw new ActiveMQException("failure"); } }
@Override public void afterCreateConnection(RemotingConnection connection) throws ActiveMQException { try { //Verify that calling getClientID() before initialized doesn't cause an error //Test for ARTEMIS-1713 connection.getClientID(); } catch (Exception e) { throw new ActiveMQException(e.getMessage()); } } });
@Override public void open() throws ActiveMQException { try { if (cFile != null && cFile.isOpen()) { cFile.close(); } cFile = file.cloneFile(); cFile.open(); } catch (Exception e) { throw new ActiveMQException(ActiveMQExceptionType.INTERNAL_ERROR, e.getMessage(), e); } }
private void doConvertException(final ActiveMQExceptionType errorCode, final Class<? extends Throwable> expectedException) { ActiveMQException me = new ActiveMQException(errorCode); Exception e = JMSExceptionHelper.convertFromActiveMQException(me); Assert.assertNotNull(e); Assert.assertTrue(e.getClass().isAssignableFrom(expectedException)); } }