private void postOnDefaultChannel(String postingThread) { NYBus.get().post(new ComputationThreadEvent(postingThread)); NYBus.get().post(new ExecutorThreadEvent(postingThread)); NYBus.get().post(new IOThreadEvent(postingThread)); NYBus.get().post(new MainThreadEvent(postingThread)); NYBus.get().post(new NewThreadEvent(postingThread)); NYBus.get().post(new PostingThreadEvent(postingThread)); NYBus.get().post(new TrampolineThreadEvent(postingThread)); }
@Override protected void onStop() { super.onStop(); NYBus.get().unregister(this, Channel.DEFAULT, CHANNEL_ONE, CHANNEL_TWO); }
@Before public void before() throws Exception { bus = NYBus.get(); bus.setLogger(logger); bus.enableLogging(); }
/** * Unregister from the event. * * @param object the context object. * @param channelIDs channel ids. */ @Override public void unregister(Object object, String... channelIDs) { unregister(object, ListUtils.convertVarargsToList(channelIDs)); }
/** * Register for event. * * @param object the context object. * @param channelIDs channel ids. */ @Override public void register(Object object, String... channelIDs) { register(object, ListUtils.convertVarargsToList(channelIDs)); }
/** * Post the event. * * @param object the event. */ @Override public void post(Object object) { post(object, Channel.DEFAULT); }
public static NYBus get() { if (sNYBusInstance == null) { synchronized (NYBus.class) { if (sNYBusInstance == null) { sNYBusInstance = new NYBus(); } } } return sNYBusInstance; }
@Before public void before() throws Exception { bus = NYBus.get(); bus.setSchedulerProvider(new TestSchedulerProvider()); bus.setLogger(logger); bus.enableLogging(); }
/** * Unregister from the event. * * @param object the context object. * @param channelIDs channel ids. */ @Override public void unregister(Object object, String... channelIDs) { unregister(object, ListUtils.convertVarargsToList(channelIDs)); }
/** * Register for the event. * * @param object the context object. * @param channelIDs channel ids. */ @Override public void register(Object object, String... channelIDs) { register(object, ListUtils.convertVarargsToList(channelIDs)); }
/** * Post the event. * * @param object the event. */ @Override public void post(Object object) { post(object, Channel.DEFAULT); }
public static NYBus get() { if (sNYBusInstance == null) { synchronized (NYBus.class) { if (sNYBusInstance == null) { sNYBusInstance = new NYBus(); } } } return sNYBusInstance; }
private void createEventsFromMainThread() { NYBus.get().post(new ComputationThreadEvent(POSTING_THREAD_MAIN)); NYBus.get().post(new ExecutorThreadEvent(POSTING_THREAD_MAIN)); NYBus.get().post(new IOThreadEvent(POSTING_THREAD_MAIN)); NYBus.get().post(new MainThreadEvent(POSTING_THREAD_MAIN)); NYBus.get().post(new NewThreadEvent(POSTING_THREAD_MAIN)); NYBus.get().post(new PostingThreadEvent(POSTING_THREAD_MAIN)); NYBus.get().post(new TrampolineThreadEvent(POSTING_THREAD_MAIN)); }
@Override protected void onStop() { super.onStop(); NYBus.get().unregister(this); }
@Before public void before() throws Exception { bus = NYBus.get(); bus.setSchedulerProvider(new TestSchedulerProvider()); bus.setLogger(logger); bus.enableLogging(); }
private void postOnGivenChannel(String postingThread, String channel) { NYBus.get().post(new ComputationThreadEvent(postingThread), channel); NYBus.get().post(new ExecutorThreadEvent(postingThread), channel); NYBus.get().post(new IOThreadEvent(postingThread), channel); NYBus.get().post(new MainThreadEvent(postingThread), channel); NYBus.get().post(new NewThreadEvent(postingThread), channel); NYBus.get().post(new PostingThreadEvent(postingThread), channel); NYBus.get().post(new TrampolineThreadEvent(postingThread), channel); }
@Override public void run() { try { Thread.sleep(1000); // delay for posting event after 1 sec } catch (InterruptedException e) { e.printStackTrace(); } NYBus.get().post(new ComputationThreadEvent(POSTING_THREAD_BACKGROUND)); NYBus.get().post(new ExecutorThreadEvent(POSTING_THREAD_BACKGROUND)); NYBus.get().post(new IOThreadEvent(POSTING_THREAD_BACKGROUND)); NYBus.get().post(new MainThreadEvent(POSTING_THREAD_BACKGROUND)); NYBus.get().post(new NewThreadEvent(POSTING_THREAD_BACKGROUND)); NYBus.get().post(new PostingThreadEvent(POSTING_THREAD_BACKGROUND)); NYBus.get().post(new TrampolineThreadEvent(POSTING_THREAD_BACKGROUND)); } });