国产xxxx99真实实拍_久久不雅视频_高清韩国a级特黄毛片_嗯老师别我我受不了了小说

資訊專欄INFORMATION COLUMN

ABAP SICF服務和Java Servlet的比較

Youngs / 3272人閱讀

In my opinion ABAP ICF handler and Java Servlet play the same role in enhancement which enables your web server with additional functionality.

This blog will not introduce how an ICF handler class in ABAP or a Servlet in Java are developed, but focus the way those instances of handler class or Servlet are spawned by Web Server.

Let’s first study the Servlet spawn behavior in Java.

Servlet in Java

According to Servlet specification, http request against a given url will be served by the same single instance of servlet.

For example, I have developed a simple Servlet which just returns “Hello world” as response. I map it with url starting with “/Hello”.

In the doGet method, I print out the current thread id and instance address to try to verify if every request is served with the SAME servlet instance.

System.out.println("User id: " + userId + " at thread: " + Thread.currentThread().getId() + " current instance: " + this);

In client side I use jQuery to send out five different request simultaneously:

var LOCAL = "http://localhost:9098/JerryServlet/Hello?userId=";
var PREFIX = "i04241";
function main() {
 for( var i = 0; i < 5; i++) {
 var url = LOCAL + PREFIX + i;
 var html = getPostByAJAX(url);
 console.log("response: " + html);
 }
}
$(function(){ 
    main();
}); 
function getPostByAJAX(requestURL){
 var html = $.ajax({
     url: requestURL, async: true}).responseText; 
 return html;
}

When executing the client JavaScript code, I observe in Server console and could find out that these five requests are handled by the same Servlet instance ,however in different threads.

Since I perform the request in an asynchronous mode, so the response of those five requests are processed and returned in parallel.

How singleton behavior of Servlet is achieved

The instance of requested Servlet will only be initialized when it is asked for the first time. The below two-fold instance checking against null is a typical thread-safe implementation pattern for Singleton in Java.

The method loadServlet in class StandardWrapper will call constructor of my sample Servlet via reflection. All subsequent request will be served by this singleton.

Thread pool in Java Servlet

This thread pool behavior is easy to observe, just set breakpoint in doGet method in my Servlet, line 58:

Perform the client code to send five requests, then in Eclipse we can see the five working threads stopped at the breakpoint at the same time:

From the bottom of callstack we get the hint that those working threads are centrally managed by the Thread pool.

ICF Handler class in ABAP

Create a simple ICF service in tcode SICF and implement its handler class.

Set a breakpoint on method HANDLE_REQUEST, then trigger the request sending in client code:

Five debugger windows will pop up for the same time, each for one separate ABAP session where the request is handled.

From this source code we know the fact that in ABAP, the instance of handler class does not behave as singleton in Java Servlet.

From debugging we can observe that different session has different ICF handler instance which are isolated among each other.

Further reading

I have written a series of blogs which compare the language feature among ABAP, JavaScript and Java. You can find a list of them below:

Lazy Loading, Singleton and Bridge design pattern in JavaScript and in ABAP

Functional programming – Simulate Curry in ABAP

Functional Programming – Try Reduce in JavaScript and in ABAP

Simulate Mockito in ABAP

A simulation of Java Spring dependency injection annotation @Inject in ABAP

Singleton bypass – ABAP and Java

Weak reference in ABAP and Java

Fibonacci Sequence in ES5, ES6 and ABAP

Java byte code and ABAP Load

How to write a correct program rejected by compiler: Exception handling in Java and in ABAP

An small example to learn Garbage collection in Java and in ABAP

String Template in ABAP, ES6, Angular and React

Try to access static private attribute via ABAP RTTI and Java Reflection

Local class in ABAP, Java and JavaScript

Integer in ABAP, Java and JavaScript

Covariance in Java and simulation in ABAP

Various Proxy Design Pattern implementation variants in Java and ABAP

Tag(Marker) Interface in ABAP and Java

Bitwise operation ( OR, AND, XOR ) on ABAP Integer

