private void configure(String broadcasterLifeCyclePolicy) {

    int maxIdleTime = 5 * 60 * 1000;
    String idleTime =
        config.getInitParameter(ApplicationConfig.BROADCASTER_LIFECYCLE_POLICY_IDLETIME);
    if (idleTime != null) {
      maxIdleTime = Integer.parseInt(idleTime);
    }

    if (EMPTY.name().equalsIgnoreCase(broadcasterLifeCyclePolicy)) {
      policy = new BroadcasterLifeCyclePolicy.Builder().policy(EMPTY).build();
    } else if (EMPTY_DESTROY.name().equalsIgnoreCase(broadcasterLifeCyclePolicy)) {
      policy = new BroadcasterLifeCyclePolicy.Builder().policy(EMPTY_DESTROY).build();
    } else if (IDLE.name().equalsIgnoreCase(broadcasterLifeCyclePolicy)) {
      policy =
          new BroadcasterLifeCyclePolicy.Builder().policy(IDLE).idleTimeInMS(maxIdleTime).build();
    } else if (IDLE_DESTROY.name().equalsIgnoreCase(broadcasterLifeCyclePolicy)) {
      policy =
          new BroadcasterLifeCyclePolicy.Builder()
              .policy(IDLE_DESTROY)
              .idleTimeInMS(maxIdleTime)
              .build();
    } else if (IDLE_RESUME.name().equalsIgnoreCase(broadcasterLifeCyclePolicy)) {
      policy =
          new BroadcasterLifeCyclePolicy.Builder()
              .policy(IDLE_RESUME)
              .idleTimeInMS(maxIdleTime)
              .build();
    } else if (NEVER.name().equalsIgnoreCase(broadcasterLifeCyclePolicy)) {
      policy = new BroadcasterLifeCyclePolicy.Builder().policy(NEVER).build();
    } else {
      logger.warn("Unsupported BroadcasterLifeCyclePolicy policy {}", broadcasterLifeCyclePolicy);
    }
  }
Exemplo n.º 2
0
 public static FieldEditor createFieldEditor(
     String preferenceName, String labelText, Composite parent) {
   return new RadioGroupFieldEditor(
       preferenceName,
       labelText,
       3, //
       new String[][] {
         {Messages.WhenKind_0, ALWAYS.name()},
         {Messages.WhenKind_1, NEVER.name()},
         {Messages.WhenKind_2, PROMPT.name()}
       }, //
       parent);
 }