WebSphere Application Server - Express for i5/OS, Version 6.1   
             オペレーティング・システム: i5/OS

             目次と検索結果のパーソナライズ化

例: 相関サービス・インターフェースの使用

サーブレット計測機能の一部として ARM API を相関サービスとともに使用する場合は、この情報を参照してください。

arm40 バイナリーは、インプリメンテーション・プロバイダーによって提供されるインストールの指示どおりにインストールしてください。 インストールを行ったら、サーバーを再始動します。 これによって、トレース・レコードが SystemOut.log ファイル内に生成され、適切な ARM インプリメンテーションのインスタンス化が示されます。

以下の例は、サーブレット計測機能の一部として相関サービスと連携して ARM API を使用する、標準的なワークフローの 1 つを示しています。

public void doGet(HttpServletRequest request, HttpServletResponse response)
		throws ServletException, IOException {

PmiRmArmTx artrax =
// The factory detects the currently active ARM implementation (specified by user through
// admin console) and instantiates an appropriate ARM wrapper object

    PmiRmArmTxFactory.createPmiRmArmTx();
ArmTransaction at = newArmTx();
if (null == at)
            out.println("Got a null ArmTransaction");
ArmCorrelator arc = newArmCorr();
at.start(arc);
try {
	artrax.setArmTransaction(at);
	PmiRmArmStack.pushTransaction(artrax);
} catch (Exception e) {
	System.out.println("Caught 1 exception" + e);
}

PmiRmArmTx atxwrp = PmiRmArmStack.peekTransaction();

if (atxwrp == null)
	out.println("Armtransaction is null");

//getArmType
try {
	out.println("ARMTYPE is"+ PmiRmArmTx.getARMType());
} catch (Exception e) {
	out.println(e);
}
//getting correlator bytes
try {
	if (null == atxwrp.getCorrelatorBytes())
		out.println("Got a null Correlator");
} catch (Exception e) {
	out.println(e);
}

//blocked/unblocked
long blkid = 0;
try {
	out.println(blkid = atxwrp.blocked());
} catch (Exception e) {
	out.println(e);
}

try {
	out.println(atxwrp.unblocked(blkid));
} catch (Exception e) {
	out.println(e);
}
try {
	atxwrp = PmiRmArmStack.popTransaction();
	ArmTransaction art = (ArmTransaction) atxwrp.getArmTransaction();
	art.stop(ArmConstants.STATUS_GOOD);
} catch (Exception e) {
	out.println(e);
}

}



private ArmTransaction newArmTx() {

	ArmTransactionFactory txFactory = null;
try {
	String sWasName = "WebSphere";
	String appName = "t23xpimage/t23xpimage/server1";
	String sCellName = appName.substring(0, appName.indexOf("/"));
	String sNodeInstance =
			appName.substring(appName.indexOf("/") + 1, appName.length());
	sNodeInstance = sNodeInstance.replace('/', '.');
	txFactory =	(ArmTransactionFactory)
	newObjectInstance("org.opengroup.arm40.sdk.ArmTransactionFactoryImpl");
	ArmApplication app = null; // 149297
	ArmApplicationDefinition appDef = null; //LIDB3207
	appDef =				txFactory.newArmApplicationDefinition(sWasName, null, null);
	app = txFactory.newArmApplication(appDef, sCellName, sNodeInstance, null);

	String[] idnames = { "request_type" };
	String[] idvalues = { "URI" };
	String[] ctxnames = { "URI" };
	ArmIdentityPropertiesTransaction props =
			txFactory.newArmIdentityPropertiesTransaction(
					idnames,
					idvalues,
					ctxnames,
					null);
	ArmTransactionDefinition atd =
				txFactory.newArmTransactionDefinition(
					appDef,
					"URI",
					props,
					(ArmID) null);
	ArmTransaction at = txFactory.newArmTransaction(app, atd);
	return at;
} catch (Exception e) {
	System.out.println(e);
	return null;
}

}

private ArmCorrelator newArmCorr() {

	ArmTransactionFactory txFactory = null;
try {
	String sWasName = "WebSphere";
	String appName = "t23xpimage/t23xpimage/server1";
	txFactory =
	(ArmTransactionFactory) newObjectInstance("org.opengroup.arm40.sdk.ArmTransactionFactoryImpl");

	ArmCorrelator arc =txFactory.newArmCorrelator(
					PmiRmArmStack.peekTransaction().getCorrelatorBytes());
	return arc;
} catch (Exception e) {
	System.out.println(e);
	return null;
}

}

PmiRmArmStack の使用には、可能性のあるシナリオがいくつかあります。 この例では、コードがスタック上の既存の PmiRmArmTx にアクセスし、 相関関係子を抽出し、blocked と unblocked を呼び出すシナリオを示します。 これは、 サポートされないプロトコルに従って相関関係子を送信する場合の標準的なシナリオです。 このシナリオでは、Arm トランザクションがすでにスタック上にあります。
1			PmiRmArmTx artrax =
2				PmiRmArmStack.peekTransaction();
3			if( artrax != null )
4	                        {
5	                                    try
6	                                    {
7				    byte[] cbytes = artrax.getCorrelatorBytes();
8	                                        stuffBytesIntoOutboundMessage( msg, cbytes);
9	                                         long blockedId = 0;
10	                                        try
11	                                        {
12	                                           blockedId = artrax.blocked();
13	                                         }
14	                                         catch( NoSuchMethodException nsme )
15	                                         {
16	                                             // must not be running ARM4 or eWLM
17	                                         }
18	                                           sendMsg( msg );
19	                                        try
20	                                        {
21	                                           artrax.blocked( blockedId );
22	                                         }
23	                                         catch( NoSuchMethodException nsme )
24	                                         {
25	                                             // must not be running ARM4 or eWLM
26	                                         }
27	
28	                                     }
29	                                     catch( Exception e )
30	                                     {
31	                                        report a problem;
32	                                     }
33			}
 



関連概念
要求メトリックの拡張
関連タスク
アプリケーション・フローのモニター
参照トピック    

ご利用条件 | フィードバック

最終更新: Jan 21, 2008 7:05:28 PM EST
http://publib.boulder.ibm.com/infocenter/wasinfo/v6r1/index.jsp?topic=/com.ibm.websphere.express.iseries.doc/info/iseriesexp/ae/rprf_excorrserv.html