ABAP ICF handler and Java Servlet

ADBC and JDBC

CL_ABAP_CORRESPONDING, CL_JAVA_CORRESPONDING and CL_JS_CORRESPONDING

Build an Cross Site Scripting example in Java and ABAP

Play around with JSONP in nodeJS server and ABAP server

要獲取更多Jerry的原創文章,請關注公眾號"汪子熙":

文章版權歸作者所有,未經允許請勿轉載,若此文章存在違規行為,您可以聯系管理員刪除。

轉載請注明本文地址:http://specialneedsforspecialkids.com/yun/72672.html

相關文章

  • 不喜歡SAP GUI?那試試用Eclipse進行ABAP開發吧

    摘要:比如的的個性化設置是這樣的,字體必須用程序猿專用的等寬開源字體,這樣顯得比較專業。我覺得網上流傳的程序猿和工具的鄙視鏈很無聊,與其有時間去鄙視別人,不如把這時間用來深入研究自己每天用的,進一步提高自己單位時間內的工作效率。 Jerry和SAP成都研究院一些新同事聊天時,談到ABAP和SAP GUI這個話題。很多新同事在加入SAP成都之前,是做Java和C++開發的,習慣了Eclipse...

    jkyin 評論0 收藏0
  • 站在巨人肩膀上牛頓:KubernetesSAP Kyma

    摘要:小的時候,聽過牛頓這樣謙虛的一句話如果說我看得比別人更遠些,那是因為我站在巨人的肩膀上。。發布一個的事件,事件包含創建訂單的字段。 這周Jerry在SAP上海研究院參加了一個為期4天的Kubernetes培訓,度過了忙碌而又充實的4天。Jason,Benny和Peng三位大神的培訓干貨滿滿,借此機會,Jerry和過去的兩位老領導Patrick和Evan敘了敘舊,也拜見了上海SAP圈子里...

    hosition 評論0 收藏0
  • 站在巨人肩膀上牛頓:KubernetesSAP Kyma

    摘要:小的時候,聽過牛頓這樣謙虛的一句話如果說我看得比別人更遠些,那是因為我站在巨人的肩膀上。。發布一個的事件,事件包含創建訂單的字段。 這周Jerry在SAP上海研究院參加了一個為期4天的Kubernetes培訓,度過了忙碌而又充實的4天。Jason,Benny和Peng三位大神的培訓干貨滿滿,借此機會,Jerry和過去的兩位老領導Patrick和Evan敘了敘舊,也拜見了上海SAP圈子里...

    Harpsichord1207 評論0 收藏0
  • 站在巨人肩膀上牛頓:KubernetesSAP Kyma

    摘要:小的時候,聽過牛頓這樣謙虛的一句話如果說我看得比別人更遠些,那是因為我站在巨人的肩膀上。。發布一個的事件,事件包含創建訂單的字段。 這周Jerry在SAP上海研究院參加了一個為期4天的Kubernetes培訓,度過了忙碌而又充實的4天。Jason,Benny和Peng三位大神的培訓干貨滿滿,借此機會,Jerry和過去的兩位老領導Patrick和Evan敘了敘舊,也拜見了上海SAP圈子里...

    王陸寬 評論0 收藏0
  • ABAP Netweaver, Hybris CommerceSAP 云平臺登錄認證

    摘要:通過這個鏈接打開對應的幫助文檔,可以看到下列七種登錄手段。上圖的圖例描述了部署在云平臺環境上的應用是如何通過訪問系統上的服務。用戶完成登錄操作后,一個簡稱為被創建,發送給,并緩存于內。將請求通過轉發給。 ABAP Netweaver 在事務碼SICF里選擇一個服務,在明細頁面對Procedure字段點擊F1,查看Logon Procedure的幫助文檔。showImg(https://...

    blastz 評論0 收藏0

發表評論

0條評論

Youngs

|高級講師

TA的文章

閱讀更多
最新活動
閱讀需要支付1元查看
<