@Override public String toString() { return "ActiveMQConnection {id=" + info.getConnectionId() + ",clientId=" + info.getClientId() + ",started=" + started.get() + "}"; }
public ConnectionContext(ConnectionInfo info) { this(); setClientId(info.getClientId()); setUserName(info.getUserName()); setConnectionId(info.getConnectionId()); }
/** * Write the booleans that this object uses to a BooleanStream */ public void looseMarshal(OpenWireFormat wireFormat, Object o, DataOutput dataOut) throws IOException { ConnectionInfo info = (ConnectionInfo)o; super.looseMarshal(wireFormat, o, dataOut); looseMarshalCachedObject(wireFormat, (DataStructure)info.getConnectionId(), dataOut); looseMarshalString(info.getClientId(), dataOut); looseMarshalString(info.getPassword(), dataOut); looseMarshalString(info.getUserName(), dataOut); looseMarshalObjectArray(wireFormat, info.getBrokerPath(), dataOut); dataOut.writeBoolean(info.isBrokerMasterConnector()); dataOut.writeBoolean(info.isManageable()); } }
state = (TransportConnectionState) brokerConnectionStates.get(info.getConnectionId()); if (state == null) { state = new TransportConnectionState(info, this); brokerConnectionStates.put(info.getConnectionId(), state); registerConnectionState(info.getConnectionId(), state); LOG.debug("Setting up new connection id: {}, address: {}, info: {}", new Object[]{ info.getConnectionId(), getRemoteAddress(), info }); this.faultTolerantConnection = info.isFaultTolerant(); String clientId = info.getClientId(); context = new ConnectionContext(); context.setBroker(broker); context.setFaultTolerant(faultTolerantConnection); context.setTransactions(new ConcurrentHashMap<TransactionId, Transaction>()); context.setUserName(info.getUserName()); context.setWireFormatInfo(wireFormatInfo); context.setReconnect(info.isFailoverReconnect()); this.manageable = info.isManageable(); context.setConnectionState(state); state.setContext(context); throw e; if (info.isManageable()) {
@Override public Response processAddConnection(ConnectionInfo info) throws Exception { Response answer = super.processAddConnection(info); String clientId = info.getClientId(); if (populateUserName) { ((ConnectionView) mbean).setUserName(info.getUserName()); } if (clientId != null) { if (byClientIdName == null) { byClientIdName = createObjectName("clientId", clientId); registerMBean(byClientIdName); } } return answer; }
/** * Write the booleans that this object uses to a BooleanStream */ public void looseMarshal(OpenWireFormat wireFormat, Object o, DataOutput dataOut) throws IOException { ConnectionInfo info = (ConnectionInfo)o; super.looseMarshal(wireFormat, o, dataOut); looseMarshalCachedObject(wireFormat, (DataStructure)info.getConnectionId(), dataOut); looseMarshalString(info.getClientId(), dataOut); looseMarshalString(info.getPassword(), dataOut); looseMarshalString(info.getUserName(), dataOut); looseMarshalObjectArray(wireFormat, info.getBrokerPath(), dataOut); dataOut.writeBoolean(info.isBrokerMasterConnector()); dataOut.writeBoolean(info.isManageable()); dataOut.writeBoolean(info.isClientMaster()); } }
state = (TransportConnectionState) brokerConnectionStates.get(info.getConnectionId()); if (state == null) { state = new TransportConnectionState(info, this); brokerConnectionStates.put(info.getConnectionId(), state); registerConnectionState(info.getConnectionId(), state); LOG.debug("Setting up new connection id: {}, address: {}, info: {}", new Object[]{ info.getConnectionId(), getRemoteAddress(), info }); this.faultTolerantConnection = info.isFaultTolerant(); String clientId = info.getClientId(); context = new ConnectionContext(); context.setBroker(broker); context.setFaultTolerant(faultTolerantConnection); context.setTransactions(new ConcurrentHashMap<TransactionId, Transaction>()); context.setUserName(info.getUserName()); context.setWireFormatInfo(wireFormatInfo); context.setReconnect(info.isFailoverReconnect()); this.manageable = info.isManageable(); context.setConnectionState(state); state.setContext(context); throw e; if (info.isManageable()) {
public AMQConnectionContext(ConnectionInfo info) { this(); setClientId(info.getClientId()); setUserName(info.getUserName()); setConnectionId(info.getConnectionId()); }
@Override public String getConnectionId() { List<TransportConnectionState> connectionStates = listConnectionStates(); for (TransportConnectionState cs : connectionStates) { if (cs.getInfo().getClientId() != null) { return cs.getInfo().getClientId(); } return cs.getInfo().getConnectionId().toString(); } return null; }
/** * Write the booleans that this object uses to a BooleanStream */ public void looseMarshal(OpenWireFormat wireFormat, Object o, DataOutput dataOut) throws IOException { ConnectionInfo info = (ConnectionInfo)o; super.looseMarshal(wireFormat, o, dataOut); looseMarshalCachedObject(wireFormat, (DataStructure)info.getConnectionId(), dataOut); looseMarshalString(info.getClientId(), dataOut); looseMarshalString(info.getPassword(), dataOut); looseMarshalString(info.getUserName(), dataOut); looseMarshalObjectArray(wireFormat, info.getBrokerPath(), dataOut); dataOut.writeBoolean(info.isBrokerMasterConnector()); dataOut.writeBoolean(info.isManageable()); dataOut.writeBoolean(info.isClientMaster()); } }
state = (TransportConnectionState) brokerConnectionStates.get(info.getConnectionId()); if (state == null) { state = new TransportConnectionState(info, this); brokerConnectionStates.put(info.getConnectionId(), state); registerConnectionState(info.getConnectionId(), state); LOG.debug("Setting up new connection id: {}, address: {}, info: {}", new Object[]{ info.getConnectionId(), getRemoteAddress(), info }); this.faultTolerantConnection = info.isFaultTolerant(); String clientId = info.getClientId(); context = new ConnectionContext(); context.setBroker(broker); context.setFaultTolerant(faultTolerantConnection); context.setTransactions(new ConcurrentHashMap<TransactionId, Transaction>()); context.setUserName(info.getUserName()); context.setWireFormatInfo(wireFormatInfo); context.setReconnect(info.isFailoverReconnect()); this.manageable = info.isManageable(); context.setConnectionState(state); state.setContext(context); throw e; if (info.isManageable()) {
public ConnectionContext(ConnectionInfo info) { this(); setClientId(info.getClientId()); setUserName(info.getUserName()); setConnectionId(info.getConnectionId()); }
@Override public void removeConnection(ConnectionContext context, ConnectionInfo info, Throwable error) throws Exception { String clientId = info.getClientId(); if (clientId == null) { throw new InvalidClientIDException("No clientID specified for connection disconnect request"); } synchronized (clientIdSet) { ConnectionContext oldValue = clientIdSet.get(clientId); // we may be removing the duplicate connection, not the first connection to be created // so lets check that their connection IDs are the same if (oldValue == context) { if (isEqual(oldValue.getConnectionId(), info.getConnectionId())) { clientIdSet.remove(clientId); } } } connections.remove(context.getConnection()); }
/** * Write the booleans that this object uses to a BooleanStream */ public void looseMarshal(OpenWireFormat wireFormat, Object o, DataOutput dataOut) throws IOException { ConnectionInfo info = (ConnectionInfo)o; super.looseMarshal(wireFormat, o, dataOut); looseMarshalCachedObject(wireFormat, (DataStructure)info.getConnectionId(), dataOut); looseMarshalString(info.getClientId(), dataOut); looseMarshalString(info.getPassword(), dataOut); looseMarshalString(info.getUserName(), dataOut); looseMarshalObjectArray(wireFormat, info.getBrokerPath(), dataOut); dataOut.writeBoolean(info.isBrokerMasterConnector()); dataOut.writeBoolean(info.isManageable()); dataOut.writeBoolean(info.isClientMaster()); } }
state = (TransportConnectionState) brokerConnectionStates.get(info.getConnectionId()); if (state == null) { state = new TransportConnectionState(info, this); brokerConnectionStates.put(info.getConnectionId(), state); registerConnectionState(info.getConnectionId(), state); LOG.debug("Setting up new connection id: {}, address: {}, info: {}", new Object[]{ info.getConnectionId(), getRemoteAddress(), info }); this.faultTolerantConnection = info.isFaultTolerant(); String clientId = info.getClientId(); context = new ConnectionContext(); context.setBroker(broker); context.setFaultTolerant(faultTolerantConnection); context.setTransactions(new ConcurrentHashMap<TransactionId, Transaction>()); context.setUserName(info.getUserName()); context.setWireFormatInfo(wireFormatInfo); context.setReconnect(info.isFailoverReconnect()); this.manageable = info.isManageable(); context.setConnectionState(state); state.setContext(context); throw e; if (info.isManageable()) {
public ConnectionContext(ConnectionInfo info) { this(); setClientId(info.getClientId()); setUserName(info.getUserName()); setConnectionId(info.getConnectionId()); }
/** * Send the ConnectionInfo to the Broker * * @throws JMSException */ protected void ensureConnectionInfoSent() throws JMSException { synchronized(this.ensureConnectionInfoSentMutex) { // Can we skip sending the ConnectionInfo packet?? if (isConnectionInfoSentToBroker || closed.get()) { return; } //TODO shouldn't this check be on userSpecifiedClientID rather than the value of clientID? if (info.getClientId() == null || info.getClientId().trim().length() == 0) { info.setClientId(clientIdGenerator.generateId()); } syncSendPacket(info.copy(), getConnectResponseTimeout()); this.isConnectionInfoSentToBroker = true; // Add a temp destination advisory consumer so that // We know what the valid temporary destinations are on the // broker without having to do an RPC to the broker. ConsumerId consumerId = new ConsumerId(new SessionId(info.getConnectionId(), -1), consumerIdGenerator.getNextSequenceId()); if (watchTopicAdvisories) { advisoryConsumer = new AdvisoryConsumer(this, consumerId); } } }
/** * Write the booleans that this object uses to a BooleanStream */ public void looseMarshal(OpenWireFormat wireFormat, Object o, DataOutput dataOut) throws IOException { ConnectionInfo info = (ConnectionInfo)o; super.looseMarshal(wireFormat, o, dataOut); looseMarshalCachedObject(wireFormat, (DataStructure)info.getConnectionId(), dataOut); looseMarshalString(info.getClientId(), dataOut); looseMarshalString(info.getPassword(), dataOut); looseMarshalString(info.getUserName(), dataOut); looseMarshalObjectArray(wireFormat, info.getBrokerPath(), dataOut); dataOut.writeBoolean(info.isBrokerMasterConnector()); dataOut.writeBoolean(info.isManageable()); dataOut.writeBoolean(info.isClientMaster()); } }
public KapuaConnectionContext(String brokerId, ConnectionInfo info) { authDestinations = new ArrayList<>(); this.brokerId = brokerId; userName = info.getUserName(); clientId = info.getClientId(); clientIp = info.getClientIp(); connectionId = info.getConnectionId().getValue(); if(info.getTransportContext() instanceof Certificate[]) { clientCertificates = (Certificate[]) info.getTransportContext(); } }
/** * Unsubscribes a durable subscription that has been created by a client. * <P> * This method deletes the state being maintained on behalf of the * subscriber by its provider. * <P> * It is erroneous for a client to delete a durable subscription while there * is an active <CODE>MessageConsumer </CODE> or * <CODE>TopicSubscriber</CODE> for the subscription, or while a consumed * message is part of a pending transaction or has not been acknowledged in * the session. * * @param name the name used to identify this subscription * @throws JMSException if the session fails to unsubscribe to the durable * subscription due to some internal error. * @throws InvalidDestinationException if an invalid subscription name is * specified. * @since 1.1 */ public void unsubscribe(String name) throws InvalidDestinationException, JMSException { checkClosedOrFailed(); RemoveSubscriptionInfo rsi = new RemoveSubscriptionInfo(); rsi.setConnectionId(getConnectionInfo().getConnectionId()); rsi.setSubscriptionName(name); rsi.setClientId(getConnectionInfo().getClientId()); syncSendPacket(rsi); }