本文整理汇总了Java中org.apache.catalina.Manager类的典型用法代码示例。如果您正苦于以下问题:Java Manager类的具体用法?Java Manager怎么用?Java Manager使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
Manager类属于org.apache.catalina包,在下文中一共展示了Manager类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: invoke
import org.apache.catalina.Manager; //导入依赖的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);
}
示例2: invoke
import org.apache.catalina.Manager; //导入依赖的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);
}
示例3: createPrimaryIndicator
import org.apache.catalina.Manager; //导入依赖的package包/类
/**
* Mark Request that processed at primary node with attribute
* primaryIndicatorName
*
* @param request
* @throws IOException
*/
protected void createPrimaryIndicator(Request request) throws IOException {
String id = request.getRequestedSessionId();
if ((id != null) && (id.length() > 0)) {
Manager manager = request.getContext().getManager();
Session session = manager.findSession(id);
if (session instanceof ClusterSession) {
ClusterSession cses = (ClusterSession) session;
if (log.isDebugEnabled())
log.debug(sm.getString(
"ReplicationValve.session.indicator", request.getContext().getName(),id,
primaryIndicatorName,
Boolean.valueOf(cses.isPrimarySession())));
request.setAttribute(primaryIndicatorName, cses.isPrimarySession()?Boolean.TRUE:Boolean.FALSE);
} else {
if (log.isDebugEnabled()) {
if (session != null) {
log.debug(sm.getString(
"ReplicationValve.session.found", request.getContext().getName(),id));
} else {
log.debug(sm.getString(
"ReplicationValve.session.invalid", request.getContext().getName(),id));
}
}
}
}
}
示例4: createManager
import org.apache.catalina.Manager; //导入依赖的package包/类
/**
* Create new Manager without add to cluster (comes with start the manager)
*
* @param name
* Context Name of this manager
* @see org.apache.catalina.Cluster#createManager(java.lang.String)
* @see DeltaManager#start()
*/
@Override
public synchronized Manager createManager(String name) {
if (log.isDebugEnabled()) {
log.debug("Creating ClusterManager for context " + name +
" using class " + getManagerTemplate().getClass().getName());
}
ClusterManager manager = null;
try {
manager = managerTemplate.cloneFromTemplate();
manager.setName(name);
} catch (Exception x) {
log.error("Unable to clone cluster manager, defaulting to org.apache.catalina.ha.session.DeltaManager", x);
manager = new org.apache.catalina.ha.session.DeltaManager();
} finally {
if ( manager != null) manager.setCluster(this);
}
return manager;
}
示例5: destroyMBean
import org.apache.catalina.Manager; //导入依赖的package包/类
/**
* Deregister the MBean for this
* <code>Manager</code> object.
*
* @param manager The Manager to be managed
*
* @exception Exception if an MBean cannot be deregistered
* @deprecated Unused. Will be removed in Tomcat 8.0.x
*/
@Deprecated
static void destroyMBean(Manager manager)
throws Exception {
String mname = createManagedName(manager);
ManagedBean managed = registry.findManagedBean(mname);
if (managed == null) {
return;
}
String domain = managed.getDomain();
if (domain == null)
domain = mserver.getDefaultDomain();
ObjectName oname = createObjectName(domain, manager);
if( mserver.isRegistered(oname) )
mserver.unregisterMBean(oname);
}
示例6: sessionEvent
import org.apache.catalina.Manager; //导入依赖的package包/类
@Override
public void sessionEvent(SessionEvent event) {
if (!Session.SESSION_DESTROYED_EVENT.equals(event.getType())) {
return;
}
Session session = event.getSession();
Manager manager = session.getManager();
if (manager == null) {
return;
}
Context context = (Context) manager.getContainer();
Authenticator authenticator = context.getAuthenticator();
if (!(authenticator instanceof AuthenticatorBase)) {
return;
}
SingleSignOn sso = ((AuthenticatorBase) authenticator).sso;
if (sso == null) {
return;
}
sso.sessionDestroyed(ssoId, session);
}
示例7: isRequestedSessionIdValid
import org.apache.catalina.Manager; //导入依赖的package包/类
/**
* Return <code>true</code> if the session identifier included in this
* request identifies a valid session.
*/
public boolean isRequestedSessionIdValid() {
if (requestedSessionId == null)
return (false);
if (context == null)
return (false);
Manager manager = context.getManager();
if (manager == null)
return (false);
Session session = null;
try {
session = manager.findSession(requestedSessionId);
} catch (IOException e) {
session = null;
}
if ((session != null) && session.isValid())
return (true);
else
return (false);
}
示例8: createManager
import org.apache.catalina.Manager; //导入依赖的package包/类
/**
* Create new Manager without add to cluster (comes with start the manager)
*
* @param name
* Context Name of this manager
* @see org.apache.catalina.Cluster#createManager(java.lang.String)
* @see DeltaManager#start()
*/
@Override
public synchronized Manager createManager(String name) {
if (log.isDebugEnabled()) {
log.debug("Creating ClusterManager for context " + name + " using class "
+ getManagerTemplate().getClass().getName());
}
ClusterManager manager = null;
try {
manager = managerTemplate.cloneFromTemplate();
manager.setName(name);
} catch (Exception x) {
log.error("Unable to clone cluster manager, defaulting to org.apache.catalina.ha.session.DeltaManager", x);
manager = new org.apache.catalina.ha.session.DeltaManager();
} finally {
if (manager != null)
manager.setCluster(this);
}
return manager;
}
示例9: createMBean
import org.apache.catalina.Manager; //导入依赖的package包/类
/**
* Create, register, and return an MBean for this
* <code>Manager</code> object.
*
* @param manager The Manager to be managed
*
* @exception Exception if an MBean cannot be created or registered
*/
static DynamicMBean createMBean(Manager manager)
throws Exception {
String mname = createManagedName(manager);
ManagedBean managed = registry.findManagedBean(mname);
if (managed == null) {
Exception e = new Exception("ManagedBean is not found with "+mname);
throw new MBeanException(e);
}
String domain = managed.getDomain();
if (domain == null)
domain = mserver.getDefaultDomain();
DynamicMBean mbean = managed.createMBean(manager);
ObjectName oname = createObjectName(domain, manager);
if( mserver.isRegistered( oname )) {
mserver.unregisterMBean(oname);
}
mserver.registerMBean(mbean, oname);
return (mbean);
}
示例10: destroyMBean
import org.apache.catalina.Manager; //导入依赖的package包/类
/**
* Deregister the MBean for this <code>Manager</code> object.
*
* @param manager
* The Manager to be managed
*
* @exception Exception
* if an MBean cannot be deregistered
* @deprecated Unused. Will be removed in Tomcat 8.0.x
*/
@Deprecated
static void destroyMBean(Manager manager) throws Exception {
String mname = createManagedName(manager);
ManagedBean managed = registry.findManagedBean(mname);
if (managed == null) {
return;
}
String domain = managed.getDomain();
if (domain == null)
domain = mserver.getDefaultDomain();
ObjectName oname = createObjectName(domain, manager);
if (mserver.isRegistered(oname))
mserver.unregisterMBean(oname);
}
示例11: createMBean
import org.apache.catalina.Manager; //导入依赖的package包/类
/**
* Create, register, and return an MBean for this
* <code>Manager</code> object.
*
* @param manager The Manager to be managed
*
* @exception Exception if an MBean cannot be created or registered
*/
public static ModelMBean createMBean(Manager manager)
throws Exception {
String mname = createManagedName(manager);
ManagedBean managed = registry.findManagedBean(mname);
if (managed == null) {
Exception e = new Exception("ManagedBean is not found with "+mname);
throw new MBeanException(e);
}
String domain = managed.getDomain();
if (domain == null)
domain = mserver.getDefaultDomain();
ModelMBean mbean = managed.createMBean(manager);
ObjectName oname = createObjectName(domain, manager);
mserver.registerMBean(mbean, oname);
return (mbean);
}
示例12: destroyMBean
import org.apache.catalina.Manager; //导入依赖的package包/类
/**
* Deregister the MBean for this
* <code>Manager</code> object.
*
* @param manager The Manager to be managed
*
* @exception Exception if an MBean cannot be deregistered
*/
public static void destroyMBean(Manager manager)
throws Exception {
String mname = createManagedName(manager);
ManagedBean managed = registry.findManagedBean(mname);
if (managed == null) {
return;
}
String domain = managed.getDomain();
if (domain == null)
domain = mserver.getDefaultDomain();
ObjectName oname = createObjectName(domain, manager);
mserver.unregisterMBean(oname);
}
示例13: isDefaultManager
import org.apache.catalina.Manager; //导入依赖的package包/类
/**
* Is this an instance of the default <code>Manager</code> configuration,
* with all-default properties?
*
* @param manager Manager to be tested
*/
private boolean isDefaultManager(Manager manager) {
if (!(manager instanceof StandardManager)) {
return (false);
}
StandardManager smanager = (StandardManager) manager;
if ((smanager.getDebug() != 0) ||
!smanager.getPathname().equals("SESSIONS.ser") ||
(smanager.getCheckInterval() != 60) ||
!smanager.getRandomClass().equals("java.security.SecureRandom") ||
(smanager.getMaxActiveSessions() != -1) ||
!smanager.getAlgorithm().equals("MD5")) {
return (false);
}
return (true);
}
示例14: registerManager
import org.apache.catalina.Manager; //导入依赖的package包/类
@Override
public void registerManager(Manager manager) {
if (!(manager instanceof ClusterManager)) {
log.warn("Manager [ " + manager
+ "] does not implement ClusterManager, addition to cluster has been aborted.");
return;
}
ClusterManager cmanager = (ClusterManager) manager;
// Notify our interested LifecycleListeners
fireLifecycleEvent(BEFORE_MANAGERREGISTER_EVENT, manager);
String clusterName = getManagerName(cmanager.getName(), manager);
cmanager.setName(clusterName);
cmanager.setCluster(this);
managers.put(clusterName, cmanager);
// Notify our interested LifecycleListeners
fireLifecycleEvent(AFTER_MANAGERREGISTER_EVENT, manager);
}
示例15: registerManager
import org.apache.catalina.Manager; //导入依赖的package包/类
@Override
public void registerManager(Manager manager) {
if (! (manager instanceof ClusterManager)) {
log.warn("Manager [ " + manager + "] does not implement ClusterManager, addition to cluster has been aborted.");
return;
}
ClusterManager cmanager = (ClusterManager) manager;
// Notify our interested LifecycleListeners
fireLifecycleEvent(BEFORE_MANAGERREGISTER_EVENT, manager);
String clusterName = getManagerName(cmanager.getName(), manager);
cmanager.setName(clusterName);
cmanager.setCluster(this);
managers.put(clusterName, cmanager);
// Notify our interested LifecycleListeners
fireLifecycleEvent(AFTER_MANAGERREGISTER_EVENT, manager);
}