本文整理了Java中org.apache.qpid.proton.engine.Transport.isClosed()
方法的一些代码示例,展示了Transport.isClosed()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Transport.isClosed()
方法的具体详情如下:
包路径:org.apache.qpid.proton.engine.Transport
类名称:Transport
方法名:isClosed
暂无
代码示例来源:origin: apache/activemq-artemis
@Override
public void run() {
ByteBuffer source = incoming.nioBuffer();
LOG.trace("Client Received from Broker {} bytes:", source.remaining());
if (protonTransport.isClosed()) {
LOG.debug("Ignoring incoming data because transport is closed");
return;
}
do {
ByteBuffer buffer = protonTransport.getInputBuffer();
int limit = Math.min(buffer.remaining(), source.remaining());
ByteBuffer duplicate = source.duplicate();
duplicate.limit(source.position() + limit);
buffer.put(duplicate);
protonTransport.processInput();
source.position(source.position() + limit);
}
while (source.hasRemaining());
ReferenceCountUtil.release(incoming);
// Process the state changes from the latest data and then answer back
// any pending updates to the Broker.
processUpdates();
pumpToProtonTransport();
}
});
代码示例来源:origin: apache/qpid-jms
@Override
public void run() {
boolean checkScheduled = false;
if (connection.getLocalState() == EndpointState.ACTIVE) {
// Using nano time since it is not related to the wall clock, which may change
long now = TimeUnit.NANOSECONDS.toMillis(System.nanoTime());
long deadline = protonTransport.tick(now);
boolean pumpSucceeded = pumpToProtonTransport();
if (protonTransport.isClosed()) {
LOG.info("IdleTimeoutCheck closed the transport due to the peer exceeding our requested idle-timeout.");
if (pumpSucceeded) {
fireProviderException(new IOException("Transport closed due to the peer exceeding our requested idle-timeout"));
}
} else {
if (deadline != 0) {
long delay = deadline - now;
checkScheduled = true;
LOG.trace("IdleTimeoutCheck rescheduling with delay: {}", delay);
nextIdleTimeoutCheck = serializer.schedule(this, delay, TimeUnit.MILLISECONDS);
}
}
} else {
LOG.trace("IdleTimeoutCheck skipping check, connection is not active.");
}
if (!checkScheduled) {
nextIdleTimeoutCheck = null;
LOG.trace("IdleTimeoutCheck exiting");
}
}
}
代码示例来源:origin: org.apache.qpid/qpid-jms-client
@Override
public void run() {
boolean checkScheduled = false;
if (connection.getLocalState() == EndpointState.ACTIVE) {
// Using nano time since it is not related to the wall clock, which may change
long now = TimeUnit.NANOSECONDS.toMillis(System.nanoTime());
long deadline = protonTransport.tick(now);
boolean pumpSucceeded = pumpToProtonTransport();
if (protonTransport.isClosed()) {
LOG.info("IdleTimeoutCheck closed the transport due to the peer exceeding our requested idle-timeout.");
if (pumpSucceeded) {
fireProviderException(new IOException("Transport closed due to the peer exceeding our requested idle-timeout"));
}
} else {
if (deadline != 0) {
long delay = deadline - now;
checkScheduled = true;
LOG.trace("IdleTimeoutCheck rescheduling with delay: {}", delay);
nextIdleTimeoutCheck = serializer.schedule(this, delay, TimeUnit.MILLISECONDS);
}
}
} else {
LOG.trace("IdleTimeoutCheck skipping check, connection is not active.");
}
if (!checkScheduled) {
nextIdleTimeoutCheck = null;
LOG.trace("IdleTimeoutCheck exiting");
}
}
}
代码示例来源:origin: com.microsoft.azure.iot/proton-j-azure-iot
private static int pending(Selectable selectable) {
Transport transport = ((SelectableImpl)selectable).getTransport();
int pending = transport.pending();
if (pending < 0) {
if (transport.isClosed()) {
selectable.terminate();
}
}
return pending;
}
代码示例来源:origin: org.apache.activemq/artemis-proton-plug
@Override
public long tick(boolean firstTick) {
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) {
transport.close();
connection.setCondition(new ErrorCondition());
}
return 0;
}
return transport.tick(TimeUnit.NANOSECONDS.toMillis(System.nanoTime()));
}
代码示例来源:origin: org.apache.qpid/proton-j
private static int capacity(Selectable selectable) {
Transport transport = ((SelectableImpl)selectable).getTransport();
int capacity = transport.capacity();
if (capacity < 0) {
if (transport.isClosed()) {
selectable.terminate();
}
}
return capacity;
}
代码示例来源:origin: org.apache.qpid/proton-j
private static int pending(Selectable selectable) {
Transport transport = ((SelectableImpl)selectable).getTransport();
int pending = transport.pending();
if (pending < 0) {
if (transport.isClosed()) {
selectable.terminate();
}
}
return pending;
}
代码示例来源:origin: org.apache.activemq/activemq-all
@Override
public long keepAlive() throws IOException {
long rescheduleAt = 0l;
LOG.trace("Performing connection:{} keep-alive processing", amqpTransport.getRemoteAddress());
if (protonConnection.getLocalState() != EndpointState.CLOSED) {
// Using nano time since it is not related to the wall clock, which may change
long now = TimeUnit.NANOSECONDS.toMillis(System.nanoTime());
long deadline = protonTransport.tick(now);
pumpProtonToSocket();
if (protonTransport.isClosed()) {
LOG.debug("Transport closed after inactivity check.");
throw new InactivityIOException("Channel was inactive for too long");
} else {
if(deadline != 0) {
// caller treats 0 as no-work, ensure value is at least 1 as there was a deadline
rescheduleAt = Math.max(deadline - now, 1);
}
}
}
LOG.trace("Connection:{} keep alive processing done, next update in {} milliseconds.",
amqpTransport.getRemoteAddress(), rescheduleAt);
return rescheduleAt;
}
代码示例来源:origin: com.microsoft.azure.iot/proton-j-azure-iot
private static int capacity(Selectable selectable) {
Transport transport = ((SelectableImpl)selectable).getTransport();
int capacity = transport.capacity();
if (capacity < 0) {
if (transport.isClosed()) {
selectable.terminate();
}
}
return capacity;
}
代码示例来源:origin: org.apache.activemq/artemis-amqp-protocol
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");
代码示例来源:origin: org.apache.activemq/activemq-osgi
@Override
public long keepAlive() throws IOException {
long rescheduleAt = 0l;
LOG.trace("Performing connection:{} keep-alive processing", amqpTransport.getRemoteAddress());
if (protonConnection.getLocalState() != EndpointState.CLOSED) {
// Using nano time since it is not related to the wall clock, which may change
long now = TimeUnit.NANOSECONDS.toMillis(System.nanoTime());
long deadline = protonTransport.tick(now);
pumpProtonToSocket();
if (protonTransport.isClosed()) {
LOG.debug("Transport closed after inactivity check.");
throw new InactivityIOException("Channel was inactive for too long");
} else {
if(deadline != 0) {
// caller treats 0 as no-work, ensure value is at least 1 as there was a deadline
rescheduleAt = Math.max(deadline - now, 1);
}
}
}
LOG.trace("Connection:{} keep alive processing done, next update in {} milliseconds.",
amqpTransport.getRemoteAddress(), rescheduleAt);
return rescheduleAt;
}
代码示例来源:origin: apache/activemq-artemis
public Long tick(boolean firstTick) {
requireHandler();
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());
} finally {
flush();
}
return 0L;
}
return transport.tick(TimeUnit.NANOSECONDS.toMillis(System.nanoTime()));
}
代码示例来源:origin: apache/activemq-artemis
@Override
public void run() {
try {
if (getEndpoint().getLocalState() != EndpointState.CLOSED) {
LOG.debug("Client performing next idle check");
// Using nano time since it is not related to the wall clock, which may change
long now = TimeUnit.NANOSECONDS.toMillis(System.nanoTime());
long deadline = protonTransport.tick(now);
pumpToProtonTransport();
if (protonTransport.isClosed()) {
LOG.debug("Transport closed after inactivity check.");
throw new InactivityIOException("Channel was inactive for too long");
} else {
if (deadline != 0) {
getScheduler().schedule(this, deadline - now, TimeUnit.MILLISECONDS);
}
}
}
} catch (Exception e) {
try {
transport.close();
} catch (IOException e1) {
}
fireClientException(e);
}
}
}, initialKeepAliveDeadline - initialNow, TimeUnit.MILLISECONDS);
代码示例来源:origin: io.vertx/vertx-proton
@Override
public void handle(Long event) {
boolean checkScheduled = false;
if (connection.getLocalState() == EndpointState.ACTIVE) {
// Using nano time since it is not related to the wall clock, which may change
long now = TimeUnit.NANOSECONDS.toMillis(System.nanoTime());
long deadline = transport.tick(now);
flush();
if (transport.isClosed()) {
LOG.info("IdleTimeoutCheck closed the transport due to the peer exceeding our requested idle-timeout.");
disconnect();
} else {
if (deadline != 0) {
// timer treats 0 as error, ensure value is at least 1 as there was a deadline
long delay = Math.max(deadline - now, 1);
checkScheduled = true;
LOG.trace("IdleTimeoutCheck rescheduling with delay: {0}", delay);
idleTimeoutCheckTimerId = vertx.setTimer(delay, this);
}
}
} else {
LOG.trace("IdleTimeoutCheck skipping check, connection is not active.");
}
if (!checkScheduled) {
idleTimeoutCheckTimerId = null;
LOG.trace("IdleTimeoutCheck exiting");
}
}
}
代码示例来源:origin: org.apache.activemq/activemq-all
if (protonTransport.isClosed()) {
LOG.debug("Ignoring incoming AMQP data, transport is closed.");
return;
代码示例来源:origin: org.apache.activemq/activemq-osgi
if (protonTransport.isClosed()) {
LOG.debug("Ignoring incoming AMQP data, transport is closed.");
return;
代码示例来源:origin: com.ibm.mqlight/mqlight-api
try {
EngineConnection engineConnection = (EngineConnection) dr.channel.getContext();
if (!engineConnection.closed && !engineConnection.transport.isClosed()) {
int bytesAvailable;
while ((bytesAvailable = dr.buffer.readableBytes()) > 0) {
内容来源于网络,如有侵权,请联系作者删除!