String name = UUIDGenerator.getInstance().generateStringUUID();
boolean retry = false;
do
{
Version clientVersion = VersionLoader.getVersion();
Lock lock = null;
try
{
Channel channel1;
synchronized (failoverLock)
{
if (connection == null)
{
throw new IllegalStateException("Connection is null");
}
channel1 = connection.getChannel(1, -1);
// Lock it - this must be done while the failoverLock is held
while (!channel1.getLock().tryLock(100, TimeUnit.MILLISECONDS))
{
if (exitLoop)
throw HornetQMessageBundle.BUNDLE.clientSessionClosed();
}
lock = channel1.getLock();
} // We can now release the failoverLock
// We now set a flag saying createSession is executing
synchronized (inCreateSessionGuard)
{
if (exitLoop)
throw HornetQMessageBundle.BUNDLE.clientSessionClosed();
inCreateSession = true;
inCreateSessionLatch = new CountDownLatch(1);
}
long sessionChannelID = connection.generateChannelID();
Packet request = new CreateSessionMessage(name,
sessionChannelID,
clientVersion.getIncrementingVersion(),
username,
password,
serverLocator.getMinLargeMessageSize(),
xa,
autoCommitSends,