/** * Called when a leadership change event occurs. * * @param oldLeadership the old leadership * @param newLeadership the new leadership */ @Event void onLeadershipChange(Leadership<byte[]> oldLeadership, Leadership<byte[]> newLeadership);
/** * Recursively finds events defined by the given type and its implemented interfaces. * * @param type the type for which to find events * @return the events defined by the given type and its parent interfaces */ private static Map<Method, EventType> findMethods(Class<?> type) { Map<Method, EventType> events = new HashMap<>(); for (Method method : type.getDeclaredMethods()) { Event event = method.getAnnotation(Event.class); if (event != null) { String name = event.value().equals("") ? method.getName() : event.value(); events.put(method, EventType.from(name)); } } for (Class<?> iface : type.getInterfaces()) { events.putAll(findMethods(iface)); } return events; }
/** * Recursively finds events defined by the given type and its implemented interfaces. * * @param type the type for which to find events * @return the events defined by the given type and its parent interfaces */ private static Map<EventType, Method> findEvents(Class<?> type) { Map<EventType, Method> events = new HashMap<>(); for (Method method : type.getDeclaredMethods()) { Event event = method.getAnnotation(Event.class); if (event != null) { String name = event.value().equals("") ? method.getName() : event.value(); events.put(EventType.from(name), method); } } for (Class<?> iface : type.getInterfaces()) { events.putAll(findEvents(iface)); } return events; }
/** * Notifies the client that a task is available. */ @Event void taskAvailable();
/** * Releases the client from waiting. * * @param id the barrier instance identifier * @param index the index at which the client entered the barrier */ @Event void release(long id, int index);
/** * Notifies this client to run the barrier action. */ @Event void runAction();
/** * Called when an event is received by the client. * * @param event the collection event */ @Event void onEvent(CollectionEvent<E> event);
/** * Called when a leadership change occurs. * * @param topic the topic for which the leadership change occurred * @param oldLeadership the old leadership * @param newLeadership the new leadership */ @Event void onLeadershipChange(String topic, Leadership<byte[]> oldLeadership, Leadership<byte[]> newLeadership);
/** * Notifies the client of a change event. * * @param newValue the updated value * @param oldValue the previous value */ @Event void change(byte[] newValue, byte[] oldValue);
/** * Called when a map change event occurs. * * @param event the change event */ @Event("change") void change(AtomicMapEvent<K, byte[]> event);
/** * Called when a lock attempt has failed. * * @param id the lock identifier */ @Event("failed") void failed(int id);
/** * Handles a change event. * * @param key the key that changed * @param oldValue the old value * @param newValue the new value */ @Event("change") void onChange(String key, byte[] oldValue, byte[] newValue);
/** * Handles a document tree event. * * @param event the document tree event */ @Event void change(DocumentTreeEvent<byte[]> event);
/** * Notifies the client that the barrier is broken. * * @param id the barrier instance identifier */ @Event void broken(long id);
/** * Called when the client has acquired a lock. * * @param id the lock identifier * @param version the lock version */ @Event("locked") void locked(int id, long version);
@Event("succeeded") void succeeded(long id, long version, int permits);
@Event("failed") void failed(long id);
/** * Called when a lock attempt has failed. * * @param id the lock identifier */ @Event("failed") void failed(int id);
/** * Called when a leadership change occurs. * * @param topic the topic for which the leadership change occurred * @param oldLeadership the old leadership * @param newLeadership the new leadership */ @Event void onLeadershipChange(String topic, Leadership<byte[]> oldLeadership, Leadership<byte[]> newLeadership);
/** * Called when a leadership change event occurs. * * @param oldLeadership the old leadership * @param newLeadership the new leadership */ @Event void onLeadershipChange(Leadership<byte[]> oldLeadership, Leadership<byte[]> newLeadership);