All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.netflix.governator.annotations.binding.UpStatus Maven / Gradle / Ivy

There is a newer version: 1.17.5
Show newest version
package com.netflix.governator.annotations.binding;

import java.lang.annotation.ElementType;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.lang.annotation.Target;

import javax.inject.Qualifier;

/**
 * A generic binding annotation that can be associated with the up status
 * of an application.
 *
 * 
 *  bind(Boolean.class).annotatedWith(UpStatus.class).toInstance(new AtomicBoolean(true));
 *  bind(new TypeLiteral() {}>).annotatedWith(UpStatus.class).toInstance(new SomeSupplierThatTellsYouTheUpStatus());
 *
 *  public class Foo() {
 *     @Inject
 *     public Foo(@UpStatus Supplier isUp) {
 *        System.out.println("Application isUp: " + isUp);
 *     }
 *  }
 * 
* * If you're using RxJava you can set up an Observable of up status *
 *  bind(new TypeLiteral>() {}>).annotatedWith(UpStatus.class).toInstance(new SomethingThatEmitsChangesInUpStatus());
 *
 *  public class Foo() {
 *     @Inject
 *     public Foo(@UpStatus Observable upStatus) {
 *         upStatus.subscribe(new Action1() {
 *             public void call(Boolean status) {
 *                 System.out.println("Status is now up");
 *             }
 *         });
 *     }
 *  }
 *
 * @see DownStatus
 * 
*/ @Qualifier @Target({ElementType.FIELD, ElementType.PARAMETER, ElementType.METHOD}) @Retention(RetentionPolicy.RUNTIME) public @interface UpStatus { }




© 2015 - 2025 Weber Informatics LLC | Privacy Policy