本文整理汇总了Java中org.apache.qpid.proton.engine.EndpointState.CLOSED属性的典型用法代码示例。如果您正苦于以下问题:Java EndpointState.CLOSED属性的具体用法?Java EndpointState.CLOSED怎么用?Java EndpointState.CLOSED使用的例子?那么恭喜您, 这里精选的属性代码示例或许可以为您提供帮助。您也可以进一步了解该属性所在类org.apache.qpid.proton.engine.EndpointState
的用法示例。
在下文中一共展示了EndpointState.CLOSED属性的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: bind
@Override
public void bind(Connection conn)
{
// TODO - check if already bound
_connectionEndpoint = (ConnectionImpl) conn;
put(Event.Type.CONNECTION_BOUND, conn);
_connectionEndpoint.setTransport(this);
_connectionEndpoint.incref();
if(getRemoteState() != EndpointState.UNINITIALIZED)
{
_connectionEndpoint.handleOpen(_open);
if(getRemoteState() == EndpointState.CLOSED)
{
_connectionEndpoint.setRemoteState(EndpointState.CLOSED);
}
_frameParser.flush();
}
}
示例2: send
@Override
public int send(final byte[] bytes, int offset, int length)
{
if (getLocalState() == EndpointState.CLOSED)
{
throw new IllegalStateException("send not allowed after the sender is closed.");
}
DeliveryImpl current = current();
if (current == null || current.getLink() != this)
{
throw new IllegalArgumentException();//TODO.
}
int sent = current.send(bytes, offset, length);
if (sent > 0) {
getSession().incrementOutgoingBytes(sent);
}
return sent;
}
示例3: detach
@Override
public void detach(AsyncResult request) {
// If already closed signal success or else the caller might never get notified.
if (getEndpoint().getLocalState() == EndpointState.CLOSED || getEndpoint().getRemoteState() == EndpointState.CLOSED) {
if (getEndpoint().getLocalState() != EndpointState.CLOSED) {
doDetach();
getEndpoint().free();
}
request.onSuccess();
} else {
this.closeRequest = request;
doDetach();
}
}
示例4: close
@Override
public void close(AsyncResult request) {
// If already closed signal success or else the caller might never get notified.
if (getEndpoint().getLocalState() == EndpointState.CLOSED || getEndpoint().getRemoteState() == EndpointState.CLOSED) {
if (getEndpoint().getLocalState() != EndpointState.CLOSED) {
doClose();
getEndpoint().free();
}
request.onSuccess();
} else {
this.closeRequest = request;
doClose();
}
}
示例5: tick
public long tick(boolean firstTick) {
lock.lock();
try {
if (!firstTick) {
try {
if (connection.getLocalState() != EndpointState.CLOSED) {
long rescheduleAt = transport.tick(TimeUnit.NANOSECONDS.toMillis(System.nanoTime()));
if (transport.isClosed()) {
throw new IllegalStateException("Channel was inactive for to long");
}
return rescheduleAt;
}
} catch (Exception e) {
log.warn(e.getMessage(), e);
transport.close();
connection.setCondition(new ErrorCondition());
}
return 0;
}
return transport.tick(TimeUnit.NANOSECONDS.toMillis(System.nanoTime()));
} finally {
lock.unlock();
flushBytes();
}
}
示例6: processStateChange
@Override
public void processStateChange() throws IOException {
EndpointState remoteState = endpoint.getRemoteState();
if (remoteState == EndpointState.ACTIVE) {
if (isAwaitingOpen()) {
LOG.debug("Link {} is now open: ", this);
opened();
}
// Should not receive an ACTIVE event if not awaiting the open state.
} else if (remoteState == EndpointState.CLOSED) {
if (isAwaitingClose()) {
LOG.debug("Link {} is now closed: ", this);
closed();
} else if (isAwaitingOpen()) {
// Error on Open, create exception and signal failure.
LOG.warn("Open of link {} failed: ", this);
Exception remoteError = this.getRemoteError();
failed(remoteError);
} else {
// TODO - Handle remote asynchronous close.
}
}
}
示例7: onConnectionRemoteClose
@Override
public void onConnectionRemoteClose(Event evt) {
Connection conn = evt.getConnection();
if (conn.getLocalState() != EndpointState.CLOSED) {
conn.close();
}
}
示例8: onSessionRemoteClose
@Override
public void onSessionRemoteClose(Event evt) {
Session ssn = evt.getSession();
if (ssn.getLocalState() != EndpointState.CLOSED) {
ssn.close();
}
}
示例9: onLinkRemoteClose
@Override
public void onLinkRemoteClose(Event evt) {
Link link = evt.getLink();
if (link.getLocalState() != EndpointState.CLOSED) {
link.close();
}
}
示例10: oldApiCheckStateBeforeInput
/**
* This method is public as it is used by Python layer.
* @see org.apache.qpid.proton.engine.Transport#input(byte[], int, int)
*/
public TransportResult oldApiCheckStateBeforeInput(int inputLength)
{
_lastTransportResult.checkIsOk();
if(inputLength == 0)
{
if(_connectionEndpoint == null || _connectionEndpoint.getRemoteState() != EndpointState.CLOSED)
{
return TransportResultFactory.error(new TransportException("Unexpected EOS when remote connection not closed: connection aborted"));
}
}
return TransportResultFactory.ok();
}
示例11: processEnd
private void processEnd()
{
if(_connectionEndpoint != null && _isOpenSent)
{
EndpointImpl endpoint = _connectionEndpoint.getTransportHead();
while(endpoint != null)
{
SessionImpl session;
TransportSession transportSession;
if((endpoint instanceof SessionImpl)) {
if ((session = (SessionImpl)endpoint).getLocalState() == EndpointState.CLOSED
&& (transportSession = session.getTransportSession()).isLocalChannelSet()
&& !_isCloseSent)
{
if (hasSendableMessages(session)) {
endpoint = endpoint.transportNext();
continue;
}
int channel = freeLocalChannel(transportSession);
End end = new End();
ErrorCondition localError = endpoint.getCondition();
if( localError.getCondition() !=null )
{
end.setError(localError);
}
writeFrame(channel, end, null, null);
}
endpoint.clearModified();
}
endpoint = endpoint.transportNext();
}
}
}
示例12: processClose
private void processClose()
{
if ((_condition != null ||
(_connectionEndpoint != null &&
_connectionEndpoint.getLocalState() == EndpointState.CLOSED)) &&
!_isCloseSent) {
if(!hasSendableMessages(null))
{
Close close = new Close();
ErrorCondition localError;
if (_connectionEndpoint == null) {
localError = _condition;
} else {
localError = _connectionEndpoint.getCondition();
}
if(localError.getCondition() != null)
{
close.setError(localError);
}
_isCloseSent = true;
writeFrame(0, close, null, null);
if (_connectionEndpoint != null) {
_connectionEndpoint.clearModified();
}
}
}
}
示例13: close
@Override
public void close()
{
if (getLocalState() != EndpointState.CLOSED)
{
_localState = EndpointState.CLOSED;
localClose();
modified();
}
}
示例14: processStateChange
@Override
public void processStateChange() {
// TODO - We might want to check on our producer to see if it becomes closed
// which might indicate that the broker purged the temporary destination.
EndpointState remoteState = endpoint.getRemoteState();
if (remoteState == EndpointState.ACTIVE) {
LOG.trace("Temporary Destination: {} is now open", this.info);
opened();
} else if (remoteState == EndpointState.CLOSED) {
LOG.trace("Temporary Destination: {} is now closed", this.info);
closed();
}
}
示例15: close
@Override
public void close(AsyncResult<Void> request) {
// If already closed signal success or else the caller might never get notified.
if (endpoint.getLocalState() == EndpointState.CLOSED &&
endpoint.getRemoteState() == EndpointState.CLOSED) {
request.onSuccess();
}
this.closeRequest = request;
doClose();
this.endpoint.close();
}