⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 sessionmanagementmbean.html

📁 一个实用的java源程序
💻 HTML
📖 第 1 页 / 共 2 页
字号:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<!--NewPage-->
<HTML>
<HEAD>
<!-- Generated by javadoc (build 1.5.0_11) on Fri Jan 25 02:21:56 EST 2008 -->
<TITLE>
SessionManagementMBean
</TITLE>

<META NAME="keywords" CONTENT="com.bea.wli.sb.management.configuration.SessionManagementMBean interface">

<LINK REL ="stylesheet" TYPE="text/css" HREF="../../../../../../stylesheet.css" TITLE="Style">

<SCRIPT type="text/javascript">
function windowTitle()
{
    parent.document.title="SessionManagementMBean";
}
</SCRIPT>
<NOSCRIPT>
</NOSCRIPT>

</HEAD>

<BODY BGCOLOR="white" onload="windowTitle();">


<!-- ========= START OF TOP NAVBAR ======= -->
<A NAME="navbar_top"><!-- --></A>
<A HREF="#skip-navbar_top" title="Skip navigation links"></A>
<TABLE BORDER="0" WIDTH="100%" CELLPADDING="1" CELLSPACING="0" SUMMARY="">
<TR>
<TD COLSPAN=2 BGCOLOR="#EEEEFF" CLASS="NavBarCell1">
<A NAME="navbar_top_firstrow"><!-- --></A>
<TABLE BORDER="0" CELLPADDING="0" CELLSPACING="3" SUMMARY="">
  <TR ALIGN="center" VALIGN="top">
  <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1">    <A HREF="../../../../../../overview-summary.html"><FONT CLASS="NavBarFont1"><B>Overview</B></FONT></A>&nbsp;</TD>
  <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1">    <A HREF="package-summary.html"><FONT CLASS="NavBarFont1"><B>Package</B></FONT></A>&nbsp;</TD>
  <TD BGCOLOR="#FFFFFF" CLASS="NavBarCell1Rev"> &nbsp;<FONT CLASS="NavBarFont1Rev"><B>Class</B></FONT>&nbsp;</TD>
  <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1">    <A HREF="package-tree.html"><FONT CLASS="NavBarFont1"><B>Tree</B></FONT></A>&nbsp;</TD>
  <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1">    <A HREF="../../../../../../deprecated-list.html"><FONT CLASS="NavBarFont1"><B>Deprecated</B></FONT></A>&nbsp;</TD>
  <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1">    <A HREF="../../../../../../index-all.html"><FONT CLASS="NavBarFont1"><B>Index</B></FONT></A>&nbsp;</TD>
  <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1">    <A HREF="../../../../../../help-doc.html"><FONT CLASS="NavBarFont1"><B>Help</B></FONT></A>&nbsp;</TD>
  </TR>
</TABLE>
</TD>
<TD ALIGN="right" VALIGN="top" ROWSPAN=3><EM>
</EM>
</TD>
</TR>

<TR>
<TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2">
&nbsp;<A HREF="../../../../../../com/bea/wli/sb/management/configuration/ServiceAccountType.html" title="enum in com.bea.wli.sb.management.configuration"><B>PREV CLASS</B></A>&nbsp;
&nbsp;NEXT CLASS</FONT></TD>
<TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2">
  <A HREF="../../../../../../index.html?com/bea/wli/sb/management/configuration/SessionManagementMBean.html" target="_top"><B>FRAMES</B></A>  &nbsp;
&nbsp;<A HREF="SessionManagementMBean.html" target="_top"><B>NO FRAMES</B></A>  &nbsp;
&nbsp;<SCRIPT type="text/javascript">
  <!--
  if(window==top) {
    document.writeln('<A HREF="../../../../../../allclasses-noframe.html"><B>All Classes</B></A>');
  }
  //-->
</SCRIPT>
<NOSCRIPT>
  <A HREF="../../../../../../allclasses-noframe.html"><B>All Classes</B></A>
</NOSCRIPT>


</FONT></TD>
</TR>
<TR>
<TD VALIGN="top" CLASS="NavBarCell3"><FONT SIZE="-2">
  SUMMARY:&nbsp;NESTED&nbsp;|&nbsp;<A HREF="#field_summary">FIELD</A>&nbsp;|&nbsp;CONSTR&nbsp;|&nbsp;<A HREF="#method_summary">METHOD</A></FONT></TD>
<TD VALIGN="top" CLASS="NavBarCell3"><FONT SIZE="-2">
DETAIL:&nbsp;<A HREF="#field_detail">FIELD</A>&nbsp;|&nbsp;CONSTR&nbsp;|&nbsp;<A HREF="#method_detail">METHOD</A></FONT></TD>
</TR>
</TABLE>
<A NAME="skip-navbar_top"></A>
<!-- ========= END OF TOP NAVBAR ========= -->

<HR>
<!-- ======== START OF CLASS DATA ======== -->
<H2>
<FONT SIZE="-1">
com.bea.wli.sb.management.configuration</FONT>
<BR>
Interface SessionManagementMBean</H2>
<DL>
<DT><B>All Superinterfaces:</B> <DD>weblogic.management.provider.Service</DD>
</DL>
<HR>
<DL>
<DT><PRE>public interface <B>SessionManagementMBean</B><DT>extends weblogic.management.mbeanservers.Service</DL>
</PRE>

