当前位置: 首页>>代码示例>>Java>>正文


Java Handler类代码示例

本文整理汇总了Java中org.apache.qpid.proton.engine.Handler的典型用法代码示例。如果您正苦于以下问题:Java Handler类的具体用法?Java Handler怎么用?Java Handler使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


Handler类属于org.apache.qpid.proton.engine包,在下文中一共展示了Handler类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: dispatch

import org.apache.qpid.proton.engine.Handler; //导入依赖的package包/类
@Override
public void dispatch(Handler handler) throws HandlerException
{
    Handler old_delegated = delegated;
    try {
        delegated = handler;
        try {
            handler.handle(this);
        } catch(HandlerException handlerException) {
            throw handlerException;
        } catch(RuntimeException runtimeException) {
            throw new HandlerException(handler, runtimeException);
        }
        delegate();
    } finally {
        delegated = old_delegated;
    }
}
 
开发者ID:apache,项目名称:qpid-proton-j,代码行数:19,代码来源:EventImpl.java

示例2: processEvents

import org.apache.qpid.proton.engine.Handler; //导入依赖的package包/类
public void processEvents() {
    while (true) {
        Event ev = collector.peek();
        if (ev == null) break;
        ev.dispatch(this);
        for (Handler h : handlers) {
            ev.dispatch(h);
        }
        collector.pop();
    }
}
 
开发者ID:apache,项目名称:qpid-proton-j,代码行数:12,代码来源:Driver.java

示例3: delegate

import org.apache.qpid.proton.engine.Handler; //导入依赖的package包/类
@Override
public void delegate() throws HandlerException
{
    if (delegated == null) {
        return; // short circuit
    }
    Iterator<Handler> children = delegated.children();
    delegated = null;
    while(children.hasNext()) {
        dispatch(children.next());
    }
}
 
开发者ID:apache,项目名称:qpid-proton-j,代码行数:13,代码来源:EventImpl.java

示例4: redispatch

import org.apache.qpid.proton.engine.Handler; //导入依赖的package包/类
@Override
public void redispatch(EventType as_type, Handler handler) throws HandlerException 
{
    if (!as_type.isValid()) {
        throw new IllegalArgumentException("Can only redispatch valid event types");
    }
    EventType old = type;
    try {
        type = as_type;
        dispatch(handler);
    }
    finally {
        type = old;
    }
}
 
开发者ID:apache,项目名称:qpid-proton-j,代码行数:16,代码来源:EventImpl.java

示例5: AcceptorImpl

import org.apache.qpid.proton.engine.Handler; //导入依赖的package包/类
protected AcceptorImpl(Reactor reactor, String host, int port, Handler handler) throws IOException {
    ServerSocketChannel ssc = ((ReactorImpl)reactor).getIO().serverSocketChannel();
    ssc.bind(new InetSocketAddress(host, port));
    sel = ((ReactorImpl)reactor).selectable(this);
    sel.setChannel(ssc);
    sel.onReadable(new AcceptorReadable());
    sel.onFree(new AcceptorFree());
    sel.setReactor(reactor);
    BaseHandler.setHandler(this, handler);
    sel.setReading(true);
    reactor.update(sel);
}
 
开发者ID:apache,项目名称:qpid-proton-j,代码行数:13,代码来源:AcceptorImpl.java

示例6: eventHandler

import org.apache.qpid.proton.engine.Handler; //导入依赖的package包/类
private Handler eventHandler(Event event) {
    Handler result;
    if (event.getLink() != null) {
        result = BaseHandler.getHandler(event.getLink());
        if (result != null) return result;
    }
    if (event.getSession() != null) {
        result = BaseHandler.getHandler(event.getSession());
        if (result != null) return result;
    }
    if (event.getConnection() != null) {
        result = BaseHandler.getHandler(event.getConnection());
        if (result != null) return result;
    }

    if (event.getTask() != null) {
        result = BaseHandler.getHandler(event.getTask());
        if (result != null) return result;
    }

    if (event.getSelectable() != null) {
        result = BaseHandler.getHandler(event.getSelectable());
        if (result != null) return result;
    }

    return handler;
}
 
开发者ID:apache,项目名称:qpid-proton-j,代码行数:28,代码来源:ReactorImpl.java

示例7: schedule

import org.apache.qpid.proton.engine.Handler; //导入依赖的package包/类
@Override
public Task schedule(int delay, Handler handler) {
    Task task = timer.schedule(now + delay);
    ((TaskImpl)task).setReactor(this);
    BaseHandler.setHandler(task, handler);
    if (selectable != null) {
        selectable.setDeadline(timer.deadline());
        update(selectable);
    }
    return task;
}
 
开发者ID:apache,项目名称:qpid-proton-j,代码行数:12,代码来源:ReactorImpl.java

示例8: handlerRun

import org.apache.qpid.proton.engine.Handler; //导入依赖的package包/类
/**
 * Tests adding a handler to a reactor and running the reactor.  The
 * expected behaviour is for the reactor to return, and a number of reactor-
 * related events to have been delivered to the handler.
 * @throws IOException
 */
