* @return the TransportChannel to use with the embedded broker
* @throws JMSException
*/
protected TransportChannel createTransportChannel(String theURLString) throws JMSException {
URI uri = createURI(theURLString);
TransportChannelFactory factory = TransportChannelProvider.getFactory(uri);
BrokerConnector brokerConnector = null;
boolean created = false;
TransportChannel transportChannel = null;
boolean embedServer = isUseEmbeddedBroker() || factory.requiresEmbeddedBroker();
if (embedServer) {
synchronized (this) {
if (factory.requiresEmbeddedBroker()) {
transportChannel = factory.create(getWireFormat(), uri);
brokerConnector = transportChannel.getEmbeddedBrokerConnector();
}
if (brokerConnector == null) {
brokerConnector = brokerContext.getConnectorByURL(theURLString);
if (brokerConnector == null) {
brokerConnector = createBrokerConnector(theURLString);
brokerContext.registerConnector(theURLString, brokerConnector);
startedEmbeddedBrokers.add(theURLString);
created = true;
}
}
else {
created = true;
}
}
}
if (transportChannel == null){
transportChannel = factory.create(getWireFormat(), uri);
}
if (embedServer) {
return ensureServerIsAvailable(uri, transportChannel, brokerConnector, created);
}