本文整理汇总了Java中org.apache.activemq.transport.TransportDisposedIOException类的典型用法代码示例。如果您正苦于以下问题:Java TransportDisposedIOException类的具体用法?Java TransportDisposedIOException怎么用?Java TransportDisposedIOException使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
TransportDisposedIOException类属于org.apache.activemq.transport包,在下文中一共展示了TransportDisposedIOException类的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: getMessageQueue
import org.apache.activemq.transport.TransportDisposedIOException; //导入依赖的package包/类
public LinkedBlockingQueue<Object> getMessageQueue() throws TransportDisposedIOException {
LinkedBlockingQueue<Object> result = messageQueue;
if (result == null) {
synchronized (this) {
result = messageQueue;
if (result == null) {
if (disposed.get()) {
throw new TransportDisposedIOException("The Transport has been disposed");
}
messageQueue = result = new LinkedBlockingQueue<Object>(this.asyncQueueDepth);
}
}
}
return result;
}
示例2: oneway
import org.apache.activemq.transport.TransportDisposedIOException; //导入依赖的package包/类
public void oneway(Object command) throws IOException {
if (disposed.get()) {
throw new TransportDisposedIOException("Transport disposed.");
}
if (peer == null) {
throw new IOException("Peer not connected.");
}
try {
if (peer.disposed.get()) {
throw new TransportDisposedIOException("Peer (" + peer.toString() + ") disposed.");
}
if (peer.async || !peer.started.get()) {
peer.getMessageQueue().put(command);
peer.wakeup();
return;
}
} catch (InterruptedException e) {
InterruptedIOException iioe = new InterruptedIOException(e.getMessage());
iioe.initCause(e);
throw iioe;
}
dispatch(peer, peer.messageQueue, command);
}
示例3: doDispatch
import org.apache.activemq.transport.TransportDisposedIOException; //导入依赖的package包/类
public void doDispatch(VMTransport transport, TransportListener transportListener, Object command) {
if (command == DISCONNECT) {
transportListener.onException(new TransportDisposedIOException("Peer (" + peer.toString() + ") disposed."));
} else {
transport.receiveCounter++;
transportListener.onCommand(command);
}
}
示例4: iterate
import org.apache.activemq.transport.TransportDisposedIOException; //导入依赖的package包/类
/**
* @see org.apache.activemq.thread.Task#iterate()
*/
public boolean iterate() {
final TransportListener tl = transportListener;
LinkedBlockingQueue<Object> mq;
try {
mq = getMessageQueue();
} catch (TransportDisposedIOException e) {
return false;
}
Object command = mq.poll();
if (command != null && !disposed.get()) {
if( command == DISCONNECT ) {
tl.onException(new TransportDisposedIOException("Peer (" + peer.toString() + ") disposed."));
} else {
tl.onCommand(command);
}
return !mq.isEmpty() && !disposed.get();
} else {
if(disposed.get()) {
mq.clear();
}
return false;
}
}