@Test
public void handlerRun() throws IOException {
    Handler handler = reactor.getHandler();
    assertNotNull(handler);
    TestHandler testHandler = new TestHandler();
    handler.add(testHandler);
    reactor.run();
    reactor.free();
    testHandler.assertEvents(Type.REACTOR_INIT, Type.SELECTABLE_INIT, Type.SELECTABLE_UPDATED, Type.SELECTABLE_FINAL, Type.REACTOR_FINAL);
}
 
开发者ID:apache,项目名称:qpid-proton-j,代码行数:17,代码来源:ReactorTest.java

示例9: assertReactorRunBarfsOnHandler

import org.apache.qpid.proton.engine.Handler; //导入依赖的package包/类
private void assertReactorRunBarfsOnHandler(Reactor reactor, BarfException expectedException, Handler expectedHandler) {
    try {
        reactor.run();
        throw new AssertionFailedError("Reactor.run() should have thrown an exception");
    } catch(HandlerException handlerException) {
        assertSame("Linked exception does not match expected exception", expectedException, handlerException.getCause());
        assertSame("Handler in exception does not match expected handler", expectedHandler, handlerException.getHandler());
    }
}
 
开发者ID:apache,项目名称:qpid-proton-j,代码行数:10,代码来源:ReactorTest.java

示例10: barfInReactorFinal

import org.apache.qpid.proton.engine.Handler; //导入依赖的package包/类
@Test
public void barfInReactorFinal() throws IOException {
    BarfException expectedBarf = new BarfException();
    Handler expectedHandler = new BarfOnReactorFinal(expectedBarf);
    reactor.getGlobalHandler().add(expectedHandler);
    assertReactorRunBarfsOnHandler(reactor, expectedBarf, expectedHandler);
    reactor.free();
}
 
开发者ID:apache,项目名称:qpid-proton-j,代码行数:9,代码来源:ReactorTest.java

示例11: barfOnGlobalSet

import org.apache.qpid.proton.engine.Handler; //导入依赖的package包/类
@Test
public void barfOnGlobalSet() throws IOException {
    BarfException expectedBarf = new BarfException();
    Handler expectedHandler = new BarfOnReactorInit(expectedBarf);
    reactor.setGlobalHandler(expectedHandler);
    assertReactorRunBarfsOnHandler(reactor, expectedBarf, expectedHandler);
    reactor.free();
}
 
开发者ID:apache,项目名称:qpid-proton-j,代码行数:9,代码来源:ReactorTest.java

示例12: barfOnGlobalAdd

import org.apache.qpid.proton.engine.Handler; //导入依赖的package包/类
@Test
public void barfOnGlobalAdd() throws IOException {
    BarfException expectedBarf = new BarfException();
    Handler expectedHandler = new BarfOnReactorInit(expectedBarf);
    reactor.getGlobalHandler().add(expectedHandler);
    assertReactorRunBarfsOnHandler(reactor, expectedBarf, expectedHandler);
    reactor.free();
}
 
开发者ID:apache,项目名称:qpid-proton-j,代码行数:9,代码来源:ReactorTest.java

示例13: barfOnReactorSet

import org.apache.qpid.proton.engine.Handler; //导入依赖的package包/类
@Test
public void barfOnReactorSet() throws IOException {
    BarfException expectedBarf = new BarfException();
    Handler expectedHandler = new BarfOnReactorInit(expectedBarf);
    reactor.setHandler(expectedHandler);
    assertReactorRunBarfsOnHandler(reactor, expectedBarf, expectedHandler);
    reactor.free();
}
 
开发者ID:apache,项目名称:qpid-proton-j,代码行数:9,代码来源:ReactorTest.java

示例14: barfOnReactorAdd

import org.apache.qpid.proton.engine.Handler; //导入依赖的package包/类
@Test
public void barfOnReactorAdd() throws IOException {
    BarfException expectedBarf = new BarfException();
    Handler expectedHandler = new BarfOnReactorInit(expectedBarf);
    reactor.getHandler().add(expectedHandler);
    assertReactorRunBarfsOnHandler(reactor, expectedBarf, expectedHandler);
    reactor.free();
}
 
开发者ID:apache,项目名称:qpid-proton-j,代码行数:9,代码来源:ReactorTest.java

示例15: barfOnConnection

import org.apache.qpid.proton.engine.Handler; //导入依赖的package包/类
@Test
public void barfOnConnection() throws IOException {
    BarfException expectedBarf = new BarfException();
    Handler expectedHandler = new BarfOnConnectionInit(expectedBarf);
    reactor.connection(expectedHandler);
    assertReactorRunBarfsOnHandler(reactor, expectedBarf, expectedHandler);
    reactor.free();
}
 
开发者ID:apache,项目名称:qpid-proton-j,代码行数:9,代码来源:ReactorTest.java


注:本文中的org.apache.qpid.proton.engine.Handler类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。