Package org.apache.qpid.proton.engine

# Interface Connection

All Superinterfaces:
  `Endpoint`, `Extendable`, `ReactorChild`

All Known Subinterfaces:
  `ProtonJConnection`

All Known Implementing Classes:
  `ConnectionImpl`

public interface Connection extends Endpoint, ReactorChild
Maintains lists of sessions, links and deliveries in a state that is interesting to the application. These are exposed by returning the head of those lists via `sessionHead(EnumSet, EnumSet)`, `linkHead(EnumSet, EnumSet)` `getWorkHead()` respectively.

## Nested Class Summary

Nested Classes
Modifier and Type
Interface
Description
`static final class`
`Connection.Factory`

## Method Summary

Modifier and Type
Method
Description
`void`
`collect(Collector collector)`
`String`
`getContainer()`
`Object`
`getContext()`
`String`
`getHostname()`
`Reactor`
`getReactor()`
`String`
`getRemoteContainer()`
`Symbol[]`
`getRemoteDesiredCapabilities()`
`String`
`getRemoteHostname()`
`Symbol[]`
`getRemoteOfferedCapabilities()`
`Map<Symbol,Object>`
`getRemoteProperties()`
`Transport`
`getTransport()`
`Delivery`
`getWorkHead()`
Returns the head of the delivery work list.
`Link`
`linkHead(EnumSet<EndpointState> local, EnumSet<EndpointState> remote)`
Returns the head of the list of links in the specified states.
`Session`
`session()`
Returns a newly created session TODO does the Connection's channel-max property limit how many sessions can be created, or opened, or neither?
`Session`
`sessionHead(EnumSet<EndpointState> local, EnumSet<EndpointState> remote)`
Returns the head of the list of sessions in the specified states.
`void`
`setContainer(String container)`
`void`
`setContext(Object context)`
Sets an arbitrary an application owned object on the end-point.
`void`
`setDesiredCapabilities(Symbol[] capabilities)`
`void`
`setHostname(String hostname)`
Set the name of the host (either fully qualified or relative) to which this connection is connecting to.
`void`
`setOfferedCapabilities(Symbol[] capabilities)`
`void`
`setProperties(Map<Symbol,Object> properties)`

### Methods inherited from interface org.apache.qpid.proton.engine.Endpoint

`close, free, getCondition, getLocalState, getRemoteCondition, getRemoteState, open, setCondition`

### Methods inherited from interface org.apache.qpid.proton.engine.Extendable

`attachments`

### Methods inherited from interface org.apache.qpid.proton.reactor.ReactorChild

`free`

## Method Details

### session

Session session()
Returns a newly created session TODO does the Connection's channel-max property limit how many sessions can be created, or opened, or neither?

### sessionHead

Session sessionHead(EnumSet<EndpointState> local, EnumSet<EndpointState> remote)
Returns the head of the list of sessions in the specified states. Typically used to discover sessions whose remote state has acquired particular values, e.g. sessions that have been remotely opened or closed. TODO what ordering guarantees on the returned "linked list" are provided?

See Also:
  - `Session.next(EnumSet, EnumSet)`

### linkHead

Link linkHead(EnumSet<EndpointState> local, EnumSet<EndpointState> remote)
Returns the head of the list of links in the specified states. Typically used to discover links whose remote state has acquired particular values, e.g. links that have been remotely opened or closed.

See Also:
  - `Link.next(EnumSet, EnumSet)`

### getWorkHead

Delivery getWorkHead()
Returns the head of the delivery work list. The delivery work list consists of unsettled deliveries whose state has been changed by the other container and not yet locally processed.

See Also:
  - `Receiver.recv(byte[], int, int)`
  - `Delivery.settle()`
  - `Delivery.getWorkNext()`

### setContainer

void setContainer(String container)

### getContainer

String getContainer()

### setHostname

void setHostname(String hostname)
Set the name of the host (either fully qualified or relative) to which this connection is connecting to. This information may be used by the remote peer to determine the correct back-end service to connect the client to. This value will be sent in the Open performative. Note that it is illegal to set the hostname to a numeric IP address or include a port number.

Parameters:
  `hostname` - the RFC1035 compliant host name.

### getHostname

String getHostname()

### getRemoteContainer

String getRemoteContainer()

### getRemoteHostname

String getRemoteHostname()

### setOfferedCapabilities

void setOfferedCapabilities(Symbol[] capabilities)

### setDesiredCapabilities

void setDesiredCapabilities(Symbol[] capabilities)

### getRemoteOfferedCapabilities

Symbol[] getRemoteOfferedCapabilities()

### getRemoteDesiredCapabilities

Symbol[] getRemoteDesiredCapabilities()

### getRemoteProperties

Map<Symbol,Object> getRemoteProperties()

### setProperties

void setProperties(Map<Symbol,Object> properties)

### getContext

Object getContext()

Specified by:
  `getContext` in interface `Endpoint`
See Also:
  - `Endpoint.setContext(Object)`

### setContext

void setContext(Object context)
Description copied from interface: `Endpoint`
Sets an arbitrary an application owned object on the end-point. This object is not used by Proton.

Specified by:
  `setContext` in interface `Endpoint`

### collect

void collect(Collector collector)

### getTransport

Transport getTransport()

### getReactor

Reactor getReactor()