本文整理汇总了Java中org.apache.catalina.session.PersistentManager类的典型用法代码示例。如果您正苦于以下问题:Java PersistentManager类的具体用法?Java PersistentManager怎么用?Java PersistentManager使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
PersistentManager类属于org.apache.catalina.session包,在下文中一共展示了PersistentManager类的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。
示例1: invoke
import org.apache.catalina.session.PersistentManager; //导入依赖的package包/类
/**
* Detect possible the JVMRoute change at cluster backup node..
*
* @param request
* tomcat request being processed
* @param response
* tomcat response being processed
* @exception IOException
* if an input/output error has occurred
* @exception ServletException
* if a servlet error has occurred
*/
@Override
public void invoke(Request request, Response response) throws IOException,
ServletException {
if (getEnabled() &&
request.getContext() != null &&
request.getContext().getDistributable() &&
!request.isAsyncDispatching()) {
// valve cluster can access manager - other cluster handle turnover
// at host level - hopefully!
Manager manager = request.getContext().getManager();
if (manager != null && (
(manager instanceof ClusterManager
&& getCluster() != null
&& getCluster().getManager(((ClusterManager)manager).getName()) != null)
||
(manager instanceof PersistentManager)))
handlePossibleTurnover(request);
}
// Pass this request on to the next valve in our pipeline
getNext().invoke(request, response);
}
开发者ID:liaokailin,项目名称:tomcat7,代码行数:36,代码来源:JvmRouteBinderValve.java
示例2: invoke
import org.apache.catalina.session.PersistentManager; //导入依赖的package包/类
/**
* Detect possible the JVMRoute change at cluster backup node..
*
* @param request
* tomcat request being processed
* @param response
* tomcat response being processed
* @exception IOException
* if an input/output error has occurred
* @exception ServletException
* if a servlet error has occurred
*/
@Override
public void invoke(Request request, Response response) throws IOException, ServletException {
if (getEnabled() && request.getContext() != null && request.getContext().getDistributable()
&& !request.isAsyncDispatching()) {
// valve cluster can access manager - other cluster handle turnover
// at host level - hopefully!
Manager manager = request.getContext().getManager();
if (manager != null && ((manager instanceof ClusterManager && getCluster() != null
&& getCluster().getManager(((ClusterManager) manager).getName()) != null)
|| (manager instanceof PersistentManager)))
handlePossibleTurnover(request);
}
// Pass this request on to the next valve in our pipeline
getNext().invoke(request, response);
}
开发者ID:how2j,项目名称:lazycat,代码行数:30,代码来源:JvmRouteBinderValve.java
示例3: containerCustomizer
import org.apache.catalina.session.PersistentManager; //导入依赖的package包/类
@Bean
public EmbeddedServletContainerCustomizer containerCustomizer() {
return factory -> {
TomcatEmbeddedServletContainerFactory containerFactory = (TomcatEmbeddedServletContainerFactory) factory;
containerFactory.setTomcatContextCustomizers(Arrays.asList(context -> {
final PersistentManager persistentManager = new PersistentManager();
final FileStore store = new FileStore();
final String sessionDirectory = makeSessionDirectory();
log.info("Writing sessions to " + sessionDirectory);
store.setDirectory(sessionDirectory);
persistentManager.setStore(store);
context.setManager(persistentManager);
}));
};
}
开发者ID:joakim666,项目名称:spring-boot-spring-loaded-java8-example,代码行数:18,代码来源:Application.java
示例4: getSessionManager
import org.apache.catalina.session.PersistentManager; //导入依赖的package包/类
private Manager getSessionManager(Context context)
{
// Must be set for the persistent manager to work correctly.
System.setProperty("org.apache.catalina.session.StandardSession.ACTIVITY_CHECK", "true");
PersistentManager manager = new PersistentManager();
StoreBase store;
// Check if Migration has run and setup JDBC persistence
if( !hibernateMigrationService.hasRunSystemMigration("com.tle.tomcat.migration.CreateTomcatSessionEntity") )
{
// Use filestore until JDBC setup complete
LOGGER.info("Setting up temporary file session store");
FileStore fileStore = new FileStore();
fileStore.setDirectory(System.getProperty("java.io.tmpdir"));
store = fileStore;
}
else
{
LOGGER.info("Setting up JDBC session store");
JDBCStore jdbcStore = new JDBCStore();
jdbcStore.setConnectionURL(dataSourceService.getSystemUrl());
jdbcStore.setConnectionName(dataSourceService.getSystemUsername());
jdbcStore.setConnectionPassword(dataSourceService.getSystemPassword());
jdbcStore.setDriverName(dataSourceService.getDriverClass());
jdbcStore.setSessionTable("tomcat_sessions");
store = jdbcStore;
}
manager.setContext(context);
manager.setProcessExpiresFrequency(3); // Every 30 seconds
manager.setStore(store);
// Persist immediately but leave in memory
manager.setMaxIdleBackup(0);
// Don't remove from memory for 30 minutes
manager.setMaxIdleSwap((int) TimeUnit.MINUTES.toSeconds(30));
return manager;
}
开发者ID:equella,项目名称:Equella,代码行数:40,代码来源:TomcatServiceImpl.java
示例5: storeManager
import org.apache.catalina.session.PersistentManager; //导入依赖的package包/类
/**
* Store the specified Manager properties.
*
* @param writer PrintWriter to which we are storing
* @param indent Number of spaces to indent this element
* @param manager Object whose properties are being stored
*
* @exception Exception if an exception occurs while storing
*/
private void storeManager(PrintWriter writer, int indent,
Manager manager) throws Exception {
if (isDefaultManager(manager)) {
return;
}
// Store the beginning of this element
for (int i = 0; i < indent; i++) {
writer.print(' ');
}
writer.print("<Manager");
storeAttributes(writer, manager);
writer.println(">");
// Store nested <Store> element
if (manager instanceof PersistentManager) {
Store store = ((PersistentManager) manager).getStore();
if (store != null) {
storeStore(writer, indent + 2, store);
}
}
// Store the ending of this element
for (int i = 0; i < indent; i++) {
writer.print(' ');
}
writer.println("</Manager>");
}
开发者ID:c-rainstorm,项目名称:jerrydog,代码行数:40,代码来源:StandardServer.java
注:本文中的org.apache.catalina.session.PersistentManager类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论