Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
[jetty-users] Code migration from 9.3.x to 9.4.x

Hi all,
In RAP project we are using embedded Jetty for our cluster tests with sessions persistence in H2. Our implementation is based on the example shown in [1]. The code which we are using in Jetty 9.3.x is:
---------
public SessionManager createSessionManager( Server server ) {
  JDBCSessionManager result = new JDBCSessionManager();
  result.setSaveInterval( SAVE_INTERVAL );
  return result;
}

public SessionIdManager createSessionIdManager( Server server ) {
  JDBCSessionIdManager result = new JDBCSessionIdManager( server );
  result.setScavengeInterval( SCAVENGE_INTERVAL );
  result.setWorkerName( generateNodeName() );
  Driver driver = databaseServer.getDriver();
  String connectionUrl = databaseServer.getConnectionUrl();
  result.setDriverInfo( driver, connectionUrl );
  return result;
}
---------
What I understand from the migration guide is that in Jetty 9.4.x we don't have (JDBC)SessionManager anymore and the functionality is handled by SessionHandler. That's clear. (JDBC)SessionIdManager is replaced by DefaultSessionIdManager. I have 3 questions:
1. What is the replacement of setSaveInterval?
2. To set scavenge interval I have to create HouseKeeper and set it on DefaultSessionIdManager. Right?
3. How to set the database driver info in session id manager?
Could you provide some code snippets that answer the questions above?

Thanks in advance,
Ivan

[1] https://wiki.eclipse.org/Jetty/Feature/Session_Clustering_Using_a_Database


Back to the top