LinkManager (OpenMap API)
Date: 2016-12-09

Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## com.bbn.openmap.layer.link
Class LinkManager

    java.lang.Object
      com.bbn.openmap.layer.link.LinkManager

    public class LinkManager

extends java.lang.Object

The LinkManager..

Field Summary
`protected java.lang.String` | `host`
`protected ClientLink` | `link` volatile because we want internal methods to get the message that a link was nulled out.
`protected boolean` | `obeyCommandToExit`
`protected int` | `port`

Constructor Summary
`protected` | `LinkManager()` Constructor.
`` | `LinkManager(java.lang.String host, int port)` Constructor.

Method Summary
`void` | `finLink()` When a getLink() is called, and the link is reserved for that caller, finLink() MUST be called to release the link for others.
`protected ClientLink` | `getLink()` Get the ClientLink however it is appropriate for this LinkManager.
`ClientLink` | `getLink(boolean waitForLock)` This should be the only method a multi-threaded object uses to gain use of the thread, i.e., on the client side where a GUI can start a lot of requests.
`protected ClientLink` | `getLink(LinkListener ll)` Called for a LayerListener that will not write to the Link, only read from it.
`boolean` | `getObeyCommandToExit()`
`void` | `resetLink()` Set the link to null.
`void` | `setObeyCommandToExit(boolean value)`

Methods inherited from class java.lang.Object
`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

Field Detail

### host

    protected java.lang.String host

### port

    protected int port

### obeyCommandToExit

    protected boolean obeyCommandToExit

### link

    protected volatile ClientLink link

  volatile because we want internal methods to get the message that a link was nulled out.

Constructor Detail

### LinkManager

    protected LinkManager()

  Constructor.

### LinkManager

    public LinkManager(java.lang.String host,
                       int port)

  Constructor.

Method Detail

### setObeyCommandToExit

    public void setObeyCommandToExit(boolean value)

### getObeyCommandToExit

    public boolean getObeyCommandToExit()

### getLink

    public ClientLink getLink(boolean waitForLock)
                       throws java.io.IOException

  This should be the only method a multi-threaded object uses to gain use of the thread, i.e., on the client side where a GUI can start a lot of requests. If the link was not able to be retained for the requestor, then null will be returned. Null should be tested for by the callers, so that they can handle the rejection properly.

  Parameters:
    `waitForLock` - if true, the caller will block in this method until the link has been locked for the caller. If false, a null will be returned if the lock on the link couldn't be set for the caller's use.
  Returns:
    a link if the link is locked for the caller's use, null if the link is not available.
  Throws:
    `java.io.IOException`

### getLink

    protected ClientLink getLink(LinkListener ll)
                          throws java.io.IOException

  Called for a LayerListener that will not write to the Link, only read from it. Doesn't effect the lock.

  Returns:
    a link if the link is locked for the caller's use, null if the link is not available.
  Throws:
    `java.io.IOException`

### getLink

    protected ClientLink getLink()
                          throws java.io.IOException

  Get the ClientLink however it is appropriate for this LinkManager. In this case, the LinkManager will just use the host and port assigned.

  Throws:
    `java.io.IOException`

### finLink

    public void finLink()
                 throws java.io.IOException

  When a getLink() is called, and the link is reserved for that caller, finLink() MUST be called to release the link for others. If it is not called, no one else will be able to use it.

  Throws:
    `java.io.IOException`

### resetLink

    public void resetLink()

  Set the link to null.

Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

Copyright (C) BBNT Solutions LLC; See http://openmap.bbn.com/ for details