<P>
Provides API to create, activate or discard sessions. <p><h3>The Concept of Session</h3>ALSB features the concept of a session which allows different users to update differentparts of configuration data without interfering with each other. In order to modifyresources and ALSB configuration, the user must create a session, and perform changesin that session. The changes are only reflected to the core data (the data which ALSBruns on) when the session is activated.<p>A session is essentially a named sandbox, which is used to isolate the changes from otherusers, as well as from the core data, until the changes are activated. A user cancreate as many sessions as he wishes, with arbitrary names, provided that no other sessionwith the same name already exists. <p><h3> Sessions and MBeans</h3>A session can be created, and then discarded or activated using theSessionManagementMBean API. There is one instance of SessionManagementMBeanin the whole domain. <p>Once a session is created, updates can be performed using only the instance of an MBean that workson that session data. Each MBean type, except for SessionManagementMBean, has one instance per session.When a session is created, a new set of MBean instances, one for each MBean Type, are created automatically.Furthermore there is one instance of each MBean Type for operating on core data. However operationson core data are limited to read only operations. For example, if there are 10 sessions, there willbe 11 instance of ProxyServiceConfigurationMBean, 10 for operating on each session, and 1 for operatingon the core data. The MBean instance that works on core data will not support update operations. <p>MBean instances are destroyed when a session is discarded or activated. MBean instances that operate oncore data are never destroyed. <p><h3> Using MBeans from a Java client</h3>The following sample code shows how to obtain SessionManagementMBean for creating a session,and ALSBConfigurationMBean for operating on both the session that is created, and on core data.<p><b>Note: Never embed username/password in source code. The code below does so for clarity </b><pre>import weblogic.management.mbeanservers.domainruntime.DomainRuntimeServiceMBean;import weblogic.management.jmx.MBeanServerInvocationHandler;import com.bea.wli.sb.management.configuration.ALSBConfigurationMBean;import com.bea.wli.sb.management.configuration.SessionManagementMBean;public class MBeanSample {static public void main(String[] args) throws Exception {  // get the jmx connector  JMXConnector conn = initConnection("localhost", 7001, "weblogic", "weblogic");  // get mbean connection  MBeanServerConnection mbconn = conn.getMBeanServerConnection();  // get domain service mbean. This is the topmost mbean  DomainRuntimeServiceMBean domainService = (DomainRuntimeServiceMBean) MBeanServerInvocationHandler.     newProxyInstance(mbconn, new ObjectName(DomainRuntimeServiceMBean.OBJECT_NAME));  // obtain session management mbean to create a session.  // This mbean instance can be used more than once to  // create/discard/commit many sessions  SessionManagementMBean sm = (SessionManagementMBean) domainService.     findService(SessionManagementMBean.NAME,                 SessionManagementMBean.TYPE, null);  // create a session  sm.createSession("mysession");  // obtain the ALSBConfigurationMBean instance that operates on the session that has  // just been created. Notice that the name of the mbean contains the session name.  ALSBConfigurationMBean alsbSession = (ALSBConfigurationMBean) domainService.     findService(ALSBConfigurationMBean.NAME + "." + "mysession",                 ALSBConfigurationMBean.TYPE, null);  // Perform updates or read operations in the session using alsbSession  ...  // activate changes performed in the session  sm.activateSession("mysession", "description");  // Obtain MBean for peforming read only operations. Notice that the name  // of the mbean for the core data does not contain any session name.  ALSBConfigurationMBean alsbCore =     (ALSBConfigurationMBean) domainService.findService(ALSBConfigurationMBean.NAME,                                                        ALSBConfigurationMBean.TYPE, null);  // Perform read-only operations on core data using alsbCore  ....  conn.close();}public static JMXConnector initConnection(String hostname, int port,                                          String username, String password)   throws IOException,MalformedURLException{  JMXServiceURL serviceURL =      new JMXServiceURL("t3", hostname, port,                        "/jndi/" + DomainRuntimeServiceMBean.MBEANSERVER_JNDI_NAME);  Hashtable&lt;String, String&gt; h = new Hashtable&lt;String, String&gt;();  h.put(Context.SECURITY_PRINCIPAL, username);  h.put(Context.SECURITY_CREDENTIALS, password);  h.put(JMXConnectorFactory.PROTOCOL_PROVIDER_PACKAGES, "weblogic.management.remote");  return JMXConnectorFactory.connect(serviceURL, h);}}</pre><h3> Using MBeans in a script </h3>The management API provided by MBeans is available for scripting via WLST. The java client codepresented above is reimplemented here using the following python script. To run this examplesimply save the code below in a file named basic.py and invoke it via the following command<p><tt>java weblogic.WLST basic.py</tt>You must set the classpath and environment variables correctly by invoking the setDomainEnv.[cmd|sh] script in the bin directory of your domain.<pre>import wlstModulefrom com.bea.wli.sb.management.configuration import SessionManagementMBeanfrom com.bea.wli.sb.management.configuration import ALSBConfigurationMBeanfrom com.bea.wli.config import Reftry:    connect("weblogic", "weblogic", "t3://localhost:7001")    domainRuntime()    # obtain session management mbean to create a session.    # This mbean instance can be used more than once to    # create/discard/commit many sessions    sessionMBean = findService(SessionManagementMBean.NAME,SessionManagementMBean.TYPE)    # create a session    sessionMBean.createSession("mysession")    # obtain the ALSBConfigurationMBean instance that operates    # on the session that has just been created. Notice that    # the name of the mbean contains the session name.    alsbSession = findService(ALSBConfigurationMBean.NAME + "." + "mysession", ALSBConfigurationMBean.TYPE)    # Perform updates or read operations in the session using alsbSession    ...    # activate changes performed in the session    sessionMBean.activateSession("mysession", "description for session activation")    # Obtain MBean for peforming read only operations.    # Notice that the name of the mbean for the core    # data does not contain any session name.    alsbCore = findService(ALSBConfigurationMBean.NAME, ALSBConfigurationMBean.TYPE)    # Perform read-only operations on core data using alsbCore    ...

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -