Tabnine Logo
EventManager.register
Code IndexAdd Tabnine to your IDE (free)

How to use
register
method
in
org.apache.servicecomb.foundation.common.event.EventManager

Best Java code snippets using org.apache.servicecomb.foundation.common.event.EventManager.register (Showing top 4 results out of 315)

origin: apache/servicecomb-java-chassis

public MemberDiscovery(List<String> configCenterUri) {
 if (configCenterUri != null && !configCenterUri.isEmpty()) {
  configServerAddresses.addAll(configCenterUri);
 }
 Collections.shuffle(configServerAddresses);
 EventManager.register(this);
}
origin: apache/servicecomb-java-chassis

/**
 * <p>As the process of instance registry is asynchronous, the {@code AFTER_REGISTRY}
 * event should not be sent immediately after {@link RegistryUtils#run()} is invoked.
 * When the instance registry succeeds, {@link MicroserviceInstanceRegisterTask} will be posted in {@link EventManager},
 * register a subscriber to watch this event and send {@code AFTER_REGISTRY}.</p>
 *
 * <p>This method should be called before {@link RegistryUtils#run()} to avoid that the registry process is too quick
 * that the event is not watched by this subscriber.</p>
 *
 * <p>Check if {@code InstanceId} is null to judge whether the instance registry has succeeded.</p>
 */
private void triggerAfterRegistryEvent() {
 EventManager.register(new Object() {
  @Subscribe
  public void afterRegistryInstance(MicroserviceInstanceRegisterTask microserviceInstanceRegisterTask) {
   LOGGER.info("receive MicroserviceInstanceRegisterTask event, check instance Id...");
   if (!StringUtils.isEmpty(RegistryUtils.getMicroserviceInstance().getInstanceId())) {
    LOGGER.info("instance registry succeeds for the first time, will send AFTER_REGISTRY event.");
    status = SCBStatus.UP;
    triggerEvent(EventType.AFTER_REGISTRY);
    EventManager.unregister(this);
    LOGGER.info("ServiceComb is ready.");
   }
  }
 });
}
origin: org.apache.servicecomb/config-cc

public MemberDiscovery(List<String> configCenterUri) {
 if (configCenterUri != null && !configCenterUri.isEmpty()) {
  configServerAddresses.addAll(configCenterUri);
 }
 Collections.shuffle(configServerAddresses);
 EventManager.register(this);
}
origin: org.apache.servicecomb/java-chassis-core

/**
 * <p>As the process of instance registry is asynchronous, the {@code AFTER_REGISTRY}
 * event should not be sent immediately after {@link RegistryUtils#run()} is invoked.
 * When the instance registry succeeds, {@link MicroserviceInstanceRegisterTask} will be posted in {@link EventManager},
 * register a subscriber to watch this event and send {@code AFTER_REGISTRY}.</p>
 *
 * <p>This method should be called before {@link RegistryUtils#run()} to avoid that the registry process is too quick
 * that the event is not watched by this subscriber.</p>
 *
 * <p>Check if {@code InstanceId} is null to judge whether the instance registry has succeeded.</p>
 */
private void triggerAfterRegistryEvent() {
 EventManager.register(new Object() {
  @Subscribe
  public void afterRegistryInstance(MicroserviceInstanceRegisterTask microserviceInstanceRegisterTask) {
   LOGGER.info("receive MicroserviceInstanceRegisterTask event, check instance Id...");
   if (!StringUtils.isEmpty(RegistryUtils.getMicroserviceInstance().getInstanceId())) {
    LOGGER.info("instance registry succeeds for the first time, will send AFTER_REGISTRY event.");
    status = SCBStatus.UP;
    triggerEvent(EventType.AFTER_REGISTRY);
    EventManager.unregister(this);
    LOGGER.info("ServiceComb is ready.");
   }
  }
 });
}
org.apache.servicecomb.foundation.common.eventEventManagerregister

Javadoc

Registering listener.

Popular methods of EventManager

  • post
    post event.
  • getEventBus
  • unregister
    Unregistering listener.

Popular in Java

  • Making http post requests using okhttp
  • requestLocationUpdates (LocationManager)
  • notifyDataSetChanged (ArrayAdapter)
  • getSharedPreferences (Context)
  • MalformedURLException (java.net)
    This exception is thrown when a program attempts to create an URL from an incorrect specification.
  • NoSuchElementException (java.util)
    Thrown when trying to retrieve an element past the end of an Enumeration or Iterator.
  • TreeMap (java.util)
    Walk the nodes of the tree left-to-right or right-to-left. Note that in descending iterations, next
  • AtomicInteger (java.util.concurrent.atomic)
    An int value that may be updated atomically. See the java.util.concurrent.atomic package specificati
  • Annotation (javassist.bytecode.annotation)
    The annotation structure.An instance of this class is returned bygetAnnotations() in AnnotationsAttr
  • LogFactory (org.apache.commons.logging)
    Factory for creating Log instances, with discovery and configuration features similar to that employ
  • CodeWhisperer alternatives
Tabnine Logo
  • Products

    Search for Java codeSearch for JavaScript code
  • IDE Plugins

    IntelliJ IDEAWebStormVisual StudioAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimGoLandRubyMineEmacsJupyter NotebookJupyter LabRiderDataGripAppCode
  • Company

    About UsContact UsCareers
  • Resources

    FAQBlogTabnine AcademyTerms of usePrivacy policyJava Code IndexJavascript Code Index
Get Tabnine for your IDE now