List of usage examples for javax.jms InvalidClientIDException InvalidClientIDException
public InvalidClientIDException(String reason)
From source file:com.amazon.sqs.javamessaging.SQSConnection.java
/** * Sets the client identifier for this connection. * <P>//from ww w . ja v a2 s . co m * Does not verify uniqueness of client ID, so does not detect if another * connection is already using the same client ID * * @param clientID * The client identifier * @throws JMSException * If the connection is being closed * @throws InvalidClientIDException * If empty or null client ID is used * @throws IllegalStateException * If the client ID is already set or attempted to set after an * action on the connection already took place */ @Override public void setClientID(String clientID) throws JMSException { checkClosing(); if (clientID == null || clientID.isEmpty()) { throw new InvalidClientIDException("ClientID is empty"); } if (this.clientID != null) { throw new IllegalStateException("ClientID is already set"); } if (actionOnConnectionTaken) { throw new IllegalStateException("Client ID cannot be set after any action on the connection is taken"); } this.clientID = clientID; }
From source file:net.timewalker.ffmq4.common.connection.AbstractConnection.java
@Override public String getClientID() throws JMSException { externalAccessLock.readLock().lock(); try {/* w w w . j a va 2 s . c o m*/ if (clientID == null) throw new InvalidClientIDException("Client ID not set"); return clientID; } finally { externalAccessLock.readLock().unlock(); } }
From source file:net.timewalker.ffmq4.common.connection.AbstractConnection.java
@Override public void setClientID(String clientID) throws JMSException { externalAccessLock.readLock().lock(); try {// www .j a va 2 s . c o 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.local.connection.ClientIDRegistry.java
/** * Register a new client ID/*from www. j a v a 2 s . c om*/ */ public synchronized void register(String clientID) throws InvalidClientIDException { if (!clientIDs.add(clientID)) { log.error("Client ID already exists : " + clientID); throw new InvalidClientIDException("Client ID already exists : " + clientID); } log.debug("Registered clientID : " + clientID); }