Code example for ReadWriteLock

Methods: writeLock

0
    } 
 
    @Override 
    public void setServer(ProxiedPlayer player)
    { 
        lock.writeLock().lock();
        try 
        { 
            data.put( key( player ), ( player.getReconnectServer() != null ) ? player.getReconnectServer().getName() : player.getServer().getInfo().getName() );
        } finally 
        { 
            lock.writeLock().unlock();
        } 
    } 
 
    private String key(ProxiedPlayer player)
    { 
        InetSocketAddress host = player.getPendingConnection().getVirtualHost();
        return player.getName() + ";" + host.getHostString() + ":" + host.getPort();
    } 
Stop searching for code, let great code find you!  Add Codota to your java IDE