List of usage examples for javax.jms IllegalStateException IllegalStateException
public IllegalStateException(String reason)
From source file:com.amazon.sqs.javamessaging.SQSSession.java
void finishedCallback() throws JMSException { synchronized (stateLock) { if (activeConsumerInCallback == null) { throw new IllegalStateException("Callback not in progress"); }/*from www . j ava 2s .com*/ activeConsumerInCallback = null; activeCallbackSessionThread = null; stateLock.notifyAll(); } }
From source file:com.amazon.sqs.javamessaging.SQSSession.java
/** * Check if session is closed.//from w w w .jav a2 s. c o m */ public void checkClosed() throws IllegalStateException { if (closed) { throw new IllegalStateException("Session is closed"); } }
From source file:com.amazon.sqs.javamessaging.SQSSession.java
/** * Check if session is closed or closing. *//*from www.j a v a2s.com*/ public void checkClosing() throws IllegalStateException { if (closing) { throw new IllegalStateException("Session is closed or closing"); } }
From source file:net.timewalker.ffmq4.common.connection.AbstractConnection.java
@Override public void setClientID(String clientID) throws JMSException { externalAccessLock.readLock().lock(); try {/*w ww. ja v a2s . co m*/ checkNotClosed(); if (StringTools.isEmpty(clientID)) throw new InvalidClientIDException("Empty client ID"); if (this.clientID != null) throw new IllegalStateException("Client ID is already set"); // [JMS SPEC] this.clientID = clientID; } finally { externalAccessLock.readLock().unlock(); } }
From source file:net.timewalker.ffmq4.common.session.AbstractSession.java
/** * Check that the session is not closed// www. ja va2s . c om */ protected final void checkNotClosed() throws JMSException { if (closed) throw new IllegalStateException("Session is closed"); // [JMS SPEC] }
From source file:net.timewalker.ffmq4.common.session.AbstractSession.java
/** * Check temporary destinations scope (JMS Spec 4.4.3 p2) * @param destination destination to check *//*from w w w . j a v a2s .c o m*/ public final void checkTemporaryDestinationScope(Destination destination) throws JMSException { if (destination instanceof LocalQueue) { LocalQueue localQueue = (LocalQueue) destination; if (localQueue.isTemporary() && !connection.isRegisteredTemporaryQueue(localQueue.getQueueName())) throw new IllegalStateException("Temporary queue does not belong to session's connection."); } else if (destination instanceof LocalTopic) { LocalTopic localTopic = (LocalTopic) destination; if (localTopic.isTemporary() && !connection.isRegisteredTemporaryTopic(localTopic.getTopicName())) throw new IllegalStateException("Temporary topic does not belong to session's connection."); } else throw new FFMQException("Unexpected destination type : " + destination, "INTERNAL_ERROR"); }
From source file:net.timewalker.ffmq4.local.session.LocalSession.java
/** * Commit pending put/get operations in this session * @param commitGets/*from w w w .j av a 2 s .c om*/ * @param deliveredMessageIDs * @throws JMSException */ public final void commit(boolean commitGets, List<String> deliveredMessageIDs) throws JMSException { if (!transacted) throw new IllegalStateException("Session is not transacted"); // [JMS SPEC] externalAccessLock.readLock().lock(); try { checkNotClosed(); commitUpdates(commitGets, deliveredMessageIDs, true); } finally { externalAccessLock.readLock().unlock(); } }
From source file:net.timewalker.ffmq4.local.session.LocalSession.java
/** * Rollback pending put/get operations in this session * @param rollbackGets/* ww w. ja v a 2 s. co m*/ * @param deliveredMessageIDs * @throws JMSException */ public final void rollback(boolean rollbackGets, List<String> deliveredMessageIDs) throws JMSException { if (!transacted) throw new IllegalStateException("Session is not transacted"); // [JMS SPEC] externalAccessLock.readLock().lock(); try { checkNotClosed(); rollbackUpdates(true, rollbackGets, deliveredMessageIDs); } finally { externalAccessLock.readLock().unlock(); } }
From source file:net.timewalker.ffmq4.local.session.LocalSession.java
/** * @see #rollback(boolean, List)/*w w w. j a va 2 s . co m*/ */ public final void recover(List<String> deliveredMessageIDs) throws JMSException { externalAccessLock.readLock().lock(); try { checkNotClosed(); if (transacted) throw new IllegalStateException("Session is transacted"); // [JMS SPEC] rollbackUpdates(true, true, deliveredMessageIDs); } finally { externalAccessLock.readLock().unlock(); } }
From source file:net.timewalker.ffmq4.local.session.LocalSession.java
/** * @see #commit(boolean,List)//from w w w . j a va 2 s.c om */ public final void acknowledge(List<String> deliveredMessageIDs) throws JMSException { if (transacted) throw new IllegalStateException("Session is transacted"); // [JMS SPEC] externalAccessLock.readLock().lock(); try { checkNotClosed(); commitUpdates(true, deliveredMessageIDs, false); } finally { externalAccessLock.readLock().unlock(); } }