本文整理匯總了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;
}
}