本文整理了Java中org.fusesource.hawtdispatch.Dispatch.getCurrentQueue()
方法的一些代码示例,展示了Dispatch.getCurrentQueue()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Dispatch.getCurrentQueue()
方法的具体详情如下:
包路径:org.fusesource.hawtdispatch.Dispatch
类名称:Dispatch
方法名:getCurrentQueue
[英]Returns the queue on which the currently executing runnable is running.
When #getCurrentQueue() is called outside of the context of a submitted runnable, it will return null.
[中]返回当前正在执行的runnable正在其上运行的队列。
在提交的runnable的上下文之外调用#getCurrentQueue()时,它将返回null。
代码示例来源:origin: org.apache.qpid/proton-hawtdispatch
static protected void assertNotOnDispatchQueue() {
assert Dispatch.getCurrentQueue()==null : "Not allowed to be called when executing on a dispatch queue";
}
代码示例来源:origin: org.apache.aries.rsa.provider/org.apache.aries.rsa.provider.fastbin
@Override
protected ResponseFuture createResponse(SerializationStrategy serializationStrategy, ClassLoader loader, Method method, Object[] args) throws Exception {
return new AsyncResponseFuture(loader, method, serializationStrategy, Dispatch.getCurrentQueue());
}
代码示例来源:origin: org.apache.aries.rsa.provider/org.apache.aries.rsa.provider.fastbin
@Override
protected ResponseFuture createResponse(SerializationStrategy serializationStrategy, ClassLoader loader, Method method, Object[] args) throws Exception {
return new AsyncResponseFuture(loader, method, (AsyncCallback) args[args.length-1], serializationStrategy, Dispatch.getCurrentQueue());
}
代码示例来源:origin: org.apache.aries.rsa.provider/org.apache.aries.rsa.provider.fastbin
@Override
protected ResponseFuture createResponse(SerializationStrategy serializationStrategy, ClassLoader loader, Method method, Object[] args) throws Exception {
return new AsyncResponseFuture(loader, method, serializationStrategy, Dispatch.getCurrentQueue());
}
代码示例来源:origin: org.apache.qpid/proton-hawtdispatch
protected void fireWatches() {
if( !this.watches.isEmpty() ) {
Dispatch.getCurrentQueue().execute(new Task(){
@Override
public void run() {
// Lets see if any of the watches are triggered.
LinkedList<Watch> tmp = watches;
watches = new LinkedList<Watch>();
for (Watch task : tmp) {
if( !task.execute() ) {
watches.add(task);
}
}
}
});
}
}
代码示例来源:origin: jboss-fuse/fabric8
public ResponseFuture request(SerializationStrategy serializationStrategy, ClassLoader loader, Method method, Object[] args, DataByteArrayOutputStream target) throws Exception {
assert Dispatch.getCurrentQueue() == null : "You should not do blocking RPC class when executing on a dispatch queue";
serializationStrategy.encodeRequest(loader, method.getParameterTypes(), args, target);
return new BlockingResponseFuture(loader, method, serializationStrategy);
}
代码示例来源:origin: jboss-fuse/fabric8
public ResponseFuture request(SerializationStrategy serializationStrategy, ClassLoader loader, Method method, Object[] args, DataByteArrayOutputStream target) throws Exception {
if(!isAsyncMethod(method)) {
throw new IllegalArgumentException("Invalid async method declaration: last argument is not a RequestCallback");
}
Class[] new_types = payloadTypes(method);
Object[] new_args = new Object[args.length-1];
System.arraycopy(args, 0, new_args, 0, new_args.length);
serializationStrategy.encodeRequest(loader, new_types, new_args, target);
return new AsyncResponseFuture(loader, method, (AsyncCallback) args[args.length-1], serializationStrategy, Dispatch.getCurrentQueue());
}
代码示例来源:origin: fusesource/hawtdispatch
public void execute(Runnable task) {
if (getCurrentQueue() == null) {
queue.execute(new TaskWrapper(task));
} else {
source.merge(task);
}
}
代码示例来源:origin: jboss-fuse/fabric8
public boolean offer(Object command) {
assert Dispatch.getCurrentQueue() == dispatchQueue;
try {
if (!socketState.is(CONNECTED.class)) {
throw new IOException("Not connected.");
}
if (getServiceState() != STARTED) {
throw new IOException("Not running.");
}
ProtocolCodec.BufferState rc = codec.write(command);
switch (rc ) {
case FULL:
return false;
default:
if( drained ) {
drained = false;
resumeWrite();
}
return true;
}
} catch (IOException e) {
onTransportFailure(e);
return false;
}
}
代码示例来源:origin: org.apache.aries.rsa.provider/org.apache.aries.rsa.provider.fastbin
public boolean offer(Object command) {
assert Dispatch.getCurrentQueue() == dispatchQueue;
try {
if (!socketState.isConnected()) {
throw new IOException("Not connected.");
}
if (!getServiceState().isStarted()) {
throw new IOException("Not running.");
}
ProtocolCodec.BufferState rc = codec.write(command);
switch (rc ) {
case FULL:
return false;
default:
if( drained ) {
drained = false;
resumeWrite();
}
return true;
}
} catch (IOException e) {
onTransportFailure(e);
return false;
}
}
代码示例来源:origin: org.apache.activemq/apollo-mqtt
@Override
public void destroy(final Task cb) {
StoreUOW uow = store.create_uow();
uow.put(session_key, null);
final DispatchQueue current = Dispatch.getCurrentQueue();
uow.on_complete(Scala2Java.toScala(new UnitFn0() {
@Override
public void call() {
current.execute(new Task() {
@Override
public void run() {
strategy = new NoopStrategy();
cb.run();
}
});
}
}));
uow.release();
}
代码示例来源:origin: jboss-fuse/fabric8
/**
*
*/
protected void drainOutbound() {
assert Dispatch.getCurrentQueue() == dispatchQueue;
if (getServiceState() != STARTED || !socketState.is(CONNECTED.class)) {
return;
}
try {
if( codec.flush() == ProtocolCodec.BufferState.WAS_EMPTY && flush() ) {
if( !drained ) {
drained = true;
suspendWrite();
listener.onRefill(this);
}
}
} catch (IOException e) {
onTransportFailure(e);
}
}
代码示例来源:origin: org.apache.aries.rsa.provider/org.apache.aries.rsa.provider.fastbin
/**
*
*/
protected void drainOutbound() {
assert Dispatch.getCurrentQueue() == dispatchQueue;
if (!getServiceState().isStarted() || !socketState.isConnected()) {
return;
}
try {
if( codec.flush() == ProtocolCodec.BufferState.WAS_EMPTY && flush() ) {
if( !drained ) {
drained = true;
suspendWrite();
listener.onRefill(this);
}
}
} catch (IOException e) {
onTransportFailure(e);
}
}
代码示例来源:origin: org.apache.activemq/apollo-mqtt
final DispatchQueue current = Dispatch.getCurrentQueue();
uow.on_complete(Scala2Java.toScala(new UnitFn0() {
@Override
内容来源于网络,如有侵权,请联系作者删除!