fix: getState now mandatory on EventProvider (#531)
* fix: getState mandatory on EventProvider Signed-off-by: Todd Baert <todd.baert@dynatrace.com> * fixup: update test class Signed-off-by: Todd Baert <todd.baert@dynatrace.com> * Update src/test/java/dev/openfeature/sdk/EventProviderTest.java Co-authored-by: Giovanni Liva <giovanni.liva@dynatrace.com> Signed-off-by: Todd Baert <todd.baert@dynatrace.com> --------- Signed-off-by: Todd Baert <todd.baert@dynatrace.com> Co-authored-by: Giovanni Liva <giovanni.liva@dynatrace.com>
This commit is contained in:
parent
8789f90d33
commit
37fd2be673
|
|
@ -16,6 +16,12 @@ import dev.openfeature.sdk.internal.TriConsumer;
|
||||||
*/
|
*/
|
||||||
public abstract class EventProvider implements FeatureProvider {
|
public abstract class EventProvider implements FeatureProvider {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* {@inheritDoc}
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public abstract ProviderState getState();
|
||||||
|
|
||||||
private TriConsumer<EventProvider, ProviderEvent, ProviderEventDetails> onEmit = null;
|
private TriConsumer<EventProvider, ProviderEvent, ProviderEventDetails> onEmit = null;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
||||||
|
|
@ -31,7 +31,7 @@ public interface FeatureProvider {
|
||||||
* if they have special initialization needed prior being called for flag
|
* if they have special initialization needed prior being called for flag
|
||||||
* evaluation.
|
* evaluation.
|
||||||
* <p>
|
* <p>
|
||||||
* It is ok, if the method is expensive as it is executed in the background. All
|
* It is ok if the method is expensive as it is executed in the background. All
|
||||||
* runtime exceptions will be
|
* runtime exceptions will be
|
||||||
* caught and logged.
|
* caught and logged.
|
||||||
* </p>
|
* </p>
|
||||||
|
|
@ -46,7 +46,7 @@ public interface FeatureProvider {
|
||||||
* Providers can overwrite this method, if they have special shutdown actions
|
* Providers can overwrite this method, if they have special shutdown actions
|
||||||
* needed.
|
* needed.
|
||||||
* <p>
|
* <p>
|
||||||
* It is ok, if the method is expensive as it is executed in the background. All
|
* It is ok if the method is expensive as it is executed in the background. All
|
||||||
* runtime exceptions will be
|
* runtime exceptions will be
|
||||||
* caught and logged.
|
* caught and logged.
|
||||||
* </p>
|
* </p>
|
||||||
|
|
@ -57,7 +57,11 @@ public interface FeatureProvider {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns a representation of the current readiness of the provider.
|
* Returns a representation of the current readiness of the provider.
|
||||||
* Providers which do not implement this method are assumed to be ready immediately.
|
* If the provider needs to be initialized, it should return {@link ProviderState#NOT_READY}.
|
||||||
|
* If the provider is in an error state, it should return {@link ProviderState#ERROR}.
|
||||||
|
* If the provider is functioning normally, it should return {@link ProviderState#READY}.
|
||||||
|
*
|
||||||
|
* <p><i>Providers which do not implement this method are assumed to be ready immediately.</i></p>
|
||||||
*
|
*
|
||||||
* @return ProviderState
|
* @return ProviderState
|
||||||
*/
|
*/
|
||||||
|
|
|
||||||
|
|
@ -121,6 +121,11 @@ class EventProviderTest {
|
||||||
// TODO Auto-generated method stub
|
// TODO Auto-generated method stub
|
||||||
throw new UnsupportedOperationException("Unimplemented method 'getObjectEvaluation'");
|
throw new UnsupportedOperationException("Unimplemented method 'getObjectEvaluation'");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public ProviderState getState() {
|
||||||
|
return ProviderState.READY;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@SuppressWarnings("unchecked")
|
@SuppressWarnings("unchecked")
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue