Example #1
0
  public static JBossWebMetaData createWebMetaData(
      ReplicationGranularity granularity,
      ReplicationTrigger trigger,
      int maxSessions,
      boolean passivation,
      int maxIdle,
      int minIdle,
      boolean batchMode,
      int maxUnreplicated) {
    JBossWebMetaData webMetaData = new JBossWebMetaData();
    webMetaData.setDistributable(new EmptyMetaData());
    webMetaData.setMaxActiveSessions(new Integer(maxSessions));
    PassivationConfig pcfg = new PassivationConfig();
    pcfg.setUseSessionPassivation(Boolean.valueOf(passivation));
    pcfg.setPassivationMaxIdleTime(new Integer(maxIdle));
    pcfg.setPassivationMinIdleTime(new Integer(minIdle));
    webMetaData.setPassivationConfig(pcfg);
    ReplicationConfig repCfg = new ReplicationConfig();
    repCfg.setReplicationGranularity(granularity);
    repCfg.setReplicationTrigger(trigger);
    repCfg.setReplicationFieldBatchMode(Boolean.valueOf(batchMode));
    repCfg.setMaxUnreplicatedInterval(Integer.valueOf(maxUnreplicated));
    repCfg.setSnapshotMode(SnapshotMode.INSTANT);
    webMetaData.setReplicationConfig(repCfg);

    return webMetaData;
  }
Example #2
0
  /** {@inheritDoc} */
  public void init(String name, JBossWebMetaData webMetaData)
      throws ClusteringNotSupportedException {
    if (webMetaData.getMaxActiveSessions() != null) {
      maxActiveAllowed_ = webMetaData.getMaxActiveSessions().intValue();
    }

    PassivationConfig pConfig = webMetaData.getPassivationConfig();
    if (pConfig != null) {
      if (pConfig.getUseSessionPassivation() != null) {
        setUseSessionPassivation(pConfig.getUseSessionPassivation().booleanValue());
        if (getUseSessionPassivation()) {
          Integer min = pConfig.getPassivationMinIdleTime();
          if (min != null) setPassivationMinIdleTime(min.intValue());
          Integer max = pConfig.getPassivationMaxIdleTime();
          if (max != null) setPassivationMaxIdleTime(max.intValue());
        }
      }
    }

    log_.debug(
        "init(): maxActiveSessions allowed is "
            + maxActiveAllowed_
            + " and passivationMode is "
            + passivationMode_);
  }