private void checkClosed() throws HornetQException { if (closed) { throw new HornetQException(HornetQException.OBJECT_CLOSED, "Producer is closed"); } }
public HornetQException createException(String msg) { return new HornetQException(msg + ", code:" + this); }
private void checkClosed() throws HornetQException { if (closed || inClose) { throw new HornetQException(HornetQException.OBJECT_CLOSED, "Session is closed"); } }
private void checkClosed() throws HornetQException { if (closed) { throw new HornetQException(HornetQException.OBJECT_CLOSED, "Consumer is closed"); } }
public boolean waitCompletion(final long timeout) throws Exception { boolean retValue = latch.await(timeout, TimeUnit.MILLISECONDS); if (errorMessage != null) { throw new HornetQException(errorCode, errorMessage); } return retValue; }
public void connectionDestroyed(final Object connectionID) { // It has to use the same executor as the disconnect message is being sent through final HornetQException ex = new HornetQException(HornetQException.NOT_CONNECTED, "Channel disconnected"); closeExecutor.execute(new Runnable() { public void run() { handleConnectionFailure(connectionID, ex); } }); }
@Override public void waitCompletion() throws Exception { latch.await(); if (errorMessage != null) { throw new HornetQException(errorCode, errorMessage); } return; }
private void rollbackOnFailover(boolean outcomeKnown) throws HornetQException { rollback(false); if(outcomeKnown) { throw new HornetQException(HornetQException.TRANSACTION_ROLLED_BACK, "The transaction was rolled back on failover to a backup server"); } else { throw new HornetQException(HornetQException.TRANSACTION_OUTCOME_UNKNOWN, "The transaction was rolled back on failover however commit may have been succesful"); } }
public void close() throws HornetQException { try { cFile.close(); } catch (Exception e) { throw new HornetQException(HornetQException.INTERNAL_ERROR, e.getMessage(), e); } }
public int encode(final ByteBuffer bufferRead) throws HornetQException { try { return cFile.read(bufferRead); } catch (Exception e) { throw new HornetQException(HornetQException.INTERNAL_ERROR, e.getMessage(), e); } }
public void connect(final int initialConnectAttempts, final boolean failoverOnInitialConnection) throws HornetQException { // Get the connection getConnectionWithRetry(initialConnectAttempts); if (connection == null) { StringBuffer msg = new StringBuffer("Unable to connect to server using configuration ").append(connectorConfig); if (backupConfig != null) { msg.append(" and backup configuration ").append(backupConfig); } throw new HornetQException(HornetQException.NOT_CONNECTED, msg.toString()); } }
public void onError(final int errorCode, final String errorMessage) { log.warn("Error processing IOCallback code = " + errorCode + " message = " + errorMessage); HornetQExceptionMessage exceptionMessage = new HornetQExceptionMessage(new HornetQException(errorCode, errorMessage)); doConfirmAndResponse(confirmPacket, exceptionMessage, flush, closeChannel); }
public void run() { conn.fail(new HornetQException(HornetQException.DISCONNECTED, "The connection was disconnected because of server shutdown")); } });
public synchronized ReplicationEndpoint connectToReplicationEndpoint(final Channel channel) throws Exception { if (!configuration.isBackup()) { throw new HornetQException(HornetQException.ILLEGAL_STATE, "Connected server is not a backup server"); } if (replicationEndpoint.getChannel() != null) { throw new HornetQException(HornetQException.ILLEGAL_STATE, "Backup replication server is already connected to another server"); } replicationEndpoint.setChannel(channel); return replicationEndpoint; }
public void onError(final int errorCode, final String errorMessage) { log.warn("Error processing IOCallback code = " + errorCode + " message = " + errorMessage); StompFrame error = createError(new HornetQException(errorCode, errorMessage), frame); send(connection, error); }
@Override public void decodeRest(final HornetQBuffer buffer) { int code = buffer.readInt(); String msg = buffer.readNullableString(); exception = new HornetQException(code, msg); }
public synchronized void saveBuffer(final OutputStream output) throws HornetQException { if (streamClosed) { throw new HornetQException(HornetQException.ILLEGAL_STATE, "The large message lost connection with its session, either because of a rollback or a closed session"); } setOutputStream(output); waitCompletion(0); }
public void saveToOutputStream(final OutputStream out) throws HornetQException { try { byte readBuffer[] = new byte[getBodySize()]; getBodyBuffer().readBytes(readBuffer); out.write(readBuffer); out.flush(); } catch (IOException e) { throw new HornetQException(HornetQException.LARGE_MESSAGE_ERROR_BODY, "Error saving the message body", e); } }
private void internalCreateQueue(final SimpleString address, final SimpleString queueName, final SimpleString filterString, final boolean durable, final boolean temp) throws HornetQException { checkClosed(); if (durable && temp) { throw new HornetQException(HornetQException.INTERNAL_ERROR, "Queue can not be both durable and temporay"); } CreateQueueMessage request = new CreateQueueMessage(address, queueName, filterString, durable, temp, true); channel.sendBlocking(request); }
public boolean addBinding(final Binding binding) throws Exception { if (nameMap.putIfAbsent(binding.getUniqueName(), binding) != null) { throw new HornetQException(HornetQException.QUEUE_EXISTS, "Binding already exists " + binding); } if (log.isDebugEnabled()) { log.debug("Adding binding " + binding + " with address = " + binding.getUniqueName(), new Exception ("trace")); } return addMappingInternal(binding.getAddress(), binding); }