public void ReConnect(bool recreate) { lock (_zkEventLock) { _connection.Close(); _connection.Connect(this); Task.Run(async() => { await RecreateEphemeraleNodeAsync(recreate).ConfigureAwait(false); }).ConfigureAwait(false).GetAwaiter().GetResult(); } }
public void ReConnect(bool recreate) { lock (_zkEventLock) { try { _connection.Close(); _connection.Connect(this); RecreateEphemeraleNode(recreate); } catch (ThreadInterruptedException e) { throw new ZKInterruptedException(e); } } }
public void TestSequentials() { _connection = EstablishConnection(); string sequentialPath = _connection.Create("/a", new byte[0], CreateMode.EphemeralSequential); int firstSequential = int.Parse(sequentialPath.Substring(2)); Assert.True("/a" + ZKPathUtil.LeadingZeros(firstSequential++, 10) == sequentialPath); Assert.True("/a" + ZKPathUtil.LeadingZeros(firstSequential++, 10) == _connection.Create("/a", new byte[0], CreateMode.EphemeralSequential)); Assert.True("/a" + ZKPathUtil.LeadingZeros(firstSequential++, 10) == _connection.Create("/a", new byte[0], CreateMode.EphemeralSequential)); Assert.True("/b" + ZKPathUtil.LeadingZeros(firstSequential++, 10) == _connection.Create("/b", new byte[0], CreateMode.EphemeralSequential)); Assert.True("/b" + ZKPathUtil.LeadingZeros(firstSequential++, 10) == _connection.Create("/b", new byte[0], CreateMode.EphemeralSequential)); Assert.True("/a" + ZKPathUtil.LeadingZeros(firstSequential++, 10) == _connection.Create("/a", new byte[0], CreateMode.EphemeralSequential)); _connection.Close(); _connection = null; }
public async Task TestSequentials() { _connection = EstablishConnection(); string sequentialPath = await _connection.CreateAsync("/a", new byte[0], CreateMode.EPHEMERAL_SEQUENTIAL); int firstSequential = int.Parse(sequentialPath.Substring(2)); Assert.True("/a" + ZKPathUtil.LeadingZeros(firstSequential++, 10) == sequentialPath); Assert.True("/a" + ZKPathUtil.LeadingZeros(firstSequential++, 10) == await _connection.CreateAsync("/a", new byte[0], CreateMode.EPHEMERAL_SEQUENTIAL)); Assert.True("/a" + ZKPathUtil.LeadingZeros(firstSequential++, 10) == await _connection.CreateAsync("/a", new byte[0], CreateMode.EPHEMERAL_SEQUENTIAL)); Assert.True("/b" + ZKPathUtil.LeadingZeros(firstSequential++, 10) == await _connection.CreateAsync("/b", new byte[0], CreateMode.EPHEMERAL_SEQUENTIAL)); Assert.True("/b" + ZKPathUtil.LeadingZeros(firstSequential++, 10) == await _connection.CreateAsync("/b", new byte[0], CreateMode.EPHEMERAL_SEQUENTIAL)); Assert.True("/a" + ZKPathUtil.LeadingZeros(firstSequential++, 10) == await _connection.CreateAsync("/a", new byte[0], CreateMode.EPHEMERAL_SEQUENTIAL)); _connection.Close(); _connection = null; }