Skip to content

Commit

Permalink
remove unspecified option from annotation
Browse files Browse the repository at this point in the history
  • Loading branch information
efgpinto committed Dec 18, 2023
1 parent d8b2359 commit a3bfebe
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,6 @@
@Documented
public @interface Trigger {
enum TriggerEvent {
UNSPECIFIED,

/**
* The on startup hook is called every time a service instance boots up.
* This can happen for very different reasons: restarting / redeploying the service,
Expand All @@ -44,7 +42,7 @@ enum TriggerEvent {
/**
* The service life-cycle event for which this hook will be triggered.
*/
TriggerEvent on() default TriggerEvent.UNSPECIFIED;
TriggerEvent on();

/**
* The maximum number of retries we will do upon failure of the method hook calls.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -66,14 +66,10 @@ private[impl] object ActionDescriptorFactory extends ComponentDescriptorFactory
private def triggerOptions(javaMethod: Method): Option[TriggerOptions] = {
condOpt(hasTriggerMethodOptions(javaMethod)) { case true =>
val ann = javaMethod.getAnnotation(classOf[Trigger]);
val triggerEvent = ann.on() match {
case Trigger.TriggerEvent.UNSPECIFIED => TriggerOptions.TriggerEvent.UNSPECIFIED
case Trigger.TriggerEvent.STARTUP => TriggerOptions.TriggerEvent.STARTUP
}

TriggerOptions
.newBuilder()
.setOn(triggerEvent)
.setOn(TriggerOptions.TriggerEvent.STARTUP) // this is the only event available at the moment
.setMaxRetries(ann.maxRetries())
.build()
}
Expand Down

0 comments on commit a3bfebe

Please sign in to comment.