@Override
  public void register(final Identifier id, final InetSocketAddress addr) throws Exception {

    // needed to keep threads from reading the wrong response
    // TODO: better fix matches replies to threads with a map after REEF-198
    synchronized (this) {

      LOG.log(Level.FINE, "Register {0} : {1}", new Object[]{id, addr});

      final Link<NamingMessage> link = this.transport.open(
          this.serverSocketAddr, this.codec, new LoggingLinkListener<NamingMessage>());

      link.write(new NamingRegisterRequest(new NameAssignmentTuple(id, addr)));

      for (;;) {
        try {
          this.replyQueue.poll(this.timeout, TimeUnit.MILLISECONDS);
          break;
        } catch (final InterruptedException e) {
          LOG.log(Level.INFO, "Interrupted", e);
          throw new NamingException(e);
        }
      }
    }
  }
@ Override public void register ( final Identifier id , final InetSocketAddress addr ) throws Exception { synchronized ( this ) { LOG . log ( Level . FINE , "Register {0} : {1}" , new Object [ ] { id , addr } ) ; final Link < NamingMessage > link = this . transport . open ( this . serverSocketAddr , this . codec , new LoggingLinkListener < NamingMessage > ( ) ) ; link . write ( new NamingRegisterRequest ( new NameAssignmentTuple ( id , addr ) ) ) ; for ( ; ; ) { try { this . replyQueue . poll ( this . timeout , TimeUnit . MILLISECONDS ) ; break ; } catch ( final InterruptedException e ) { LOG . log ( Level . INFO , "Interrupted" , e ) ; throw new NamingException ( e ) ; } } } }
Registers an (identifier, address) mapping.

@param id   an identifier
@param addr an Internet socket address