Guava AsyncEventBus - top ranked examples from Open Source projects

These code examples were ranked by Codota’s semantic indexing as the best open source examples for Guava AsyncEventBus class.

This code example shows how to use the following methods:
        } else { 
            ThreadPoolExecutor executor = new ThreadPoolExecutor(1, 1,
                    0L, TimeUnit.MILLISECONDS,
                    new LinkedBlockingQueue<Runnable>());
            asyncExecutorList.add(executor);
            return new AsyncEventBus(executor);
        } 
    } 
 
    /** 
     * Getter of eventBus. 
     * 
     * @return eventBus 
     */ 
    public EventBus getEventBus() {
        return eventBus;
    } 
 
    /** 
     * Getter of asyncEventBus. 
5
CodeRank
Experience pair programming with AI  Get Codota for Java
This code example shows how to use the following methods:
	@Bean 
	public EventBus eventBus() {
		// EventBus eventBus = new EventBus(); 
		// return eventBus; 
 
		AsyncEventBus asyncEventBus = new AsyncEventBus(Executors.newFixedThreadPool(10));
		return asyncEventBus;
	} 
 
} 
4
CodeRank
Experience pair programming with AI  Get Codota for Java
This code example shows how to use the following methods:post, register
 
    @Override 
    public void close() throws IOException
    { 
        if (!finished.getAndSet(true)) {
            eventBus.register(this);
 
            final PoisonPill pill = pillHolder.getAndSet(null);
            if (pill != null) {
                eventBus.post(pill);
                try { 
                    pill.awaitTermination(1, TimeUnit.DAYS);
 
                    // The poison pill made it through the event bus, so 
                    // all events that were present before are either delivered 
                    // or in flight. Shut down the executor now. 
                    executor.shutdown();
                    executor.awaitTermination(1, TimeUnit.SECONDS);
                } 
                catch (final InterruptedException e) {
4
CodeRank
Experience pair programming with AI  Get Codota for Java
This code example shows how to use the following methods:
    private EventBus eventBus;
    private AsyncEventBus asyncEventBus;
 
    private EventInst() { 
        eventBus=new EventBus();
        asyncEventBus = new AsyncEventBus(Executors.newFixedThreadPool(20));
    } 
 
    public static EventInst getInstance() { 
 
        return eventInst;
    } 
 
    /** 
     * @return the eventBus 
     */ 
    public EventBus getEventBus() {
        return eventBus;
    } 
     /** 
4
CodeRank
Experience pair programming with AI  Get Codota for Java
This code example shows how to use the following methods:
    ThreadPoolExecutor executor = new ThreadPoolExecutor(2, 2, 0L,
        TimeUnit.MILLISECONDS, new LinkedBlockingQueue<Runnable>(),
        new AlertEventBusThreadFactory(), 
        new ThreadPoolExecutor.CallerRunsPolicy());
 
    m_eventBus = new AsyncEventBus(executor);
  } 
 
  /** 
   * Publishes the specified event to all registered listeners that 
   * {@link Subscribe} to any of the {@link AlertEvent} instances. 
   * 
   * @param event 
   */ 
  public void publish(AlertEvent event) {
    m_eventBus.post(event);
  } 
 
  /** 
   * Register a listener to receive events. The listener should use the 
3
CodeRank
Experience pair programming with AI  Get Codota for Java
This code example shows how to use the following methods:register
 * @author THiNk 
 */ 
public class TestGenericSubscribe { 
 
    public TestGenericSubscribe(AsyncEventBus asyncEventBus) {
        asyncEventBus.register(this);
    } 
 
    @Subscribe 
    @AllowConcurrentEvents 
    public void handleEventConcurrent(CountDownLatch signal) {
        try { 
            Date date = new Date(System.currentTimeMillis());
            TestTable test = new TestTable();
            test.setCount(signal.getCount());
            test.setCreateDate(date);
            test.setId(UUID.randomUUID().toString());
            test.setName("创建测试=" + UUID.randomUUID().toString());
            
            TestTableWriter ttw = new TestTableWriter();
4
CodeRank
Experience pair programming with AI  Get Codota for Java
This code example shows how to use the following methods:register
public class LongProcessSubscriber { 
 
    private CountDownLatch doneSignal;
 
    public LongProcessSubscriber(AsyncEventBus asyncEventBus, CountDownLatch doneSignal) {
        asyncEventBus.register(this);
        this.doneSignal = doneSignal;
    } 
 
    @Subscribe 
    @AllowConcurrentEvents 
    public void handleEventConcurrent(CreditPurchaseEvent event) {
        pause(300l); 
        doneSignal.countDown();
    } 
 
    @Subscribe 
    public void handleEventNonConcurrent(CashPurchaseEvent event) {
        pause(300l); 
        doneSignal.countDown();
4
CodeRank
Experience pair programming with AI  Get Codota for Java