distributeCredit();
}
private void processEndpoints(Connector c)
{
Connection connection = c.getConnection();
if (connection.getLocalState() == EndpointState.UNINITIALIZED)
{
connection.open();
}
Delivery delivery = connection.getWorkHead();
while (delivery != null)
{
Link link = delivery.getLink();
if (delivery.isUpdated())
{
if (link instanceof Sender)
{
delivery.disposition(delivery.getRemoteState());
}
StoreEntry e = (StoreEntry) delivery.getContext();
if (e != null) e.updated();
}
if (delivery.isReadable())
{
pumpIn( link.getSource().getAddress(), (Receiver)link );
}
Delivery next = delivery.getWorkNext();
delivery.clear();
delivery = next;
}
for (Session session : new Sessions(connection, UNINIT, ANY))
{
session.open();
_logger.log(Level.FINE, "Opened session " + session);
}
for (Link link : new Links(connection, UNINIT, ANY))
{
//TODO: the following is not correct; should only copy those properties that we understand
link.setSource(link.getRemoteSource());
link.setTarget(link.getRemoteTarget());
linkAdded(link);
link.open();
_logger.log(Level.FINE, "Opened link " + link);
}
distributeCredit();
for (Link link : new Links(connection, ACTIVE, ACTIVE))
{
if (link instanceof Sender)
{
pumpOut(link.getTarget().getAddress(), (Sender)link);
}
}
for (Session session : new Sessions(connection, ACTIVE, CLOSED))
{
session.close();
}
for (Link link : new Links(connection, ANY, CLOSED))
{
if (link.getLocalState() == EndpointState.ACTIVE)
{
link.close();
}
else
{
reclaimLink(link);
}
}
if (connection.getRemoteState() == EndpointState.CLOSED)
{
if (connection.getLocalState() == EndpointState.ACTIVE)
{
connection.close();
}
}
}