Skip to content

Commit

Permalink
Unnecessary AtomicReference
Browse files Browse the repository at this point in the history
  • Loading branch information
andrewkerr9000 committed Feb 1, 2018
1 parent e42b622 commit e3f6eb1
Showing 1 changed file with 3 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@

import java.util.Iterator;
import java.util.concurrent.CompletableFuture;
import java.util.concurrent.atomic.AtomicReference;
import java.util.concurrent.locks.ReadWriteLock;
import java.util.concurrent.locks.ReentrantReadWriteLock;

Expand Down Expand Up @@ -62,7 +61,7 @@ public SenderService( ChannelInitializer channelInitializer, LogProvider logProv
@Override
public void send( AdvertisedSocketAddress to, Message message, boolean block )
{
AtomicReference<CompletableFuture<Void>> future = new AtomicReference<>( new CompletableFuture<>() );
CompletableFuture<Void> future;
serviceLock.readLock().lock();
try
{
Expand All @@ -73,7 +72,7 @@ public void send( AdvertisedSocketAddress to, Message message, boolean block )

Channel channel = channel( to );

future.set( channel.writeAndFlush( message ) );
future = channel.writeAndFlush( message );
}
finally
{
Expand All @@ -82,7 +81,7 @@ public void send( AdvertisedSocketAddress to, Message message, boolean block )

if ( block )
{
future.get().join();
future.join();
}
}

Expand Down

0 comments on commit e3f6eb1

Please sign in to comment.