tag:blogger.com,1999:blog-38581815424679164902024-02-19T06:43:30.665+03:00Open Source Software and Database TechnologiesOpen Source Software and Database Technologies, Java, J2EEAli Gelenlerhttp://www.blogger.com/profile/09439697648573423668noreply@blogger.comBlogger37125tag:blogger.com,1999:blog-3858181542467916490.post-59186114299170921392022-03-20T13:52:00.001+03:002022-06-24T22:21:37.275+03:00<h2 style="text-align: left;"><div class="separator" style="clear: both; text-align: left;"><span style="font-size: x-large;">Web security: Understanding different type of injection attacks</span></div></h2><h2 style="text-align: left;"><span style="font-size: medium;">Introduction:</span></h2><h2><div class="separator" style="clear: both; text-align: center;"><p class="graf graf--p" name="3392" style="text-align: left;"><span style="font-size: small; font-weight: normal;">In this article, I will try to explain different type of injection attacks that can be used to exploit a web application. Injection is one of the most dangerous attacks that targets web applications. The current <a class="markup--anchor markup--p-anchor" data-href="https://owasp.org/www-project-top-ten/" href="https://owasp.org/www-project-top-ten/" rel="noopener" target="_blank">OWASP Top 10 list</a> still lists the injection in top three web application security risks. All injection attacks are based on using user supplied untrusted data in an interpreter as part of a command or query.</span></p><p class="graf graf--p" name="3ac1" style="text-align: left;"><span style="font-size: small; font-weight: normal;">If you want to see hands-on examples with these injection attacks and want to hack the vulnerable applications you have developed, you can check out my new course: <a class="markup--anchor markup--p-anchor" data-href="https://www.udemy.com/course/secure-coding-dive-into-injections-with-java-spring-boot/?couponCode=722CFAE3F4537AEA036E" href="https://www.udemy.com/course/secure-coding-dive-into-injections-with-java-spring-boot/?couponCode=12E58CFC7047D6667347" rel="noopener" target="_blank"><span class="markup--strong markup--p-strong">Web security: Injection Attacks with Java & Spring Boot</span></a></span></p><p class="graf graf--p" name="0403" style="text-align: left;"><span style="font-size: small; font-weight: normal;">Let’s summarise the 5 widely used injection attacks in web applications: SQL , NoSQL, LDAP, LOG and CSV Injections.</span></p></div></h2><h4 style="text-align: left;"><span class="markup--strong markup--h3-strong"><u><span style="font-size: medium;">SQL Injection:</span></u></span></h4><h2><div class="separator" style="clear: both; text-align: center;"><p class="graf graf--p" name="0d37" style="text-align: left;"><span style="font-size: small; font-weight: normal;">SQL injection occurs when user supplied untrusted data send to a database engine as part of a command or query.</span></p><p class="graf graf--p" name="888e" style="text-align: left;"><span style="font-size: small; font-weight: normal;">As a result of SQL injection attacker can bypass authentication, disclosure data on database, cause alter or delete data which will break data integrity, run system commands on database server.</span></p><p class="graf graf--p" name="3d44" style="text-align: left;"><span class="markup--strong markup--p-strong" style="font-weight: normal;"><em class="markup--em markup--p-em"><span style="font-size: small;">An example SQL Injection attack using an always true condition;</span></em></span></p><p class="graf graf--p" name="b78b" style="text-align: left;"><span style="font-size: small; font-weight: normal;">Let’s say an application uses below sql query as a string variable;</span></p><p class="graf graf--p" name="44ce" style="text-align: left;"><span class="markup--strong markup--p-strong" style="font-weight: normal;"><span style="font-size: small;">sql = select username, password from users where username=’%s’;</span></span></p><p class="graf graf--p" name="af4f" style="text-align: left;"><span style="font-size: small; font-weight: normal;">For above query if an attacker provides a username as <span class="markup--strong markup--p-strong">xxx’ or ‘1’=’1;</span></span></p><p class="graf graf--p" name="a010" style="text-align: left;"><span style="font-size: small; font-weight: normal;">The resulting query will be as below;</span></p><p class="graf graf--p" name="68ce" style="text-align: left;"><span class="markup--strong markup--p-strong" style="font-weight: normal;"><span style="font-size: small;">select username, password from users where username=’xxx’ or ‘1’=’1’</span></span></p><p class="graf graf--p" name="3d51" style="text-align: left;"><span style="font-size: small; font-weight: normal;">Here,<span class="markup--strong markup--p-strong"> or ‘1’=’1 </span>part is an always true condition, and it will result a <span class="markup--strong markup--p-strong">true </span>where condition which will return all username/password pairs from the database.</span></p><p class="graf graf--p" name="396a" style="text-align: left;"><span style="font-size: small; font-weight: normal;">To defend against <a class="markup--anchor markup--p-anchor" data-href="https://owasp.org/www-community/attacks/SQL_Injection" href="https://owasp.org/www-community/attacks/SQL_Injection" rel="noopener" target="_blank">SQL injection</a> at least the following protections should be used;</span></p><ul class="postList"><li class="graf graf--li" name="c6c9" style="text-align: left;"><span style="font-size: small; font-weight: normal;">Using a strong validation and sanitisation mechanism</span></li><li class="graf graf--li" name="deb9" style="text-align: left;"><span style="font-size: small; font-weight: normal;">Using parametrised queries with prepared statements</span></li></ul></div></h2><h3 class="graf graf--h3" name="65b1"><span class="markup--strong markup--h3-strong"><span style="font-size: small;"><u>NoSQL Injection:</u></span></span></h3><h2><div class="separator" style="clear: both; text-align: center;"><p class="graf graf--p" name="8a2c" style="text-align: left;"><span style="font-size: small; font-weight: normal;">In NoSQL injection attacker inject the code into commands to execute in the NoSQL engine.</span></p><p class="graf graf--p" name="24fc" style="text-align: left;"><span style="font-size: small; font-weight: normal;">NoSQL query syntax is specific to the NoSQL engine. Usually, the queries are written in the programming language of the application like JavaScript or Java. For example in MongoDB, Injecting JavaScript code using $where query operator is possible.</span></p><p class="graf graf--p" name="fd89" style="text-align: left;"><span style="font-size: small; font-weight: normal;">To defend against <a class="markup--anchor markup--p-anchor" data-href="https://owasp.org/www-project-web-security-testing-guide/latest/4-Web_Application_Security_Testing/07-Input_Validation_Testing/05.6-Testing_for_NoSQL_Injection" href="https://owasp.org/www-project-web-security-testing-guide/latest/4-Web_Application_Security_Testing/07-Input_Validation_Testing/05.6-Testing_for_NoSQL_Injection" rel="noopener" target="_blank">NoSQL injection</a> at least the following protections should be used;</span></p><ul class="postList"><li class="graf graf--li" name="6922" style="text-align: left;"><span style="font-size: small; font-weight: normal;">Using a strong validation and sanitisation mechanism</span></li><li class="graf graf--li" name="6530" style="text-align: left;"><span style="font-size: small; font-weight: normal;">Using parametrised queries</span></li><li class="graf graf--li" name="c9c9" style="text-align: left;"><span style="font-size: small; font-weight: normal;">Using built-in features of the NoSQL engine to create secure queries</span></li></ul></div></h2><h3 class="graf graf--h3" name="b6c5"><span class="markup--strong markup--h3-strong"><u><span style="font-size: medium;">LDAP Injection:</span></u></span></h3><h2><div class="separator" style="clear: both; text-align: center;"><p class="graf graf--p" name="cf3e" style="text-align: left;"><span style="font-size: small; font-weight: normal;">In LDAP injection attacker inject the code into commands to execute in the LDAP engine.</span></p><p class="graf graf--p" name="8854" style="text-align: left;"><span style="font-size: small; font-weight: normal;">LDAP require queries with some special characters to be used in construction of predicates. If an attacker can send an input directly as a control character the query can be changed to do unwanted operations.</span></p><p class="graf graf--p" name="7f2b" style="text-align: left;"><span style="font-size: small; font-weight: normal;">To defend against <a class="markup--anchor markup--p-anchor" data-href="https://cheatsheetseries.owasp.org/cheatsheets/LDAP_Injection_Prevention_Cheat_Sheet.html" href="https://cheatsheetseries.owasp.org/cheatsheets/LDAP_Injection_Prevention_Cheat_Sheet.html" rel="noopener" target="_blank">LDAP injection</a> at least the following protections should be used;</span></p><ul class="postList"><li class="graf graf--li" name="3dc4" style="text-align: left;"><span style="font-size: small; font-weight: normal;">Using a strong validation and sanitisation mechanism</span></li><li class="graf graf--li" name="7880" style="text-align: left;"><span style="font-size: small; font-weight: normal;">Using parametrised queries</span></li><li class="graf graf--li" name="ffeb" style="text-align: left;"><span style="font-size: small; font-weight: normal;">Using built-in features and trusted libraries to create LDAP queries</span></li></ul></div></h2><h3 class="graf graf--h3" name="03af"><u><span style="font-size: medium;">LOG Injection:</span></u></h3><h2><div class="separator" style="clear: both; text-align: center;"><p class="graf graf--p" name="991d" style="text-align: left;"><span style="font-size: small; font-weight: normal;">In LOG injection the attacker inject code into logs which can lead to different vulnerabilities by polluting or compromising the system logs.</span></p><p class="graf graf--p" name="4aaa" style="text-align: left;"><span style="font-size: small; font-weight: normal;">Through LOG injection an attacker can perform;</span></p><ul class="postList"><li class="graf graf--li" name="f2de" style="text-align: left;"><span style="font-size: small; font-weight: normal;">Log forging by using CRLF(\n\r) characters</span></li><li class="graf graf--li" name="ce33" style="text-align: left;"><span style="font-size: small; font-weight: normal;">XSS attacks</span></li><li class="graf graf--li" name="1ddc" style="text-align: left;"><span style="font-size: small; font-weight: normal;">Code execution</span></li></ul><p class="graf graf--p" name="5180" style="text-align: left;"><span style="font-size: small; font-weight: normal;">To defend against <a class="markup--anchor markup--p-anchor" data-href="https://owasp.org/www-community/attacks/Log_Injection" href="https://owasp.org/www-community/attacks/Log_Injection" rel="noopener" target="_blank">LOG injection</a> at least the following protections should be used;</span></p><ul class="postList"><li class="graf graf--li" name="c275" style="text-align: left;"><span style="font-size: small; font-weight: normal;">Using a strong validation and sanitisation mechanism</span></li><li class="graf graf--li" name="7ce0" style="text-align: left;"><span style="font-size: small; font-weight: normal;">At least filtering out or replacing CRLF characters before printing in log</span></li><li class="graf graf--li" name="923c" style="text-align: left;"><span style="font-size: small; font-weight: normal;">Limiting the size of the log messages</span></li><li class="graf graf--li" name="6613" style="text-align: left;"><span style="font-size: small; font-weight: normal;">Using available protections in the log framework and from trusted libraries</span></li><li class="graf graf--li" name="18fc" style="text-align: left;"><span style="font-size: small; font-weight: normal;">Preventing to save or view the Javascript content through logs</span></li></ul></div></h2><h3 class="graf graf--h3" name="288e"><u><span style="font-size: medium;">CSV Injection:</span></u></h3><h2><div class="separator" style="clear: both; text-align: center;"><p class="graf graf--p" name="4bad" style="text-align: left;"><span style="font-size: small; font-weight: normal;">CSV Injection, also known as Formula Injection, occurs when websites embed untrusted input inside CSV files.</span></p><p class="graf graf--p" name="2396" style="text-align: left;"><span style="font-size: small; font-weight: normal;">CSV injection can be used to steal data from CSV or Excel files and running formulas to run commands on the user’s machine that is viewing the document.</span></p><p class="graf graf--p" name="5790" style="text-align: left;"><span style="font-size: small; font-weight: normal;">To defend against <a class="markup--anchor markup--p-anchor" data-href="https://owasp.org/www-community/attacks/CSV_Injection" href="https://owasp.org/www-community/attacks/CSV_Injection" rel="noopener" target="_blank">CSV injection</a> at least the following protections should be used;</span></p><ul class="postList"><li class="graf graf--li" name="5b17" style="text-align: left;"><span style="font-size: small; font-weight: normal;">Using a strong validation and sanitisation mechanism</span></li><li class="graf graf--li" name="fcb1" style="text-align: left;"><span style="font-size: small; font-weight: normal;">Never directly input user provided data into files that includes formula definition</span></li><li class="graf graf--li" name="35b6" style="text-align: left;"><span style="font-size: small; font-weight: normal;">Wrap each cell field in double quotes</span></li><li class="graf graf--li" name="f31c" style="text-align: left;"><span style="font-size: small; font-weight: normal;">Prepend each cell field with a single quote</span></li><li class="graf graf--li" name="f065" style="text-align: left;"><span style="font-size: small; font-weight: normal;">Escape every double quote using an additional double quote</span></li></ul></div></h2><h3 class="graf graf--h3" name="4e88"><span style="font-size: medium;">Conclusion:</span></h3><h2><div class="separator" style="clear: both; text-align: center;"><p class="graf graf--p" name="ae9f" style="text-align: left;"><span style="font-size: small; font-weight: normal;">An insecure software can easily cause serious consequences for businesses and individuals. Those consequences can include financial abuse, theft and loss of reputation. Vulnerable software will be especially cause huge damages on important industries such as finance and healthcare. Someone can try to hack your application on purpose, or a user can compromise it unintentionally. Therefore it is always needed to program defensively to prevent compromising your application in either case.</span></p><p class="graf graf--p" name="a2ab" style="text-align: left;"><span style="font-size: small; font-weight: normal;">To secure web application and prevent injection vulnerability;</span></p><ul class="postList"><li class="graf graf--li" name="7072" style="text-align: left;"><span style="font-size: small; font-weight: normal;">Separate user provided data from the executable content</span></li><li class="graf graf--li" name="b8f1" style="text-align: left;"><span style="font-size: small; font-weight: normal;">Validate and escape user provided data before using it</span></li><li class="graf graf--li" name="4b31" style="text-align: left;"><span style="font-size: small; font-weight: normal;">Run the web application with the least privilege that is needed</span></li><li class="graf graf--li" name="f261" style="text-align: left;"><span style="font-size: small; font-weight: normal;">Always follow defense-in-depth methodology to prevent the attacks in multiple layers.</span></li></ul><p class="graf graf--p" name="3ac1" style="text-align: left;"><span style="font-size: small; font-weight: normal;">If you want to see hands-on examples with these injection attacks and want to hack the vulnerable applications you have developed, you can check out my new course: <a class="markup--anchor markup--p-anchor" data-href="https://www.udemy.com/course/secure-coding-dive-into-injections-with-java-spring-boot/?couponCode=722CFAE3F4537AEA036E" href="https://www.udemy.com/course/secure-coding-dive-into-injections-with-java-spring-boot/?couponCode=12E58CFC7047D6667347" rel="noopener" target="_blank"><span class="markup--strong markup--p-strong">Web security: Injection Attacks with Java & Spring Boot</span></a></span></p><p class="graf graf--p" name="260a" style="text-align: left;"><span style="font-size: small; font-weight: normal;">In this course you will learn web security and perform different type of injection attacks using the following steps in each section.</span></p><ul class="postList"><li class="graf graf--li" name="a588" style="text-align: left;"><span style="font-size: small; font-weight: normal;">Development of the vulnerable web application using Java, Spring boot and Spring security</span></li><li class="graf graf--li" name="4fdb" style="text-align: left;"><span style="font-size: small; font-weight: normal;">Hacking of the application with various attack payloads and with Ethical hacking examples</span></li><li class="graf graf--li" name="5c9b" style="text-align: left;"><span style="font-size: small; font-weight: normal;">Protection steps and the implementations to prevent injection attacks</span></li></ul></div></h2>Ali Gelenlerhttp://www.blogger.com/profile/09439697648573423668noreply@blogger.com0tag:blogger.com,1999:blog-3858181542467916490.post-83418589943388558752021-04-09T08:44:00.020+03:002022-07-28T11:32:30.701+03:00 Event-Driven Architecture: Why and How to use EDA?<h1><strong style="font-family: "times new roman", serif; font-size: 18.6667px;"><u>Introduction:</u></strong></h1>
<p class="gmail-p1" style="font-family: "Helvetica Neue"; font-size: medium; font-stretch: normal; font-variant-east-asian: normal; font-variant-numeric: normal; line-height: normal; margin: 0px;"><span style="font-weight: normal;">Microservices architecture leads to build highly scalable, available and resilient systems while developing and deploying each service independently, possibly using different technologies. While microservices have a lot of advantages it also brings some level of difficulty when it comes to tracing, testing, logging and especially with data sharing, transactions.</span></p>
<p class="gmail-p2" style="font-family: "Helvetica Neue"; font-size: medium; font-stretch: normal; font-variant-east-asian: normal; font-variant-numeric: normal; line-height: normal; margin: 0px; min-height: 14px;"><span style="font-weight: normal;"> </span></p>
<p class="gmail-p1" style="font-family: "Helvetica Neue"; font-size: medium; font-stretch: normal; font-variant-east-asian: normal; font-variant-numeric: normal; line-height: normal; margin: 0px;"><span style="font-weight: normal;">When working with microservices each service should own its data. This will prevent single point of failure with other services, like using a common data store. However it will also come with three problems;</span></p>
<ul class="gmail-ul1">
<li class="gmail-li1" style="font-family: "Helvetica Neue"; font-stretch: normal; font-variant-east-asian: normal; font-variant-numeric: normal; line-height: normal; margin: 0px;"><span style="font-weight: normal;">Sharing data between services</span></li>
<li class="gmail-li1" style="font-family: "Helvetica Neue"; font-stretch: normal; font-variant-east-asian: normal; font-variant-numeric: normal; line-height: normal; margin: 0px;"><span style="font-weight: normal;">Running transactions across services.<span class="gmail-Apple-converted-space"> </span></span></li>
<li class="gmail-li1" style="font-family: "Helvetica Neue"; font-stretch: normal; font-variant-east-asian: normal; font-variant-numeric: normal; line-height: normal; margin: 0px;"><span style="font-weight: normal;">Scalability requires to replicate data store in each instance of a service, otherwise it will lead to another single point of failure; the single data store shared by instances of a service</span></li>
</ul><div><b><span style="font-family: "Helvetica Neue";">If you want to see an event-driven microservices architecture in live, you can check my course on udemy: </span><a href="https://www.udemy.com/course/event-driven-microservices-spring-boot-kafka-and-elasticsearch/?couponCode=0EA4EEB1F42BDC52BEBC" style="font-family: "Helvetica Neue";" target="_blank">Event-Driven Microservices: Spring Boot, Kafka and Elasticsearch</a></b></div><div><span style="font-family: Helvetica Neue;"><br /></span></div>
<p class="gmail-p1" style="font-family: "Helvetica Neue"; font-size: medium; font-stretch: normal; font-variant-east-asian: normal; font-variant-numeric: normal; line-height: normal; margin: 0px;"><span style="font-weight: normal;">To share data Rest calls can be used. However a Rest call will be a synchronous operation, because Rest uses Http to communicate, and Http is a synchronous protocol which requires to send a request and wait for a response immediately, blocking the caller. As you can imagine with multiple services communicating over the network this would cause significant problems. There can be delays causing higher response times, and if there is no timeout applied properly on caller service, that can block indefinitely.<span class="gmail-Apple-converted-space"> </span></span></p>
<p class="gmail-p1" style="font-family: "Helvetica Neue"; font-size: medium; font-stretch: normal; font-variant-east-asian: normal; font-variant-numeric: normal; line-height: normal; margin: 0px;"><span style="font-weight: normal;">In addition to that, to query the data on a specific service, we will be restricted with the abilities of the data store’s query capability on that specific service. For example, the data store could be Cassandra or Elasticsearch, or a Relational database, and the data you want to query will be stored differently in each case. This may create differences in the returned data format and on the performance of a query.</span></p>
<p class="gmail-p2" style="font-family: "Helvetica Neue"; font-size: medium; font-stretch: normal; font-variant-east-asian: normal; font-variant-numeric: normal; line-height: normal; margin: 0px; min-height: 14px;"><span style="font-weight: normal;"> </span></p>
<p class="gmail-p1" style="font-family: "Helvetica Neue"; font-size: medium; font-stretch: normal; font-variant-east-asian: normal; font-variant-numeric: normal; line-height: normal; margin: 0px;"><span style="font-weight: normal;">For transactions across services, distributed transactions (two-phase commit - 2PC) can be used. However this will require the data stores in each service to support 2PC, which may not always be the option. Besides, according to the <a href="https://en.wikipedia.org/wiki/CAP_theorem">CAP theorem</a> we cannot choose consistency, availability and partition tolerance at the same time. In most cases choosing availability and partition tolerance is a must, so we need to find a solution other than a distributed transaction that requires traditional consistency. This solution will lead to an eventual consistency.</span></p>
<p class="gmail-p2" style="font-family: "Helvetica Neue"; font-size: medium; font-stretch: normal; font-variant-east-asian: normal; font-variant-numeric: normal; line-height: normal; margin: 0px; min-height: 14px;"><span style="font-weight: normal;"> </span></p>
<p class="gmail-p1" style="font-family: "Helvetica Neue"; font-size: medium; font-stretch: normal; font-variant-east-asian: normal; font-variant-numeric: normal; line-height: normal; margin: 0px;"><span style="font-weight: normal;">The main problem resides in above mentioned points is the strong coupling of different services. Could there be a better way to decouple services truly?</span></p>
<p class="gmail-p2" style="font-family: "Helvetica Neue"; font-size: medium; font-stretch: normal; font-variant-east-asian: normal; font-variant-numeric: normal; line-height: normal; margin: 0px; min-height: 14px;"><span style="font-weight: normal;"> </span></p>
<p class="gmail-p1" style="font-family: "Helvetica Neue"; font-size: medium; font-stretch: normal; font-variant-east-asian: normal; font-variant-numeric: normal; line-height: normal; margin: 0px;"><span style="font-weight: normal;">And for the third problem above, scalability, could there be a way to remove the state from the service and scale much more easily?<span class="gmail-Apple-converted-space"> </span></span></p>
<h1><strong style="font-family: "times new roman", serif; font-size: 18.6667px;"><u>EDA comes to rescue:</u></strong></h1>
<p class="gmail-p2" style="font-family: "Helvetica Neue"; font-size: 12px; font-stretch: normal; font-variant-east-asian: normal; font-variant-numeric: normal; line-height: normal; margin: 0px; min-height: 14px;"><span style="font-size: medium; font-weight: normal;">An event-driven architecture (EDA), when implemented correctly, can be used to resolve the issues mentioned above. It leads to accomplish true decoupling of services, and to build to a better microservices architecture with more resilient services. In essence EDA helps to;</span></p>
<ul style="text-align: left;">
<li><span style="font-weight: normal;"><span style="font-size: medium; font-weight: normal;">Create resilient services, as a service has no direct communication with other services. When a target service is down, it will not affect the caller service because of the decoupling.</span></span></li>
<li><span style="font-weight: normal;"><span style="font-size: medium; font-weight: normal;">Use asynchronous communication between services. A target service will produce/create an event at a time. Then the caller service can consume/read that event at a later time. It also allows to adjust the consumption according to caller service processing power and leads to replay the events if needed.</span></span></li>
<li><span style="font-weight: normal;"><span style="font-size: medium; font-weight: normal;">Favour to use a state store for all services, removing the state from service and leading to better scalability.</span></span></li>
</ul>
<p class="gmail-p1" style="font-family: "Helvetica Neue"; font-size: 12px; font-stretch: normal; font-variant-east-asian: normal; font-variant-numeric: normal; line-height: normal; margin: 0px; min-height: 14px;"><span style="font-size: medium; font-weight: normal;">To better explain how EDA helps to create more resilient and asynchronous communicated services, let’s go into the details of EDA a bit.</span></p>
<p class="gmail-p2" style="font-family: "Helvetica Neue"; font-stretch: normal; font-variant-east-asian: normal; font-variant-numeric: normal; line-height: normal; margin: 0px; min-height: 14px; text-align: left;"><span style="font-weight: normal;"><span style="font-size: small;"> </span></span></p>
<p class="gmail-p1" style="font-family: "Helvetica Neue"; font-stretch: normal; font-variant-east-asian: normal; font-variant-numeric: normal; line-height: normal; margin: 0px; text-align: left;"><span style="font-weight: normal;"><span style="font-size: medium; font-weight: normal;">First of all, let’s discuss what is an event. An event is basically a change of state on the system that can be recognized, reacted and processed.</span></span></p>
<p class="gmail-p1" style="font-family: "Helvetica Neue"; font-stretch: normal; font-variant-east-asian: normal; font-variant-numeric: normal; line-height: normal; margin: 0px; text-align: left;"><span style="font-weight: normal;"><span style="font-size: medium; font-weight: normal;">Since the events are the core components of EDA, we can ask how events help EDA to be asynchronous and non-blocking? An event is always created by a producer, and can be consumed by one or more consumers. The important thing is that those producers and consumers are completely decoupled and don't need to know each other. An event can directly go to a subscribed consumer or go to an event store if used, such as <a href="https://kafka.apache.org/">Kafka</a>, which is the preferred way most of the time. In any case, events will be one-way, and never expect a response. Consider a communication that uses Http protocol, such as Rest. Such an Http call needs to include a request and a corresponding response which be a synchronous operation. Since an event never needs a response, an architecture that uses it such as EDA will naturally be a non-blocking/asynchronous system.</span></span></p>
<p class="gmail-p2" style="font-family: "Helvetica Neue"; font-stretch: normal; font-variant-east-asian: normal; font-variant-numeric: normal; line-height: normal; margin: 0px; min-height: 14px; text-align: left;"><span style="font-weight: normal;"><span style="font-size: small;"> </span></span></p>
<p class="gmail-p1" style="font-family: "Helvetica Neue"; font-stretch: normal; font-variant-east-asian: normal; font-variant-numeric: normal; line-height: normal; margin: 0px; text-align: left;"><span style="font-weight: normal;"><span style="font-size: medium; font-weight: normal;">Using an event store in EDA will make the things easier, as all producers and consumers only need to know about the event store. Besides, by keeping all events in the event store we can make the services truly stateless. That will then lead to truly scalable services as without a state creating a new instance of a service will be much easier. When we say an event store that is used by all producers and consumers, you may think that we are creating another single point of failure. That might be true if the event store solution is not an easily scalable and resilient solution.</span></span></p>
<p class="gmail-p2" style="font-family: "Helvetica Neue"; font-stretch: normal; font-variant-east-asian: normal; font-variant-numeric: normal; line-height: normal; margin: 0px; min-height: 14px; text-align: left;"><span style="font-weight: normal;"><span style="font-size: small;"> </span></span></p>
<p class="gmail-p1" style="font-family: "Helvetica Neue"; font-stretch: normal; font-variant-east-asian: normal; font-variant-numeric: normal; line-height: normal; margin: 0px; text-align: left;"><span style="font-weight: normal;"><span style="font-size: medium; font-weight: normal;">I would favour Kafka at this point as an event store, being an event-log, and a fault-tolerant and naturally scaling solution thanks to built-in partioning. From the Kafka documentation;</span></span></p>
<p class="gmail-p1" style="font-family: "Helvetica Neue"; font-stretch: normal; font-variant-east-asian: normal; font-variant-numeric: normal; line-height: normal; margin: 0px; text-align: left;"> </p>
<p class="gmail-p1" style="font-family: "Helvetica Neue"; font-stretch: normal; font-variant-east-asian: normal; font-variant-numeric: normal; line-height: normal; margin: 0px;"><span style="background-color: #d6eaf8; border-radius: 5px; color: #111212; display: inline-block; font-size: small; font-weight: normal;"><span class="gmail-s3" style="border-radius: 5px; color: #111212; display: inline-block; font-weight: normal; ont-size: medium; padding: 3px 10px;"><a href="http://martinfowler.com/eaaDev/EventSourcing.html">Event sourcing</a></span><span style="font-size: medium; font-weight: normal;">is a style of application design where state changes are logged as a time ordered sequence of records. Kafka's support for very large stored log data makes it an excellent backend for an application built in this style.</span></span></p>
<p class="gmail-p1" style="font-family: "Helvetica Neue"; font-stretch: normal; font-variant-east-asian: normal; font-variant-numeric: normal; line-height: normal; margin: 0px;"> </p>
<p class="gmail-p1" style="font-family: "Helvetica Neue"; font-stretch: normal; font-variant-east-asian: normal; font-variant-numeric: normal; line-height: normal; margin: 0px;"><span style="font-weight: normal;"><span style="font-size: medium; font-weight: normal;">Note that, any new type of event will be a corresponding topic in kafka terms.</span></span></p><p class="gmail-p1" style="font-family: "Helvetica Neue"; font-stretch: normal; font-variant-east-asian: normal; font-variant-numeric: normal; line-height: normal; margin: 0px;"><span style="font-weight: normal;"><span style="font-size: medium; font-weight: normal;"><br /></span></span></p><p class="gmail-p1" style="font-family: "Helvetica Neue"; font-stretch: normal; font-variant-east-asian: normal; font-variant-numeric: normal; line-height: normal; margin: 0px;"><span style="font-weight: normal;"><span style="font-size: medium; font-weight: normal;">Let's leave the details of Kafka, as general and as an event store, for another post and continue with the details of EDA.</span></span></p><p class="gmail-p1" style="font-family: "Helvetica Neue"; font-stretch: normal; font-variant-east-asian: normal; font-variant-numeric: normal; line-height: normal; margin: 0px;"><span style="font-weight: normal;"><span style="font-size: medium; font-weight: normal;"><br /></span></span></p><p class="gmail-p1" style="font-family: "Helvetica Neue"; font-stretch: normal; font-variant-east-asian: normal; font-variant-numeric: normal; line-height: normal; margin: 0px;"><span style="font-weight: normal;"><span style="font-size: medium; font-weight: normal;">With a scalable and resilient event store, consumers will be able to replay an event, favouring availability of the system, when there is an error or simply when they are offline.<span class="gmail-Apple-converted-space"> </span></span></span></p>
<p class="gmail-p1" style="font-family: "Helvetica Neue"; font-stretch: normal; font-variant-east-asian: normal; font-variant-numeric: normal; line-height: normal; margin: 0px;"><span style="font-weight: normal;"><span style="font-size: small;"> </span></span></p>
<p class="gmail-p1" style="font-family: "Helvetica Neue"; font-stretch: normal; font-variant-east-asian: normal; font-variant-numeric: normal; line-height: normal; margin: 0px;"><span style="font-weight: normal;"><span style="font-size: medium; font-weight: normal;">One important aspect of an event is that it must be immutable. Therefore the event store should also support immutability, which can be achieved by the concept of event logs. In an event log you cannot change and delete an event after it occurred. Any update to the state of an application will be a new event. The latest state of an application can be obtained by replaying the events in all history.<span class="gmail-Apple-converted-space"> </span></span></span></p>
<p class="gmail-p2" style="font-family: "Helvetica Neue"; font-stretch: normal; font-variant-east-asian: normal; font-variant-numeric: normal; line-height: normal; margin: 0px; min-height: 14px;"><br /></p>
<p class="gmail-p1" style="font-family: "Helvetica Neue"; font-stretch: normal; font-variant-east-asian: normal; font-variant-numeric: normal; line-height: normal; margin: 0px;"><span style="font-weight: normal;"><span style="font-size: medium; font-weight: normal;">Now, let’s remember the issues we listed at the beginning of this post. We asked;</span></span></p>
<ul style="text-align: left;">
<li><span style="font-size: medium; font-weight: normal;">Could there be a better way to decouple services truly?</span></li>
<li><span style="font-size: medium; font-weight: normal;">Could there be a way to remove the state from the service and scale much more easily?<span class="gmail-Apple-converted-space" style="font-family: 'Helvetica Neue';"> </span></span></li>
</ul>
<p class="gmail-p1" style="font-family: "Helvetica Neue"; font-stretch: normal; font-variant-east-asian: normal; font-variant-numeric: normal; line-height: normal; margin: 0px;"><span style="font-weight: normal;"><span style="font-size: medium; font-weight: normal;">And pointed the problems about;</span></span></p>
<ul style="text-align: left;">
<li><span style="font-weight: normal;"><span style="font-size: medium; font-weight: normal;">Sharing data</span></span></li>
<li><span style="font-weight: normal;"><span style="font-size: medium; font-weight: normal;">Transactions across services</span></span></li>
<li><span style="font-weight: normal;"><span style="font-size: medium; font-weight: normal;">Scaling</span></span></li>
</ul>
<p class="gmail-p2" style="font-family: "Helvetica Neue"; font-size: 12px; font-stretch: normal; font-variant-east-asian: normal; font-variant-numeric: normal; line-height: normal; margin: 0px; min-height: 14px;"> </p>
<p class="gmail-p1" style="font-family: "Helvetica Neue"; font-stretch: normal; font-variant-east-asian: normal; font-variant-numeric: normal; line-height: normal; margin: 0px;"><span style="font-weight: normal;"><span style="font-size: medium; font-weight: normal;">Here are the solutions to these problems by EDA;</span></span></p>
<ul style="text-align: left;">
<li><span style="font-weight: normal;"><span style="font-size: medium; font-weight: normal;">Truly decouple the services. They don’t need to know about each other. Being producers and consumers that are creating and consuming events, the services only need to know about the event store.</span></span></li>
<li><span style="font-weight: normal;"><span style="font-size: medium; font-weight: normal;">As the states will be logged in the event store, the stateless services can easily scale by just creating new instances.</span></span></li>
<li><span style="font-weight: normal;"><span style="font-size: medium; font-weight: normal;">Can share data asynchronously using events and an event store. Note that a materialized view is always an option for pre-loaded joined data, across services. This materialized views can be constructed as a local database. To keep this view up to date a consumer needs to be defined by subscribing to the corresponding event in the event store.</span></span></li>
<li><span style="font-weight: normal;"><span style="font-size: medium; font-weight: normal;">Can handle transactions that span multiple services in an eventual consistency manner using events. Such as a producer creates an event for a change and the corresponding consumer will react to this event to complete a transaction asynchronously.</span></span></li>
</ul>
<p class="gmail-p1" style="font-family: "Helvetica Neue"; font-stretch: normal; font-variant-east-asian: normal; font-variant-numeric: normal; line-height: normal; margin: 0px;"><span style="font-weight: normal;"><span style="font-size: medium; font-weight: normal;">Additionally, EDA has also below benefits for a microservices architecture if implemented with a sophisticated event broker.</span></span></p>
<ul style="text-align: left;">
<li><span style="font-weight: normal;"><span style="font-size: medium; font-weight: normal;">Easy asynchronous communication of services</span></span></li>
<li><span style="font-weight: normal;"><span style="font-size: medium; font-weight: normal;">No Api change issue, as no direct call between services</span></span></li>
<li><span style="font-weight: normal;"><span style="font-size: medium; font-weight: normal;">Independent development of components, i.e; no API dependency to other services</span></span></li>
<li><span style="font-weight: normal;"><span style="font-size: medium; font-weight: normal;">Better resiliency and fault-tolerant</span></span></li>
<li><span style="font-weight: normal;"><span style="font-size: medium; font-weight: normal;">Better scaling with stateless services</span></span></li>
<li><span style="font-weight: normal;"><span style="font-size: medium; font-weight: normal;">Reduced complexity by giving some responsibilities to event broker</span></span></li>
</ul>
<p class="gmail-p2" style="font-family: "Helvetica Neue"; font-size: 12px; font-stretch: normal; font-variant-east-asian: normal; font-variant-numeric: normal; line-height: normal; margin: 0px; min-height: 14px;"><strong style="font-family: "times new roman", serif; font-size: 18.6667px;"><u>Conclusion:</u></strong></p>
<p class="gmail-p2" style="font-family: "Helvetica Neue"; font-size: 12px; font-stretch: normal; font-variant-east-asian: normal; font-variant-numeric: normal; line-height: normal; margin: 0px; min-height: 14px;"> </p>
<p class="gmail-p1" style="font-family: "Helvetica Neue"; font-stretch: normal; font-variant-east-asian: normal; font-variant-numeric: normal; line-height: normal; margin: 0px;"><span style="font-weight: normal;"><span style="font-size: medium; font-weight: normal;">Having the ability to create truly decoupled services, EDA is a perfect match for reliable, fault-tolerant and better scalable microservices architecture by solving general issues raised like communication of services and api changes. Events can be any real time changed state, such as signals created by sensors, dropped packets on networks, security violations on file systems, or creating tweets on twitter. EDA can be used in all types of applications that can be pictured using events.</span></span></p>
<p class="gmail-p1" style="font-family: "Helvetica Neue"; font-stretch: normal; font-variant-east-asian: normal; font-variant-numeric: normal; line-height: normal; margin: 0px;"><span style="font-weight: normal;"><span style="font-size: medium; font-weight: normal;">As you can imagine not all systems can completely fit into an event driven, asynchronous and eventual consistent architecture. In that case EDA can be combined with a synchronous solution like REST in case there is a need to do an operation with traditional consistency manner, following <a href="https://en.wikipedia.org/wiki/ACID">ACID transactions</a>.</span></span></p>
<p class="gmail-p1" style="font-family: "Helvetica Neue"; font-stretch: normal; font-variant-east-asian: normal; font-variant-numeric: normal; line-height: normal; margin: 0px;"><span style="font-weight: normal;"><span style="font-size: small;"> </span></span></p>
<p class="gmail-p1" style="font-family: "Helvetica Neue"; font-stretch: normal; font-variant-east-asian: normal; font-variant-numeric: normal; line-height: normal; margin: 0px;"><span><span><b>If you want to see an event-driven microservices architecture in live, you can check my course on udemy: <a href="https://www.udemy.com/course/event-driven-microservices-spring-boot-kafka-and-elasticsearch/?couponCode=0EA4EEB1F42BDC52BEBC" target="_blank">Event-Driven Microservices: Spring Boot, Kafka and Elasticsearch</a></b></span></span></p><p class="gmail-p1" style="font-family: "Helvetica Neue"; font-stretch: normal; font-variant-east-asian: normal; font-variant-numeric: normal; line-height: normal; margin: 0px;"><span><span><br /></span></span></p><p class="gmail-p1" style="font-family: "Helvetica Neue"; font-stretch: normal; font-variant-east-asian: normal; font-variant-numeric: normal; line-height: normal; margin: 0px;"><span><span><br /></span></span></p><p class="gmail-p1" style="font-family: "Helvetica Neue"; font-stretch: normal; font-variant-east-asian: normal; font-variant-numeric: normal; line-height: normal; margin: 0px;"><span><span><br /></span></span></p><p class="gmail-p1" style="font-family: "Helvetica Neue"; font-stretch: normal; font-variant-east-asian: normal; font-variant-numeric: normal; line-height: normal; margin: 0px;"><span><span><br /></span></span></p><p class="gmail-p1" style="font-family: "Helvetica Neue"; font-stretch: normal; font-variant-east-asian: normal; font-variant-numeric: normal; line-height: normal; margin: 0px;"><span><span><br /></span></span></p><p class="gmail-p1" style="font-family: "Helvetica Neue"; font-stretch: normal; font-variant-east-asian: normal; font-variant-numeric: normal; line-height: normal; margin: 0px;"><span><span><br /></span></span></p><p class="gmail-p1" style="font-family: "Helvetica Neue"; font-stretch: normal; font-variant-east-asian: normal; font-variant-numeric: normal; line-height: normal; margin: 0px;"><span><span><br /></span></span></p><p class="gmail-p1" style="font-family: "Helvetica Neue"; font-stretch: normal; font-variant-east-asian: normal; font-variant-numeric: normal; line-height: normal; margin: 0px;"><span><span><br /></span></span></p>Ali Gelenlerhttp://www.blogger.com/profile/09439697648573423668noreply@blogger.com5tag:blogger.com,1999:blog-3858181542467916490.post-61012931341294452402019-08-24T15:11:00.000+03:002019-09-23T22:28:16.727+03:00Understanding Type of References in Java<b style="font-family: "times new roman", serif; font-size: 18.6667px;"><u>Introduction:</u></b><br />
<b style="font-family: "times new roman", serif; font-size: 18.6667px;"><u><br /></u></b>
<span style="font-family: "times new roman" , serif; font-size: 16px;"> </span><span style="font-size: small;">There are four types of references in Java and for each of them garbage
collector behaves differently.</span><br />
<!--[if gte mso 9]><xml>
<o:OfficeDocumentSettings>
<o:AllowPNG/>
</o:OfficeDocumentSettings>
</xml><![endif]-->
<!--[if gte mso 9]><xml>
<w:WordDocument>
<w:View>Normal</w:View>
<w:Zoom>0</w:Zoom>
<w:TrackMoves/>
<w:TrackFormatting/>
<w:PunctuationKerning/>
<w:ValidateAgainstSchemas/>
<w:SaveIfXMLInvalid>false</w:SaveIfXMLInvalid>
<w:IgnoreMixedContent>false</w:IgnoreMixedContent>
<w:AlwaysShowPlaceholderText>false</w:AlwaysShowPlaceholderText>
<w:DoNotPromoteQF/>
<w:LidThemeOther>EN-US</w:LidThemeOther>
<w:LidThemeAsian>X-NONE</w:LidThemeAsian>
<w:LidThemeComplexScript>X-NONE</w:LidThemeComplexScript>
<w:Compatibility>
<w:BreakWrappedTables/>
<w:SnapToGridInCell/>
<w:WrapTextWithPunct/>
<w:UseAsianBreakRules/>
<w:DontGrowAutofit/>
<w:SplitPgBreakAndParaMark/>
<w:EnableOpenTypeKerning/>
<w:DontFlipMirrorIndents/>
<w:OverrideTableStyleHps/>
</w:Compatibility>
<m:mathPr>
<m:mathFont m:val="Cambria Math"/>
<m:brkBin m:val="before"/>
<m:brkBinSub m:val="--"/>
<m:smallFrac m:val="off"/>
<m:dispDef/>
<m:lMargin m:val="0"/>
<m:rMargin m:val="0"/>
<m:defJc m:val="centerGroup"/>
<m:wrapIndent m:val="1440"/>
<m:intLim m:val="subSup"/>
<m:naryLim m:val="undOvr"/>
</m:mathPr></w:WordDocument>
</xml><![endif]--><!--[if gte mso 9]><xml>
<w:LatentStyles DefLockedState="false" DefUnhideWhenUsed="false"
DefSemiHidden="false" DefQFormat="false" DefPriority="99"
LatentStyleCount="376">
<w:LsdException Locked="false" Priority="0" QFormat="true" Name="Normal"/>
<w:LsdException Locked="false" Priority="9" QFormat="true" Name="heading 1"/>
<w:LsdException Locked="false" Priority="9" SemiHidden="true"
UnhideWhenUsed="true" QFormat="true" Name="heading 2"/>
<w:LsdException Locked="false" Priority="9" SemiHidden="true"
UnhideWhenUsed="true" QFormat="true" Name="heading 3"/>
<w:LsdException Locked="false" Priority="9" SemiHidden="true"
UnhideWhenUsed="true" QFormat="true" Name="heading 4"/>
<w:LsdException Locked="false" Priority="9" SemiHidden="true"
UnhideWhenUsed="true" QFormat="true" Name="heading 5"/>
<w:LsdException Locked="false" Priority="9" SemiHidden="true"
UnhideWhenUsed="true" QFormat="true" Name="heading 6"/>
<w:LsdException Locked="false" Priority="9" SemiHidden="true"
UnhideWhenUsed="true" QFormat="true" Name="heading 7"/>
<w:LsdException Locked="false" Priority="9" SemiHidden="true"
UnhideWhenUsed="true" QFormat="true" Name="heading 8"/>
<w:LsdException Locked="false" Priority="9" SemiHidden="true"
UnhideWhenUsed="true" QFormat="true" Name="heading 9"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="index 1"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="index 2"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="index 3"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="index 4"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="index 5"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="index 6"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="index 7"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="index 8"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="index 9"/>
<w:LsdException Locked="false" Priority="39" SemiHidden="true"
UnhideWhenUsed="true" Name="toc 1"/>
<w:LsdException Locked="false" Priority="39" SemiHidden="true"
UnhideWhenUsed="true" Name="toc 2"/>
<w:LsdException Locked="false" Priority="39" SemiHidden="true"
UnhideWhenUsed="true" Name="toc 3"/>
<w:LsdException Locked="false" Priority="39" SemiHidden="true"
UnhideWhenUsed="true" Name="toc 4"/>
<w:LsdException Locked="false" Priority="39" SemiHidden="true"
UnhideWhenUsed="true" Name="toc 5"/>
<w:LsdException Locked="false" Priority="39" SemiHidden="true"
UnhideWhenUsed="true" Name="toc 6"/>
<w:LsdException Locked="false" Priority="39" SemiHidden="true"
UnhideWhenUsed="true" Name="toc 7"/>
<w:LsdException Locked="false" Priority="39" SemiHidden="true"
UnhideWhenUsed="true" Name="toc 8"/>
<w:LsdException Locked="false" Priority="39" SemiHidden="true"
UnhideWhenUsed="true" Name="toc 9"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="Normal Indent"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="footnote text"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="annotation text"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="header"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="footer"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="index heading"/>
<w:LsdException Locked="false" Priority="35" SemiHidden="true"
UnhideWhenUsed="true" QFormat="true" Name="caption"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="table of figures"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="envelope address"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="envelope return"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="footnote reference"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="annotation reference"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="line number"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="page number"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="endnote reference"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="endnote text"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="table of authorities"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="macro"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="toa heading"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="List"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="List Bullet"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="List Number"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="List 2"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="List 3"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="List 4"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="List 5"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="List Bullet 2"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="List Bullet 3"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="List Bullet 4"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="List Bullet 5"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="List Number 2"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="List Number 3"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="List Number 4"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="List Number 5"/>
<w:LsdException Locked="false" Priority="10" QFormat="true" Name="Title"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="Closing"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="Signature"/>
<w:LsdException Locked="false" Priority="1" SemiHidden="true"
UnhideWhenUsed="true" Name="Default Paragraph Font"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="Body Text"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="Body Text Indent"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="List Continue"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="List Continue 2"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="List Continue 3"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="List Continue 4"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="List Continue 5"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="Message Header"/>
<w:LsdException Locked="false" Priority="11" QFormat="true" Name="Subtitle"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="Salutation"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="Date"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="Body Text First Indent"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="Body Text First Indent 2"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="Note Heading"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="Body Text 2"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="Body Text 3"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="Body Text Indent 2"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="Body Text Indent 3"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="Block Text"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="Hyperlink"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="FollowedHyperlink"/>
<w:LsdException Locked="false" Priority="22" QFormat="true" Name="Strong"/>
<w:LsdException Locked="false" Priority="20" QFormat="true" Name="Emphasis"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="Document Map"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="Plain Text"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="E-mail Signature"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="HTML Top of Form"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="HTML Bottom of Form"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="Normal (Web)"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="HTML Acronym"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="HTML Address"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="HTML Cite"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="HTML Code"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="HTML Definition"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="HTML Keyboard"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
QFormat="true" Name="HTML Preformatted"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="HTML Sample"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="HTML Typewriter"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="HTML Variable"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="Normal Table"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="annotation subject"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="No List"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="Outline List 1"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="Outline List 2"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="Outline List 3"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="Table Simple 1"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="Table Simple 2"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="Table Simple 3"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="Table Classic 1"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="Table Classic 2"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="Table Classic 3"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="Table Classic 4"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="Table Colorful 1"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="Table Colorful 2"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="Table Colorful 3"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="Table Columns 1"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="Table Columns 2"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="Table Columns 3"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="Table Columns 4"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="Table Columns 5"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="Table Grid 1"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="Table Grid 2"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="Table Grid 3"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="Table Grid 4"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="Table Grid 5"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="Table Grid 6"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="Table Grid 7"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="Table Grid 8"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="Table List 1"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="Table List 2"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="Table List 3"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="Table List 4"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="Table List 5"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="Table List 6"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="Table List 7"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="Table List 8"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="Table 3D effects 1"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="Table 3D effects 2"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="Table 3D effects 3"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="Table Contemporary"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="Table Elegant"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="Table Professional"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="Table Subtle 1"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="Table Subtle 2"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="Table Web 1"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="Table Web 2"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="Table Web 3"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="Balloon Text"/>
<w:LsdException Locked="false" Priority="39" Name="Table Grid"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="Table Theme"/>
<w:LsdException Locked="false" SemiHidden="true" Name="Placeholder Text"/>
<w:LsdException Locked="false" Priority="1" QFormat="true" Name="No Spacing"/>
<w:LsdException Locked="false" Priority="60" Name="Light Shading"/>
<w:LsdException Locked="false" Priority="61" Name="Light List"/>
<w:LsdException Locked="false" Priority="62" Name="Light Grid"/>
<w:LsdException Locked="false" Priority="63" Name="Medium Shading 1"/>
<w:LsdException Locked="false" Priority="64" Name="Medium Shading 2"/>
<w:LsdException Locked="false" Priority="65" Name="Medium List 1"/>
<w:LsdException Locked="false" Priority="66" Name="Medium List 2"/>
<w:LsdException Locked="false" Priority="67" Name="Medium Grid 1"/>
<w:LsdException Locked="false" Priority="68" Name="Medium Grid 2"/>
<w:LsdException Locked="false" Priority="69" Name="Medium Grid 3"/>
<w:LsdException Locked="false" Priority="70" Name="Dark List"/>
<w:LsdException Locked="false" Priority="71" Name="Colorful Shading"/>
<w:LsdException Locked="false" Priority="72" Name="Colorful List"/>
<w:LsdException Locked="false" Priority="73" Name="Colorful Grid"/>
<w:LsdException Locked="false" Priority="60" Name="Light Shading Accent 1"/>
<w:LsdException Locked="false" Priority="61" Name="Light List Accent 1"/>
<w:LsdException Locked="false" Priority="62" Name="Light Grid Accent 1"/>
<w:LsdException Locked="false" Priority="63" Name="Medium Shading 1 Accent 1"/>
<w:LsdException Locked="false" Priority="64" Name="Medium Shading 2 Accent 1"/>
<w:LsdException Locked="false" Priority="65" Name="Medium List 1 Accent 1"/>
<w:LsdException Locked="false" SemiHidden="true" Name="Revision"/>
<w:LsdException Locked="false" Priority="34" QFormat="true"
Name="List Paragraph"/>
<w:LsdException Locked="false" Priority="29" QFormat="true" Name="Quote"/>
<w:LsdException Locked="false" Priority="30" QFormat="true"
Name="Intense Quote"/>
<w:LsdException Locked="false" Priority="66" Name="Medium List 2 Accent 1"/>
<w:LsdException Locked="false" Priority="67" Name="Medium Grid 1 Accent 1"/>
<w:LsdException Locked="false" Priority="68" Name="Medium Grid 2 Accent 1"/>
<w:LsdException Locked="false" Priority="69" Name="Medium Grid 3 Accent 1"/>
<w:LsdException Locked="false" Priority="70" Name="Dark List Accent 1"/>
<w:LsdException Locked="false" Priority="71" Name="Colorful Shading Accent 1"/>
<w:LsdException Locked="false" Priority="72" Name="Colorful List Accent 1"/>
<w:LsdException Locked="false" Priority="73" Name="Colorful Grid Accent 1"/>
<w:LsdException Locked="false" Priority="60" Name="Light Shading Accent 2"/>
<w:LsdException Locked="false" Priority="61" Name="Light List Accent 2"/>
<w:LsdException Locked="false" Priority="62" Name="Light Grid Accent 2"/>
<w:LsdException Locked="false" Priority="63" Name="Medium Shading 1 Accent 2"/>
<w:LsdException Locked="false" Priority="64" Name="Medium Shading 2 Accent 2"/>
<w:LsdException Locked="false" Priority="65" Name="Medium List 1 Accent 2"/>
<w:LsdException Locked="false" Priority="66" Name="Medium List 2 Accent 2"/>
<w:LsdException Locked="false" Priority="67" Name="Medium Grid 1 Accent 2"/>
<w:LsdException Locked="false" Priority="68" Name="Medium Grid 2 Accent 2"/>
<w:LsdException Locked="false" Priority="69" Name="Medium Grid 3 Accent 2"/>
<w:LsdException Locked="false" Priority="70" Name="Dark List Accent 2"/>
<w:LsdException Locked="false" Priority="71" Name="Colorful Shading Accent 2"/>
<w:LsdException Locked="false" Priority="72" Name="Colorful List Accent 2"/>
<w:LsdException Locked="false" Priority="73" Name="Colorful Grid Accent 2"/>
<w:LsdException Locked="false" Priority="60" Name="Light Shading Accent 3"/>
<w:LsdException Locked="false" Priority="61" Name="Light List Accent 3"/>
<w:LsdException Locked="false" Priority="62" Name="Light Grid Accent 3"/>
<w:LsdException Locked="false" Priority="63" Name="Medium Shading 1 Accent 3"/>
<w:LsdException Locked="false" Priority="64" Name="Medium Shading 2 Accent 3"/>
<w:LsdException Locked="false" Priority="65" Name="Medium List 1 Accent 3"/>
<w:LsdException Locked="false" Priority="66" Name="Medium List 2 Accent 3"/>
<w:LsdException Locked="false" Priority="67" Name="Medium Grid 1 Accent 3"/>
<w:LsdException Locked="false" Priority="68" Name="Medium Grid 2 Accent 3"/>
<w:LsdException Locked="false" Priority="69" Name="Medium Grid 3 Accent 3"/>
<w:LsdException Locked="false" Priority="70" Name="Dark List Accent 3"/>
<w:LsdException Locked="false" Priority="71" Name="Colorful Shading Accent 3"/>
<w:LsdException Locked="false" Priority="72" Name="Colorful List Accent 3"/>
<w:LsdException Locked="false" Priority="73" Name="Colorful Grid Accent 3"/>
<w:LsdException Locked="false" Priority="60" Name="Light Shading Accent 4"/>
<w:LsdException Locked="false" Priority="61" Name="Light List Accent 4"/>
<w:LsdException Locked="false" Priority="62" Name="Light Grid Accent 4"/>
<w:LsdException Locked="false" Priority="63" Name="Medium Shading 1 Accent 4"/>
<w:LsdException Locked="false" Priority="64" Name="Medium Shading 2 Accent 4"/>
<w:LsdException Locked="false" Priority="65" Name="Medium List 1 Accent 4"/>
<w:LsdException Locked="false" Priority="66" Name="Medium List 2 Accent 4"/>
<w:LsdException Locked="false" Priority="67" Name="Medium Grid 1 Accent 4"/>
<w:LsdException Locked="false" Priority="68" Name="Medium Grid 2 Accent 4"/>
<w:LsdException Locked="false" Priority="69" Name="Medium Grid 3 Accent 4"/>
<w:LsdException Locked="false" Priority="70" Name="Dark List Accent 4"/>
<w:LsdException Locked="false" Priority="71" Name="Colorful Shading Accent 4"/>
<w:LsdException Locked="false" Priority="72" Name="Colorful List Accent 4"/>
<w:LsdException Locked="false" Priority="73" Name="Colorful Grid Accent 4"/>
<w:LsdException Locked="false" Priority="60" Name="Light Shading Accent 5"/>
<w:LsdException Locked="false" Priority="61" Name="Light List Accent 5"/>
<w:LsdException Locked="false" Priority="62" Name="Light Grid Accent 5"/>
<w:LsdException Locked="false" Priority="63" Name="Medium Shading 1 Accent 5"/>
<w:LsdException Locked="false" Priority="64" Name="Medium Shading 2 Accent 5"/>
<w:LsdException Locked="false" Priority="65" Name="Medium List 1 Accent 5"/>
<w:LsdException Locked="false" Priority="66" Name="Medium List 2 Accent 5"/>
<w:LsdException Locked="false" Priority="67" Name="Medium Grid 1 Accent 5"/>
<w:LsdException Locked="false" Priority="68" Name="Medium Grid 2 Accent 5"/>
<w:LsdException Locked="false" Priority="69" Name="Medium Grid 3 Accent 5"/>
<w:LsdException Locked="false" Priority="70" Name="Dark List Accent 5"/>
<w:LsdException Locked="false" Priority="71" Name="Colorful Shading Accent 5"/>
<w:LsdException Locked="false" Priority="72" Name="Colorful List Accent 5"/>
<w:LsdException Locked="false" Priority="73" Name="Colorful Grid Accent 5"/>
<w:LsdException Locked="false" Priority="60" Name="Light Shading Accent 6"/>
<w:LsdException Locked="false" Priority="61" Name="Light List Accent 6"/>
<w:LsdException Locked="false" Priority="62" Name="Light Grid Accent 6"/>
<w:LsdException Locked="false" Priority="63" Name="Medium Shading 1 Accent 6"/>
<w:LsdException Locked="false" Priority="64" Name="Medium Shading 2 Accent 6"/>
<w:LsdException Locked="false" Priority="65" Name="Medium List 1 Accent 6"/>
<w:LsdException Locked="false" Priority="66" Name="Medium List 2 Accent 6"/>
<w:LsdException Locked="false" Priority="67" Name="Medium Grid 1 Accent 6"/>
<w:LsdException Locked="false" Priority="68" Name="Medium Grid 2 Accent 6"/>
<w:LsdException Locked="false" Priority="69" Name="Medium Grid 3 Accent 6"/>
<w:LsdException Locked="false" Priority="70" Name="Dark List Accent 6"/>
<w:LsdException Locked="false" Priority="71" Name="Colorful Shading Accent 6"/>
<w:LsdException Locked="false" Priority="72" Name="Colorful List Accent 6"/>
<w:LsdException Locked="false" Priority="73" Name="Colorful Grid Accent 6"/>
<w:LsdException Locked="false" Priority="19" QFormat="true"
Name="Subtle Emphasis"/>
<w:LsdException Locked="false" Priority="21" QFormat="true"
Name="Intense Emphasis"/>
<w:LsdException Locked="false" Priority="31" QFormat="true"
Name="Subtle Reference"/>
<w:LsdException Locked="false" Priority="32" QFormat="true"
Name="Intense Reference"/>
<w:LsdException Locked="false" Priority="33" QFormat="true" Name="Book Title"/>
<w:LsdException Locked="false" Priority="37" SemiHidden="true"
UnhideWhenUsed="true" Name="Bibliography"/>
<w:LsdException Locked="false" Priority="39" SemiHidden="true"
UnhideWhenUsed="true" QFormat="true" Name="TOC Heading"/>
<w:LsdException Locked="false" Priority="41" Name="Plain Table 1"/>
<w:LsdException Locked="false" Priority="42" Name="Plain Table 2"/>
<w:LsdException Locked="false" Priority="43" Name="Plain Table 3"/>
<w:LsdException Locked="false" Priority="44" Name="Plain Table 4"/>
<w:LsdException Locked="false" Priority="45" Name="Plain Table 5"/>
<w:LsdException Locked="false" Priority="40" Name="Grid Table Light"/>
<w:LsdException Locked="false" Priority="46" Name="Grid Table 1 Light"/>
<w:LsdException Locked="false" Priority="47" Name="Grid Table 2"/>
<w:LsdException Locked="false" Priority="48" Name="Grid Table 3"/>
<w:LsdException Locked="false" Priority="49" Name="Grid Table 4"/>
<w:LsdException Locked="false" Priority="50" Name="Grid Table 5 Dark"/>
<w:LsdException Locked="false" Priority="51" Name="Grid Table 6 Colorful"/>
<w:LsdException Locked="false" Priority="52" Name="Grid Table 7 Colorful"/>
<w:LsdException Locked="false" Priority="46"
Name="Grid Table 1 Light Accent 1"/>
<w:LsdException Locked="false" Priority="47" Name="Grid Table 2 Accent 1"/>
<w:LsdException Locked="false" Priority="48" Name="Grid Table 3 Accent 1"/>
<w:LsdException Locked="false" Priority="49" Name="Grid Table 4 Accent 1"/>
<w:LsdException Locked="false" Priority="50" Name="Grid Table 5 Dark Accent 1"/>
<w:LsdException Locked="false" Priority="51"
Name="Grid Table 6 Colorful Accent 1"/>
<w:LsdException Locked="false" Priority="52"
Name="Grid Table 7 Colorful Accent 1"/>
<w:LsdException Locked="false" Priority="46"
Name="Grid Table 1 Light Accent 2"/>
<w:LsdException Locked="false" Priority="47" Name="Grid Table 2 Accent 2"/>
<w:LsdException Locked="false" Priority="48" Name="Grid Table 3 Accent 2"/>
<w:LsdException Locked="false" Priority="49" Name="Grid Table 4 Accent 2"/>
<w:LsdException Locked="false" Priority="50" Name="Grid Table 5 Dark Accent 2"/>
<w:LsdException Locked="false" Priority="51"
Name="Grid Table 6 Colorful Accent 2"/>
<w:LsdException Locked="false" Priority="52"
Name="Grid Table 7 Colorful Accent 2"/>
<w:LsdException Locked="false" Priority="46"
Name="Grid Table 1 Light Accent 3"/>
<w:LsdException Locked="false" Priority="47" Name="Grid Table 2 Accent 3"/>
<w:LsdException Locked="false" Priority="48" Name="Grid Table 3 Accent 3"/>
<w:LsdException Locked="false" Priority="49" Name="Grid Table 4 Accent 3"/>
<w:LsdException Locked="false" Priority="50" Name="Grid Table 5 Dark Accent 3"/>
<w:LsdException Locked="false" Priority="51"
Name="Grid Table 6 Colorful Accent 3"/>
<w:LsdException Locked="false" Priority="52"
Name="Grid Table 7 Colorful Accent 3"/>
<w:LsdException Locked="false" Priority="46"
Name="Grid Table 1 Light Accent 4"/>
<w:LsdException Locked="false" Priority="47" Name="Grid Table 2 Accent 4"/>
<w:LsdException Locked="false" Priority="48" Name="Grid Table 3 Accent 4"/>
<w:LsdException Locked="false" Priority="49" Name="Grid Table 4 Accent 4"/>
<w:LsdException Locked="false" Priority="50" Name="Grid Table 5 Dark Accent 4"/>
<w:LsdException Locked="false" Priority="51"
Name="Grid Table 6 Colorful Accent 4"/>
<w:LsdException Locked="false" Priority="52"
Name="Grid Table 7 Colorful Accent 4"/>
<w:LsdException Locked="false" Priority="46"
Name="Grid Table 1 Light Accent 5"/>
<w:LsdException Locked="false" Priority="47" Name="Grid Table 2 Accent 5"/>
<w:LsdException Locked="false" Priority="48" Name="Grid Table 3 Accent 5"/>
<w:LsdException Locked="false" Priority="49" Name="Grid Table 4 Accent 5"/>
<w:LsdException Locked="false" Priority="50" Name="Grid Table 5 Dark Accent 5"/>
<w:LsdException Locked="false" Priority="51"
Name="Grid Table 6 Colorful Accent 5"/>
<w:LsdException Locked="false" Priority="52"
Name="Grid Table 7 Colorful Accent 5"/>
<w:LsdException Locked="false" Priority="46"
Name="Grid Table 1 Light Accent 6"/>
<w:LsdException Locked="false" Priority="47" Name="Grid Table 2 Accent 6"/>
<w:LsdException Locked="false" Priority="48" Name="Grid Table 3 Accent 6"/>
<w:LsdException Locked="false" Priority="49" Name="Grid Table 4 Accent 6"/>
<w:LsdException Locked="false" Priority="50" Name="Grid Table 5 Dark Accent 6"/>
<w:LsdException Locked="false" Priority="51"
Name="Grid Table 6 Colorful Accent 6"/>
<w:LsdException Locked="false" Priority="52"
Name="Grid Table 7 Colorful Accent 6"/>
<w:LsdException Locked="false" Priority="46" Name="List Table 1 Light"/>
<w:LsdException Locked="false" Priority="47" Name="List Table 2"/>
<w:LsdException Locked="false" Priority="48" Name="List Table 3"/>
<w:LsdException Locked="false" Priority="49" Name="List Table 4"/>
<w:LsdException Locked="false" Priority="50" Name="List Table 5 Dark"/>
<w:LsdException Locked="false" Priority="51" Name="List Table 6 Colorful"/>
<w:LsdException Locked="false" Priority="52" Name="List Table 7 Colorful"/>
<w:LsdException Locked="false" Priority="46"
Name="List Table 1 Light Accent 1"/>
<w:LsdException Locked="false" Priority="47" Name="List Table 2 Accent 1"/>
<w:LsdException Locked="false" Priority="48" Name="List Table 3 Accent 1"/>
<w:LsdException Locked="false" Priority="49" Name="List Table 4 Accent 1"/>
<w:LsdException Locked="false" Priority="50" Name="List Table 5 Dark Accent 1"/>
<w:LsdException Locked="false" Priority="51"
Name="List Table 6 Colorful Accent 1"/>
<w:LsdException Locked="false" Priority="52"
Name="List Table 7 Colorful Accent 1"/>
<w:LsdException Locked="false" Priority="46"
Name="List Table 1 Light Accent 2"/>
<w:LsdException Locked="false" Priority="47" Name="List Table 2 Accent 2"/>
<w:LsdException Locked="false" Priority="48" Name="List Table 3 Accent 2"/>
<w:LsdException Locked="false" Priority="49" Name="List Table 4 Accent 2"/>
<w:LsdException Locked="false" Priority="50" Name="List Table 5 Dark Accent 2"/>
<w:LsdException Locked="false" Priority="51"
Name="List Table 6 Colorful Accent 2"/>
<w:LsdException Locked="false" Priority="52"
Name="List Table 7 Colorful Accent 2"/>
<w:LsdException Locked="false" Priority="46"
Name="List Table 1 Light Accent 3"/>
<w:LsdException Locked="false" Priority="47" Name="List Table 2 Accent 3"/>
<w:LsdException Locked="false" Priority="48" Name="List Table 3 Accent 3"/>
<w:LsdException Locked="false" Priority="49" Name="List Table 4 Accent 3"/>
<w:LsdException Locked="false" Priority="50" Name="List Table 5 Dark Accent 3"/>
<w:LsdException Locked="false" Priority="51"
Name="List Table 6 Colorful Accent 3"/>
<w:LsdException Locked="false" Priority="52"
Name="List Table 7 Colorful Accent 3"/>
<w:LsdException Locked="false" Priority="46"
Name="List Table 1 Light Accent 4"/>
<w:LsdException Locked="false" Priority="47" Name="List Table 2 Accent 4"/>
<w:LsdException Locked="false" Priority="48" Name="List Table 3 Accent 4"/>
<w:LsdException Locked="false" Priority="49" Name="List Table 4 Accent 4"/>
<w:LsdException Locked="false" Priority="50" Name="List Table 5 Dark Accent 4"/>
<w:LsdException Locked="false" Priority="51"
Name="List Table 6 Colorful Accent 4"/>
<w:LsdException Locked="false" Priority="52"
Name="List Table 7 Colorful Accent 4"/>
<w:LsdException Locked="false" Priority="46"
Name="List Table 1 Light Accent 5"/>
<w:LsdException Locked="false" Priority="47" Name="List Table 2 Accent 5"/>
<w:LsdException Locked="false" Priority="48" Name="List Table 3 Accent 5"/>
<w:LsdException Locked="false" Priority="49" Name="List Table 4 Accent 5"/>
<w:LsdException Locked="false" Priority="50" Name="List Table 5 Dark Accent 5"/>
<w:LsdException Locked="false" Priority="51"
Name="List Table 6 Colorful Accent 5"/>
<w:LsdException Locked="false" Priority="52"
Name="List Table 7 Colorful Accent 5"/>
<w:LsdException Locked="false" Priority="46"
Name="List Table 1 Light Accent 6"/>
<w:LsdException Locked="false" Priority="47" Name="List Table 2 Accent 6"/>
<w:LsdException Locked="false" Priority="48" Name="List Table 3 Accent 6"/>
<w:LsdException Locked="false" Priority="49" Name="List Table 4 Accent 6"/>
<w:LsdException Locked="false" Priority="50" Name="List Table 5 Dark Accent 6"/>
<w:LsdException Locked="false" Priority="51"
Name="List Table 6 Colorful Accent 6"/>
<w:LsdException Locked="false" Priority="52"
Name="List Table 7 Colorful Accent 6"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="Mention"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="Smart Hyperlink"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="Hashtag"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="Unresolved Mention"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="Smart Link"/>
</w:LatentStyles>
</xml><![endif]-->
<style>
<!--
/* Font Definitions */
@font-face
{font-family:"Cambria Math";
panose-1:2 4 5 3 5 4 6 3 2 4;
mso-font-charset:0;
mso-generic-font-family:roman;
mso-font-pitch:variable;
mso-font-signature:-536870145 1107305727 0 0 415 0;}
@font-face
{font-family:Calibri;
panose-1:2 15 5 2 2 2 4 3 2 4;
mso-font-charset:0;
mso-generic-font-family:swiss;
mso-font-pitch:variable;
mso-font-signature:-536859905 -1073697537 9 0 511 0;}
/* Style Definitions */
p.MsoNormal, li.MsoNormal, div.MsoNormal
{mso-style-unhide:no;
mso-style-qformat:yes;
mso-style-parent:"";
margin:0cm;
margin-bottom:.0001pt;
mso-pagination:widow-orphan;
font-size:12.0pt;
font-family:"Calibri",sans-serif;
mso-ascii-font-family:Calibri;
mso-ascii-theme-font:minor-latin;
mso-fareast-font-family:Calibri;
mso-fareast-theme-font:minor-latin;
mso-hansi-font-family:Calibri;
mso-hansi-theme-font:minor-latin;
mso-bidi-font-family:"Times New Roman";
mso-bidi-theme-font:minor-bidi;
mso-fareast-language:EN-US;}
.MsoChpDefault
{mso-style-type:export-only;
mso-default-props:yes;
font-family:"Calibri",sans-serif;
mso-ascii-font-family:Calibri;
mso-ascii-theme-font:minor-latin;
mso-fareast-font-family:Calibri;
mso-fareast-theme-font:minor-latin;
mso-hansi-font-family:Calibri;
mso-hansi-theme-font:minor-latin;
mso-bidi-font-family:"Times New Roman";
mso-bidi-theme-font:minor-bidi;
mso-fareast-language:EN-US;}
@page WordSection1
{size:595.0pt 842.0pt;
margin:72.0pt 72.0pt 72.0pt 72.0pt;
mso-header-margin:35.4pt;
mso-footer-margin:35.4pt;
mso-paper-source:0;}
div.WordSection1
{page:WordSection1;}
-->
</style>
<!--[if gte mso 10]>
<style>
/* Style Definitions */
table.MsoNormalTable
{mso-style-name:"Table Normal";
mso-tstyle-rowband-size:0;
mso-tstyle-colband-size:0;
mso-style-noshow:yes;
mso-style-priority:99;
mso-style-parent:"";
mso-padding-alt:0cm 5.4pt 0cm 5.4pt;
mso-para-margin:0cm;
mso-para-margin-bottom:.0001pt;
mso-pagination:widow-orphan;
font-size:12.0pt;
font-family:"Calibri",sans-serif;
mso-ascii-font-family:Calibri;
mso-ascii-theme-font:minor-latin;
mso-hansi-font-family:Calibri;
mso-hansi-theme-font:minor-latin;
mso-bidi-font-family:"Times New Roman";
mso-bidi-theme-font:minor-bidi;
mso-fareast-language:EN-US;}
</style>
<![endif]-->
<!--StartFragment-->
<br />
<div class="MsoNormal">
<span style="font-family: "times new roman" , serif;"><span style="font-size: small;">- Strong References<o:p></o:p></span></span></div>
<div class="MsoNormal">
<span style="font-family: "times new roman" , serif;"><span style="font-size: small;">- Weak References<o:p></o:p></span></span></div>
<div class="MsoNormal">
<span style="font-family: "times new roman" , serif;"><span style="font-size: small;">- Soft References<o:p></o:p></span></span></div>
<div class="MsoNormal">
<span style="font-family: "times new roman" , serif;"><span style="font-size: small;">- Phantom References<o:p></o:p></span></span></div>
<div class="MsoNormal">
<span style="font-family: "times new roman" , serif;"><span style="font-size: small;"><br />
Below I will try to explain each type of reference's characteristics and
possible use cases.<o:p></o:p></span></span></div>
<div class="MsoNormal">
<span style="font-size: small;"><span style="font-family: "times new roman" , serif;"> </span><span style="font-family: "times new roman" , serif;"> </span></span></div>
<!--EndFragment-->
<b style="font-family: "times new roman", serif; font-size: 18.6667px;"><u>Strong References:</u></b><br />
<span style="font-family: "times new roman" , serif; font-size: 16px;"><br /></span>
<span style="font-family: "times new roman" , serif; font-size: 16px;"> </span><span style="font-size: small;">The default type of reference is the strong reference. When you
define an object regularly it will have strong reference and as long as an
object has a strong reference the object will not be eligible for garbage
collector. When we set the strong variable to null, that object will become
eligible to garbage collection and as long as GC runs the space that object
uses will be reclaimed. </span><br />
<!--[if gte mso 9]><xml>
<o:OfficeDocumentSettings>
<o:AllowPNG/>
</o:OfficeDocumentSettings>
</xml><![endif]-->
<!--[if gte mso 9]><xml>
<w:WordDocument>
<w:View>Normal</w:View>
<w:Zoom>0</w:Zoom>
<w:TrackMoves/>
<w:TrackFormatting/>
<w:PunctuationKerning/>
<w:ValidateAgainstSchemas/>
<w:SaveIfXMLInvalid>false</w:SaveIfXMLInvalid>
<w:IgnoreMixedContent>false</w:IgnoreMixedContent>
<w:AlwaysShowPlaceholderText>false</w:AlwaysShowPlaceholderText>
<w:DoNotPromoteQF/>
<w:LidThemeOther>EN-US</w:LidThemeOther>
<w:LidThemeAsian>X-NONE</w:LidThemeAsian>
<w:LidThemeComplexScript>X-NONE</w:LidThemeComplexScript>
<w:Compatibility>
<w:BreakWrappedTables/>
<w:SnapToGridInCell/>
<w:WrapTextWithPunct/>
<w:UseAsianBreakRules/>
<w:DontGrowAutofit/>
<w:SplitPgBreakAndParaMark/>
<w:EnableOpenTypeKerning/>
<w:DontFlipMirrorIndents/>
<w:OverrideTableStyleHps/>
</w:Compatibility>
<m:mathPr>
<m:mathFont m:val="Cambria Math"/>
<m:brkBin m:val="before"/>
<m:brkBinSub m:val="--"/>
<m:smallFrac m:val="off"/>
<m:dispDef/>
<m:lMargin m:val="0"/>
<m:rMargin m:val="0"/>
<m:defJc m:val="centerGroup"/>
<m:wrapIndent m:val="1440"/>
<m:intLim m:val="subSup"/>
<m:naryLim m:val="undOvr"/>
</m:mathPr></w:WordDocument>
</xml><![endif]--><!--[if gte mso 9]><xml>
<w:LatentStyles DefLockedState="false" DefUnhideWhenUsed="false"
DefSemiHidden="false" DefQFormat="false" DefPriority="99"
LatentStyleCount="376">
<w:LsdException Locked="false" Priority="0" QFormat="true" Name="Normal"/>
<w:LsdException Locked="false" Priority="9" QFormat="true" Name="heading 1"/>
<w:LsdException Locked="false" Priority="9" SemiHidden="true"
UnhideWhenUsed="true" QFormat="true" Name="heading 2"/>
<w:LsdException Locked="false" Priority="9" SemiHidden="true"
UnhideWhenUsed="true" QFormat="true" Name="heading 3"/>
<w:LsdException Locked="false" Priority="9" SemiHidden="true"
UnhideWhenUsed="true" QFormat="true" Name="heading 4"/>
<w:LsdException Locked="false" Priority="9" SemiHidden="true"
UnhideWhenUsed="true" QFormat="true" Name="heading 5"/>
<w:LsdException Locked="false" Priority="9" SemiHidden="true"
UnhideWhenUsed="true" QFormat="true" Name="heading 6"/>
<w:LsdException Locked="false" Priority="9" SemiHidden="true"
UnhideWhenUsed="true" QFormat="true" Name="heading 7"/>
<w:LsdException Locked="false" Priority="9" SemiHidden="true"
UnhideWhenUsed="true" QFormat="true" Name="heading 8"/>
<w:LsdException Locked="false" Priority="9" SemiHidden="true"
UnhideWhenUsed="true" QFormat="true" Name="heading 9"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="index 1"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="index 2"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="index 3"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="index 4"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="index 5"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="index 6"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="index 7"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="index 8"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="index 9"/>
<w:LsdException Locked="false" Priority="39" SemiHidden="true"
UnhideWhenUsed="true" Name="toc 1"/>
<w:LsdException Locked="false" Priority="39" SemiHidden="true"
UnhideWhenUsed="true" Name="toc 2"/>
<w:LsdException Locked="false" Priority="39" SemiHidden="true"
UnhideWhenUsed="true" Name="toc 3"/>
<w:LsdException Locked="false" Priority="39" SemiHidden="true"
UnhideWhenUsed="true" Name="toc 4"/>
<w:LsdException Locked="false" Priority="39" SemiHidden="true"
UnhideWhenUsed="true" Name="toc 5"/>
<w:LsdException Locked="false" Priority="39" SemiHidden="true"
UnhideWhenUsed="true" Name="toc 6"/>
<w:LsdException Locked="false" Priority="39" SemiHidden="true"
UnhideWhenUsed="true" Name="toc 7"/>
<w:LsdException Locked="false" Priority="39" SemiHidden="true"
UnhideWhenUsed="true" Name="toc 8"/>
<w:LsdException Locked="false" Priority="39" SemiHidden="true"
UnhideWhenUsed="true" Name="toc 9"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="Normal Indent"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="footnote text"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="annotation text"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="header"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="footer"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="index heading"/>
<w:LsdException Locked="false" Priority="35" SemiHidden="true"
UnhideWhenUsed="true" QFormat="true" Name="caption"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="table of figures"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="envelope address"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="envelope return"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="footnote reference"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="annotation reference"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="line number"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="page number"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="endnote reference"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="endnote text"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="table of authorities"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="macro"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="toa heading"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="List"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="List Bullet"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="List Number"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="List 2"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="List 3"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="List 4"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="List 5"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="List Bullet 2"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="List Bullet 3"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="List Bullet 4"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="List Bullet 5"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="List Number 2"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="List Number 3"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="List Number 4"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="List Number 5"/>
<w:LsdException Locked="false" Priority="10" QFormat="true" Name="Title"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="Closing"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="Signature"/>
<w:LsdException Locked="false" Priority="1" SemiHidden="true"
UnhideWhenUsed="true" Name="Default Paragraph Font"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="Body Text"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="Body Text Indent"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="List Continue"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="List Continue 2"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="List Continue 3"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="List Continue 4"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="List Continue 5"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="Message Header"/>
<w:LsdException Locked="false" Priority="11" QFormat="true" Name="Subtitle"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="Salutation"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="Date"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="Body Text First Indent"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="Body Text First Indent 2"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="Note Heading"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="Body Text 2"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="Body Text 3"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="Body Text Indent 2"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="Body Text Indent 3"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="Block Text"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="Hyperlink"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="FollowedHyperlink"/>
<w:LsdException Locked="false" Priority="22" QFormat="true" Name="Strong"/>
<w:LsdException Locked="false" Priority="20" QFormat="true" Name="Emphasis"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="Document Map"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="Plain Text"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="E-mail Signature"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="HTML Top of Form"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="HTML Bottom of Form"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="Normal (Web)"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="HTML Acronym"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="HTML Address"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="HTML Cite"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="HTML Code"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="HTML Definition"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="HTML Keyboard"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
QFormat="true" Name="HTML Preformatted"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="HTML Sample"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="HTML Typewriter"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="HTML Variable"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="Normal Table"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="annotation subject"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="No List"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="Outline List 1"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="Outline List 2"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="Outline List 3"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="Table Simple 1"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="Table Simple 2"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="Table Simple 3"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="Table Classic 1"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="Table Classic 2"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="Table Classic 3"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="Table Classic 4"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="Table Colorful 1"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="Table Colorful 2"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="Table Colorful 3"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="Table Columns 1"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="Table Columns 2"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="Table Columns 3"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="Table Columns 4"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="Table Columns 5"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="Table Grid 1"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="Table Grid 2"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="Table Grid 3"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="Table Grid 4"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="Table Grid 5"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="Table Grid 6"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="Table Grid 7"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="Table Grid 8"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="Table List 1"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="Table List 2"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="Table List 3"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="Table List 4"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="Table List 5"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="Table List 6"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="Table List 7"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="Table List 8"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="Table 3D effects 1"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="Table 3D effects 2"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="Table 3D effects 3"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="Table Contemporary"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="Table Elegant"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="Table Professional"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="Table Subtle 1"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="Table Subtle 2"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="Table Web 1"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="Table Web 2"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="Table Web 3"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="Balloon Text"/>
<w:LsdException Locked="false" Priority="39" Name="Table Grid"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="Table Theme"/>
<w:LsdException Locked="false" SemiHidden="true" Name="Placeholder Text"/>
<w:LsdException Locked="false" Priority="1" QFormat="true" Name="No Spacing"/>
<w:LsdException Locked="false" Priority="60" Name="Light Shading"/>
<w:LsdException Locked="false" Priority="61" Name="Light List"/>
<w:LsdException Locked="false" Priority="62" Name="Light Grid"/>
<w:LsdException Locked="false" Priority="63" Name="Medium Shading 1"/>
<w:LsdException Locked="false" Priority="64" Name="Medium Shading 2"/>
<w:LsdException Locked="false" Priority="65" Name="Medium List 1"/>
<w:LsdException Locked="false" Priority="66" Name="Medium List 2"/>
<w:LsdException Locked="false" Priority="67" Name="Medium Grid 1"/>
<w:LsdException Locked="false" Priority="68" Name="Medium Grid 2"/>
<w:LsdException Locked="false" Priority="69" Name="Medium Grid 3"/>
<w:LsdException Locked="false" Priority="70" Name="Dark List"/>
<w:LsdException Locked="false" Priority="71" Name="Colorful Shading"/>
<w:LsdException Locked="false" Priority="72" Name="Colorful List"/>
<w:LsdException Locked="false" Priority="73" Name="Colorful Grid"/>
<w:LsdException Locked="false" Priority="60" Name="Light Shading Accent 1"/>
<w:LsdException Locked="false" Priority="61" Name="Light List Accent 1"/>
<w:LsdException Locked="false" Priority="62" Name="Light Grid Accent 1"/>
<w:LsdException Locked="false" Priority="63" Name="Medium Shading 1 Accent 1"/>
<w:LsdException Locked="false" Priority="64" Name="Medium Shading 2 Accent 1"/>
<w:LsdException Locked="false" Priority="65" Name="Medium List 1 Accent 1"/>
<w:LsdException Locked="false" SemiHidden="true" Name="Revision"/>
<w:LsdException Locked="false" Priority="34" QFormat="true"
Name="List Paragraph"/>
<w:LsdException Locked="false" Priority="29" QFormat="true" Name="Quote"/>
<w:LsdException Locked="false" Priority="30" QFormat="true"
Name="Intense Quote"/>
<w:LsdException Locked="false" Priority="66" Name="Medium List 2 Accent 1"/>
<w:LsdException Locked="false" Priority="67" Name="Medium Grid 1 Accent 1"/>
<w:LsdException Locked="false" Priority="68" Name="Medium Grid 2 Accent 1"/>
<w:LsdException Locked="false" Priority="69" Name="Medium Grid 3 Accent 1"/>
<w:LsdException Locked="false" Priority="70" Name="Dark List Accent 1"/>
<w:LsdException Locked="false" Priority="71" Name="Colorful Shading Accent 1"/>
<w:LsdException Locked="false" Priority="72" Name="Colorful List Accent 1"/>
<w:LsdException Locked="false" Priority="73" Name="Colorful Grid Accent 1"/>
<w:LsdException Locked="false" Priority="60" Name="Light Shading Accent 2"/>
<w:LsdException Locked="false" Priority="61" Name="Light List Accent 2"/>
<w:LsdException Locked="false" Priority="62" Name="Light Grid Accent 2"/>
<w:LsdException Locked="false" Priority="63" Name="Medium Shading 1 Accent 2"/>
<w:LsdException Locked="false" Priority="64" Name="Medium Shading 2 Accent 2"/>
<w:LsdException Locked="false" Priority="65" Name="Medium List 1 Accent 2"/>
<w:LsdException Locked="false" Priority="66" Name="Medium List 2 Accent 2"/>
<w:LsdException Locked="false" Priority="67" Name="Medium Grid 1 Accent 2"/>
<w:LsdException Locked="false" Priority="68" Name="Medium Grid 2 Accent 2"/>
<w:LsdException Locked="false" Priority="69" Name="Medium Grid 3 Accent 2"/>
<w:LsdException Locked="false" Priority="70" Name="Dark List Accent 2"/>
<w:LsdException Locked="false" Priority="71" Name="Colorful Shading Accent 2"/>
<w:LsdException Locked="false" Priority="72" Name="Colorful List Accent 2"/>
<w:LsdException Locked="false" Priority="73" Name="Colorful Grid Accent 2"/>
<w:LsdException Locked="false" Priority="60" Name="Light Shading Accent 3"/>
<w:LsdException Locked="false" Priority="61" Name="Light List Accent 3"/>
<w:LsdException Locked="false" Priority="62" Name="Light Grid Accent 3"/>
<w:LsdException Locked="false" Priority="63" Name="Medium Shading 1 Accent 3"/>
<w:LsdException Locked="false" Priority="64" Name="Medium Shading 2 Accent 3"/>
<w:LsdException Locked="false" Priority="65" Name="Medium List 1 Accent 3"/>
<w:LsdException Locked="false" Priority="66" Name="Medium List 2 Accent 3"/>
<w:LsdException Locked="false" Priority="67" Name="Medium Grid 1 Accent 3"/>
<w:LsdException Locked="false" Priority="68" Name="Medium Grid 2 Accent 3"/>
<w:LsdException Locked="false" Priority="69" Name="Medium Grid 3 Accent 3"/>
<w:LsdException Locked="false" Priority="70" Name="Dark List Accent 3"/>
<w:LsdException Locked="false" Priority="71" Name="Colorful Shading Accent 3"/>
<w:LsdException Locked="false" Priority="72" Name="Colorful List Accent 3"/>
<w:LsdException Locked="false" Priority="73" Name="Colorful Grid Accent 3"/>
<w:LsdException Locked="false" Priority="60" Name="Light Shading Accent 4"/>
<w:LsdException Locked="false" Priority="61" Name="Light List Accent 4"/>
<w:LsdException Locked="false" Priority="62" Name="Light Grid Accent 4"/>
<w:LsdException Locked="false" Priority="63" Name="Medium Shading 1 Accent 4"/>
<w:LsdException Locked="false" Priority="64" Name="Medium Shading 2 Accent 4"/>
<w:LsdException Locked="false" Priority="65" Name="Medium List 1 Accent 4"/>
<w:LsdException Locked="false" Priority="66" Name="Medium List 2 Accent 4"/>
<w:LsdException Locked="false" Priority="67" Name="Medium Grid 1 Accent 4"/>
<w:LsdException Locked="false" Priority="68" Name="Medium Grid 2 Accent 4"/>
<w:LsdException Locked="false" Priority="69" Name="Medium Grid 3 Accent 4"/>
<w:LsdException Locked="false" Priority="70" Name="Dark List Accent 4"/>
<w:LsdException Locked="false" Priority="71" Name="Colorful Shading Accent 4"/>
<w:LsdException Locked="false" Priority="72" Name="Colorful List Accent 4"/>
<w:LsdException Locked="false" Priority="73" Name="Colorful Grid Accent 4"/>
<w:LsdException Locked="false" Priority="60" Name="Light Shading Accent 5"/>
<w:LsdException Locked="false" Priority="61" Name="Light List Accent 5"/>
<w:LsdException Locked="false" Priority="62" Name="Light Grid Accent 5"/>
<w:LsdException Locked="false" Priority="63" Name="Medium Shading 1 Accent 5"/>
<w:LsdException Locked="false" Priority="64" Name="Medium Shading 2 Accent 5"/>
<w:LsdException Locked="false" Priority="65" Name="Medium List 1 Accent 5"/>
<w:LsdException Locked="false" Priority="66" Name="Medium List 2 Accent 5"/>
<w:LsdException Locked="false" Priority="67" Name="Medium Grid 1 Accent 5"/>
<w:LsdException Locked="false" Priority="68" Name="Medium Grid 2 Accent 5"/>
<w:LsdException Locked="false" Priority="69" Name="Medium Grid 3 Accent 5"/>
<w:LsdException Locked="false" Priority="70" Name="Dark List Accent 5"/>
<w:LsdException Locked="false" Priority="71" Name="Colorful Shading Accent 5"/>
<w:LsdException Locked="false" Priority="72" Name="Colorful List Accent 5"/>
<w:LsdException Locked="false" Priority="73" Name="Colorful Grid Accent 5"/>
<w:LsdException Locked="false" Priority="60" Name="Light Shading Accent 6"/>
<w:LsdException Locked="false" Priority="61" Name="Light List Accent 6"/>
<w:LsdException Locked="false" Priority="62" Name="Light Grid Accent 6"/>
<w:LsdException Locked="false" Priority="63" Name="Medium Shading 1 Accent 6"/>
<w:LsdException Locked="false" Priority="64" Name="Medium Shading 2 Accent 6"/>
<w:LsdException Locked="false" Priority="65" Name="Medium List 1 Accent 6"/>
<w:LsdException Locked="false" Priority="66" Name="Medium List 2 Accent 6"/>
<w:LsdException Locked="false" Priority="67" Name="Medium Grid 1 Accent 6"/>
<w:LsdException Locked="false" Priority="68" Name="Medium Grid 2 Accent 6"/>
<w:LsdException Locked="false" Priority="69" Name="Medium Grid 3 Accent 6"/>
<w:LsdException Locked="false" Priority="70" Name="Dark List Accent 6"/>
<w:LsdException Locked="false" Priority="71" Name="Colorful Shading Accent 6"/>
<w:LsdException Locked="false" Priority="72" Name="Colorful List Accent 6"/>
<w:LsdException Locked="false" Priority="73" Name="Colorful Grid Accent 6"/>
<w:LsdException Locked="false" Priority="19" QFormat="true"
Name="Subtle Emphasis"/>
<w:LsdException Locked="false" Priority="21" QFormat="true"
Name="Intense Emphasis"/>
<w:LsdException Locked="false" Priority="31" QFormat="true"
Name="Subtle Reference"/>
<w:LsdException Locked="false" Priority="32" QFormat="true"
Name="Intense Reference"/>
<w:LsdException Locked="false" Priority="33" QFormat="true" Name="Book Title"/>
<w:LsdException Locked="false" Priority="37" SemiHidden="true"
UnhideWhenUsed="true" Name="Bibliography"/>
<w:LsdException Locked="false" Priority="39" SemiHidden="true"
UnhideWhenUsed="true" QFormat="true" Name="TOC Heading"/>
<w:LsdException Locked="false" Priority="41" Name="Plain Table 1"/>
<w:LsdException Locked="false" Priority="42" Name="Plain Table 2"/>
<w:LsdException Locked="false" Priority="43" Name="Plain Table 3"/>
<w:LsdException Locked="false" Priority="44" Name="Plain Table 4"/>
<w:LsdException Locked="false" Priority="45" Name="Plain Table 5"/>
<w:LsdException Locked="false" Priority="40" Name="Grid Table Light"/>
<w:LsdException Locked="false" Priority="46" Name="Grid Table 1 Light"/>
<w:LsdException Locked="false" Priority="47" Name="Grid Table 2"/>
<w:LsdException Locked="false" Priority="48" Name="Grid Table 3"/>
<w:LsdException Locked="false" Priority="49" Name="Grid Table 4"/>
<w:LsdException Locked="false" Priority="50" Name="Grid Table 5 Dark"/>
<w:LsdException Locked="false" Priority="51" Name="Grid Table 6 Colorful"/>
<w:LsdException Locked="false" Priority="52" Name="Grid Table 7 Colorful"/>
<w:LsdException Locked="false" Priority="46"
Name="Grid Table 1 Light Accent 1"/>
<w:LsdException Locked="false" Priority="47" Name="Grid Table 2 Accent 1"/>
<w:LsdException Locked="false" Priority="48" Name="Grid Table 3 Accent 1"/>
<w:LsdException Locked="false" Priority="49" Name="Grid Table 4 Accent 1"/>
<w:LsdException Locked="false" Priority="50" Name="Grid Table 5 Dark Accent 1"/>
<w:LsdException Locked="false" Priority="51"
Name="Grid Table 6 Colorful Accent 1"/>
<w:LsdException Locked="false" Priority="52"
Name="Grid Table 7 Colorful Accent 1"/>
<w:LsdException Locked="false" Priority="46"
Name="Grid Table 1 Light Accent 2"/>
<w:LsdException Locked="false" Priority="47" Name="Grid Table 2 Accent 2"/>
<w:LsdException Locked="false" Priority="48" Name="Grid Table 3 Accent 2"/>
<w:LsdException Locked="false" Priority="49" Name="Grid Table 4 Accent 2"/>
<w:LsdException Locked="false" Priority="50" Name="Grid Table 5 Dark Accent 2"/>
<w:LsdException Locked="false" Priority="51"
Name="Grid Table 6 Colorful Accent 2"/>
<w:LsdException Locked="false" Priority="52"
Name="Grid Table 7 Colorful Accent 2"/>
<w:LsdException Locked="false" Priority="46"
Name="Grid Table 1 Light Accent 3"/>
<w:LsdException Locked="false" Priority="47" Name="Grid Table 2 Accent 3"/>
<w:LsdException Locked="false" Priority="48" Name="Grid Table 3 Accent 3"/>
<w:LsdException Locked="false" Priority="49" Name="Grid Table 4 Accent 3"/>
<w:LsdException Locked="false" Priority="50" Name="Grid Table 5 Dark Accent 3"/>
<w:LsdException Locked="false" Priority="51"
Name="Grid Table 6 Colorful Accent 3"/>
<w:LsdException Locked="false" Priority="52"
Name="Grid Table 7 Colorful Accent 3"/>
<w:LsdException Locked="false" Priority="46"
Name="Grid Table 1 Light Accent 4"/>
<w:LsdException Locked="false" Priority="47" Name="Grid Table 2 Accent 4"/>
<w:LsdException Locked="false" Priority="48" Name="Grid Table 3 Accent 4"/>
<w:LsdException Locked="false" Priority="49" Name="Grid Table 4 Accent 4"/>
<w:LsdException Locked="false" Priority="50" Name="Grid Table 5 Dark Accent 4"/>
<w:LsdException Locked="false" Priority="51"
Name="Grid Table 6 Colorful Accent 4"/>
<w:LsdException Locked="false" Priority="52"
Name="Grid Table 7 Colorful Accent 4"/>
<w:LsdException Locked="false" Priority="46"
Name="Grid Table 1 Light Accent 5"/>
<w:LsdException Locked="false" Priority="47" Name="Grid Table 2 Accent 5"/>
<w:LsdException Locked="false" Priority="48" Name="Grid Table 3 Accent 5"/>
<w:LsdException Locked="false" Priority="49" Name="Grid Table 4 Accent 5"/>
<w:LsdException Locked="false" Priority="50" Name="Grid Table 5 Dark Accent 5"/>
<w:LsdException Locked="false" Priority="51"
Name="Grid Table 6 Colorful Accent 5"/>
<w:LsdException Locked="false" Priority="52"
Name="Grid Table 7 Colorful Accent 5"/>
<w:LsdException Locked="false" Priority="46"
Name="Grid Table 1 Light Accent 6"/>
<w:LsdException Locked="false" Priority="47" Name="Grid Table 2 Accent 6"/>
<w:LsdException Locked="false" Priority="48" Name="Grid Table 3 Accent 6"/>
<w:LsdException Locked="false" Priority="49" Name="Grid Table 4 Accent 6"/>
<w:LsdException Locked="false" Priority="50" Name="Grid Table 5 Dark Accent 6"/>
<w:LsdException Locked="false" Priority="51"
Name="Grid Table 6 Colorful Accent 6"/>
<w:LsdException Locked="false" Priority="52"
Name="Grid Table 7 Colorful Accent 6"/>
<w:LsdException Locked="false" Priority="46" Name="List Table 1 Light"/>
<w:LsdException Locked="false" Priority="47" Name="List Table 2"/>
<w:LsdException Locked="false" Priority="48" Name="List Table 3"/>
<w:LsdException Locked="false" Priority="49" Name="List Table 4"/>
<w:LsdException Locked="false" Priority="50" Name="List Table 5 Dark"/>
<w:LsdException Locked="false" Priority="51" Name="List Table 6 Colorful"/>
<w:LsdException Locked="false" Priority="52" Name="List Table 7 Colorful"/>
<w:LsdException Locked="false" Priority="46"
Name="List Table 1 Light Accent 1"/>
<w:LsdException Locked="false" Priority="47" Name="List Table 2 Accent 1"/>
<w:LsdException Locked="false" Priority="48" Name="List Table 3 Accent 1"/>
<w:LsdException Locked="false" Priority="49" Name="List Table 4 Accent 1"/>
<w:LsdException Locked="false" Priority="50" Name="List Table 5 Dark Accent 1"/>
<w:LsdException Locked="false" Priority="51"
Name="List Table 6 Colorful Accent 1"/>
<w:LsdException Locked="false" Priority="52"
Name="List Table 7 Colorful Accent 1"/>
<w:LsdException Locked="false" Priority="46"
Name="List Table 1 Light Accent 2"/>
<w:LsdException Locked="false" Priority="47" Name="List Table 2 Accent 2"/>
<w:LsdException Locked="false" Priority="48" Name="List Table 3 Accent 2"/>
<w:LsdException Locked="false" Priority="49" Name="List Table 4 Accent 2"/>
<w:LsdException Locked="false" Priority="50" Name="List Table 5 Dark Accent 2"/>
<w:LsdException Locked="false" Priority="51"
Name="List Table 6 Colorful Accent 2"/>
<w:LsdException Locked="false" Priority="52"
Name="List Table 7 Colorful Accent 2"/>
<w:LsdException Locked="false" Priority="46"
Name="List Table 1 Light Accent 3"/>
<w:LsdException Locked="false" Priority="47" Name="List Table 2 Accent 3"/>
<w:LsdException Locked="false" Priority="48" Name="List Table 3 Accent 3"/>
<w:LsdException Locked="false" Priority="49" Name="List Table 4 Accent 3"/>
<w:LsdException Locked="false" Priority="50" Name="List Table 5 Dark Accent 3"/>
<w:LsdException Locked="false" Priority="51"
Name="List Table 6 Colorful Accent 3"/>
<w:LsdException Locked="false" Priority="52"
Name="List Table 7 Colorful Accent 3"/>
<w:LsdException Locked="false" Priority="46"
Name="List Table 1 Light Accent 4"/>
<w:LsdException Locked="false" Priority="47" Name="List Table 2 Accent 4"/>
<w:LsdException Locked="false" Priority="48" Name="List Table 3 Accent 4"/>
<w:LsdException Locked="false" Priority="49" Name="List Table 4 Accent 4"/>
<w:LsdException Locked="false" Priority="50" Name="List Table 5 Dark Accent 4"/>
<w:LsdException Locked="false" Priority="51"
Name="List Table 6 Colorful Accent 4"/>
<w:LsdException Locked="false" Priority="52"
Name="List Table 7 Colorful Accent 4"/>
<w:LsdException Locked="false" Priority="46"
Name="List Table 1 Light Accent 5"/>
<w:LsdException Locked="false" Priority="47" Name="List Table 2 Accent 5"/>
<w:LsdException Locked="false" Priority="48" Name="List Table 3 Accent 5"/>
<w:LsdException Locked="false" Priority="49" Name="List Table 4 Accent 5"/>
<w:LsdException Locked="false" Priority="50" Name="List Table 5 Dark Accent 5"/>
<w:LsdException Locked="false" Priority="51"
Name="List Table 6 Colorful Accent 5"/>
<w:LsdException Locked="false" Priority="52"
Name="List Table 7 Colorful Accent 5"/>
<w:LsdException Locked="false" Priority="46"
Name="List Table 1 Light Accent 6"/>
<w:LsdException Locked="false" Priority="47" Name="List Table 2 Accent 6"/>
<w:LsdException Locked="false" Priority="48" Name="List Table 3 Accent 6"/>
<w:LsdException Locked="false" Priority="49" Name="List Table 4 Accent 6"/>
<w:LsdException Locked="false" Priority="50" Name="List Table 5 Dark Accent 6"/>
<w:LsdException Locked="false" Priority="51"
Name="List Table 6 Colorful Accent 6"/>
<w:LsdException Locked="false" Priority="52"
Name="List Table 7 Colorful Accent 6"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="Mention"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="Smart Hyperlink"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="Hashtag"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="Unresolved Mention"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="Smart Link"/>
</w:LatentStyles>
</xml><![endif]-->
<style>
<!--
/* Font Definitions */
@font-face
{font-family:"Cambria Math";
panose-1:2 4 5 3 5 4 6 3 2 4;
mso-font-charset:0;
mso-generic-font-family:roman;
mso-font-pitch:variable;
mso-font-signature:-536870145 1107305727 0 0 415 0;}
@font-face
{font-family:Calibri;
panose-1:2 15 5 2 2 2 4 3 2 4;
mso-font-charset:0;
mso-generic-font-family:swiss;
mso-font-pitch:variable;
mso-font-signature:-536859905 -1073697537 9 0 511 0;}
/* Style Definitions */
p.MsoNormal, li.MsoNormal, div.MsoNormal
{mso-style-unhide:no;
mso-style-qformat:yes;
mso-style-parent:"";
margin:0cm;
margin-bottom:.0001pt;
mso-pagination:widow-orphan;
font-size:12.0pt;
font-family:"Calibri",sans-serif;
mso-ascii-font-family:Calibri;
mso-ascii-theme-font:minor-latin;
mso-fareast-font-family:Calibri;
mso-fareast-theme-font:minor-latin;
mso-hansi-font-family:Calibri;
mso-hansi-theme-font:minor-latin;
mso-bidi-font-family:"Times New Roman";
mso-bidi-theme-font:minor-bidi;
mso-fareast-language:EN-US;}
p
{mso-style-priority:99;
mso-margin-top-alt:auto;
margin-right:0cm;
mso-margin-bottom-alt:auto;
margin-left:0cm;
mso-pagination:widow-orphan;
font-size:12.0pt;
font-family:"Times New Roman",serif;
mso-fareast-font-family:"Times New Roman";}
.MsoChpDefault
{mso-style-type:export-only;
mso-default-props:yes;
font-family:"Calibri",sans-serif;
mso-ascii-font-family:Calibri;
mso-ascii-theme-font:minor-latin;
mso-fareast-font-family:Calibri;
mso-fareast-theme-font:minor-latin;
mso-hansi-font-family:Calibri;
mso-hansi-theme-font:minor-latin;
mso-bidi-font-family:"Times New Roman";
mso-bidi-theme-font:minor-bidi;
mso-fareast-language:EN-US;}
@page WordSection1
{size:595.0pt 842.0pt;
margin:72.0pt 72.0pt 72.0pt 72.0pt;
mso-header-margin:35.4pt;
mso-footer-margin:35.4pt;
mso-paper-source:0;}
div.WordSection1
{page:WordSection1;}
-->
</style>
<!--[if gte mso 10]>
<style>
/* Style Definitions */
table.MsoNormalTable
{mso-style-name:"Table Normal";
mso-tstyle-rowband-size:0;
mso-tstyle-colband-size:0;
mso-style-noshow:yes;
mso-style-priority:99;
mso-style-parent:"";
mso-padding-alt:0cm 5.4pt 0cm 5.4pt;
mso-para-margin:0cm;
mso-para-margin-bottom:.0001pt;
mso-pagination:widow-orphan;
font-size:12.0pt;
font-family:"Calibri",sans-serif;
mso-ascii-font-family:Calibri;
mso-ascii-theme-font:minor-latin;
mso-hansi-font-family:Calibri;
mso-hansi-theme-font:minor-latin;
mso-bidi-font-family:"Times New Roman";
mso-bidi-theme-font:minor-bidi;
mso-fareast-language:EN-US;}
</style>
<![endif]-->
<!--StartFragment-->
<br />
<div style="margin-bottom: 0.0001pt; margin-top: 0cm;">
<span style="font-size: small;"><br />
Let's see a strong reference behaviour with an example.<o:p></o:p></span></div>
<div style="margin-bottom: 0.0001pt; margin-top: 0cm;">
<span style="font-size: small;">Below StrongReference class has
a nested class named A. It creates an instance of A and set it to null. At that
time that object should be eligible for GC.</span><span style="font-size: 13.5pt;"><o:p></o:p></span></div>
<div class="MsoNormal">
<br /></div>
<!--EndFragment--><br />
<div style="background: rgb(248, 249, 250); border: 1pt solid rgb(234, 236, 240); font-family: Georgia, Utopia, "Palatino Linotype", Palatino, serif; padding: 12pt;">
<div class="MsoNormal" style="background-attachment: initial; background-clip: initial; background-image: initial; background-origin: initial; background-position: initial; background-repeat: initial; background-size: initial; border: none; line-height: 15.6pt; margin-bottom: 0cm; padding: 0cm;">
<!--[if gte mso 9]><xml>
<o:OfficeDocumentSettings>
<o:AllowPNG/>
</o:OfficeDocumentSettings>
</xml><![endif]-->
<!--[if gte mso 9]><xml>
<w:WordDocument>
<w:View>Normal</w:View>
<w:Zoom>0</w:Zoom>
<w:TrackMoves/>
<w:TrackFormatting/>
<w:PunctuationKerning/>
<w:ValidateAgainstSchemas/>
<w:SaveIfXMLInvalid>false</w:SaveIfXMLInvalid>
<w:IgnoreMixedContent>false</w:IgnoreMixedContent>
<w:AlwaysShowPlaceholderText>false</w:AlwaysShowPlaceholderText>
<w:DoNotPromoteQF/>
<w:LidThemeOther>EN-US</w:LidThemeOther>
<w:LidThemeAsian>X-NONE</w:LidThemeAsian>
<w:LidThemeComplexScript>X-NONE</w:LidThemeComplexScript>
<w:Compatibility>
<w:BreakWrappedTables/>
<w:SnapToGridInCell/>
<w:WrapTextWithPunct/>
<w:UseAsianBreakRules/>
<w:DontGrowAutofit/>
<w:SplitPgBreakAndParaMark/>
<w:EnableOpenTypeKerning/>
<w:DontFlipMirrorIndents/>
<w:OverrideTableStyleHps/>
</w:Compatibility>
<m:mathPr>
<m:mathFont m:val="Cambria Math"/>
<m:brkBin m:val="before"/>
<m:brkBinSub m:val="--"/>
<m:smallFrac m:val="off"/>
<m:dispDef/>
<m:lMargin m:val="0"/>
<m:rMargin m:val="0"/>
<m:defJc m:val="centerGroup"/>
<m:wrapIndent m:val="1440"/>
<m:intLim m:val="subSup"/>
<m:naryLim m:val="undOvr"/>
</m:mathPr></w:WordDocument>
</xml><![endif]--><!--[if gte mso 9]><xml>
<w:LatentStyles DefLockedState="false" DefUnhideWhenUsed="false"
DefSemiHidden="false" DefQFormat="false" DefPriority="99"
LatentStyleCount="376">
<w:LsdException Locked="false" Priority="0" QFormat="true" Name="Normal"/>
<w:LsdException Locked="false" Priority="9" QFormat="true" Name="heading 1"/>
<w:LsdException Locked="false" Priority="9" SemiHidden="true"
UnhideWhenUsed="true" QFormat="true" Name="heading 2"/>
<w:LsdException Locked="false" Priority="9" SemiHidden="true"
UnhideWhenUsed="true" QFormat="true" Name="heading 3"/>
<w:LsdException Locked="false" Priority="9" SemiHidden="true"
UnhideWhenUsed="true" QFormat="true" Name="heading 4"/>
<w:LsdException Locked="false" Priority="9" SemiHidden="true"
UnhideWhenUsed="true" QFormat="true" Name="heading 5"/>
<w:LsdException Locked="false" Priority="9" SemiHidden="true"
UnhideWhenUsed="true" QFormat="true" Name="heading 6"/>
<w:LsdException Locked="false" Priority="9" SemiHidden="true"
UnhideWhenUsed="true" QFormat="true" Name="heading 7"/>
<w:LsdException Locked="false" Priority="9" SemiHidden="true"
UnhideWhenUsed="true" QFormat="true" Name="heading 8"/>
<w:LsdException Locked="false" Priority="9" SemiHidden="true"
UnhideWhenUsed="true" QFormat="true" Name="heading 9"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="index 1"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="index 2"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="index 3"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="index 4"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="index 5"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="index 6"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="index 7"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="index 8"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="index 9"/>
<w:LsdException Locked="false" Priority="39" SemiHidden="true"
UnhideWhenUsed="true" Name="toc 1"/>
<w:LsdException Locked="false" Priority="39" SemiHidden="true"
UnhideWhenUsed="true" Name="toc 2"/>
<w:LsdException Locked="false" Priority="39" SemiHidden="true"
UnhideWhenUsed="true" Name="toc 3"/>
<w:LsdException Locked="false" Priority="39" SemiHidden="true"
UnhideWhenUsed="true" Name="toc 4"/>
<w:LsdException Locked="false" Priority="39" SemiHidden="true"
UnhideWhenUsed="true" Name="toc 5"/>
<w:LsdException Locked="false" Priority="39" SemiHidden="true"
UnhideWhenUsed="true" Name="toc 6"/>
<w:LsdException Locked="false" Priority="39" SemiHidden="true"
UnhideWhenUsed="true" Name="toc 7"/>
<w:LsdException Locked="false" Priority="39" SemiHidden="true"
UnhideWhenUsed="true" Name="toc 8"/>
<w:LsdException Locked="false" Priority="39" SemiHidden="true"
UnhideWhenUsed="true" Name="toc 9"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="Normal Indent"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="footnote text"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="annotation text"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="header"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="footer"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="index heading"/>
<w:LsdException Locked="false" Priority="35" SemiHidden="true"
UnhideWhenUsed="true" QFormat="true" Name="caption"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="table of figures"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="envelope address"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="envelope return"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="footnote reference"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="annotation reference"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="line number"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="page number"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="endnote reference"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="endnote text"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="table of authorities"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="macro"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="toa heading"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="List"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="List Bullet"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="List Number"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="List 2"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="List 3"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="List 4"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="List 5"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="List Bullet 2"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="List Bullet 3"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="List Bullet 4"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="List Bullet 5"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="List Number 2"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="List Number 3"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="List Number 4"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="List Number 5"/>
<w:LsdException Locked="false" Priority="10" QFormat="true" Name="Title"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="Closing"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="Signature"/>
<w:LsdException Locked="false" Priority="1" SemiHidden="true"
UnhideWhenUsed="true" Name="Default Paragraph Font"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="Body Text"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="Body Text Indent"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="List Continue"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="List Continue 2"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="List Continue 3"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="List Continue 4"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="List Continue 5"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="Message Header"/>
<w:LsdException Locked="false" Priority="11" QFormat="true" Name="Subtitle"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="Salutation"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="Date"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="Body Text First Indent"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="Body Text First Indent 2"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="Note Heading"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="Body Text 2"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="Body Text 3"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="Body Text Indent 2"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="Body Text Indent 3"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="Block Text"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="Hyperlink"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="FollowedHyperlink"/>
<w:LsdException Locked="false" Priority="22" QFormat="true" Name="Strong"/>
<w:LsdException Locked="false" Priority="20" QFormat="true" Name="Emphasis"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="Document Map"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="Plain Text"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="E-mail Signature"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="HTML Top of Form"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="HTML Bottom of Form"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="Normal (Web)"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="HTML Acronym"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="HTML Address"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="HTML Cite"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="HTML Code"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="HTML Definition"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="HTML Keyboard"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
QFormat="true" Name="HTML Preformatted"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="HTML Sample"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="HTML Typewriter"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="HTML Variable"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="Normal Table"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="annotation subject"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="No List"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="Outline List 1"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="Outline List 2"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="Outline List 3"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="Table Simple 1"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="Table Simple 2"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="Table Simple 3"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="Table Classic 1"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="Table Classic 2"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="Table Classic 3"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="Table Classic 4"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="Table Colorful 1"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="Table Colorful 2"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="Table Colorful 3"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="Table Columns 1"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="Table Columns 2"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="Table Columns 3"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="Table Columns 4"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="Table Columns 5"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="Table Grid 1"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="Table Grid 2"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="Table Grid 3"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="Table Grid 4"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="Table Grid 5"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="Table Grid 6"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="Table Grid 7"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="Table Grid 8"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="Table List 1"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="Table List 2"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="Table List 3"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="Table List 4"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="Table List 5"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="Table List 6"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="Table List 7"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="Table List 8"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="Table 3D effects 1"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="Table 3D effects 2"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="Table 3D effects 3"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="Table Contemporary"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="Table Elegant"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="Table Professional"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="Table Subtle 1"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="Table Subtle 2"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="Table Web 1"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="Table Web 2"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="Table Web 3"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="Balloon Text"/>
<w:LsdException Locked="false" Priority="39" Name="Table Grid"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="Table Theme"/>
<w:LsdException Locked="false" SemiHidden="true" Name="Placeholder Text"/>
<w:LsdException Locked="false" Priority="1" QFormat="true" Name="No Spacing"/>
<w:LsdException Locked="false" Priority="60" Name="Light Shading"/>
<w:LsdException Locked="false" Priority="61" Name="Light List"/>
<w:LsdException Locked="false" Priority="62" Name="Light Grid"/>
<w:LsdException Locked="false" Priority="63" Name="Medium Shading 1"/>
<w:LsdException Locked="false" Priority="64" Name="Medium Shading 2"/>
<w:LsdException Locked="false" Priority="65" Name="Medium List 1"/>
<w:LsdException Locked="false" Priority="66" Name="Medium List 2"/>
<w:LsdException Locked="false" Priority="67" Name="Medium Grid 1"/>
<w:LsdException Locked="false" Priority="68" Name="Medium Grid 2"/>
<w:LsdException Locked="false" Priority="69" Name="Medium Grid 3"/>
<w:LsdException Locked="false" Priority="70" Name="Dark List"/>
<w:LsdException Locked="false" Priority="71" Name="Colorful Shading"/>
<w:LsdException Locked="false" Priority="72" Name="Colorful List"/>
<w:LsdException Locked="false" Priority="73" Name="Colorful Grid"/>
<w:LsdException Locked="false" Priority="60" Name="Light Shading Accent 1"/>
<w:LsdException Locked="false" Priority="61" Name="Light List Accent 1"/>
<w:LsdException Locked="false" Priority="62" Name="Light Grid Accent 1"/>
<w:LsdException Locked="false" Priority="63" Name="Medium Shading 1 Accent 1"/>
<w:LsdException Locked="false" Priority="64" Name="Medium Shading 2 Accent 1"/>
<w:LsdException Locked="false" Priority="65" Name="Medium List 1 Accent 1"/>
<w:LsdException Locked="false" SemiHidden="true" Name="Revision"/>
<w:LsdException Locked="false" Priority="34" QFormat="true"
Name="List Paragraph"/>
<w:LsdException Locked="false" Priority="29" QFormat="true" Name="Quote"/>
<w:LsdException Locked="false" Priority="30" QFormat="true"
Name="Intense Quote"/>
<w:LsdException Locked="false" Priority="66" Name="Medium List 2 Accent 1"/>
<w:LsdException Locked="false" Priority="67" Name="Medium Grid 1 Accent 1"/>
<w:LsdException Locked="false" Priority="68" Name="Medium Grid 2 Accent 1"/>
<w:LsdException Locked="false" Priority="69" Name="Medium Grid 3 Accent 1"/>
<w:LsdException Locked="false" Priority="70" Name="Dark List Accent 1"/>
<w:LsdException Locked="false" Priority="71" Name="Colorful Shading Accent 1"/>
<w:LsdException Locked="false" Priority="72" Name="Colorful List Accent 1"/>
<w:LsdException Locked="false" Priority="73" Name="Colorful Grid Accent 1"/>
<w:LsdException Locked="false" Priority="60" Name="Light Shading Accent 2"/>
<w:LsdException Locked="false" Priority="61" Name="Light List Accent 2"/>
<w:LsdException Locked="false" Priority="62" Name="Light Grid Accent 2"/>
<w:LsdException Locked="false" Priority="63" Name="Medium Shading 1 Accent 2"/>
<w:LsdException Locked="false" Priority="64" Name="Medium Shading 2 Accent 2"/>
<w:LsdException Locked="false" Priority="65" Name="Medium List 1 Accent 2"/>
<w:LsdException Locked="false" Priority="66" Name="Medium List 2 Accent 2"/>
<w:LsdException Locked="false" Priority="67" Name="Medium Grid 1 Accent 2"/>
<w:LsdException Locked="false" Priority="68" Name="Medium Grid 2 Accent 2"/>
<w:LsdException Locked="false" Priority="69" Name="Medium Grid 3 Accent 2"/>
<w:LsdException Locked="false" Priority="70" Name="Dark List Accent 2"/>
<w:LsdException Locked="false" Priority="71" Name="Colorful Shading Accent 2"/>
<w:LsdException Locked="false" Priority="72" Name="Colorful List Accent 2"/>
<w:LsdException Locked="false" Priority="73" Name="Colorful Grid Accent 2"/>
<w:LsdException Locked="false" Priority="60" Name="Light Shading Accent 3"/>
<w:LsdException Locked="false" Priority="61" Name="Light List Accent 3"/>
<w:LsdException Locked="false" Priority="62" Name="Light Grid Accent 3"/>
<w:LsdException Locked="false" Priority="63" Name="Medium Shading 1 Accent 3"/>
<w:LsdException Locked="false" Priority="64" Name="Medium Shading 2 Accent 3"/>
<w:LsdException Locked="false" Priority="65" Name="Medium List 1 Accent 3"/>
<w:LsdException Locked="false" Priority="66" Name="Medium List 2 Accent 3"/>
<w:LsdException Locked="false" Priority="67" Name="Medium Grid 1 Accent 3"/>
<w:LsdException Locked="false" Priority="68" Name="Medium Grid 2 Accent 3"/>
<w:LsdException Locked="false" Priority="69" Name="Medium Grid 3 Accent 3"/>
<w:LsdException Locked="false" Priority="70" Name="Dark List Accent 3"/>
<w:LsdException Locked="false" Priority="71" Name="Colorful Shading Accent 3"/>
<w:LsdException Locked="false" Priority="72" Name="Colorful List Accent 3"/>
<w:LsdException Locked="false" Priority="73" Name="Colorful Grid Accent 3"/>
<w:LsdException Locked="false" Priority="60" Name="Light Shading Accent 4"/>
<w:LsdException Locked="false" Priority="61" Name="Light List Accent 4"/>
<w:LsdException Locked="false" Priority="62" Name="Light Grid Accent 4"/>
<w:LsdException Locked="false" Priority="63" Name="Medium Shading 1 Accent 4"/>
<w:LsdException Locked="false" Priority="64" Name="Medium Shading 2 Accent 4"/>
<w:LsdException Locked="false" Priority="65" Name="Medium List 1 Accent 4"/>
<w:LsdException Locked="false" Priority="66" Name="Medium List 2 Accent 4"/>
<w:LsdException Locked="false" Priority="67" Name="Medium Grid 1 Accent 4"/>
<w:LsdException Locked="false" Priority="68" Name="Medium Grid 2 Accent 4"/>
<w:LsdException Locked="false" Priority="69" Name="Medium Grid 3 Accent 4"/>
<w:LsdException Locked="false" Priority="70" Name="Dark List Accent 4"/>
<w:LsdException Locked="false" Priority="71" Name="Colorful Shading Accent 4"/>
<w:LsdException Locked="false" Priority="72" Name="Colorful List Accent 4"/>
<w:LsdException Locked="false" Priority="73" Name="Colorful Grid Accent 4"/>
<w:LsdException Locked="false" Priority="60" Name="Light Shading Accent 5"/>
<w:LsdException Locked="false" Priority="61" Name="Light List Accent 5"/>
<w:LsdException Locked="false" Priority="62" Name="Light Grid Accent 5"/>
<w:LsdException Locked="false" Priority="63" Name="Medium Shading 1 Accent 5"/>
<w:LsdException Locked="false" Priority="64" Name="Medium Shading 2 Accent 5"/>
<w:LsdException Locked="false" Priority="65" Name="Medium List 1 Accent 5"/>
<w:LsdException Locked="false" Priority="66" Name="Medium List 2 Accent 5"/>
<w:LsdException Locked="false" Priority="67" Name="Medium Grid 1 Accent 5"/>
<w:LsdException Locked="false" Priority="68" Name="Medium Grid 2 Accent 5"/>
<w:LsdException Locked="false" Priority="69" Name="Medium Grid 3 Accent 5"/>
<w:LsdException Locked="false" Priority="70" Name="Dark List Accent 5"/>
<w:LsdException Locked="false" Priority="71" Name="Colorful Shading Accent 5"/>
<w:LsdException Locked="false" Priority="72" Name="Colorful List Accent 5"/>
<w:LsdException Locked="false" Priority="73" Name="Colorful Grid Accent 5"/>
<w:LsdException Locked="false" Priority="60" Name="Light Shading Accent 6"/>
<w:LsdException Locked="false" Priority="61" Name="Light List Accent 6"/>
<w:LsdException Locked="false" Priority="62" Name="Light Grid Accent 6"/>
<w:LsdException Locked="false" Priority="63" Name="Medium Shading 1 Accent 6"/>
<w:LsdException Locked="false" Priority="64" Name="Medium Shading 2 Accent 6"/>
<w:LsdException Locked="false" Priority="65" Name="Medium List 1 Accent 6"/>
<w:LsdException Locked="false" Priority="66" Name="Medium List 2 Accent 6"/>
<w:LsdException Locked="false" Priority="67" Name="Medium Grid 1 Accent 6"/>
<w:LsdException Locked="false" Priority="68" Name="Medium Grid 2 Accent 6"/>
<w:LsdException Locked="false" Priority="69" Name="Medium Grid 3 Accent 6"/>
<w:LsdException Locked="false" Priority="70" Name="Dark List Accent 6"/>
<w:LsdException Locked="false" Priority="71" Name="Colorful Shading Accent 6"/>
<w:LsdException Locked="false" Priority="72" Name="Colorful List Accent 6"/>
<w:LsdException Locked="false" Priority="73" Name="Colorful Grid Accent 6"/>
<w:LsdException Locked="false" Priority="19" QFormat="true"
Name="Subtle Emphasis"/>
<w:LsdException Locked="false" Priority="21" QFormat="true"
Name="Intense Emphasis"/>
<w:LsdException Locked="false" Priority="31" QFormat="true"
Name="Subtle Reference"/>
<w:LsdException Locked="false" Priority="32" QFormat="true"
Name="Intense Reference"/>
<w:LsdException Locked="false" Priority="33" QFormat="true" Name="Book Title"/>
<w:LsdException Locked="false" Priority="37" SemiHidden="true"
UnhideWhenUsed="true" Name="Bibliography"/>
<w:LsdException Locked="false" Priority="39" SemiHidden="true"
UnhideWhenUsed="true" QFormat="true" Name="TOC Heading"/>
<w:LsdException Locked="false" Priority="41" Name="Plain Table 1"/>
<w:LsdException Locked="false" Priority="42" Name="Plain Table 2"/>
<w:LsdException Locked="false" Priority="43" Name="Plain Table 3"/>
<w:LsdException Locked="false" Priority="44" Name="Plain Table 4"/>
<w:LsdException Locked="false" Priority="45" Name="Plain Table 5"/>
<w:LsdException Locked="false" Priority="40" Name="Grid Table Light"/>
<w:LsdException Locked="false" Priority="46" Name="Grid Table 1 Light"/>
<w:LsdException Locked="false" Priority="47" Name="Grid Table 2"/>
<w:LsdException Locked="false" Priority="48" Name="Grid Table 3"/>
<w:LsdException Locked="false" Priority="49" Name="Grid Table 4"/>
<w:LsdException Locked="false" Priority="50" Name="Grid Table 5 Dark"/>
<w:LsdException Locked="false" Priority="51" Name="Grid Table 6 Colorful"/>
<w:LsdException Locked="false" Priority="52" Name="Grid Table 7 Colorful"/>
<w:LsdException Locked="false" Priority="46"
Name="Grid Table 1 Light Accent 1"/>
<w:LsdException Locked="false" Priority="47" Name="Grid Table 2 Accent 1"/>
<w:LsdException Locked="false" Priority="48" Name="Grid Table 3 Accent 1"/>
<w:LsdException Locked="false" Priority="49" Name="Grid Table 4 Accent 1"/>
<w:LsdException Locked="false" Priority="50" Name="Grid Table 5 Dark Accent 1"/>
<w:LsdException Locked="false" Priority="51"
Name="Grid Table 6 Colorful Accent 1"/>
<w:LsdException Locked="false" Priority="52"
Name="Grid Table 7 Colorful Accent 1"/>
<w:LsdException Locked="false" Priority="46"
Name="Grid Table 1 Light Accent 2"/>
<w:LsdException Locked="false" Priority="47" Name="Grid Table 2 Accent 2"/>
<w:LsdException Locked="false" Priority="48" Name="Grid Table 3 Accent 2"/>
<w:LsdException Locked="false" Priority="49" Name="Grid Table 4 Accent 2"/>
<w:LsdException Locked="false" Priority="50" Name="Grid Table 5 Dark Accent 2"/>
<w:LsdException Locked="false" Priority="51"
Name="Grid Table 6 Colorful Accent 2"/>
<w:LsdException Locked="false" Priority="52"
Name="Grid Table 7 Colorful Accent 2"/>
<w:LsdException Locked="false" Priority="46"
Name="Grid Table 1 Light Accent 3"/>
<w:LsdException Locked="false" Priority="47" Name="Grid Table 2 Accent 3"/>
<w:LsdException Locked="false" Priority="48" Name="Grid Table 3 Accent 3"/>
<w:LsdException Locked="false" Priority="49" Name="Grid Table 4 Accent 3"/>
<w:LsdException Locked="false" Priority="50" Name="Grid Table 5 Dark Accent 3"/>
<w:LsdException Locked="false" Priority="51"
Name="Grid Table 6 Colorful Accent 3"/>
<w:LsdException Locked="false" Priority="52"
Name="Grid Table 7 Colorful Accent 3"/>
<w:LsdException Locked="false" Priority="46"
Name="Grid Table 1 Light Accent 4"/>
<w:LsdException Locked="false" Priority="47" Name="Grid Table 2 Accent 4"/>
<w:LsdException Locked="false" Priority="48" Name="Grid Table 3 Accent 4"/>
<w:LsdException Locked="false" Priority="49" Name="Grid Table 4 Accent 4"/>
<w:LsdException Locked="false" Priority="50" Name="Grid Table 5 Dark Accent 4"/>
<w:LsdException Locked="false" Priority="51"
Name="Grid Table 6 Colorful Accent 4"/>
<w:LsdException Locked="false" Priority="52"
Name="Grid Table 7 Colorful Accent 4"/>
<w:LsdException Locked="false" Priority="46"
Name="Grid Table 1 Light Accent 5"/>
<w:LsdException Locked="false" Priority="47" Name="Grid Table 2 Accent 5"/>
<w:LsdException Locked="false" Priority="48" Name="Grid Table 3 Accent 5"/>
<w:LsdException Locked="false" Priority="49" Name="Grid Table 4 Accent 5"/>
<w:LsdException Locked="false" Priority="50" Name="Grid Table 5 Dark Accent 5"/>
<w:LsdException Locked="false" Priority="51"
Name="Grid Table 6 Colorful Accent 5"/>
<w:LsdException Locked="false" Priority="52"
Name="Grid Table 7 Colorful Accent 5"/>
<w:LsdException Locked="false" Priority="46"
Name="Grid Table 1 Light Accent 6"/>
<w:LsdException Locked="false" Priority="47" Name="Grid Table 2 Accent 6"/>
<w:LsdException Locked="false" Priority="48" Name="Grid Table 3 Accent 6"/>
<w:LsdException Locked="false" Priority="49" Name="Grid Table 4 Accent 6"/>
<w:LsdException Locked="false" Priority="50" Name="Grid Table 5 Dark Accent 6"/>
<w:LsdException Locked="false" Priority="51"
Name="Grid Table 6 Colorful Accent 6"/>
<w:LsdException Locked="false" Priority="52"
Name="Grid Table 7 Colorful Accent 6"/>
<w:LsdException Locked="false" Priority="46" Name="List Table 1 Light"/>
<w:LsdException Locked="false" Priority="47" Name="List Table 2"/>
<w:LsdException Locked="false" Priority="48" Name="List Table 3"/>
<w:LsdException Locked="false" Priority="49" Name="List Table 4"/>
<w:LsdException Locked="false" Priority="50" Name="List Table 5 Dark"/>
<w:LsdException Locked="false" Priority="51" Name="List Table 6 Colorful"/>
<w:LsdException Locked="false" Priority="52" Name="List Table 7 Colorful"/>
<w:LsdException Locked="false" Priority="46"
Name="List Table 1 Light Accent 1"/>
<w:LsdException Locked="false" Priority="47" Name="List Table 2 Accent 1"/>
<w:LsdException Locked="false" Priority="48" Name="List Table 3 Accent 1"/>
<w:LsdException Locked="false" Priority="49" Name="List Table 4 Accent 1"/>
<w:LsdException Locked="false" Priority="50" Name="List Table 5 Dark Accent 1"/>
<w:LsdException Locked="false" Priority="51"
Name="List Table 6 Colorful Accent 1"/>
<w:LsdException Locked="false" Priority="52"
Name="List Table 7 Colorful Accent 1"/>
<w:LsdException Locked="false" Priority="46"
Name="List Table 1 Light Accent 2"/>
<w:LsdException Locked="false" Priority="47" Name="List Table 2 Accent 2"/>
<w:LsdException Locked="false" Priority="48" Name="List Table 3 Accent 2"/>
<w:LsdException Locked="false" Priority="49" Name="List Table 4 Accent 2"/>
<w:LsdException Locked="false" Priority="50" Name="List Table 5 Dark Accent 2"/>
<w:LsdException Locked="false" Priority="51"
Name="List Table 6 Colorful Accent 2"/>
<w:LsdException Locked="false" Priority="52"
Name="List Table 7 Colorful Accent 2"/>
<w:LsdException Locked="false" Priority="46"
Name="List Table 1 Light Accent 3"/>
<w:LsdException Locked="false" Priority="47" Name="List Table 2 Accent 3"/>
<w:LsdException Locked="false" Priority="48" Name="List Table 3 Accent 3"/>
<w:LsdException Locked="false" Priority="49" Name="List Table 4 Accent 3"/>
<w:LsdException Locked="false" Priority="50" Name="List Table 5 Dark Accent 3"/>
<w:LsdException Locked="false" Priority="51"
Name="List Table 6 Colorful Accent 3"/>
<w:LsdException Locked="false" Priority="52"
Name="List Table 7 Colorful Accent 3"/>
<w:LsdException Locked="false" Priority="46"
Name="List Table 1 Light Accent 4"/>
<w:LsdException Locked="false" Priority="47" Name="List Table 2 Accent 4"/>
<w:LsdException Locked="false" Priority="48" Name="List Table 3 Accent 4"/>
<w:LsdException Locked="false" Priority="49" Name="List Table 4 Accent 4"/>
<w:LsdException Locked="false" Priority="50" Name="List Table 5 Dark Accent 4"/>
<w:LsdException Locked="false" Priority="51"
Name="List Table 6 Colorful Accent 4"/>
<w:LsdException Locked="false" Priority="52"
Name="List Table 7 Colorful Accent 4"/>
<w:LsdException Locked="false" Priority="46"
Name="List Table 1 Light Accent 5"/>
<w:LsdException Locked="false" Priority="47" Name="List Table 2 Accent 5"/>
<w:LsdException Locked="false" Priority="48" Name="List Table 3 Accent 5"/>
<w:LsdException Locked="false" Priority="49" Name="List Table 4 Accent 5"/>
<w:LsdException Locked="false" Priority="50" Name="List Table 5 Dark Accent 5"/>
<w:LsdException Locked="false" Priority="51"
Name="List Table 6 Colorful Accent 5"/>
<w:LsdException Locked="false" Priority="52"
Name="List Table 7 Colorful Accent 5"/>
<w:LsdException Locked="false" Priority="46"
Name="List Table 1 Light Accent 6"/>
<w:LsdException Locked="false" Priority="47" Name="List Table 2 Accent 6"/>
<w:LsdException Locked="false" Priority="48" Name="List Table 3 Accent 6"/>
<w:LsdException Locked="false" Priority="49" Name="List Table 4 Accent 6"/>
<w:LsdException Locked="false" Priority="50" Name="List Table 5 Dark Accent 6"/>
<w:LsdException Locked="false" Priority="51"
Name="List Table 6 Colorful Accent 6"/>
<w:LsdException Locked="false" Priority="52"
Name="List Table 7 Colorful Accent 6"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="Mention"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="Smart Hyperlink"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="Hashtag"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="Unresolved Mention"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="Smart Link"/>
</w:LatentStyles>
</xml><![endif]-->
<style>
<!--
/* Font Definitions */
@font-face
{font-family:"Cambria Math";
panose-1:2 4 5 3 5 4 6 3 2 4;
mso-font-charset:0;
mso-generic-font-family:roman;
mso-font-pitch:variable;
mso-font-signature:-536870145 1107305727 0 0 415 0;}
@font-face
{font-family:Calibri;
panose-1:2 15 5 2 2 2 4 3 2 4;
mso-font-charset:0;
mso-generic-font-family:swiss;
mso-font-pitch:variable;
mso-font-signature:-536859905 -1073697537 9 0 511 0;}
@font-face
{font-family:Menlo;
panose-1:2 11 6 9 3 8 4 2 2 4;
mso-font-charset:0;
mso-generic-font-family:modern;
mso-font-pitch:fixed;
mso-font-signature:-436198657 -771687941 33554472 0 479 0;}
/* Style Definitions */
p.MsoNormal, li.MsoNormal, div.MsoNormal
{mso-style-unhide:no;
mso-style-qformat:yes;
mso-style-parent:"";
margin:0cm;
margin-bottom:.0001pt;
mso-pagination:widow-orphan;
font-size:12.0pt;
font-family:"Calibri",sans-serif;
mso-ascii-font-family:Calibri;
mso-ascii-theme-font:minor-latin;
mso-fareast-font-family:Calibri;
mso-fareast-theme-font:minor-latin;
mso-hansi-font-family:Calibri;
mso-hansi-theme-font:minor-latin;
mso-bidi-font-family:"Times New Roman";
mso-bidi-theme-font:minor-bidi;
mso-fareast-language:EN-US;}
.MsoChpDefault
{mso-style-type:export-only;
mso-default-props:yes;
font-family:"Calibri",sans-serif;
mso-ascii-font-family:Calibri;
mso-ascii-theme-font:minor-latin;
mso-fareast-font-family:Calibri;
mso-fareast-theme-font:minor-latin;
mso-hansi-font-family:Calibri;
mso-hansi-theme-font:minor-latin;
mso-bidi-font-family:"Times New Roman";
mso-bidi-theme-font:minor-bidi;
mso-fareast-language:EN-US;}
@page WordSection1
{size:612.0pt 792.0pt;
margin:72.0pt 72.0pt 72.0pt 72.0pt;
mso-header-margin:36.0pt;
mso-footer-margin:36.0pt;
mso-paper-source:0;}
div.WordSection1
{page:WordSection1;}
-->
</style>
<!--[if gte mso 10]>
<style>
/* Style Definitions */
table.MsoNormalTable
{mso-style-name:"Table Normal";
mso-tstyle-rowband-size:0;
mso-tstyle-colband-size:0;
mso-style-noshow:yes;
mso-style-priority:99;
mso-style-parent:"";
mso-padding-alt:0cm 5.4pt 0cm 5.4pt;
mso-para-margin:0cm;
mso-para-margin-bottom:.0001pt;
mso-pagination:widow-orphan;
font-size:12.0pt;
font-family:"Calibri",sans-serif;
mso-ascii-font-family:Calibri;
mso-ascii-theme-font:minor-latin;
mso-hansi-font-family:Calibri;
mso-hansi-theme-font:minor-latin;
mso-bidi-font-family:"Times New Roman";
mso-bidi-theme-font:minor-bidi;
mso-fareast-language:EN-US;}
</style>
<![endif]-->
<!--StartFragment-->
<br />
<pre><span style="font-size: xx-small;"><span style="color: #cc7832; font-family: "menlo";">package </span><span style="color: #a9b7c6; font-family: "menlo";">references</span><span style="color: #cc7832; font-family: "menlo";">;
import </span><span style="color: #a9b7c6; font-family: "menlo";">java.io.File</span><span style="color: #cc7832; font-family: "menlo";">;
import </span><span style="color: #a9b7c6; font-family: "menlo";">java.util.Objects</span><span style="color: #cc7832; font-family: "menlo";">;
public class </span><span style="color: #a9b7c6; font-family: "menlo";">StrongReference {
<span style="mso-spacerun: yes;"> </span></span><span style="color: #cc7832; font-family: "menlo";">private static final int </span><i><span style="color: #9876aa; font-family: "menlo";">RETRY </span></i><span style="color: #a9b7c6; font-family: "menlo";">= </span><span style="color: #6897bb; font-family: "menlo";">3</span><span style="color: #cc7832; font-family: "menlo";">;
<span style="mso-spacerun: yes;"> </span>public static void </span><span style="color: #ffc66d; font-family: "menlo";">main</span><span style="color: #a9b7c6; font-family: "menlo";">(String[] args) </span><span style="color: #cc7832; font-family: "menlo";">throws </span><span style="color: #a9b7c6; font-family: "menlo";">InterruptedException {
<span style="mso-spacerun: yes;"> </span><i>deleteOldDumps</i>()</span><span style="color: #cc7832; font-family: "menlo";">;
<span style="mso-spacerun: yes;"> </span><span style="mso-spacerun: yes;"> </span></span><span style="color: #a9b7c6; font-family: "menlo";">A a = </span><span style="color: #cc7832; font-family: "menlo";">new </span><span style="color: #a9b7c6; font-family: "menlo";">A(</span><span style="color: #6a8759; font-family: "menlo";">"Strong Reference"</span><span style="color: #a9b7c6; font-family: "menlo";">)</span><span style="color: #cc7832; font-family: "menlo";">;
<span style="mso-spacerun: yes;"> </span></span><span style="color: #a9b7c6; font-family: "menlo";">references.HeapDump.<i>dumpHeap</i>(</span><span style="color: #6a8759; font-family: "menlo";">"java/heap-dumps/strongRefBeforeGCEligible.hprof"</span><span style="color: #cc7832; font-family: "menlo";">, false</span><span style="color: #a9b7c6; font-family: "menlo";">)</span><span style="color: #cc7832; font-family: "menlo";">;
<span style="mso-spacerun: yes;"> </span></span><span style="color: #a9b7c6; font-family: "menlo";">a = </span><span style="color: #cc7832; font-family: "menlo";">null; </span><span style="color: grey; font-family: "menlo";">// Make the strong reference eligible for GC
<span style="mso-spacerun: yes;"> </span></span><span style="color: #a9b7c6; font-family: "menlo";">references.HeapDump.<i>dumpHeap</i>(</span><span style="color: #6a8759; font-family: "menlo";">"java/heap-dumps/strongRefBeforeGC.hprof"</span><span style="color: #cc7832; font-family: "menlo";">, false</span><span style="color: #a9b7c6; font-family: "menlo";">)</span><span style="color: #cc7832; font-family: "menlo";">;
<span style="mso-spacerun: yes;"> </span></span><i><span style="color: #a9b7c6; font-family: "menlo";">runGC</span></i><span style="color: #a9b7c6; font-family: "menlo";">();</span><span style="color: #cc7832; font-family: "menlo";">
<span style="mso-spacerun: yes;"> </span></span><span style="color: #a9b7c6; font-family: "menlo";">references.HeapDump.<i>dumpHeap</i>(</span><span style="color: #6a8759; font-family: "menlo";">"java/heap-dumps/strongRefAfterGC.hprof"</span><span style="color: #cc7832; font-family: "menlo";">, false</span><span style="color: #a9b7c6; font-family: "menlo";">)</span><span style="color: #cc7832; font-family: "menlo";">;
<span style="mso-spacerun: yes;"> </span></span><span style="color: #a9b7c6; font-family: "menlo";">}
<span style="mso-spacerun: yes;"> </span></span><span style="color: #cc7832; font-family: "menlo";">static class </span><span style="color: #a9b7c6; font-family: "menlo";">A {
<span style="mso-spacerun: yes;"> </span></span><span style="color: #ffc66d; font-family: "menlo";">A</span><span style="color: #a9b7c6; font-family: "menlo";">(String s) {
<span style="mso-spacerun: yes;"> </span></span><span style="color: #cc7832; font-family: "menlo";">this</span><span style="color: #a9b7c6; font-family: "menlo";">.</span><span style="color: #9876aa; font-family: "menlo";">s </span><span style="color: #a9b7c6; font-family: "menlo";">= s</span><span style="color: #cc7832; font-family: "menlo";">;
<span style="mso-spacerun: yes;"> </span></span><span style="color: #a9b7c6; font-family: "menlo";">}
<span style="mso-spacerun: yes;"> </span>String </span><span style="color: #9876aa; font-family: "menlo";">s</span><span style="color: #cc7832; font-family: "menlo";">;
<span style="mso-spacerun: yes;"> </span></span><span style="color: #a9b7c6; font-family: "menlo";">}</span></span></pre>
<pre><span style="font-size: xx-small;"><span style="color: #a9b7c6; font-family: "menlo";">
<span style="mso-spacerun: yes;"> </span></span><span style="color: #cc7832; font-family: "menlo";">static void </span><span style="color: #ffc66d; font-family: "menlo";">deleteOldDumps</span><span style="color: #a9b7c6; font-family: "menlo";">() </span><span style="color: #cc7832; font-family: "menlo";">throws </span><span style="color: #a9b7c6; font-family: "menlo";">InterruptedException {
<span style="mso-spacerun: yes;"> </span></span><span style="color: #cc7832; font-family: "menlo";">boolean </span><span style="color: #a9b7c6; font-family: "menlo";">isDeleted = <i>deleteFiles</i>()</span><span style="color: #cc7832; font-family: "menlo";">;
<span style="mso-spacerun: yes;"> </span>int </span><span style="color: #a9b7c6; font-family: "menlo";">attempt = </span><span style="color: #6897bb; font-family: "menlo";">0</span><span style="color: #cc7832; font-family: "menlo";">;
<span style="mso-spacerun: yes;"> </span>while </span><span style="color: #a9b7c6; font-family: "menlo";">(!isDeleted && attempt++ < </span><i><span style="color: #9876aa; font-family: "menlo";">RETRY</span></i><span style="color: #a9b7c6; font-family: "menlo";">) {
<span style="mso-spacerun: yes;"> </span>isDeleted = <i>deleteFiles</i>()</span><span style="color: #cc7832; font-family: "menlo";">;
<span style="mso-spacerun: yes;"> </span></span><span style="color: #a9b7c6; font-family: "menlo";">Thread.<i>sleep</i>(</span><span style="color: #6897bb; font-family: "menlo";">1000 </span><span style="color: #a9b7c6; font-family: "menlo";">* attempt)</span><span style="color: #cc7832; font-family: "menlo";">;
<span style="mso-spacerun: yes;"> </span></span><span style="color: #a9b7c6; font-family: "menlo";">}
<span style="mso-spacerun: yes;"> </span>}</span></span></pre>
<pre><span style="font-size: xx-small;"><span style="color: #a9b7c6; font-family: "menlo";">
<span style="mso-spacerun: yes;"> </span></span><span style="color: #cc7832; font-family: "menlo";">private static boolean </span><span style="color: #ffc66d; font-family: "menlo";">deleteFiles</span><span style="color: #a9b7c6; font-family: "menlo";">() {
<span style="mso-spacerun: yes;"> </span>File dir = </span><span style="color: #cc7832; font-family: "menlo";">new </span><span style="color: #a9b7c6; font-family: "menlo";">File(</span><span style="color: #6a8759; font-family: "menlo";">"java/heap-dumps"</span><span style="color: #a9b7c6; font-family: "menlo";">)</span><span style="color: #cc7832; font-family: "menlo";">;
<span style="mso-spacerun: yes;"> </span></span><span style="color: #a9b7c6; font-family: "menlo";">File[] files = dir.listFiles()</span><span style="color: #cc7832; font-family: "menlo";">;
<span style="mso-spacerun: yes;"> </span>for </span><span style="color: #a9b7c6; font-family: "menlo";">(File file : Objects.<i>requireNonNull</i>(files)) {
<span style="mso-spacerun: yes;"> </span>file.delete()</span><span style="color: #cc7832; font-family: "menlo";">;
<span style="mso-spacerun: yes;"> </span></span><span style="color: #a9b7c6; font-family: "menlo";">}
<span style="mso-spacerun: yes;"> </span></span><span style="color: #cc7832; font-family: "menlo";">return </span><span style="color: #a9b7c6; font-family: "menlo";">files.</span><span style="color: #9876aa; font-family: "menlo";">length </span><span style="color: #a9b7c6; font-family: "menlo";">!= </span><span style="color: #6897bb; font-family: "menlo";">0</span><span style="color: #cc7832; font-family: "menlo";">;
<span style="mso-spacerun: yes;"> </span></span><span style="color: #a9b7c6; font-family: "menlo";">}</span></span></pre>
<pre><span style="font-size: xx-small;"><span style="color: #a9b7c6; font-family: "menlo";">
<span style="mso-spacerun: yes;"> </span></span><span style="color: #cc7832; font-family: "menlo";">static void </span><span style="color: #ffc66d; font-family: "menlo";">runGC</span><span style="color: #a9b7c6; font-family: "menlo";">() </span><span style="color: #cc7832; font-family: "menlo";">throws </span><span style="color: #a9b7c6; font-family: "menlo";">InterruptedException {
<span style="mso-spacerun: yes;"> </span>System.</span><i><span style="color: #9876aa; font-family: "menlo";">out</span></i><span style="color: #a9b7c6; font-family: "menlo";">.println(</span><span style="color: #6a8759; font-family: "menlo";">"Running GC.."</span><span style="color: #a9b7c6; font-family: "menlo";">)</span><span style="color: #cc7832; font-family: "menlo";">;
<span style="mso-spacerun: yes;"> </span></span><span style="color: #a9b7c6; font-family: "menlo";">System.<i>gc</i>()</span><span style="color: #cc7832; font-family: "menlo";">; </span><span style="color: grey; font-family: "menlo";">// Hint to run gc
<span style="mso-spacerun: yes;"> </span></span><span style="color: #a9b7c6; font-family: "menlo";">Thread.<i>sleep</i>(</span><span style="color: #6897bb; font-family: "menlo";">2000L</span><span style="color: #a9b7c6; font-family: "menlo";">)</span><span style="color: #cc7832; font-family: "menlo";">; </span><span style="color: grey; font-family: "menlo";">// sleep hoping to let GC thread run
<span style="mso-spacerun: yes;"> </span></span><span style="color: #a9b7c6; font-family: "menlo";">System.</span><i><span style="color: #9876aa; font-family: "menlo";">out</span></i><span style="color: #a9b7c6; font-family: "menlo";">.println(</span><span style="color: #6a8759; font-family: "menlo";">"Finished running GC.."</span><span style="color: #a9b7c6; font-family: "menlo";">)</span><span style="color: #cc7832; font-family: "menlo";">;
<span style="mso-spacerun: yes;"> </span></span><span style="color: #a9b7c6; font-family: "menlo";">}
}</span> </span></pre>
<!--EndFragment--></div>
</div>
<div style="margin-bottom: .0001pt; margin: 0cm;">
<span style="font-size: 13.5pt;"><br /></span></div>
<div style="margin-bottom: .0001pt; margin: 0cm;">
<span style="font-size: small;">Here
we use "com.sun.management:type=HotSpotDiagnostic" mbean to dump
memory to later inspect it with jhat command line utility. Remember to delete
the previous dump files with deleteOldDumps method otherwise heap dump will
give "File exists" error.<o:p></o:p></span></div>
<div style="margin-bottom: .0001pt; margin: 0cm;">
<span style="font-size: small;">We
use <a href="https://github.com/agelenler/myblog/blob/master/java/src/references/HeapDump.java" target="_blank"><span style="color: #954f72;">this</span></a> class
to use HotSpotDiagnostic mbean and dump memory to a hprof file.<o:p></o:p></span></div>
<div style="margin-bottom: .0001pt; margin: 0cm;">
<span style="font-size: small;">Note
that the second parameter of dumpHeap method is a boolean and if we set it true
it will only dump live objects which will cause running GC before taking heap
dump so that we do not need to hint with System.gc(). In this example we set it
the second parameter to false and try to hint GC to run with System.gc() instead.<o:p></o:p></span></div>
<div style="margin-bottom: .0001pt; margin: 0cm;">
<span style="font-size: small;">Note
that to monitor GC runs with System.gc() call, run the class with
"-verbose:gc" JVM parameter so that we can see the GC running in
logs.<o:p></o:p></span></div>
<div style="margin-bottom: .0001pt; margin: 0cm;">
<span style="font-size: small;">We
take 3 dumps file before setting the object to null, after setting to null and
after hinting to run GC.<o:p></o:p></span></div>
<div style="margin-bottom: .0001pt; margin: 0cm;">
<span style="font-size: small;">Now
let's run the class and follow the steps below using jhat command to see our
memory snapshot through web interface.<o:p></o:p></span></div>
<div style="margin-bottom: .0001pt; margin: 0cm;">
<span style="font-size: small;">-
Run "jhat -J-Xmx1g -port 8000 strongRefBeforeGCEligible.hprof"
with different ports for all 3 hprof files.<o:p></o:p></span></div>
<div style="margin-bottom: .0001pt; margin: 0cm;">
<span style="font-size: small;">-
Open localhost:8000/histo (we will use the heap histogram to examine the
references)</span><span style="font-size: 13.5pt;"><o:p></o:p></span></div>
<div style="margin-bottom: .0001pt; margin: 0cm;">
<br /></div>
The output of the program is:<br />
<pre style="background-color: #2b2b2b; color: #a9b7c6; font-family: 'Menlo'; font-size: 9.0pt;">Running GC..
[<span style="color: #ffc66d;">GC </span>(System.gc()) <span style="color: #6897bb;">21053</span>K-><span style="color: #6897bb;">1256</span><span style="color: #ffc66d;">K</span>(<span style="color: #6897bb;">502784</span>K)<span style="color: #cc7832;">, </span><span style="color: #6897bb;">0.0010238 </span>secs]
[Full <span style="color: #ffc66d;">GC </span>(System.gc()) <span style="color: #6897bb;">1256</span>K-><span style="color: #6897bb;">979</span><span style="color: #ffc66d;">K</span>(<span style="color: #6897bb;">502784</span>K)<span style="color: #cc7832;">, </span><span style="color: #6897bb;">0.0061717 </span>secs]
Finished running <span style="color: #9876aa;">GC</span>..</pre>
<b style="font-family: "times new roman", serif;"><span style="font-family: "times"; font-weight: 400;">And the web interface of jhat we will see the below 3 results for 3 different hprof files.</span></b><br />
<b style="font-family: "times new roman", serif; font-size: 18.6667px;"></b><br />
<table align="center" border="1"><tbody>
<tr><th><a href="http://localhost:8000/histo/class">Class</a><br />
<a href="http://localhost:8000/class/0x7156b1ef8" style="font-weight: 400; text-align: start;">class references.StrongReference$A</a></th><th><a href="http://localhost:8000/histo/count">Instance Count</a><br />
1</th><th><a href="http://localhost:8000/histo/size">Total Size</a><br />
8</th></tr>
</tbody></table>
strongRefBeforeGCEligible.hprof(localhost:8000/histo/)<br />
<div>
<br />
<div>
<table align="center" border="1"><tbody>
<tr><th><a href="http://localhost:8000/histo/class">Class</a><br />
<a href="http://localhost:8000/class/0x7156b1ef8" style="font-weight: 400; text-align: start;">class references.StrongReference$A</a></th><th><a href="http://localhost:8000/histo/count">Instance Count</a><br />
1</th><th><a href="http://localhost:8000/histo/size">Total Size</a><br />
8</th></tr>
</tbody></table>
strongRefBeforeGC.hprof(localhost:8001/histo/)</div>
<div>
<br /></div>
<div>
<table align="center" border="1"><tbody>
<tr><th><a href="http://localhost:8000/histo/class">Class</a><br />
<a href="http://localhost:8000/class/0x7156b1ef8" style="font-weight: 400; text-align: start;">class references.StrongReference$A</a></th><th><a href="http://localhost:8000/histo/count">Instance Count</a><br />
0</th><th><a href="http://localhost:8000/histo/size">Total Size</a><br />
0</th></tr>
</tbody></table>
strongRefAfterGC.hprof(localhost:8002/histo/)</div>
<div>
<br /></div>
<div>
<div class="MsoNormal">
<span style="color: black; font-family: "times new roman" , serif;"><span style="font-size: small;">As we expected after GC runs the non-referenced object of class A reclaimed
by GC.<o:p></o:p></span></span></div>
<div class="MsoNormal">
<span style="font-size: small;"><span style="font-family: "times new roman" , serif; mso-fareast-font-family: "Times New Roman"; mso-fareast-language: EN-GB;"><o:p> </o:p></span><span style="font-family: "times new roman" , serif;"> </span></span></div>
<b style="font-family: "times new roman", serif; font-size: 18.6667px;"><u>Weak References:</u></b><br />
<b style="font-family: "times new roman", serif; font-size: 18.6667px;"><u><br /></u></b> <span style="font-size: small;">A weak reference can be created with java.lang.ref.WeakReference
class. If JVM sees an object has only a weak reference during GC it will be
collected.</span><br />
<!--[if gte mso 9]><xml>
<o:OfficeDocumentSettings>
<o:AllowPNG/>
</o:OfficeDocumentSettings>
</xml><![endif]-->
<!--[if gte mso 9]><xml>
<w:WordDocument>
<w:View>Normal</w:View>
<w:Zoom>0</w:Zoom>
<w:TrackMoves/>
<w:TrackFormatting/>
<w:PunctuationKerning/>
<w:ValidateAgainstSchemas/>
<w:SaveIfXMLInvalid>false</w:SaveIfXMLInvalid>
<w:IgnoreMixedContent>false</w:IgnoreMixedContent>
<w:AlwaysShowPlaceholderText>false</w:AlwaysShowPlaceholderText>
<w:DoNotPromoteQF/>
<w:LidThemeOther>EN-US</w:LidThemeOther>
<w:LidThemeAsian>X-NONE</w:LidThemeAsian>
<w:LidThemeComplexScript>X-NONE</w:LidThemeComplexScript>
<w:Compatibility>
<w:BreakWrappedTables/>
<w:SnapToGridInCell/>
<w:WrapTextWithPunct/>
<w:UseAsianBreakRules/>
<w:DontGrowAutofit/>
<w:SplitPgBreakAndParaMark/>
<w:EnableOpenTypeKerning/>
<w:DontFlipMirrorIndents/>
<w:OverrideTableStyleHps/>
</w:Compatibility>
<m:mathPr>
<m:mathFont m:val="Cambria Math"/>
<m:brkBin m:val="before"/>
<m:brkBinSub m:val="--"/>
<m:smallFrac m:val="off"/>
<m:dispDef/>
<m:lMargin m:val="0"/>
<m:rMargin m:val="0"/>
<m:defJc m:val="centerGroup"/>
<m:wrapIndent m:val="1440"/>
<m:intLim m:val="subSup"/>
<m:naryLim m:val="undOvr"/>
</m:mathPr></w:WordDocument>
</xml><![endif]--><!--[if gte mso 9]><xml>
<w:LatentStyles DefLockedState="false" DefUnhideWhenUsed="false"
DefSemiHidden="false" DefQFormat="false" DefPriority="99"
LatentStyleCount="376">
<w:LsdException Locked="false" Priority="0" QFormat="true" Name="Normal"/>
<w:LsdException Locked="false" Priority="9" QFormat="true" Name="heading 1"/>
<w:LsdException Locked="false" Priority="9" SemiHidden="true"
UnhideWhenUsed="true" QFormat="true" Name="heading 2"/>
<w:LsdException Locked="false" Priority="9" SemiHidden="true"
UnhideWhenUsed="true" QFormat="true" Name="heading 3"/>
<w:LsdException Locked="false" Priority="9" SemiHidden="true"
UnhideWhenUsed="true" QFormat="true" Name="heading 4"/>
<w:LsdException Locked="false" Priority="9" SemiHidden="true"
UnhideWhenUsed="true" QFormat="true" Name="heading 5"/>
<w:LsdException Locked="false" Priority="9" SemiHidden="true"
UnhideWhenUsed="true" QFormat="true" Name="heading 6"/>
<w:LsdException Locked="false" Priority="9" SemiHidden="true"
UnhideWhenUsed="true" QFormat="true" Name="heading 7"/>
<w:LsdException Locked="false" Priority="9" SemiHidden="true"
UnhideWhenUsed="true" QFormat="true" Name="heading 8"/>
<w:LsdException Locked="false" Priority="9" SemiHidden="true"
UnhideWhenUsed="true" QFormat="true" Name="heading 9"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="index 1"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="index 2"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="index 3"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="index 4"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="index 5"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="index 6"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="index 7"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="index 8"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="index 9"/>
<w:LsdException Locked="false" Priority="39" SemiHidden="true"
UnhideWhenUsed="true" Name="toc 1"/>
<w:LsdException Locked="false" Priority="39" SemiHidden="true"
UnhideWhenUsed="true" Name="toc 2"/>
<w:LsdException Locked="false" Priority="39" SemiHidden="true"
UnhideWhenUsed="true" Name="toc 3"/>
<w:LsdException Locked="false" Priority="39" SemiHidden="true"
UnhideWhenUsed="true" Name="toc 4"/>
<w:LsdException Locked="false" Priority="39" SemiHidden="true"
UnhideWhenUsed="true" Name="toc 5"/>
<w:LsdException Locked="false" Priority="39" SemiHidden="true"
UnhideWhenUsed="true" Name="toc 6"/>
<w:LsdException Locked="false" Priority="39" SemiHidden="true"
UnhideWhenUsed="true" Name="toc 7"/>
<w:LsdException Locked="false" Priority="39" SemiHidden="true"
UnhideWhenUsed="true" Name="toc 8"/>
<w:LsdException Locked="false" Priority="39" SemiHidden="true"
UnhideWhenUsed="true" Name="toc 9"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="Normal Indent"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="footnote text"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="annotation text"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="header"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="footer"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="index heading"/>
<w:LsdException Locked="false" Priority="35" SemiHidden="true"
UnhideWhenUsed="true" QFormat="true" Name="caption"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="table of figures"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="envelope address"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="envelope return"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="footnote reference"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="annotation reference"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="line number"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="page number"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="endnote reference"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="endnote text"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="table of authorities"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="macro"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="toa heading"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="List"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="List Bullet"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="List Number"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="List 2"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="List 3"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="List 4"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="List 5"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="List Bullet 2"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="List Bullet 3"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="List Bullet 4"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="List Bullet 5"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="List Number 2"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="List Number 3"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="List Number 4"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="List Number 5"/>
<w:LsdException Locked="false" Priority="10" QFormat="true" Name="Title"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="Closing"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="Signature"/>
<w:LsdException Locked="false" Priority="1" SemiHidden="true"
UnhideWhenUsed="true" Name="Default Paragraph Font"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="Body Text"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="Body Text Indent"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="List Continue"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="List Continue 2"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="List Continue 3"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="List Continue 4"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="List Continue 5"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="Message Header"/>
<w:LsdException Locked="false" Priority="11" QFormat="true" Name="Subtitle"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="Salutation"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="Date"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="Body Text First Indent"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="Body Text First Indent 2"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="Note Heading"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="Body Text 2"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="Body Text 3"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="Body Text Indent 2"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="Body Text Indent 3"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="Block Text"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="Hyperlink"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="FollowedHyperlink"/>
<w:LsdException Locked="false" Priority="22" QFormat="true" Name="Strong"/>
<w:LsdException Locked="false" Priority="20" QFormat="true" Name="Emphasis"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="Document Map"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="Plain Text"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="E-mail Signature"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="HTML Top of Form"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="HTML Bottom of Form"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="Normal (Web)"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="HTML Acronym"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="HTML Address"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="HTML Cite"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="HTML Code"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="HTML Definition"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="HTML Keyboard"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
QFormat="true" Name="HTML Preformatted"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="HTML Sample"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="HTML Typewriter"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="HTML Variable"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="Normal Table"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="annotation subject"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="No List"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="Outline List 1"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="Outline List 2"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="Outline List 3"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="Table Simple 1"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="Table Simple 2"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="Table Simple 3"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="Table Classic 1"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="Table Classic 2"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="Table Classic 3"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="Table Classic 4"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="Table Colorful 1"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="Table Colorful 2"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="Table Colorful 3"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="Table Columns 1"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="Table Columns 2"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="Table Columns 3"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="Table Columns 4"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="Table Columns 5"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="Table Grid 1"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="Table Grid 2"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="Table Grid 3"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="Table Grid 4"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="Table Grid 5"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="Table Grid 6"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="Table Grid 7"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="Table Grid 8"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="Table List 1"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="Table List 2"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="Table List 3"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="Table List 4"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="Table List 5"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="Table List 6"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="Table List 7"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="Table List 8"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="Table 3D effects 1"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="Table 3D effects 2"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="Table 3D effects 3"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="Table Contemporary"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="Table Elegant"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="Table Professional"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="Table Subtle 1"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="Table Subtle 2"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="Table Web 1"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="Table Web 2"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="Table Web 3"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="Balloon Text"/>
<w:LsdException Locked="false" Priority="39" Name="Table Grid"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="Table Theme"/>
<w:LsdException Locked="false" SemiHidden="true" Name="Placeholder Text"/>
<w:LsdException Locked="false" Priority="1" QFormat="true" Name="No Spacing"/>
<w:LsdException Locked="false" Priority="60" Name="Light Shading"/>
<w:LsdException Locked="false" Priority="61" Name="Light List"/>
<w:LsdException Locked="false" Priority="62" Name="Light Grid"/>
<w:LsdException Locked="false" Priority="63" Name="Medium Shading 1"/>
<w:LsdException Locked="false" Priority="64" Name="Medium Shading 2"/>
<w:LsdException Locked="false" Priority="65" Name="Medium List 1"/>
<w:LsdException Locked="false" Priority="66" Name="Medium List 2"/>
<w:LsdException Locked="false" Priority="67" Name="Medium Grid 1"/>
<w:LsdException Locked="false" Priority="68" Name="Medium Grid 2"/>
<w:LsdException Locked="false" Priority="69" Name="Medium Grid 3"/>
<w:LsdException Locked="false" Priority="70" Name="Dark List"/>
<w:LsdException Locked="false" Priority="71" Name="Colorful Shading"/>
<w:LsdException Locked="false" Priority="72" Name="Colorful List"/>
<w:LsdException Locked="false" Priority="73" Name="Colorful Grid"/>
<w:LsdException Locked="false" Priority="60" Name="Light Shading Accent 1"/>
<w:LsdException Locked="false" Priority="61" Name="Light List Accent 1"/>
<w:LsdException Locked="false" Priority="62" Name="Light Grid Accent 1"/>
<w:LsdException Locked="false" Priority="63" Name="Medium Shading 1 Accent 1"/>
<w:LsdException Locked="false" Priority="64" Name="Medium Shading 2 Accent 1"/>
<w:LsdException Locked="false" Priority="65" Name="Medium List 1 Accent 1"/>
<w:LsdException Locked="false" SemiHidden="true" Name="Revision"/>
<w:LsdException Locked="false" Priority="34" QFormat="true"
Name="List Paragraph"/>
<w:LsdException Locked="false" Priority="29" QFormat="true" Name="Quote"/>
<w:LsdException Locked="false" Priority="30" QFormat="true"
Name="Intense Quote"/>
<w:LsdException Locked="false" Priority="66" Name="Medium List 2 Accent 1"/>
<w:LsdException Locked="false" Priority="67" Name="Medium Grid 1 Accent 1"/>
<w:LsdException Locked="false" Priority="68" Name="Medium Grid 2 Accent 1"/>
<w:LsdException Locked="false" Priority="69" Name="Medium Grid 3 Accent 1"/>
<w:LsdException Locked="false" Priority="70" Name="Dark List Accent 1"/>
<w:LsdException Locked="false" Priority="71" Name="Colorful Shading Accent 1"/>
<w:LsdException Locked="false" Priority="72" Name="Colorful List Accent 1"/>
<w:LsdException Locked="false" Priority="73" Name="Colorful Grid Accent 1"/>
<w:LsdException Locked="false" Priority="60" Name="Light Shading Accent 2"/>
<w:LsdException Locked="false" Priority="61" Name="Light List Accent 2"/>
<w:LsdException Locked="false" Priority="62" Name="Light Grid Accent 2"/>
<w:LsdException Locked="false" Priority="63" Name="Medium Shading 1 Accent 2"/>
<w:LsdException Locked="false" Priority="64" Name="Medium Shading 2 Accent 2"/>
<w:LsdException Locked="false" Priority="65" Name="Medium List 1 Accent 2"/>
<w:LsdException Locked="false" Priority="66" Name="Medium List 2 Accent 2"/>
<w:LsdException Locked="false" Priority="67" Name="Medium Grid 1 Accent 2"/>
<w:LsdException Locked="false" Priority="68" Name="Medium Grid 2 Accent 2"/>
<w:LsdException Locked="false" Priority="69" Name="Medium Grid 3 Accent 2"/>
<w:LsdException Locked="false" Priority="70" Name="Dark List Accent 2"/>
<w:LsdException Locked="false" Priority="71" Name="Colorful Shading Accent 2"/>
<w:LsdException Locked="false" Priority="72" Name="Colorful List Accent 2"/>
<w:LsdException Locked="false" Priority="73" Name="Colorful Grid Accent 2"/>
<w:LsdException Locked="false" Priority="60" Name="Light Shading Accent 3"/>
<w:LsdException Locked="false" Priority="61" Name="Light List Accent 3"/>
<w:LsdException Locked="false" Priority="62" Name="Light Grid Accent 3"/>
<w:LsdException Locked="false" Priority="63" Name="Medium Shading 1 Accent 3"/>
<w:LsdException Locked="false" Priority="64" Name="Medium Shading 2 Accent 3"/>
<w:LsdException Locked="false" Priority="65" Name="Medium List 1 Accent 3"/>
<w:LsdException Locked="false" Priority="66" Name="Medium List 2 Accent 3"/>
<w:LsdException Locked="false" Priority="67" Name="Medium Grid 1 Accent 3"/>
<w:LsdException Locked="false" Priority="68" Name="Medium Grid 2 Accent 3"/>
<w:LsdException Locked="false" Priority="69" Name="Medium Grid 3 Accent 3"/>
<w:LsdException Locked="false" Priority="70" Name="Dark List Accent 3"/>
<w:LsdException Locked="false" Priority="71" Name="Colorful Shading Accent 3"/>
<w:LsdException Locked="false" Priority="72" Name="Colorful List Accent 3"/>
<w:LsdException Locked="false" Priority="73" Name="Colorful Grid Accent 3"/>
<w:LsdException Locked="false" Priority="60" Name="Light Shading Accent 4"/>
<w:LsdException Locked="false" Priority="61" Name="Light List Accent 4"/>
<w:LsdException Locked="false" Priority="62" Name="Light Grid Accent 4"/>
<w:LsdException Locked="false" Priority="63" Name="Medium Shading 1 Accent 4"/>
<w:LsdException Locked="false" Priority="64" Name="Medium Shading 2 Accent 4"/>
<w:LsdException Locked="false" Priority="65" Name="Medium List 1 Accent 4"/>
<w:LsdException Locked="false" Priority="66" Name="Medium List 2 Accent 4"/>
<w:LsdException Locked="false" Priority="67" Name="Medium Grid 1 Accent 4"/>
<w:LsdException Locked="false" Priority="68" Name="Medium Grid 2 Accent 4"/>
<w:LsdException Locked="false" Priority="69" Name="Medium Grid 3 Accent 4"/>
<w:LsdException Locked="false" Priority="70" Name="Dark List Accent 4"/>
<w:LsdException Locked="false" Priority="71" Name="Colorful Shading Accent 4"/>
<w:LsdException Locked="false" Priority="72" Name="Colorful List Accent 4"/>
<w:LsdException Locked="false" Priority="73" Name="Colorful Grid Accent 4"/>
<w:LsdException Locked="false" Priority="60" Name="Light Shading Accent 5"/>
<w:LsdException Locked="false" Priority="61" Name="Light List Accent 5"/>
<w:LsdException Locked="false" Priority="62" Name="Light Grid Accent 5"/>
<w:LsdException Locked="false" Priority="63" Name="Medium Shading 1 Accent 5"/>
<w:LsdException Locked="false" Priority="64" Name="Medium Shading 2 Accent 5"/>
<w:LsdException Locked="false" Priority="65" Name="Medium List 1 Accent 5"/>
<w:LsdException Locked="false" Priority="66" Name="Medium List 2 Accent 5"/>
<w:LsdException Locked="false" Priority="67" Name="Medium Grid 1 Accent 5"/>
<w:LsdException Locked="false" Priority="68" Name="Medium Grid 2 Accent 5"/>
<w:LsdException Locked="false" Priority="69" Name="Medium Grid 3 Accent 5"/>
<w:LsdException Locked="false" Priority="70" Name="Dark List Accent 5"/>
<w:LsdException Locked="false" Priority="71" Name="Colorful Shading Accent 5"/>
<w:LsdException Locked="false" Priority="72" Name="Colorful List Accent 5"/>
<w:LsdException Locked="false" Priority="73" Name="Colorful Grid Accent 5"/>
<w:LsdException Locked="false" Priority="60" Name="Light Shading Accent 6"/>
<w:LsdException Locked="false" Priority="61" Name="Light List Accent 6"/>
<w:LsdException Locked="false" Priority="62" Name="Light Grid Accent 6"/>
<w:LsdException Locked="false" Priority="63" Name="Medium Shading 1 Accent 6"/>
<w:LsdException Locked="false" Priority="64" Name="Medium Shading 2 Accent 6"/>
<w:LsdException Locked="false" Priority="65" Name="Medium List 1 Accent 6"/>
<w:LsdException Locked="false" Priority="66" Name="Medium List 2 Accent 6"/>
<w:LsdException Locked="false" Priority="67" Name="Medium Grid 1 Accent 6"/>
<w:LsdException Locked="false" Priority="68" Name="Medium Grid 2 Accent 6"/>
<w:LsdException Locked="false" Priority="69" Name="Medium Grid 3 Accent 6"/>
<w:LsdException Locked="false" Priority="70" Name="Dark List Accent 6"/>
<w:LsdException Locked="false" Priority="71" Name="Colorful Shading Accent 6"/>
<w:LsdException Locked="false" Priority="72" Name="Colorful List Accent 6"/>
<w:LsdException Locked="false" Priority="73" Name="Colorful Grid Accent 6"/>
<w:LsdException Locked="false" Priority="19" QFormat="true"
Name="Subtle Emphasis"/>
<w:LsdException Locked="false" Priority="21" QFormat="true"
Name="Intense Emphasis"/>
<w:LsdException Locked="false" Priority="31" QFormat="true"
Name="Subtle Reference"/>
<w:LsdException Locked="false" Priority="32" QFormat="true"
Name="Intense Reference"/>
<w:LsdException Locked="false" Priority="33" QFormat="true" Name="Book Title"/>
<w:LsdException Locked="false" Priority="37" SemiHidden="true"
UnhideWhenUsed="true" Name="Bibliography"/>
<w:LsdException Locked="false" Priority="39" SemiHidden="true"
UnhideWhenUsed="true" QFormat="true" Name="TOC Heading"/>
<w:LsdException Locked="false" Priority="41" Name="Plain Table 1"/>
<w:LsdException Locked="false" Priority="42" Name="Plain Table 2"/>
<w:LsdException Locked="false" Priority="43" Name="Plain Table 3"/>
<w:LsdException Locked="false" Priority="44" Name="Plain Table 4"/>
<w:LsdException Locked="false" Priority="45" Name="Plain Table 5"/>
<w:LsdException Locked="false" Priority="40" Name="Grid Table Light"/>
<w:LsdException Locked="false" Priority="46" Name="Grid Table 1 Light"/>
<w:LsdException Locked="false" Priority="47" Name="Grid Table 2"/>
<w:LsdException Locked="false" Priority="48" Name="Grid Table 3"/>
<w:LsdException Locked="false" Priority="49" Name="Grid Table 4"/>
<w:LsdException Locked="false" Priority="50" Name="Grid Table 5 Dark"/>
<w:LsdException Locked="false" Priority="51" Name="Grid Table 6 Colorful"/>
<w:LsdException Locked="false" Priority="52" Name="Grid Table 7 Colorful"/>
<w:LsdException Locked="false" Priority="46"
Name="Grid Table 1 Light Accent 1"/>
<w:LsdException Locked="false" Priority="47" Name="Grid Table 2 Accent 1"/>
<w:LsdException Locked="false" Priority="48" Name="Grid Table 3 Accent 1"/>
<w:LsdException Locked="false" Priority="49" Name="Grid Table 4 Accent 1"/>
<w:LsdException Locked="false" Priority="50" Name="Grid Table 5 Dark Accent 1"/>
<w:LsdException Locked="false" Priority="51"
Name="Grid Table 6 Colorful Accent 1"/>
<w:LsdException Locked="false" Priority="52"
Name="Grid Table 7 Colorful Accent 1"/>
<w:LsdException Locked="false" Priority="46"
Name="Grid Table 1 Light Accent 2"/>
<w:LsdException Locked="false" Priority="47" Name="Grid Table 2 Accent 2"/>
<w:LsdException Locked="false" Priority="48" Name="Grid Table 3 Accent 2"/>
<w:LsdException Locked="false" Priority="49" Name="Grid Table 4 Accent 2"/>
<w:LsdException Locked="false" Priority="50" Name="Grid Table 5 Dark Accent 2"/>
<w:LsdException Locked="false" Priority="51"
Name="Grid Table 6 Colorful Accent 2"/>
<w:LsdException Locked="false" Priority="52"
Name="Grid Table 7 Colorful Accent 2"/>
<w:LsdException Locked="false" Priority="46"
Name="Grid Table 1 Light Accent 3"/>
<w:LsdException Locked="false" Priority="47" Name="Grid Table 2 Accent 3"/>
<w:LsdException Locked="false" Priority="48" Name="Grid Table 3 Accent 3"/>
<w:LsdException Locked="false" Priority="49" Name="Grid Table 4 Accent 3"/>
<w:LsdException Locked="false" Priority="50" Name="Grid Table 5 Dark Accent 3"/>
<w:LsdException Locked="false" Priority="51"
Name="Grid Table 6 Colorful Accent 3"/>
<w:LsdException Locked="false" Priority="52"
Name="Grid Table 7 Colorful Accent 3"/>
<w:LsdException Locked="false" Priority="46"
Name="Grid Table 1 Light Accent 4"/>
<w:LsdException Locked="false" Priority="47" Name="Grid Table 2 Accent 4"/>
<w:LsdException Locked="false" Priority="48" Name="Grid Table 3 Accent 4"/>
<w:LsdException Locked="false" Priority="49" Name="Grid Table 4 Accent 4"/>
<w:LsdException Locked="false" Priority="50" Name="Grid Table 5 Dark Accent 4"/>
<w:LsdException Locked="false" Priority="51"
Name="Grid Table 6 Colorful Accent 4"/>
<w:LsdException Locked="false" Priority="52"
Name="Grid Table 7 Colorful Accent 4"/>
<w:LsdException Locked="false" Priority="46"
Name="Grid Table 1 Light Accent 5"/>
<w:LsdException Locked="false" Priority="47" Name="Grid Table 2 Accent 5"/>
<w:LsdException Locked="false" Priority="48" Name="Grid Table 3 Accent 5"/>
<w:LsdException Locked="false" Priority="49" Name="Grid Table 4 Accent 5"/>
<w:LsdException Locked="false" Priority="50" Name="Grid Table 5 Dark Accent 5"/>
<w:LsdException Locked="false" Priority="51"
Name="Grid Table 6 Colorful Accent 5"/>
<w:LsdException Locked="false" Priority="52"
Name="Grid Table 7 Colorful Accent 5"/>
<w:LsdException Locked="false" Priority="46"
Name="Grid Table 1 Light Accent 6"/>
<w:LsdException Locked="false" Priority="47" Name="Grid Table 2 Accent 6"/>
<w:LsdException Locked="false" Priority="48" Name="Grid Table 3 Accent 6"/>
<w:LsdException Locked="false" Priority="49" Name="Grid Table 4 Accent 6"/>
<w:LsdException Locked="false" Priority="50" Name="Grid Table 5 Dark Accent 6"/>
<w:LsdException Locked="false" Priority="51"
Name="Grid Table 6 Colorful Accent 6"/>
<w:LsdException Locked="false" Priority="52"
Name="Grid Table 7 Colorful Accent 6"/>
<w:LsdException Locked="false" Priority="46" Name="List Table 1 Light"/>
<w:LsdException Locked="false" Priority="47" Name="List Table 2"/>
<w:LsdException Locked="false" Priority="48" Name="List Table 3"/>
<w:LsdException Locked="false" Priority="49" Name="List Table 4"/>
<w:LsdException Locked="false" Priority="50" Name="List Table 5 Dark"/>
<w:LsdException Locked="false" Priority="51" Name="List Table 6 Colorful"/>
<w:LsdException Locked="false" Priority="52" Name="List Table 7 Colorful"/>
<w:LsdException Locked="false" Priority="46"
Name="List Table 1 Light Accent 1"/>
<w:LsdException Locked="false" Priority="47" Name="List Table 2 Accent 1"/>
<w:LsdException Locked="false" Priority="48" Name="List Table 3 Accent 1"/>
<w:LsdException Locked="false" Priority="49" Name="List Table 4 Accent 1"/>
<w:LsdException Locked="false" Priority="50" Name="List Table 5 Dark Accent 1"/>
<w:LsdException Locked="false" Priority="51"
Name="List Table 6 Colorful Accent 1"/>
<w:LsdException Locked="false" Priority="52"
Name="List Table 7 Colorful Accent 1"/>
<w:LsdException Locked="false" Priority="46"
Name="List Table 1 Light Accent 2"/>
<w:LsdException Locked="false" Priority="47" Name="List Table 2 Accent 2"/>
<w:LsdException Locked="false" Priority="48" Name="List Table 3 Accent 2"/>
<w:LsdException Locked="false" Priority="49" Name="List Table 4 Accent 2"/>
<w:LsdException Locked="false" Priority="50" Name="List Table 5 Dark Accent 2"/>
<w:LsdException Locked="false" Priority="51"
Name="List Table 6 Colorful Accent 2"/>
<w:LsdException Locked="false" Priority="52"
Name="List Table 7 Colorful Accent 2"/>
<w:LsdException Locked="false" Priority="46"
Name="List Table 1 Light Accent 3"/>
<w:LsdException Locked="false" Priority="47" Name="List Table 2 Accent 3"/>
<w:LsdException Locked="false" Priority="48" Name="List Table 3 Accent 3"/>
<w:LsdException Locked="false" Priority="49" Name="List Table 4 Accent 3"/>
<w:LsdException Locked="false" Priority="50" Name="List Table 5 Dark Accent 3"/>
<w:LsdException Locked="false" Priority="51"
Name="List Table 6 Colorful Accent 3"/>
<w:LsdException Locked="false" Priority="52"
Name="List Table 7 Colorful Accent 3"/>
<w:LsdException Locked="false" Priority="46"
Name="List Table 1 Light Accent 4"/>
<w:LsdException Locked="false" Priority="47" Name="List Table 2 Accent 4"/>
<w:LsdException Locked="false" Priority="48" Name="List Table 3 Accent 4"/>
<w:LsdException Locked="false" Priority="49" Name="List Table 4 Accent 4"/>
<w:LsdException Locked="false" Priority="50" Name="List Table 5 Dark Accent 4"/>
<w:LsdException Locked="false" Priority="51"
Name="List Table 6 Colorful Accent 4"/>
<w:LsdException Locked="false" Priority="52"
Name="List Table 7 Colorful Accent 4"/>
<w:LsdException Locked="false" Priority="46"
Name="List Table 1 Light Accent 5"/>
<w:LsdException Locked="false" Priority="47" Name="List Table 2 Accent 5"/>
<w:LsdException Locked="false" Priority="48" Name="List Table 3 Accent 5"/>
<w:LsdException Locked="false" Priority="49" Name="List Table 4 Accent 5"/>
<w:LsdException Locked="false" Priority="50" Name="List Table 5 Dark Accent 5"/>
<w:LsdException Locked="false" Priority="51"
Name="List Table 6 Colorful Accent 5"/>
<w:LsdException Locked="false" Priority="52"
Name="List Table 7 Colorful Accent 5"/>
<w:LsdException Locked="false" Priority="46"
Name="List Table 1 Light Accent 6"/>
<w:LsdException Locked="false" Priority="47" Name="List Table 2 Accent 6"/>
<w:LsdException Locked="false" Priority="48" Name="List Table 3 Accent 6"/>
<w:LsdException Locked="false" Priority="49" Name="List Table 4 Accent 6"/>
<w:LsdException Locked="false" Priority="50" Name="List Table 5 Dark Accent 6"/>
<w:LsdException Locked="false" Priority="51"
Name="List Table 6 Colorful Accent 6"/>
<w:LsdException Locked="false" Priority="52"
Name="List Table 7 Colorful Accent 6"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="Mention"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="Smart Hyperlink"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="Hashtag"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="Unresolved Mention"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="Smart Link"/>
</w:LatentStyles>
</xml><![endif]-->
<style>
<!--
/* Font Definitions */
@font-face
{font-family:"Cambria Math";
panose-1:2 4 5 3 5 4 6 3 2 4;
mso-font-charset:0;
mso-generic-font-family:roman;
mso-font-pitch:variable;
mso-font-signature:-536870145 1107305727 0 0 415 0;}
@font-face
{font-family:Calibri;
panose-1:2 15 5 2 2 2 4 3 2 4;
mso-font-charset:0;
mso-generic-font-family:swiss;
mso-font-pitch:variable;
mso-font-signature:-536859905 -1073697537 9 0 511 0;}
/* Style Definitions */
p.MsoNormal, li.MsoNormal, div.MsoNormal
{mso-style-unhide:no;
mso-style-qformat:yes;
mso-style-parent:"";
margin:0cm;
margin-bottom:.0001pt;
mso-pagination:widow-orphan;
font-size:12.0pt;
font-family:"Calibri",sans-serif;
mso-ascii-font-family:Calibri;
mso-ascii-theme-font:minor-latin;
mso-fareast-font-family:Calibri;
mso-fareast-theme-font:minor-latin;
mso-hansi-font-family:Calibri;
mso-hansi-theme-font:minor-latin;
mso-bidi-font-family:"Times New Roman";
mso-bidi-theme-font:minor-bidi;
mso-fareast-language:EN-US;}
p
{mso-style-priority:99;
mso-margin-top-alt:auto;
margin-right:0cm;
mso-margin-bottom-alt:auto;
margin-left:0cm;
mso-pagination:widow-orphan;
font-size:12.0pt;
font-family:"Times New Roman",serif;
mso-fareast-font-family:"Times New Roman";}
.MsoChpDefault
{mso-style-type:export-only;
mso-default-props:yes;
font-family:"Calibri",sans-serif;
mso-ascii-font-family:Calibri;
mso-ascii-theme-font:minor-latin;
mso-fareast-font-family:Calibri;
mso-fareast-theme-font:minor-latin;
mso-hansi-font-family:Calibri;
mso-hansi-theme-font:minor-latin;
mso-bidi-font-family:"Times New Roman";
mso-bidi-theme-font:minor-bidi;
mso-fareast-language:EN-US;}
@page WordSection1
{size:595.0pt 842.0pt;
margin:72.0pt 72.0pt 72.0pt 72.0pt;
mso-header-margin:35.4pt;
mso-footer-margin:35.4pt;
mso-paper-source:0;}
div.WordSection1
{page:WordSection1;}
-->
</style>
<!--[if gte mso 10]>
<style>
/* Style Definitions */
table.MsoNormalTable
{mso-style-name:"Table Normal";
mso-tstyle-rowband-size:0;
mso-tstyle-colband-size:0;
mso-style-noshow:yes;
mso-style-priority:99;
mso-style-parent:"";
mso-padding-alt:0cm 5.4pt 0cm 5.4pt;
mso-para-margin:0cm;
mso-para-margin-bottom:.0001pt;
mso-pagination:widow-orphan;
font-size:12.0pt;
font-family:"Calibri",sans-serif;
mso-ascii-font-family:Calibri;
mso-ascii-theme-font:minor-latin;
mso-hansi-font-family:Calibri;
mso-hansi-theme-font:minor-latin;
mso-bidi-font-family:"Times New Roman";
mso-bidi-theme-font:minor-bidi;
mso-fareast-language:EN-US;}
</style>
<![endif]-->
<!--StartFragment-->
<br />
<div style="margin-bottom: 0.0001pt; margin-top: 0cm;">
<span style="font-size: small;">There is a get() method of
WeakReference which returns object itself if it is not garbage collected yet or
returns null if it is removed already.<o:p></o:p></span></div>
<div style="margin-bottom: 0.0001pt; margin-top: 0cm;">
<span style="font-size: small;">Weak references can be used to
prevent memory leaks. For example for a temporary object which will be used in
the application for a while, if you want to keep some additional information,
you generally use a global map with temporary object as key and additional
information as value. This can be seen as a in-memory cache. With a strong
referenced map, even if the temporary object lifecycle ends, since we a
reference from the map, the temporary object and the additional info will
remain in heap for more time than the expected lifecycle of the object. This
causes memory leak and it can be prevented using Weak references. Fortunately
we do not need to implement this as java has a built-in WeakHashMap class and
if you use this map GC will collect the temporary object if the only reference
to this object is from WeakHashMap.<o:p></o:p></span></div>
<div style="margin-bottom: 0.0001pt; margin-top: 0cm;">
<span style="font-size: small;">Note that WeakHashMap can hold
a ReferenceQueue which is defined during creation of Weak reference. This queue
will hold the reference object (not the referent) after GC runs. We can poll
the reference after the referent garbage collected. Before GC collect the
referent queue poll will return null.<o:p></o:p></span></div>
<div style="margin-bottom: 0.0001pt; margin-top: 0cm;">
<span style="font-size: small;">Below is an example of using
WeakHashMap and WeakReference.</span><span style="font-size: 13.5pt;"><o:p></o:p></span></div>
<div class="MsoNormal">
<br /></div>
<div style="background: rgb(248, 249, 250); border: 1pt solid rgb(234, 236, 240); font-family: Georgia, Utopia, "Palatino Linotype", Palatino, serif; padding: 12pt;">
<div class="MsoNormal" style="background-attachment: initial; background-clip: initial; background-image: initial; background-origin: initial; background-position: initial; background-repeat: initial; background-size: initial; border: none; line-height: 15.6pt; margin-bottom: 0cm; padding: 0cm;">
<pre style="font-size: 15.4px;"><span style="color: #cc7832; font-family: "menlo"; font-size: 7.5pt;">package </span><span style="color: #a9b7c6; font-family: "menlo"; font-size: 7.5pt;">references</span><span style="color: #cc7832; font-family: "menlo"; font-size: 7.5pt;">;<o:p></o:p></span></pre>
<pre style="font-size: 15.4px;"><span style="color: #cc7832; font-family: "menlo"; font-size: 7.5pt;">
</span></pre>
<pre style="font-size: 15.4px;"><span style="color: #cc7832; font-family: "menlo"; font-size: 7.5pt;">import </span><span style="color: #a9b7c6; font-family: "menlo"; font-size: 7.5pt;">java.lang.ref.Reference</span><span style="color: #cc7832; font-family: "menlo"; font-size: 7.5pt;">;</span><span style="color: #a9b7c6; font-family: "menlo";"><o:p></o:p></span></pre>
<pre style="font-size: 15.4px;"><span style="color: #cc7832; font-family: "menlo"; font-size: 7.5pt;">import </span><span style="color: #a9b7c6; font-family: "menlo"; font-size: 7.5pt;">java.lang.ref.ReferenceQueue</span><span style="color: #cc7832; font-family: "menlo"; font-size: 7.5pt;">;</span><span style="color: #a9b7c6; font-family: "menlo";"><o:p></o:p></span></pre>
<pre style="font-size: 15.4px;"><span style="color: #cc7832; font-family: "menlo"; font-size: 7.5pt;">import </span><span style="color: #a9b7c6; font-family: "menlo"; font-size: 7.5pt;">java.lang.ref.WeakReference</span><span style="color: #cc7832; font-family: "menlo"; font-size: 7.5pt;">;</span><span style="color: #a9b7c6; font-family: "menlo";"><o:p></o:p></span></pre>
<pre style="font-size: 15.4px;"><span style="color: #cc7832; font-family: "menlo"; font-size: 7.5pt;">import </span><span style="color: #a9b7c6; font-family: "menlo"; font-size: 7.5pt;">java.util.ArrayList</span><span style="color: #cc7832; font-family: "menlo"; font-size: 7.5pt;">;</span><span style="color: #a9b7c6; font-family: "menlo";"><o:p></o:p></span></pre>
<pre style="font-size: 15.4px;"><span style="color: #cc7832; font-family: "menlo"; font-size: 7.5pt;">import </span><span style="color: #a9b7c6; font-family: "menlo"; font-size: 7.5pt;">java.util.List</span><span style="color: #cc7832; font-family: "menlo"; font-size: 7.5pt;">;</span><span style="color: #a9b7c6; font-family: "menlo";"><o:p></o:p></span></pre>
<pre style="font-size: 15.4px;"><span style="color: #cc7832; font-family: "menlo"; font-size: 7.5pt;">import </span><span style="color: #a9b7c6; font-family: "menlo"; font-size: 7.5pt;">java.util.Map</span><span style="color: #cc7832; font-family: "menlo"; font-size: 7.5pt;">;</span><span style="color: #a9b7c6; font-family: "menlo";"><o:p></o:p></span></pre>
<pre style="font-size: 15.4px;"><span style="color: #cc7832; font-family: "menlo"; font-size: 7.5pt;">import </span><span style="color: #a9b7c6; font-family: "menlo"; font-size: 7.5pt;">java.util.WeakHashMap</span><span style="color: #cc7832; font-family: "menlo"; font-size: 7.5pt;">;<o:p></o:p></span></pre>
<pre style="font-size: 15.4px;"><span style="color: #cc7832; font-family: "menlo"; font-size: 7.5pt;">import static </span><span style="color: #a9b7c6; font-family: "menlo"; font-size: 7.5pt;">references.StrongReference.<i>runGC</i></span><span style="color: #cc7832; font-family: "menlo"; font-size: 7.5pt;">;</span><span style="color: #a9b7c6; font-family: "menlo";"><o:p></o:p></span></pre>
<pre><span style="font-size: xx-small;"><span style="color: #cc7832; font-family: "menlo";">import static </span><span style="color: #a9b7c6; font-family: "menlo";">references.StrongReference.<i>deleteOldDumps</i></span><span style="color: #cc7832; font-family: "menlo";">;</span></span><span style="color: #a9b7c6; font-family: "menlo"; font-size: 15.4px;"><o:p></o:p></span></pre>
<pre style="font-size: 15.4px;"><span style="color: #cc7832; font-family: "menlo"; font-size: 7.5pt;"><o:p> </o:p></span></pre>
<pre style="font-size: 15.4px;"><span style="color: #cc7832; font-family: "menlo"; font-size: 7.5pt;">public class </span><span style="color: #a9b7c6; font-family: "menlo"; font-size: 7.5pt;">WeakReferenceTest {<o:p></o:p></span></pre>
<pre style="font-size: 15.4px;"><span style="color: #cc7832; font-family: "menlo"; font-size: 7.5pt;"><o:p> </o:p></span></pre>
<pre style="font-size: 15.4px;"><span style="color: #cc7832; font-family: "menlo"; font-size: 7.5pt;"><span style="mso-spacerun: yes;"> </span>public static void </span><span style="color: #ffc66d; font-family: "menlo"; font-size: 7.5pt;">main</span><span style="color: #a9b7c6; font-family: "menlo"; font-size: 7.5pt;">(String[] args) </span><span style="color: #cc7832; font-family: "menlo"; font-size: 7.5pt;">throws </span><span style="color: #a9b7c6; font-family: "menlo"; font-size: 7.5pt;">InterruptedException {<o:p></o:p></span></pre>
<pre style="font-size: 15.4px;"><span style="color: #a9b7c6; font-family: "menlo"; font-size: 7.5pt;"><span style="mso-spacerun: yes;"> </span><span style="mso-spacerun: yes;"> </span><i>deleteOldDumps</i>()</span><span style="color: #cc7832; font-family: "menlo"; font-size: 7.5pt;">;</span></pre>
<pre style="font-size: 15.4px;"><span style="color: #cc7832; font-family: "menlo"; font-size: 7.5pt;">
</span></pre>
<pre style="font-size: 15.4px;"><span style="color: #cc7832; font-family: "menlo"; font-size: 7.5pt;"><span style="mso-spacerun: yes;"> </span><span style="mso-spacerun: yes;"> </span></span><span style="color: grey; font-family: "menlo"; font-size: 7.5pt;">//1.) WeakHashMap example</span><span style="color: #a9b7c6; font-family: "menlo";"><o:p></o:p></span></pre>
<pre style="font-size: 15.4px;"><span style="color: #cc7832; font-family: "menlo"; font-size: 7.5pt;"><span style="mso-spacerun: yes;"> </span></span><span style="color: #a9b7c6; font-family: "menlo"; font-size: 7.5pt;">System.</span><i><span style="color: #9876aa; font-family: "menlo"; font-size: 7.5pt;">out</span></i><span style="color: #a9b7c6; font-family: "menlo"; font-size: 7.5pt;">.println(</span><span style="color: #6a8759; font-family: "menlo"; font-size: 7.5pt;">"1.) WeakHashMap example:"</span><span style="color: #a9b7c6; font-family: "menlo"; font-size: 7.5pt;">)</span><span style="color: #cc7832; font-family: "menlo"; font-size: 7.5pt;">;</span><span style="color: #a9b7c6; font-family: "menlo";"><o:p></o:p></span></pre>
<pre style="font-size: 15.4px;"><span style="color: grey; font-family: "menlo"; font-size: 7.5pt;"><span style="mso-spacerun: yes;"> </span></span><span style="color: #a9b7c6; font-family: "menlo"; font-size: 7.5pt;">A a = </span><span style="color: #cc7832; font-family: "menlo"; font-size: 7.5pt;">new </span><span style="color: #a9b7c6; font-family: "menlo"; font-size: 7.5pt;">A(</span><span style="color: #6a8759; font-family: "menlo"; font-size: 7.5pt;">"a"</span><span style="color: #a9b7c6; font-family: "menlo"; font-size: 7.5pt;">)</span><span style="color: #cc7832; font-family: "menlo"; font-size: 7.5pt;">;</span><span style="color: #a9b7c6; font-family: "menlo";"><o:p></o:p></span></pre>
<pre style="font-size: 15.4px;"><span style="color: #cc7832; font-family: "menlo"; font-size: 7.5pt;"><span style="mso-spacerun: yes;"> </span></span><span style="color: #a9b7c6; font-family: "menlo"; font-size: 7.5pt;">List<Object> objects = </span><span style="color: #cc7832; font-family: "menlo"; font-size: 7.5pt;">new </span><span style="color: #a9b7c6; font-family: "menlo"; font-size: 7.5pt;">ArrayList<>()</span><span style="color: #cc7832; font-family: "menlo"; font-size: 7.5pt;">;</span><span style="color: #a9b7c6; font-family: "menlo";"><o:p></o:p></span></pre>
<pre style="font-size: 15.4px;"><span style="color: #cc7832; font-family: "menlo"; font-size: 7.5pt;"><span style="mso-spacerun: yes;"> </span></span><span style="color: #a9b7c6; font-family: "menlo"; font-size: 7.5pt;">B b = </span><span style="color: #cc7832; font-family: "menlo"; font-size: 7.5pt;">new </span><span style="color: #a9b7c6; font-family: "menlo"; font-size: 7.5pt;">B(objects)</span><span style="color: #cc7832; font-family: "menlo"; font-size: 7.5pt;">;</span><span style="color: #a9b7c6; font-family: "menlo";"><o:p></o:p></span></pre>
<pre style="font-size: 15.4px;"><span style="color: #a9b7c6; font-family: "menlo"; font-size: 7.5pt;"><span style="mso-spacerun: yes;"> </span>Map<A</span><span style="color: #cc7832; font-family: "menlo"; font-size: 7.5pt;">, </span><span style="color: #a9b7c6; font-family: "menlo"; font-size: 7.5pt;">B> </span><i><span style="color: #9876aa; font-family: "menlo"; font-size: 7.5pt;">map </span></i><span style="color: #a9b7c6; font-family: "menlo"; font-size: 7.5pt;">= </span><span style="color: #cc7832; font-family: "menlo"; font-size: 7.5pt;">new </span><span style="color: #a9b7c6; font-family: "menlo"; font-size: 7.5pt;">WeakHashMap<>()</span><span style="color: #cc7832; font-family: "menlo"; font-size: 7.5pt;">;</span><span style="color: #a9b7c6; font-family: "menlo";"><o:p></o:p></span></pre>
<pre style="font-size: 15.4px;"><span style="color: #cc7832; font-family: "menlo"; font-size: 7.5pt;"><span style="mso-spacerun: yes;"> </span><span style="mso-spacerun: yes;"> </span></span><i><span style="color: #9876aa; font-family: "menlo"; font-size: 7.5pt;">map</span></i><span style="color: #a9b7c6; font-family: "menlo"; font-size: 7.5pt;">.put(a</span><span style="color: #cc7832; font-family: "menlo"; font-size: 7.5pt;">, </span><span style="color: #a9b7c6; font-family: "menlo"; font-size: 7.5pt;">b)</span><span style="color: #cc7832; font-family: "menlo"; font-size: 7.5pt;">;</span><span style="color: #a9b7c6; font-family: "menlo";"><o:p></o:p></span></pre>
<pre style="font-size: 15.4px;"><span style="color: #cc7832; font-family: "menlo"; font-size: 7.5pt;"><span style="mso-spacerun: yes;"> </span></span><span style="color: #a9b7c6; font-family: "menlo"; font-size: 7.5pt;">a = </span><span style="color: #cc7832; font-family: "menlo"; font-size: 7.5pt;">null;</span><span style="color: #a9b7c6; font-family: "menlo";"><o:p></o:p></span></pre>
<pre style="font-size: 15.4px;"><span style="color: #cc7832; font-family: "menlo"; font-size: 7.5pt;"><span style="mso-spacerun: yes;"> </span><span style="mso-spacerun: yes;"> </span>b = null;</span><span style="font-family: "menlo";"><o:p></o:p></span></pre>
<pre style="font-size: 15.4px;"><span style="color: grey; font-family: "menlo"; font-size: 7.5pt;"><span style="mso-spacerun: yes;"> </span>//Note that B will be GC'ed after the second GC because expungeStaleEntries method</span></pre>
<pre style="font-size: 15.4px;"><span style="color: grey; font-family: "menlo"; font-size: 7.5pt;"><span style="mso-spacerun: yes;"> </span>//call needed to remove entry first as it holds a ref to b</span></pre>
<pre style="font-size: 15.4px;"><span style="color: #cc7832; font-family: "menlo"; font-size: 7.5pt;"><span style="mso-spacerun: yes;"> </span></span><span style="color: #a9b7c6; font-family: "menlo"; font-size: 7.5pt;">System.</span><i><span style="color: #9876aa; font-family: "menlo"; font-size: 7.5pt;">out</span></i><span style="color: #a9b7c6; font-family: "menlo"; font-size: 7.5pt;">.println(</span><span style="color: #6a8759; font-family: "menlo"; font-size: 7.5pt;">"Map size before gc: " </span><span style="color: #a9b7c6; font-family: "menlo"; font-size: 7.5pt;">+ </span><i><span style="color: #9876aa; font-family: "menlo"; font-size: 7.5pt;">map</span></i><span style="color: #a9b7c6; font-family: "menlo"; font-size: 7.5pt;">.size())</span><span style="color: #cc7832; font-family: "menlo"; font-size: 7.5pt;">;</span><span style="color: #a9b7c6; font-family: "menlo";"><o:p></o:p></span></pre>
<pre style="font-size: 15.4px;"><span style="color: #cc7832; font-family: "menlo"; font-size: 7.5pt;"><span style="mso-spacerun: yes;"> </span><span style="mso-spacerun: yes;"> </span></span><i><span style="color: #a9b7c6; font-family: "menlo"; font-size: 7.5pt;">runGC</span></i><span style="color: #a9b7c6; font-family: "menlo"; font-size: 7.5pt;">()</span><span style="color: #cc7832; font-family: "menlo"; font-size: 7.5pt;">;</span><span style="color: #a9b7c6; font-family: "menlo";"><o:p></o:p></span></pre>
<pre style="font-size: 15.4px;"><span style="color: #cc7832; font-family: "menlo"; font-size: 7.5pt;"><span style="mso-spacerun: yes;"> </span><span style="mso-spacerun: yes;"> </span></span><span style="color: grey; font-family: "menlo"; font-size: 7.5pt;">//expungeStaleEntries method cleaned up the entry with null key. </span><span style="color: #a9b7c6; font-family: "menlo";"><o:p></o:p></span></pre>
<pre style="font-size: 15.4px;"><span style="color: grey; font-family: "menlo"; font-size: 7.5pt;"><span style="mso-spacerun: yes;"> </span>//We expect map size as 0 </span><span style="color: #a9b7c6; font-family: "menlo";"><o:p></o:p></span></pre>
<pre style="font-size: 15.4px;"><span style="color: grey; font-family: "menlo"; font-size: 7.5pt;"><span style="mso-spacerun: yes;"> </span></span><span style="color: #a9b7c6; font-family: "menlo"; font-size: 7.5pt;">System.</span><i><span style="color: #9876aa; font-family: "menlo"; font-size: 7.5pt;">out</span></i><span style="color: #a9b7c6; font-family: "menlo"; font-size: 7.5pt;">.println(</span><span style="color: #6a8759; font-family: "menlo"; font-size: 7.5pt;">"Map size after gc: " </span><span style="color: #a9b7c6; font-family: "menlo"; font-size: 7.5pt;">+ </span><i><span style="color: #9876aa; font-family: "menlo"; font-size: 7.5pt;">map</span></i><span style="color: #a9b7c6; font-family: "menlo"; font-size: 7.5pt;">.size())</span><span style="color: #cc7832; font-family: "menlo"; font-size: 7.5pt;">;</span><span style="color: #a9b7c6; font-family: "menlo";"><o:p></o:p></span></pre>
<pre style="font-size: 15.4px;"><span style="color: #cc7832; font-family: "menlo"; font-size: 7.5pt;"><span style="mso-spacerun: yes;"> </span></span><span style="color: #a9b7c6; font-family: "menlo"; font-size: 7.5pt;">System.</span><i><span style="color: #9876aa; font-family: "menlo"; font-size: 7.5pt;">out</span></i><span style="color: #a9b7c6; font-family: "menlo"; font-size: 7.5pt;">.println(</span><span style="color: #6a8759; font-family: "menlo"; font-size: 7.5pt;">"--------------------------------------------------------"</span><span style="color: #a9b7c6; font-family: "menlo"; font-size: 7.5pt;">);</span><span style="color: #a9b7c6; font-family: "menlo";"><o:p></o:p></span></pre>
<pre style="font-size: 15.4px;"></pre>
<pre style="font-size: 15.4px;"><span style="color: #cc7832; font-family: "menlo"; font-size: 7.5pt;"><span style="mso-spacerun: yes;"> </span></span><span style="color: #a9b7c6; font-family: "menlo"; font-size: 7.5pt;">System.</span><i><span style="color: #9876aa; font-family: "menlo"; font-size: 7.5pt;">out</span></i><span style="color: #a9b7c6; font-family: "menlo"; font-size: 7.5pt;">.println(</span><span style="color: #6a8759; font-family: "menlo"; font-size: 7.5pt;">"2.) WeakReference example:"</span><span style="color: #a9b7c6; font-family: "menlo"; font-size: 7.5pt;">)</span><span style="color: #cc7832; font-family: "menlo"; font-size: 7.5pt;">;</span><span style="color: #a9b7c6; font-family: "menlo";"><o:p></o:p></span></pre>
<pre style="font-size: 15.4px;"><span style="color: #cc7832; font-family: "menlo"; font-size: 7.5pt;"><span style="mso-spacerun: yes;"> </span><span style="mso-spacerun: yes;"> </span></span><span style="color: grey; font-family: "menlo"; font-size: 7.5pt;">//2.) WeakReference example</span><span style="color: #a9b7c6; font-family: "menlo";"><o:p></o:p></span></pre>
<pre style="font-size: 15.4px;"><span style="color: grey; font-family: "menlo"; font-size: 7.5pt;"><span style="mso-spacerun: yes;"> </span>//Do not use String a referent of weak ref.</span><span style="color: #a9b7c6; font-family: "menlo";"><o:p></o:p></span></pre>
<pre style="font-size: 15.4px;"><span style="color: grey; font-family: "menlo"; font-size: 7.5pt;"><span style="mso-spacerun: yes;"> </span>//Since it is pooled you cannot observe weakreference.</span><span style="color: #a9b7c6; font-family: "menlo";"><o:p></o:p></span></pre>
<pre style="font-size: 15.4px;"><span style="color: grey; font-family: "menlo"; font-size: 7.5pt;"><span style="mso-spacerun: yes;"> </span>//WeakReference's referent property is already null after GC</span><span style="color: #a9b7c6; font-family: "menlo";"><o:p></o:p></span></pre>
<pre style="font-size: 15.4px;"><span style="color: grey; font-family: "menlo"; font-size: 7.5pt;"><span style="mso-spacerun: yes;"> </span>//as opposed to PhantomReference(prior to java 9)</span><span style="color: #a9b7c6; font-family: "menlo";"><o:p></o:p></span></pre>
<pre style="font-size: 15.4px;"><span style="color: grey; font-family: "menlo"; font-size: 7.5pt;"><span style="mso-spacerun: yes;"> </span></span><span style="color: #a9b7c6; font-family: "menlo"; font-size: 7.5pt;">A a2 = </span><span style="color: #cc7832; font-family: "menlo"; font-size: 7.5pt;">new </span><span style="color: #a9b7c6; font-family: "menlo"; font-size: 7.5pt;">A(</span><span style="color: #6a8759; font-family: "menlo"; font-size: 7.5pt;">"a"</span><span style="color: #a9b7c6; font-family: "menlo"; font-size: 7.5pt;">)</span><span style="color: #cc7832; font-family: "menlo"; font-size: 7.5pt;">;</span><span style="color: #a9b7c6; font-family: "menlo";"><o:p></o:p></span></pre>
<pre style="font-size: 15.4px;"><span style="color: #cc7832; font-family: "menlo"; font-size: 7.5pt;"><span style="mso-spacerun: yes;"> </span></span><span style="color: #a9b7c6; font-family: "menlo"; font-size: 7.5pt;">ReferenceQueue<A> referenceQueue = </span><span style="color: #cc7832; font-family: "menlo"; font-size: 7.5pt;">new </span><span style="color: #a9b7c6; font-family: "menlo"; font-size: 7.5pt;">ReferenceQueue<>()</span><span style="color: #cc7832; font-family: "menlo"; font-size: 7.5pt;">;</span><span style="color: #a9b7c6; font-family: "menlo";"><o:p></o:p></span></pre>
<pre style="font-size: 15.4px;"><span style="color: #cc7832; font-family: "menlo"; font-size: 7.5pt;"><span style="mso-spacerun: yes;"> </span></span><span style="color: #a9b7c6; font-family: "menlo"; font-size: 7.5pt;">Reference<A> weakReference = </span><span style="color: #cc7832; font-family: "menlo"; font-size: 7.5pt;">new </span><span style="color: #a9b7c6; font-family: "menlo"; font-size: 7.5pt;">WeakReference<>(a2</span><span style="color: #cc7832; font-family: "menlo"; font-size: 7.5pt;">, </span><span style="color: #a9b7c6; font-family: "menlo"; font-size: 7.5pt;">referenceQueue)</span><span style="color: #cc7832; font-family: "menlo"; font-size: 7.5pt;">; </span><span style="color: #a9b7c6; font-family: "menlo";"><o:p></o:p></span></pre>
<pre style="font-size: 15.4px;"><span style="color: #cc7832; font-family: "menlo"; font-size: 7.5pt;"><span style="mso-spacerun: yes;"> </span></span><span style="color: #a9b7c6; font-family: "menlo"; font-size: 7.5pt;">HeapDump.<i>dumpHeap</i>(</span><span style="color: #6a8759; font-family: "menlo"; font-size: 7.5pt;">"java/heap-dumps/weakRefBeforeGCEligible.hprof"</span><span style="color: #cc7832; font-family: "menlo"; font-size: 7.5pt;">, false</span><span style="color: #a9b7c6; font-family: "menlo"; font-size: 7.5pt;">)</span><span style="color: #cc7832; font-family: "menlo"; font-size: 7.5pt;">;</span><span style="color: #a9b7c6; font-family: "menlo";"><o:p></o:p></span></pre>
<pre style="font-size: 15.4px;"><span style="color: #cc7832; font-family: "menlo"; font-size: 7.5pt;"><span style="mso-spacerun: yes;"> </span></span><span style="color: #a9b7c6; font-family: "menlo"; font-size: 7.5pt;">a2 = </span><span style="color: #cc7832; font-family: "menlo"; font-size: 7.5pt;">null;</span><span style="color: #a9b7c6; font-family: "menlo";"><o:p></o:p></span></pre>
<pre style="font-size: 15.4px;"><span style="color: #cc7832; font-family: "menlo"; font-size: 7.5pt;"><span style="mso-spacerun: yes;"> </span></span><span style="color: #a9b7c6; font-family: "menlo"; font-size: 7.5pt;">System.</span><i><span style="color: #9876aa; font-family: "menlo"; font-size: 7.5pt;">out</span></i><span style="color: #a9b7c6; font-family: "menlo"; font-size: 7.5pt;">.println(</span><span style="color: #6a8759; font-family: "menlo"; font-size: 7.5pt;">"Reference.get() before gc: " </span><span style="color: #a9b7c6; font-family: "menlo"; font-size: 7.5pt;">+ weakReference.get())</span><span style="color: #cc7832; font-family: "menlo"; font-size: 7.5pt;">;</span><span style="color: #a9b7c6; font-family: "menlo";"><o:p></o:p></span></pre>
<pre style="font-size: 15.4px;"><span style="color: #cc7832; font-family: "menlo"; font-size: 7.5pt;"><span style="mso-spacerun: yes;"> </span></span><span style="color: #a9b7c6; font-family: "menlo"; font-size: 7.5pt;">System.</span><i><span style="color: #9876aa; font-family: "menlo"; font-size: 7.5pt;">out</span></i><span style="color: #a9b7c6; font-family: "menlo"; font-size: 7.5pt;">.println(</span><span style="color: #6a8759; font-family: "menlo"; font-size: 7.5pt;">"Referencequeue.poll() before gc: " </span><span style="color: #a9b7c6; font-family: "menlo"; font-size: 7.5pt;">+ referenceQueue.poll())</span><span style="color: #cc7832; font-family: "menlo"; font-size: 7.5pt;">;</span><span style="color: #a9b7c6; font-family: "menlo";"><o:p></o:p></span></pre>
<pre style="font-size: 15.4px;"><span style="color: #cc7832; font-family: "menlo"; font-size: 7.5pt;"><span style="mso-spacerun: yes;"> </span></span><span style="color: #a9b7c6; font-family: "menlo"; font-size: 7.5pt;">System.</span><i><span style="color: #9876aa; font-family: "menlo"; font-size: 7.5pt;">out</span></i><span style="color: #a9b7c6; font-family: "menlo"; font-size: 7.5pt;">.println(</span><span style="color: #6a8759; font-family: "menlo"; font-size: 7.5pt;">"is enqueued: " </span><span style="color: #a9b7c6; font-family: "menlo"; font-size: 7.5pt;">+ weakReference.isEnqueued())</span><span style="color: #cc7832; font-family: "menlo"; font-size: 7.5pt;">;</span><span style="color: #a9b7c6; font-family: "menlo";"><o:p></o:p></span></pre>
<pre style="font-size: 15.4px;"><span style="color: #cc7832; font-family: "menlo"; font-size: 7.5pt;"><span style="mso-spacerun: yes;"> </span></span><span style="color: #a9b7c6; font-family: "menlo"; font-size: 7.5pt;">HeapDump.<i>dumpHeap</i>(</span><span style="color: #6a8759; font-family: "menlo"; font-size: 7.5pt;">"java/heap-dumps/weakRefBeforeGC.hprof"</span><span style="color: #cc7832; font-family: "menlo"; font-size: 7.5pt;">, false</span><span style="color: #a9b7c6; font-family: "menlo"; font-size: 7.5pt;">)</span><span style="color: #cc7832; font-family: "menlo"; font-size: 7.5pt;">;</span><span style="color: #a9b7c6; font-family: "menlo";"><o:p></o:p></span></pre>
<pre style="font-size: 15.4px;"><span style="color: #cc7832; font-family: "menlo"; font-size: 7.5pt;"><span style="mso-spacerun: yes;"> </span><span style="mso-spacerun: yes;"> </span></span><i><span style="color: #a9b7c6; font-family: "menlo"; font-size: 7.5pt;">runGC</span></i><span style="color: #a9b7c6; font-family: "menlo"; font-size: 7.5pt;">()</span><span style="color: #cc7832; font-family: "menlo"; font-size: 7.5pt;">;</span><span style="color: #a9b7c6; font-family: "menlo";"><o:p></o:p></span></pre>
<pre style="font-size: 15.4px;"><span style="color: #cc7832; font-family: "menlo"; font-size: 7.5pt;"><span style="mso-spacerun: yes;"> </span></span><span style="color: #a9b7c6; font-family: "menlo"; font-size: 7.5pt;">HeapDump.<i>dumpHeap</i>(</span><span style="color: #6a8759; font-family: "menlo"; font-size: 7.5pt;">"java/heap-dumps/weakRefAfterGC.hprof"</span><span style="color: #cc7832; font-family: "menlo"; font-size: 7.5pt;">, false</span><span style="color: #a9b7c6; font-family: "menlo"; font-size: 7.5pt;">)</span><span style="color: #cc7832; font-family: "menlo"; font-size: 7.5pt;">;</span><span style="color: #a9b7c6; font-family: "menlo";"><o:p></o:p></span></pre>
<pre style="font-size: 15.4px;"><span style="color: #cc7832; font-family: "menlo"; font-size: 7.5pt;"><span style="mso-spacerun: yes;"> </span></span><span style="color: #a9b7c6; font-family: "menlo"; font-size: 7.5pt;">System.</span><i><span style="color: #9876aa; font-family: "menlo"; font-size: 7.5pt;">out</span></i><span style="color: #a9b7c6; font-family: "menlo"; font-size: 7.5pt;">.println(</span><span style="color: #6a8759; font-family: "menlo"; font-size: 7.5pt;">"Reference.get() after gc: " </span><span style="color: #a9b7c6; font-family: "menlo"; font-size: 7.5pt;">+ weakReference.get())</span><span style="color: #cc7832; font-family: "menlo"; font-size: 7.5pt;">;</span><span style="color: #a9b7c6; font-family: "menlo";"><o:p></o:p></span></pre>
<pre style="font-size: 15.4px;"><span style="color: #cc7832; font-family: "menlo"; font-size: 7.5pt;"><span style="mso-spacerun: yes;"> </span></span><span style="color: #a9b7c6; font-family: "menlo"; font-size: 7.5pt;">System.</span><i><span style="color: #9876aa; font-family: "menlo"; font-size: 7.5pt;">out</span></i><span style="color: #a9b7c6; font-family: "menlo"; font-size: 7.5pt;">.println(</span><span style="color: #6a8759; font-family: "menlo"; font-size: 7.5pt;">"is enqueued: " </span><span style="color: #a9b7c6; font-family: "menlo"; font-size: 7.5pt;">+ weakReference.isEnqueued())</span><span style="color: #cc7832; font-family: "menlo"; font-size: 7.5pt;">;</span><span style="color: #a9b7c6; font-family: "menlo";"><o:p></o:p></span></pre>
<pre style="font-size: 15.4px;"><span style="color: #cc7832; font-family: "menlo"; font-size: 7.5pt;"><span style="mso-spacerun: yes;"> </span></span><span style="color: #a9b7c6; font-family: "menlo"; font-size: 7.5pt;">Reference polledRef = referenceQueue.poll()</span><span style="color: #cc7832; font-family: "menlo"; font-size: 7.5pt;">; </span><span style="color: #a9b7c6; font-family: "menlo";"><o:p></o:p></span></pre>
<pre style="font-size: 15.4px;"><span style="color: #cc7832; font-family: "menlo"; font-size: 7.5pt;"><span style="mso-spacerun: yes;"> </span></span><span style="color: #a9b7c6; font-family: "menlo"; font-size: 7.5pt;">System.</span><i><span style="color: #9876aa; font-family: "menlo"; font-size: 7.5pt;">out</span></i><span style="color: #a9b7c6; font-family: "menlo"; font-size: 7.5pt;">.println(</span><span style="color: #6a8759; font-family: "menlo"; font-size: 7.5pt;">"Refs are equal: " </span><span style="color: #a9b7c6; font-family: "menlo"; font-size: 7.5pt;">+ (weakReference == polledRef))</span><span style="color: #cc7832; font-family: "menlo"; font-size: 7.5pt;">;</span><span style="color: #a9b7c6; font-family: "menlo";"><o:p></o:p></span></pre>
<pre style="font-size: 15.4px;"><span style="color: #cc7832; font-family: "menlo"; font-size: 7.5pt;"><span style="mso-spacerun: yes;"> </span></span><span style="color: #a9b7c6; font-family: "menlo"; font-size: 7.5pt;">System.</span><i><span style="color: #9876aa; font-family: "menlo"; font-size: 7.5pt;">out</span></i><span style="color: #a9b7c6; font-family: "menlo"; font-size: 7.5pt;">.println(</span><span style="color: #6a8759; font-family: "menlo"; font-size: 7.5pt;">"ReferenceQueue.poll() after gc: " </span><span style="color: #a9b7c6; font-family: "menlo"; font-size: 7.5pt;">+ polledRef)</span><span style="color: #cc7832; font-family: "menlo"; font-size: 7.5pt;">; </span><span style="color: #a9b7c6; font-family: "menlo";"><o:p></o:p></span></pre>
<pre style="font-size: 15.4px;"><span style="color: #cc7832; font-family: "menlo"; font-size: 7.5pt;"><span style="mso-spacerun: yes;"> </span><span style="mso-spacerun: yes;"> </span></span><span style="color: grey; font-family: "menlo"; font-size: 7.5pt;">//referent is already cleared and we expect null here</span><span style="color: #a9b7c6; font-family: "menlo";"><o:p></o:p></span></pre>
<pre style="font-size: 15.4px;"><span style="color: grey; font-family: "menlo"; font-size: 7.5pt;"><span style="mso-spacerun: yes;"> </span></span><span style="color: #a9b7c6; font-family: "menlo"; font-size: 7.5pt;">System.</span><i><span style="color: #9876aa; font-family: "menlo"; font-size: 7.5pt;">out</span></i><span style="color: #a9b7c6; font-family: "menlo"; font-size: 7.5pt;">.println(</span><span style="color: #6a8759; font-family: "menlo"; font-size: 7.5pt;">"Referent inside reference after gc: " </span><span style="color: #a9b7c6; font-family: "menlo"; font-size: 7.5pt;">+ polledRef.get())</span><span style="color: #cc7832; font-family: "menlo"; font-size: 7.5pt;">;</span><span style="color: #a9b7c6; font-family: "menlo";"><o:p></o:p></span></pre>
<pre style="font-size: 15.4px;"><span style="color: #cc7832; font-family: "menlo"; font-size: 7.5pt;"><span style="mso-spacerun: yes;"> </span></span><span style="color: #a9b7c6; font-family: "menlo"; font-size: 7.5pt;">System.</span><i><span style="color: #9876aa; font-family: "menlo"; font-size: 7.5pt;">out</span></i><span style="color: #a9b7c6; font-family: "menlo"; font-size: 7.5pt;">.println(</span><span style="color: #6a8759; font-family: "menlo"; font-size: 7.5pt;">"--------------------------------------------------------"</span><span style="color: #a9b7c6; font-family: "menlo"; font-size: 7.5pt;">)</span><span style="color: #cc7832; font-family: "menlo"; font-size: 7.5pt;">;</span><span style="color: #a9b7c6; font-family: "menlo";"><o:p></o:p></span></pre>
<pre style="font-size: 15.4px;"><span style="color: #cc7832; font-family: "menlo"; font-size: 7.5pt;"><o:p> </o:p></span></pre>
<pre style="font-size: 15.4px;"><span style="color: #cc7832; font-family: "menlo"; font-size: 7.5pt;"><span style="mso-spacerun: yes;"> </span></span><span style="color: #a9b7c6; font-family: "menlo"; font-size: 7.5pt;">System.</span><i><span style="color: #9876aa; font-family: "menlo"; font-size: 7.5pt;">out</span></i><span style="color: #a9b7c6; font-family: "menlo"; font-size: 7.5pt;">.println(</span><span style="color: #6a8759; font-family: "menlo"; font-size: 7.5pt;">"3.) Getting inner information from weak reference" </span><span style="color: #a9b7c6; font-family: "menlo"; font-size: 7.5pt;">+<o:p></o:p></span></pre>
<pre style="font-size: 15.4px;"><span style="color: #a9b7c6; font-family: "menlo"; font-size: 7.5pt;"><span style="mso-spacerun: yes;"> </span><span style="mso-spacerun: yes;"> </span></span><span style="color: #6a8759; font-family: "menlo"; font-size: 7.5pt;">" after the referent garbage collected"</span><span style="color: #a9b7c6; font-family: "menlo"; font-size: 7.5pt;">)</span><span style="color: #cc7832; font-family: "menlo"; font-size: 7.5pt;">;</span><span style="color: #a9b7c6; font-family: "menlo";"><o:p></o:p></span></pre>
<pre style="font-size: 15.4px;"><span style="color: #cc7832; font-family: "menlo"; font-size: 7.5pt;"><span style="mso-spacerun: yes;"> </span><span style="mso-spacerun: yes;"> </span></span><span style="color: grey; font-family: "menlo"; font-size: 7.5pt;">//3.) Reaching some inner information through weakreference after</span><span style="color: #a9b7c6; font-family: "menlo";"><o:p></o:p></span></pre>
<pre style="font-size: 15.4px;"><span style="color: grey; font-family: "menlo"; font-size: 7.5pt;"><span style="mso-spacerun: yes;"> </span>//referent the object garbage collected</span><span style="color: #a9b7c6; font-family: "menlo";"><o:p></o:p></span></pre>
<pre style="font-size: 15.4px;"><span style="color: grey; font-family: "menlo"; font-size: 7.5pt;"><span style="mso-spacerun: yes;"> </span></span><span style="color: #a9b7c6; font-family: "menlo"; font-size: 7.5pt;">ReferenceQueue<A> referenceQueue2 = </span><span style="color: #cc7832; font-family: "menlo"; font-size: 7.5pt;">new </span><span style="color: #a9b7c6; font-family: "menlo"; font-size: 7.5pt;">ReferenceQueue<>()</span><span style="color: #cc7832; font-family: "menlo"; font-size: 7.5pt;">;</span><span style="color: #a9b7c6; font-family: "menlo";"><o:p></o:p></span></pre>
<pre style="font-size: 15.4px;"><span style="color: #cc7832; font-family: "menlo"; font-size: 7.5pt;"><span style="mso-spacerun: yes;"> </span></span><span style="color: #a9b7c6; font-family: "menlo"; font-size: 7.5pt;">A a3 = </span><span style="color: #cc7832; font-family: "menlo"; font-size: 7.5pt;">new </span><span style="color: #a9b7c6; font-family: "menlo"; font-size: 7.5pt;">A(</span><span style="color: #6a8759; font-family: "menlo"; font-size: 7.5pt;">"a3"</span><span style="color: #a9b7c6; font-family: "menlo"; font-size: 7.5pt;">)</span><span style="color: #cc7832; font-family: "menlo"; font-size: 7.5pt;">;</span><span style="color: #a9b7c6; font-family: "menlo";"><o:p></o:p></span></pre>
<pre style="font-size: 15.4px;"><span style="color: #cc7832; font-family: "menlo"; font-size: 7.5pt;"><span style="mso-spacerun: yes;"> </span></span><span style="color: #a9b7c6; font-family: "menlo"; font-size: 7.5pt;">String innerInfo = </span><span style="color: #6a8759; font-family: "menlo"; font-size: 7.5pt;">"Inner info"</span><span style="color: #cc7832; font-family: "menlo"; font-size: 7.5pt;">;</span><span style="color: #a9b7c6; font-family: "menlo";"><o:p></o:p></span></pre>
<pre style="font-size: 15.4px;"><span style="color: #cc7832; font-family: "menlo"; font-size: 7.5pt;"><span style="mso-spacerun: yes;"> </span></span><span style="color: #a9b7c6; font-family: "menlo"; font-size: 7.5pt;">WeakA weakA = </span><span style="color: #cc7832; font-family: "menlo"; font-size: 7.5pt;">new </span><span style="color: #a9b7c6; font-family: "menlo"; font-size: 7.5pt;">WeakA(a3</span><span style="color: #cc7832; font-family: "menlo"; font-size: 7.5pt;">, </span><span style="color: #a9b7c6; font-family: "menlo"; font-size: 7.5pt;">innerInfo</span><span style="color: #cc7832; font-family: "menlo"; font-size: 7.5pt;">, </span><span style="color: #a9b7c6; font-family: "menlo"; font-size: 7.5pt;">referenceQueue2)</span><span style="color: #cc7832; font-family: "menlo"; font-size: 7.5pt;">;</span><span style="color: #a9b7c6; font-family: "menlo";"><o:p></o:p></span></pre>
<pre style="font-size: 15.4px;"><span style="color: #cc7832; font-family: "menlo"; font-size: 7.5pt;"><span style="mso-spacerun: yes;"> </span></span><span style="color: #a9b7c6; font-family: "menlo"; font-size: 7.5pt;">a3 = </span><span style="color: #cc7832; font-family: "menlo"; font-size: 7.5pt;">null; </span><span style="color: #a9b7c6; font-family: "menlo";"><o:p></o:p></span></pre>
<pre style="font-size: 15.4px;"><span style="color: #cc7832; font-family: "menlo"; font-size: 7.5pt;"><span style="mso-spacerun: yes;"> </span><span style="mso-spacerun: yes;"> </span></span><i><span style="color: #a9b7c6; font-family: "menlo"; font-size: 7.5pt;">runGC</span></i><span style="color: #a9b7c6; font-family: "menlo"; font-size: 7.5pt;">()</span><span style="color: #cc7832; font-family: "menlo"; font-size: 7.5pt;">;</span><span style="color: #a9b7c6; font-family: "menlo";"><o:p></o:p></span></pre>
<pre style="font-size: 15.4px;"><span style="color: #cc7832; font-family: "menlo"; font-size: 7.5pt;"><span style="mso-spacerun: yes;"> </span><span style="mso-spacerun: yes;"> </span></span><span style="color: grey; font-family: "menlo"; font-size: 7.5pt;">//should not be null but the referent inside it automatically</span><span style="color: #a9b7c6; font-family: "menlo";"><o:p></o:p></span></pre>
<pre style="font-size: 15.4px;"><span style="color: grey; font-family: "menlo"; font-size: 7.5pt;"><span style="mso-spacerun: yes;"> </span>//removed and polledRef.get() returns null as it is garbage collected </span><span style="color: #a9b7c6; font-family: "menlo";"><o:p></o:p></span></pre>
<pre style="font-size: 15.4px;"><span style="color: grey; font-family: "menlo"; font-size: 7.5pt;"><span style="mso-spacerun: yes;"> </span></span><span style="color: #a9b7c6; font-family: "menlo"; font-size: 7.5pt;">polledRef = referenceQueue2.poll()</span><span style="color: #cc7832; font-family: "menlo"; font-size: 7.5pt;">;</span><span style="color: #a9b7c6; font-family: "menlo";"><o:p></o:p></span></pre>
<pre style="font-size: 15.4px;"><span style="color: #cc7832; font-family: "menlo"; font-size: 7.5pt;"><span style="mso-spacerun: yes;"> </span></span><span style="color: #a9b7c6; font-family: "menlo"; font-size: 7.5pt;">System.</span><i><span style="color: #9876aa; font-family: "menlo"; font-size: 7.5pt;">out</span></i><span style="color: #a9b7c6; font-family: "menlo"; font-size: 7.5pt;">.println(</span><span style="color: #6a8759; font-family: "menlo"; font-size: 7.5pt;">"Referent inside reference after gc: " </span><span style="color: #a9b7c6; font-family: "menlo"; font-size: 7.5pt;">+ polledRef.get())</span><span style="color: #cc7832; font-family: "menlo"; font-size: 7.5pt;">;</span><span style="color: #a9b7c6; font-family: "menlo";"><o:p></o:p></span></pre>
<pre style="font-size: 15.4px;"><span style="color: #cc7832; font-family: "menlo"; font-size: 7.5pt;"><span style="mso-spacerun: yes;"> </span></span><span style="color: #a9b7c6; font-family: "menlo"; font-size: 7.5pt;">weakA = (WeakA) polledRef</span><span style="color: #cc7832; font-family: "menlo"; font-size: 7.5pt;">;</span><span style="color: #a9b7c6; font-family: "menlo";"><o:p></o:p></span></pre>
<pre style="font-size: 15.4px;"><span style="color: #cc7832; font-family: "menlo"; font-size: 7.5pt;"><span style="mso-spacerun: yes;"> </span></span><span style="color: #a9b7c6; font-family: "menlo"; font-size: 7.5pt;">System.</span><i><span style="color: #9876aa; font-family: "menlo"; font-size: 7.5pt;">out</span></i><span style="color: #a9b7c6; font-family: "menlo"; font-size: 7.5pt;">.println(</span><span style="color: #6a8759; font-family: "menlo"; font-size: 7.5pt;">"Get inner information from the polled reference: "</span><span style="color: #a9b7c6; font-family: "menlo";"><o:p></o:p></span></pre>
<pre style="font-size: 15.4px;"><span style="color: #6a8759; font-family: "menlo"; font-size: 7.5pt;"> <span style="mso-spacerun: yes;"> </span></span><span style="color: #a9b7c6; font-family: "menlo"; font-size: 7.5pt;">+ weakA.</span><span style="color: #9876aa; font-family: "menlo"; font-size: 7.5pt;">innerInfo</span><span style="color: #a9b7c6; font-family: "menlo"; font-size: 7.5pt;">)</span><span style="color: #cc7832; font-family: "menlo"; font-size: 7.5pt;">;</span><span style="color: #a9b7c6; font-family: "menlo";"><o:p></o:p></span></pre>
<pre style="font-size: 15.4px;"><span style="color: #cc7832; font-family: "menlo"; font-size: 7.5pt;"><span style="mso-spacerun: yes;"> </span></span><span style="color: #a9b7c6; font-family: "menlo"; font-size: 7.5pt;">}<o:p></o:p></span></pre>
<pre style="font-size: 15.4px;"><span style="color: #a9b7c6; font-family: "menlo"; font-size: 7.5pt;"><o:p> </o:p></span></pre>
<pre style="font-size: 15.4px;"><span style="color: #a9b7c6; font-family: "menlo"; font-size: 7.5pt;"><span style="mso-spacerun: yes;"> </span><span style="mso-spacerun: yes;"> </span></span><span style="color: #cc7832; font-family: "menlo"; font-size: 7.5pt;">static class </span><span style="color: #a9b7c6; font-family: "menlo"; font-size: 7.5pt;">A {<o:p></o:p></span></pre>
<pre style="font-size: 15.4px;"><span style="color: #a9b7c6; font-family: "menlo"; font-size: 7.5pt;"><span style="mso-spacerun: yes;"> </span><span style="mso-spacerun: yes;"> </span></span><span style="color: #cc7832; font-family: "menlo"; font-size: 7.5pt;">public </span><span style="color: #ffc66d; font-family: "menlo"; font-size: 7.5pt;">A</span><span style="color: #a9b7c6; font-family: "menlo"; font-size: 7.5pt;">(String s) {<o:p></o:p></span></pre>
<pre style="font-size: 15.4px;"><span style="color: #a9b7c6; font-family: "menlo"; font-size: 7.5pt;"><span style="mso-spacerun: yes;"> </span><span style="mso-spacerun: yes;"> </span></span><span style="color: #cc7832; font-family: "menlo"; font-size: 7.5pt;">this</span><span style="color: #a9b7c6; font-family: "menlo"; font-size: 7.5pt;">.</span><span style="color: #9876aa; font-family: "menlo"; font-size: 7.5pt;">s </span><span style="color: #a9b7c6; font-family: "menlo"; font-size: 7.5pt;">= s</span><span style="color: #cc7832; font-family: "menlo"; font-size: 7.5pt;">;</span><span style="color: #a9b7c6; font-family: "menlo";"><o:p></o:p></span></pre>
<pre style="font-size: 15.4px;"><span style="color: #cc7832; font-family: "menlo"; font-size: 7.5pt;"><span style="mso-spacerun: yes;"> </span></span><span style="color: #a9b7c6; font-family: "menlo"; font-size: 7.5pt;">}<o:p></o:p></span></pre>
<pre style="font-size: 15.4px;"><span style="color: #a9b7c6; font-family: "menlo"; font-size: 7.5pt;"><span style="mso-spacerun: yes;"> </span>String </span><span style="color: #9876aa; font-family: "menlo"; font-size: 7.5pt;">s</span><span style="color: #cc7832; font-family: "menlo"; font-size: 7.5pt;">;</span><span style="color: #a9b7c6; font-family: "menlo";"><o:p></o:p></span></pre>
<pre style="font-size: 15.4px;"><span style="color: #cc7832; font-family: "menlo"; font-size: 7.5pt;"><span style="mso-spacerun: yes;"> </span></span><span style="color: #a9b7c6; font-family: "menlo"; font-size: 7.5pt;">}<o:p></o:p></span></pre>
<pre style="font-size: 15.4px;"><span style="color: #a9b7c6; font-family: "menlo"; font-size: 7.5pt;"><o:p> </o:p></span></pre>
<pre style="font-size: 15.4px;"><span style="color: #a9b7c6; font-family: "menlo"; font-size: 7.5pt;"><span style="mso-spacerun: yes;"> </span><span style="mso-spacerun: yes;"> </span></span><span style="color: #cc7832; font-family: "menlo"; font-size: 7.5pt;">static class </span><span style="color: #a9b7c6; font-family: "menlo"; font-size: 7.5pt;">WeakA </span><span style="color: #cc7832; font-family: "menlo"; font-size: 7.5pt;">extends </span><span style="color: #a9b7c6; font-family: "menlo"; font-size: 7.5pt;">WeakReference<A> {</span><span style="color: #a9b7c6; font-family: "menlo";"><o:p></o:p></span></pre>
<pre style="font-size: 15.4px;"><span style="color: #cc7832; font-family: "menlo"; font-size: 7.5pt;"><span style="mso-spacerun: yes;"> </span></span><span style="color: #a9b7c6; font-family: "menlo"; font-size: 7.5pt;">String </span><span style="color: #9876aa; font-family: "menlo"; font-size: 7.5pt;">innerInfo</span><span style="color: #cc7832; font-family: "menlo"; font-size: 7.5pt;">;<o:p></o:p></span></pre>
<pre style="font-size: 15.4px;"><span style="color: #cc7832; font-family: "menlo"; font-size: 7.5pt;"><span style="mso-spacerun: yes;"> </span>public </span><span style="color: #ffc66d; font-family: "menlo"; font-size: 7.5pt;">WeakA</span><span style="color: #a9b7c6; font-family: "menlo"; font-size: 7.5pt;">(A a</span><span style="color: #cc7832; font-family: "menlo"; font-size: 7.5pt;">, </span><span style="color: #a9b7c6; font-family: "menlo"; font-size: 7.5pt;">String innerInfo</span><span style="color: #cc7832; font-family: "menlo"; font-size: 7.5pt;">, </span><span style="color: #a9b7c6; font-family: "menlo"; font-size: 7.5pt;">ReferenceQueue<A> queue) {<o:p></o:p></span></pre>
<pre style="font-size: 15.4px;"><span style="color: #a9b7c6; font-family: "menlo"; font-size: 7.5pt;"><span style="mso-spacerun: yes;"> </span><span style="mso-spacerun: yes;"> </span></span><span style="color: #cc7832; font-family: "menlo"; font-size: 7.5pt;">super</span><span style="color: #a9b7c6; font-family: "menlo"; font-size: 7.5pt;">(a</span><span style="color: #cc7832; font-family: "menlo"; font-size: 7.5pt;">, </span><span style="color: #a9b7c6; font-family: "menlo"; font-size: 7.5pt;">queue)</span><span style="color: #cc7832; font-family: "menlo"; font-size: 7.5pt;">; </span><span style="color: #a9b7c6; font-family: "menlo";"><o:p></o:p></span></pre>
<pre style="font-size: 15.4px;"><span style="color: #cc7832; font-family: "menlo"; font-size: 7.5pt;"><span style="mso-spacerun: yes;"> </span>this</span><span style="color: #a9b7c6; font-family: "menlo"; font-size: 7.5pt;">.</span><span style="color: #9876aa; font-family: "menlo"; font-size: 7.5pt;">innerInfo </span><span style="color: #a9b7c6; font-family: "menlo"; font-size: 7.5pt;">= innerInfo</span><span style="color: #cc7832; font-family: "menlo"; font-size: 7.5pt;">;</span><span style="color: #a9b7c6; font-family: "menlo";"><o:p></o:p></span></pre>
<pre style="font-size: 15.4px;"><span style="color: #cc7832; font-family: "menlo"; font-size: 7.5pt;"><span style="mso-spacerun: yes;"> </span>}</span><span style="color: #a9b7c6; font-family: "menlo"; font-size: 7.5pt;"><o:p></o:p></span></pre>
<pre style="font-size: 15.4px;"><span style="color: #a9b7c6; font-family: "menlo"; font-size: 7.5pt;"><span style="mso-spacerun: yes;"> </span>}<o:p></o:p></span></pre>
<pre style="font-size: 15.4px;"><span style="color: #a9b7c6; font-family: "menlo"; font-size: 7.5pt;"><o:p> </o:p></span></pre>
<pre style="font-size: 15.4px;"><span style="color: #a9b7c6; font-family: "menlo"; font-size: 7.5pt;"><span style="mso-spacerun: yes;"> </span><span style="mso-spacerun: yes;"> </span></span><span style="color: #cc7832; font-family: "menlo"; font-size: 7.5pt;">static class </span><span style="color: #a9b7c6; font-family: "menlo"; font-size: 7.5pt;">B {</span><span style="color: #a9b7c6; font-family: "menlo";"><o:p></o:p></span></pre>
<pre style="font-size: 15.4px;"><span style="color: #a9b7c6; font-family: "menlo"; font-size: 7.5pt;"><span style="mso-spacerun: yes;"> </span>List<Object> </span><span style="color: #9876aa; font-family: "menlo"; font-size: 7.5pt;">largeObject</span><span style="color: #cc7832; font-family: "menlo"; font-size: 7.5pt;">;</span><span style="color: #a9b7c6; font-family: "menlo";"><o:p></o:p></span></pre>
<pre style="font-size: 15.4px;"><span style="color: #a9b7c6; font-family: "menlo";"><o:p> </o:p></span></pre>
<pre style="font-size: 15.4px;"><span style="color: #a9b7c6; font-family: "menlo"; font-size: 7.5pt;"><span style="mso-spacerun: yes;"> </span><span style="mso-spacerun: yes;"> </span></span><span style="color: #cc7832; font-family: "menlo"; font-size: 7.5pt;">public </span><span style="color: #ffc66d; font-family: "menlo"; font-size: 7.5pt;">B</span><span style="color: #a9b7c6; font-family: "menlo"; font-size: 7.5pt;">(List<Object> largeObject) {<o:p></o:p></span></pre>
<pre style="font-size: 15.4px;"><span style="color: #a9b7c6; font-family: "menlo"; font-size: 7.5pt;"><span style="mso-spacerun: yes;"> </span><span style="mso-spacerun: yes;"> </span></span><span style="color: #cc7832; font-family: "menlo"; font-size: 7.5pt;">this</span><span style="color: #a9b7c6; font-family: "menlo"; font-size: 7.5pt;">.</span><span style="color: #9876aa; font-family: "menlo"; font-size: 7.5pt;">largeObject </span><span style="color: #a9b7c6; font-family: "menlo"; font-size: 7.5pt;">= largeObject</span><span style="color: #cc7832; font-family: "menlo"; font-size: 7.5pt;">;</span><span style="color: #a9b7c6; font-family: "menlo";"><o:p></o:p></span></pre>
<pre style="font-size: 15.4px;"><span style="color: #cc7832; font-family: "menlo"; font-size: 7.5pt;"><span style="mso-spacerun: yes;"> </span></span><span style="color: #a9b7c6; font-family: "menlo"; font-size: 7.5pt;">}</span><span style="color: #a9b7c6; font-family: "menlo";"><o:p></o:p></span></pre>
<pre style="font-size: 15.4px;"><span style="color: #cc7832; font-family: "menlo"; font-size: 7.5pt;"><span style="mso-spacerun: yes;"> </span></span><span style="color: #a9b7c6; font-family: "menlo"; font-size: 7.5pt;">}</span></pre>
<pre style="font-size: 15.4px;"></pre>
</div>
</div>
<br />
<br />
The output of the program is:<br />
<pre style="background-color: #2b2b2b;"><span style="color: #a9b7c6; font-family: "menlo";"><span style="font-size: 12px;">1.) WeakHashMap example:
Map size before gc: 1
Running GC..
[GC (System.gc()) 10526K->584K(502784K), 0.0008749 secs]
[Full GC (System.gc()) 584K->375K(502784K), 0.0034859 secs]
Finished running GC..
Map size after gc: 0
--------------------------------------------------------
2.) WeakReference example:
Reference.get() before gc: references.WeakReferenceTest$A@6e5e91e4
Referencequeue.poll() before gc: null
is enqueued: false
Running GC..
[GC (System.gc()) 23202K->1551K(502784K), 0.0012596 secs]
[Full GC (System.gc()) 1551K->1284K(502784K), 0.0066106 secs]
Finished running GC..
Reference.get() after gc: null
is enqueued: true
Refs are equal: true
ReferenceQueue.poll() after gc: java.lang.ref.WeakReference@30946e09
Referent inside reference after gc: null
--------------------------------------------------------
3.) Getting inner information from weak reference after the referent garbage collected
Running GC..
[GC (System.gc()) 9179K->1420K(502784K), 0.0007208 secs]
[Full GC (System.gc()) 1420K->1284K(502784K), 0.0074525 secs]
Finished running GC..
Referent inside reference after gc: null
Get inner information from the polled reference: Inner info</span></span></pre>
<br />
<div style="margin-bottom: .0001pt; margin: 0cm;">
<span style="color: black;"><span style="font-size: small;">The first part shows an example usage of WeakHashMap. We see that
the map size is one before GC but it is zero after GC as the key set to null
before GC and it is collected because the only reference to it is the Weak
reference from the WeakHashMap. Note that normally collecting the key will not
remove the Entry from the map but we see that the size of map is zero. This is
because there is a expungeStaleEntries method in WeakHashMap implementation
which is called during ordinary map operations like size/put. This method
iterates through ReferenceQueue of WeakReference and if it finds a reference
get the hash of the reference from it and use that has to find and remove the
Entry object from the map itself which in turn let the value of the entry to be
garbage collected in the next GC cycle (In above example it is a B object). It
is more effective than running through all map and remove an entry if key is
null. It uses a technique similar to the third part of the above example. By
holding a reference object which extends WeakReference we can add some
additional information to the reference itself, and even though the inner
referent inside the reference objects is cleared (after referent garbage
collected) we can still reach that inner additional information to use it
later, like using the hash to remove the Entry in the map.<o:p></o:p></span></span></div>
<div style="-webkit-text-stroke-width: 0px; font-variant-caps: normal; font-variant-ligatures: normal; margin-bottom: .0001pt; margin: 0cm; orphans: 2; text-align: start; text-decoration-color: initial; text-decoration-style: initial; widows: 2; word-spacing: 0px;">
<span style="color: black;"><span style="font-size: small;">Lastly the second part of the
above example shows a basic WeakReference example where the object is garbage
collected after the only reference to it is a weak reference as we see from the
below jhat results.<o:p></o:p></span></span></div>
<div style="-webkit-text-stroke-width: 0px; font-variant-caps: normal; font-variant-ligatures: normal; margin-bottom: .0001pt; margin: 0cm; orphans: 2; text-align: start; text-decoration-color: initial; text-decoration-style: initial; widows: 2; word-spacing: 0px;">
<br /></div>
<div style="-webkit-text-stroke-width: 0px; font-variant-caps: normal; font-variant-ligatures: normal; margin-bottom: .0001pt; margin: 0cm; orphans: 2; text-align: start; text-decoration-color: initial; text-decoration-style: initial; widows: 2; word-spacing: 0px;">
<span style="font-size: small;"><span style="color: black;">And again the web interface of
jhat we will see the below 3 results for 3 different hprof files.</span> </span></div>
<b style="font-family: "times new roman", serif; font-size: 18.6667px;"></b><br />
<table align="center" border="1"><tbody>
<tr><th><a href="http://localhost:8000/histo/class">Class</a><br />
<a href="http://localhost:8000/class/0x7156b1ef8" style="font-weight: 400; text-align: start;">class references.WeakReference$A</a></th><th><a href="http://localhost:8000/histo/count">Instance Count</a><br />
1</th><th><a href="http://localhost:8000/histo/size">Total Size</a><br />
8</th></tr>
</tbody></table>
weakRefBeforeGCEligible.hprof(localhost:8000/histo/)<br />
<div>
<br />
<div>
<table align="center" border="1"><tbody>
<tr><th><a href="http://localhost:8000/histo/class">Class</a><br />
<a href="http://localhost:8000/class/0x7156b1ef8" style="font-weight: 400; text-align: start;">class references.WeakReference$A</a></th><th><a href="http://localhost:8000/histo/count">Instance Count</a><br />
1</th><th><a href="http://localhost:8000/histo/size">Total Size</a><br />
8</th></tr>
</tbody></table>
weakRefBeforeGC.hprof(localhost:8001/histo/)</div>
<div>
<br /></div>
<div>
<table align="center" border="1"><tbody>
<tr><th><a href="http://localhost:8000/histo/class">Class</a><br />
<a href="http://localhost:8000/class/0x7156b1ef8" style="font-weight: 400; text-align: start;">class references.WeakReference$A</a></th><th><a href="http://localhost:8000/histo/count">Instance Count</a><br />
0</th><th><a href="http://localhost:8000/histo/size">Total Size</a><br />
0</th></tr>
</tbody></table>
weakRefAfterGC.hprof(localhost:8002/histo/)</div>
<div>
<br /></div>
</div>
<br />
<b style="font-family: "times new roman", serif; font-size: 18.6667px;"><u>Soft References:</u></b><br />
<b style="font-family: "times new roman", serif; font-size: 18.6667px;"><u><br /></u></b>
<span style="font-family: "times new roman" , serif; font-size: 18.6667px;"> </span><span style="font-size: small;">A soft reference can be created with java.lang.ref.SoftReference
class. A soft reference does garbage collected only if there is not enough
memory left in heap. That means it can be used for memory sensitive caches
where we do not want it to be removed from memory because reading from the
source is more expensive. </span><br />
<!--[if gte mso 9]><xml>
<o:OfficeDocumentSettings>
<o:AllowPNG/>
</o:OfficeDocumentSettings>
</xml><![endif]-->
<!--[if gte mso 9]><xml>
<w:WordDocument>
<w:View>Normal</w:View>
<w:Zoom>0</w:Zoom>
<w:TrackMoves/>
<w:TrackFormatting/>
<w:PunctuationKerning/>
<w:ValidateAgainstSchemas/>
<w:SaveIfXMLInvalid>false</w:SaveIfXMLInvalid>
<w:IgnoreMixedContent>false</w:IgnoreMixedContent>
<w:AlwaysShowPlaceholderText>false</w:AlwaysShowPlaceholderText>
<w:DoNotPromoteQF/>
<w:LidThemeOther>EN-US</w:LidThemeOther>
<w:LidThemeAsian>X-NONE</w:LidThemeAsian>
<w:LidThemeComplexScript>X-NONE</w:LidThemeComplexScript>
<w:Compatibility>
<w:BreakWrappedTables/>
<w:SnapToGridInCell/>
<w:WrapTextWithPunct/>
<w:UseAsianBreakRules/>
<w:DontGrowAutofit/>
<w:SplitPgBreakAndParaMark/>
<w:EnableOpenTypeKerning/>
<w:DontFlipMirrorIndents/>
<w:OverrideTableStyleHps/>
</w:Compatibility>
<m:mathPr>
<m:mathFont m:val="Cambria Math"/>
<m:brkBin m:val="before"/>
<m:brkBinSub m:val="--"/>
<m:smallFrac m:val="off"/>
<m:dispDef/>
<m:lMargin m:val="0"/>
<m:rMargin m:val="0"/>
<m:defJc m:val="centerGroup"/>
<m:wrapIndent m:val="1440"/>
<m:intLim m:val="subSup"/>
<m:naryLim m:val="undOvr"/>
</m:mathPr></w:WordDocument>
</xml><![endif]--><!--[if gte mso 9]><xml>
<w:LatentStyles DefLockedState="false" DefUnhideWhenUsed="false"
DefSemiHidden="false" DefQFormat="false" DefPriority="99"
LatentStyleCount="376">
<w:LsdException Locked="false" Priority="0" QFormat="true" Name="Normal"/>
<w:LsdException Locked="false" Priority="9" QFormat="true" Name="heading 1"/>
<w:LsdException Locked="false" Priority="9" SemiHidden="true"
UnhideWhenUsed="true" QFormat="true" Name="heading 2"/>
<w:LsdException Locked="false" Priority="9" SemiHidden="true"
UnhideWhenUsed="true" QFormat="true" Name="heading 3"/>
<w:LsdException Locked="false" Priority="9" SemiHidden="true"
UnhideWhenUsed="true" QFormat="true" Name="heading 4"/>
<w:LsdException Locked="false" Priority="9" SemiHidden="true"
UnhideWhenUsed="true" QFormat="true" Name="heading 5"/>
<w:LsdException Locked="false" Priority="9" SemiHidden="true"
UnhideWhenUsed="true" QFormat="true" Name="heading 6"/>
<w:LsdException Locked="false" Priority="9" SemiHidden="true"
UnhideWhenUsed="true" QFormat="true" Name="heading 7"/>
<w:LsdException Locked="false" Priority="9" SemiHidden="true"
UnhideWhenUsed="true" QFormat="true" Name="heading 8"/>
<w:LsdException Locked="false" Priority="9" SemiHidden="true"
UnhideWhenUsed="true" QFormat="true" Name="heading 9"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="index 1"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="index 2"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="index 3"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="index 4"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="index 5"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="index 6"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="index 7"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="index 8"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="index 9"/>
<w:LsdException Locked="false" Priority="39" SemiHidden="true"
UnhideWhenUsed="true" Name="toc 1"/>
<w:LsdException Locked="false" Priority="39" SemiHidden="true"
UnhideWhenUsed="true" Name="toc 2"/>
<w:LsdException Locked="false" Priority="39" SemiHidden="true"
UnhideWhenUsed="true" Name="toc 3"/>
<w:LsdException Locked="false" Priority="39" SemiHidden="true"
UnhideWhenUsed="true" Name="toc 4"/>
<w:LsdException Locked="false" Priority="39" SemiHidden="true"
UnhideWhenUsed="true" Name="toc 5"/>
<w:LsdException Locked="false" Priority="39" SemiHidden="true"
UnhideWhenUsed="true" Name="toc 6"/>
<w:LsdException Locked="false" Priority="39" SemiHidden="true"
UnhideWhenUsed="true" Name="toc 7"/>
<w:LsdException Locked="false" Priority="39" SemiHidden="true"
UnhideWhenUsed="true" Name="toc 8"/>
<w:LsdException Locked="false" Priority="39" SemiHidden="true"
UnhideWhenUsed="true" Name="toc 9"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="Normal Indent"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="footnote text"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="annotation text"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="header"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="footer"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="index heading"/>
<w:LsdException Locked="false" Priority="35" SemiHidden="true"
UnhideWhenUsed="true" QFormat="true" Name="caption"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="table of figures"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="envelope address"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="envelope return"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="footnote reference"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="annotation reference"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="line number"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="page number"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="endnote reference"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="endnote text"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="table of authorities"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="macro"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="toa heading"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="List"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="List Bullet"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="List Number"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="List 2"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="List 3"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="List 4"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="List 5"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="List Bullet 2"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="List Bullet 3"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="List Bullet 4"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="List Bullet 5"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="List Number 2"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="List Number 3"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="List Number 4"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="List Number 5"/>
<w:LsdException Locked="false" Priority="10" QFormat="true" Name="Title"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="Closing"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="Signature"/>
<w:LsdException Locked="false" Priority="1" SemiHidden="true"
UnhideWhenUsed="true" Name="Default Paragraph Font"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="Body Text"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="Body Text Indent"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="List Continue"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="List Continue 2"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="List Continue 3"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="List Continue 4"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="List Continue 5"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="Message Header"/>
<w:LsdException Locked="false" Priority="11" QFormat="true" Name="Subtitle"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="Salutation"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="Date"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="Body Text First Indent"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="Body Text First Indent 2"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="Note Heading"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="Body Text 2"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="Body Text 3"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="Body Text Indent 2"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="Body Text Indent 3"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="Block Text"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="Hyperlink"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="FollowedHyperlink"/>
<w:LsdException Locked="false" Priority="22" QFormat="true" Name="Strong"/>
<w:LsdException Locked="false" Priority="20" QFormat="true" Name="Emphasis"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="Document Map"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="Plain Text"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="E-mail Signature"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="HTML Top of Form"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="HTML Bottom of Form"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="Normal (Web)"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="HTML Acronym"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="HTML Address"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="HTML Cite"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="HTML Code"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="HTML Definition"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="HTML Keyboard"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
QFormat="true" Name="HTML Preformatted"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="HTML Sample"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="HTML Typewriter"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="HTML Variable"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="Normal Table"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="annotation subject"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="No List"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="Outline List 1"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="Outline List 2"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="Outline List 3"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="Table Simple 1"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="Table Simple 2"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="Table Simple 3"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="Table Classic 1"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="Table Classic 2"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="Table Classic 3"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="Table Classic 4"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="Table Colorful 1"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="Table Colorful 2"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="Table Colorful 3"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="Table Columns 1"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="Table Columns 2"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="Table Columns 3"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="Table Columns 4"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="Table Columns 5"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="Table Grid 1"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="Table Grid 2"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="Table Grid 3"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="Table Grid 4"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="Table Grid 5"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="Table Grid 6"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="Table Grid 7"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="Table Grid 8"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="Table List 1"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="Table List 2"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="Table List 3"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="Table List 4"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="Table List 5"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="Table List 6"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="Table List 7"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="Table List 8"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="Table 3D effects 1"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="Table 3D effects 2"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="Table 3D effects 3"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="Table Contemporary"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="Table Elegant"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="Table Professional"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="Table Subtle 1"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="Table Subtle 2"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="Table Web 1"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="Table Web 2"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="Table Web 3"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="Balloon Text"/>
<w:LsdException Locked="false" Priority="39" Name="Table Grid"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="Table Theme"/>
<w:LsdException Locked="false" SemiHidden="true" Name="Placeholder Text"/>
<w:LsdException Locked="false" Priority="1" QFormat="true" Name="No Spacing"/>
<w:LsdException Locked="false" Priority="60" Name="Light Shading"/>
<w:LsdException Locked="false" Priority="61" Name="Light List"/>
<w:LsdException Locked="false" Priority="62" Name="Light Grid"/>
<w:LsdException Locked="false" Priority="63" Name="Medium Shading 1"/>
<w:LsdException Locked="false" Priority="64" Name="Medium Shading 2"/>
<w:LsdException Locked="false" Priority="65" Name="Medium List 1"/>
<w:LsdException Locked="false" Priority="66" Name="Medium List 2"/>
<w:LsdException Locked="false" Priority="67" Name="Medium Grid 1"/>
<w:LsdException Locked="false" Priority="68" Name="Medium Grid 2"/>
<w:LsdException Locked="false" Priority="69" Name="Medium Grid 3"/>
<w:LsdException Locked="false" Priority="70" Name="Dark List"/>
<w:LsdException Locked="false" Priority="71" Name="Colorful Shading"/>
<w:LsdException Locked="false" Priority="72" Name="Colorful List"/>
<w:LsdException Locked="false" Priority="73" Name="Colorful Grid"/>
<w:LsdException Locked="false" Priority="60" Name="Light Shading Accent 1"/>
<w:LsdException Locked="false" Priority="61" Name="Light List Accent 1"/>
<w:LsdException Locked="false" Priority="62" Name="Light Grid Accent 1"/>
<w:LsdException Locked="false" Priority="63" Name="Medium Shading 1 Accent 1"/>
<w:LsdException Locked="false" Priority="64" Name="Medium Shading 2 Accent 1"/>
<w:LsdException Locked="false" Priority="65" Name="Medium List 1 Accent 1"/>
<w:LsdException Locked="false" SemiHidden="true" Name="Revision"/>
<w:LsdException Locked="false" Priority="34" QFormat="true"
Name="List Paragraph"/>
<w:LsdException Locked="false" Priority="29" QFormat="true" Name="Quote"/>
<w:LsdException Locked="false" Priority="30" QFormat="true"
Name="Intense Quote"/>
<w:LsdException Locked="false" Priority="66" Name="Medium List 2 Accent 1"/>
<w:LsdException Locked="false" Priority="67" Name="Medium Grid 1 Accent 1"/>
<w:LsdException Locked="false" Priority="68" Name="Medium Grid 2 Accent 1"/>
<w:LsdException Locked="false" Priority="69" Name="Medium Grid 3 Accent 1"/>
<w:LsdException Locked="false" Priority="70" Name="Dark List Accent 1"/>
<w:LsdException Locked="false" Priority="71" Name="Colorful Shading Accent 1"/>
<w:LsdException Locked="false" Priority="72" Name="Colorful List Accent 1"/>
<w:LsdException Locked="false" Priority="73" Name="Colorful Grid Accent 1"/>
<w:LsdException Locked="false" Priority="60" Name="Light Shading Accent 2"/>
<w:LsdException Locked="false" Priority="61" Name="Light List Accent 2"/>
<w:LsdException Locked="false" Priority="62" Name="Light Grid Accent 2"/>
<w:LsdException Locked="false" Priority="63" Name="Medium Shading 1 Accent 2"/>
<w:LsdException Locked="false" Priority="64" Name="Medium Shading 2 Accent 2"/>
<w:LsdException Locked="false" Priority="65" Name="Medium List 1 Accent 2"/>
<w:LsdException Locked="false" Priority="66" Name="Medium List 2 Accent 2"/>
<w:LsdException Locked="false" Priority="67" Name="Medium Grid 1 Accent 2"/>
<w:LsdException Locked="false" Priority="68" Name="Medium Grid 2 Accent 2"/>
<w:LsdException Locked="false" Priority="69" Name="Medium Grid 3 Accent 2"/>
<w:LsdException Locked="false" Priority="70" Name="Dark List Accent 2"/>
<w:LsdException Locked="false" Priority="71" Name="Colorful Shading Accent 2"/>
<w:LsdException Locked="false" Priority="72" Name="Colorful List Accent 2"/>
<w:LsdException Locked="false" Priority="73" Name="Colorful Grid Accent 2"/>
<w:LsdException Locked="false" Priority="60" Name="Light Shading Accent 3"/>
<w:LsdException Locked="false" Priority="61" Name="Light List Accent 3"/>
<w:LsdException Locked="false" Priority="62" Name="Light Grid Accent 3"/>
<w:LsdException Locked="false" Priority="63" Name="Medium Shading 1 Accent 3"/>
<w:LsdException Locked="false" Priority="64" Name="Medium Shading 2 Accent 3"/>
<w:LsdException Locked="false" Priority="65" Name="Medium List 1 Accent 3"/>
<w:LsdException Locked="false" Priority="66" Name="Medium List 2 Accent 3"/>
<w:LsdException Locked="false" Priority="67" Name="Medium Grid 1 Accent 3"/>
<w:LsdException Locked="false" Priority="68" Name="Medium Grid 2 Accent 3"/>
<w:LsdException Locked="false" Priority="69" Name="Medium Grid 3 Accent 3"/>
<w:LsdException Locked="false" Priority="70" Name="Dark List Accent 3"/>
<w:LsdException Locked="false" Priority="71" Name="Colorful Shading Accent 3"/>
<w:LsdException Locked="false" Priority="72" Name="Colorful List Accent 3"/>
<w:LsdException Locked="false" Priority="73" Name="Colorful Grid Accent 3"/>
<w:LsdException Locked="false" Priority="60" Name="Light Shading Accent 4"/>
<w:LsdException Locked="false" Priority="61" Name="Light List Accent 4"/>
<w:LsdException Locked="false" Priority="62" Name="Light Grid Accent 4"/>
<w:LsdException Locked="false" Priority="63" Name="Medium Shading 1 Accent 4"/>
<w:LsdException Locked="false" Priority="64" Name="Medium Shading 2 Accent 4"/>
<w:LsdException Locked="false" Priority="65" Name="Medium List 1 Accent 4"/>
<w:LsdException Locked="false" Priority="66" Name="Medium List 2 Accent 4"/>
<w:LsdException Locked="false" Priority="67" Name="Medium Grid 1 Accent 4"/>
<w:LsdException Locked="false" Priority="68" Name="Medium Grid 2 Accent 4"/>
<w:LsdException Locked="false" Priority="69" Name="Medium Grid 3 Accent 4"/>
<w:LsdException Locked="false" Priority="70" Name="Dark List Accent 4"/>
<w:LsdException Locked="false" Priority="71" Name="Colorful Shading Accent 4"/>
<w:LsdException Locked="false" Priority="72" Name="Colorful List Accent 4"/>
<w:LsdException Locked="false" Priority="73" Name="Colorful Grid Accent 4"/>
<w:LsdException Locked="false" Priority="60" Name="Light Shading Accent 5"/>
<w:LsdException Locked="false" Priority="61" Name="Light List Accent 5"/>
<w:LsdException Locked="false" Priority="62" Name="Light Grid Accent 5"/>
<w:LsdException Locked="false" Priority="63" Name="Medium Shading 1 Accent 5"/>
<w:LsdException Locked="false" Priority="64" Name="Medium Shading 2 Accent 5"/>
<w:LsdException Locked="false" Priority="65" Name="Medium List 1 Accent 5"/>
<w:LsdException Locked="false" Priority="66" Name="Medium List 2 Accent 5"/>
<w:LsdException Locked="false" Priority="67" Name="Medium Grid 1 Accent 5"/>
<w:LsdException Locked="false" Priority="68" Name="Medium Grid 2 Accent 5"/>
<w:LsdException Locked="false" Priority="69" Name="Medium Grid 3 Accent 5"/>
<w:LsdException Locked="false" Priority="70" Name="Dark List Accent 5"/>
<w:LsdException Locked="false" Priority="71" Name="Colorful Shading Accent 5"/>
<w:LsdException Locked="false" Priority="72" Name="Colorful List Accent 5"/>
<w:LsdException Locked="false" Priority="73" Name="Colorful Grid Accent 5"/>
<w:LsdException Locked="false" Priority="60" Name="Light Shading Accent 6"/>
<w:LsdException Locked="false" Priority="61" Name="Light List Accent 6"/>
<w:LsdException Locked="false" Priority="62" Name="Light Grid Accent 6"/>
<w:LsdException Locked="false" Priority="63" Name="Medium Shading 1 Accent 6"/>
<w:LsdException Locked="false" Priority="64" Name="Medium Shading 2 Accent 6"/>
<w:LsdException Locked="false" Priority="65" Name="Medium List 1 Accent 6"/>
<w:LsdException Locked="false" Priority="66" Name="Medium List 2 Accent 6"/>
<w:LsdException Locked="false" Priority="67" Name="Medium Grid 1 Accent 6"/>
<w:LsdException Locked="false" Priority="68" Name="Medium Grid 2 Accent 6"/>
<w:LsdException Locked="false" Priority="69" Name="Medium Grid 3 Accent 6"/>
<w:LsdException Locked="false" Priority="70" Name="Dark List Accent 6"/>
<w:LsdException Locked="false" Priority="71" Name="Colorful Shading Accent 6"/>
<w:LsdException Locked="false" Priority="72" Name="Colorful List Accent 6"/>
<w:LsdException Locked="false" Priority="73" Name="Colorful Grid Accent 6"/>
<w:LsdException Locked="false" Priority="19" QFormat="true"
Name="Subtle Emphasis"/>
<w:LsdException Locked="false" Priority="21" QFormat="true"
Name="Intense Emphasis"/>
<w:LsdException Locked="false" Priority="31" QFormat="true"
Name="Subtle Reference"/>
<w:LsdException Locked="false" Priority="32" QFormat="true"
Name="Intense Reference"/>
<w:LsdException Locked="false" Priority="33" QFormat="true" Name="Book Title"/>
<w:LsdException Locked="false" Priority="37" SemiHidden="true"
UnhideWhenUsed="true" Name="Bibliography"/>
<w:LsdException Locked="false" Priority="39" SemiHidden="true"
UnhideWhenUsed="true" QFormat="true" Name="TOC Heading"/>
<w:LsdException Locked="false" Priority="41" Name="Plain Table 1"/>
<w:LsdException Locked="false" Priority="42" Name="Plain Table 2"/>
<w:LsdException Locked="false" Priority="43" Name="Plain Table 3"/>
<w:LsdException Locked="false" Priority="44" Name="Plain Table 4"/>
<w:LsdException Locked="false" Priority="45" Name="Plain Table 5"/>
<w:LsdException Locked="false" Priority="40" Name="Grid Table Light"/>
<w:LsdException Locked="false" Priority="46" Name="Grid Table 1 Light"/>
<w:LsdException Locked="false" Priority="47" Name="Grid Table 2"/>
<w:LsdException Locked="false" Priority="48" Name="Grid Table 3"/>
<w:LsdException Locked="false" Priority="49" Name="Grid Table 4"/>
<w:LsdException Locked="false" Priority="50" Name="Grid Table 5 Dark"/>
<w:LsdException Locked="false" Priority="51" Name="Grid Table 6 Colorful"/>
<w:LsdException Locked="false" Priority="52" Name="Grid Table 7 Colorful"/>
<w:LsdException Locked="false" Priority="46"
Name="Grid Table 1 Light Accent 1"/>
<w:LsdException Locked="false" Priority="47" Name="Grid Table 2 Accent 1"/>
<w:LsdException Locked="false" Priority="48" Name="Grid Table 3 Accent 1"/>
<w:LsdException Locked="false" Priority="49" Name="Grid Table 4 Accent 1"/>
<w:LsdException Locked="false" Priority="50" Name="Grid Table 5 Dark Accent 1"/>
<w:LsdException Locked="false" Priority="51"
Name="Grid Table 6 Colorful Accent 1"/>
<w:LsdException Locked="false" Priority="52"
Name="Grid Table 7 Colorful Accent 1"/>
<w:LsdException Locked="false" Priority="46"
Name="Grid Table 1 Light Accent 2"/>
<w:LsdException Locked="false" Priority="47" Name="Grid Table 2 Accent 2"/>
<w:LsdException Locked="false" Priority="48" Name="Grid Table 3 Accent 2"/>
<w:LsdException Locked="false" Priority="49" Name="Grid Table 4 Accent 2"/>
<w:LsdException Locked="false" Priority="50" Name="Grid Table 5 Dark Accent 2"/>
<w:LsdException Locked="false" Priority="51"
Name="Grid Table 6 Colorful Accent 2"/>
<w:LsdException Locked="false" Priority="52"
Name="Grid Table 7 Colorful Accent 2"/>
<w:LsdException Locked="false" Priority="46"
Name="Grid Table 1 Light Accent 3"/>
<w:LsdException Locked="false" Priority="47" Name="Grid Table 2 Accent 3"/>
<w:LsdException Locked="false" Priority="48" Name="Grid Table 3 Accent 3"/>
<w:LsdException Locked="false" Priority="49" Name="Grid Table 4 Accent 3"/>
<w:LsdException Locked="false" Priority="50" Name="Grid Table 5 Dark Accent 3"/>
<w:LsdException Locked="false" Priority="51"
Name="Grid Table 6 Colorful Accent 3"/>
<w:LsdException Locked="false" Priority="52"
Name="Grid Table 7 Colorful Accent 3"/>
<w:LsdException Locked="false" Priority="46"
Name="Grid Table 1 Light Accent 4"/>
<w:LsdException Locked="false" Priority="47" Name="Grid Table 2 Accent 4"/>
<w:LsdException Locked="false" Priority="48" Name="Grid Table 3 Accent 4"/>
<w:LsdException Locked="false" Priority="49" Name="Grid Table 4 Accent 4"/>
<w:LsdException Locked="false" Priority="50" Name="Grid Table 5 Dark Accent 4"/>
<w:LsdException Locked="false" Priority="51"
Name="Grid Table 6 Colorful Accent 4"/>
<w:LsdException Locked="false" Priority="52"
Name="Grid Table 7 Colorful Accent 4"/>
<w:LsdException Locked="false" Priority="46"
Name="Grid Table 1 Light Accent 5"/>
<w:LsdException Locked="false" Priority="47" Name="Grid Table 2 Accent 5"/>
<w:LsdException Locked="false" Priority="48" Name="Grid Table 3 Accent 5"/>
<w:LsdException Locked="false" Priority="49" Name="Grid Table 4 Accent 5"/>
<w:LsdException Locked="false" Priority="50" Name="Grid Table 5 Dark Accent 5"/>
<w:LsdException Locked="false" Priority="51"
Name="Grid Table 6 Colorful Accent 5"/>
<w:LsdException Locked="false" Priority="52"
Name="Grid Table 7 Colorful Accent 5"/>
<w:LsdException Locked="false" Priority="46"
Name="Grid Table 1 Light Accent 6"/>
<w:LsdException Locked="false" Priority="47" Name="Grid Table 2 Accent 6"/>
<w:LsdException Locked="false" Priority="48" Name="Grid Table 3 Accent 6"/>
<w:LsdException Locked="false" Priority="49" Name="Grid Table 4 Accent 6"/>
<w:LsdException Locked="false" Priority="50" Name="Grid Table 5 Dark Accent 6"/>
<w:LsdException Locked="false" Priority="51"
Name="Grid Table 6 Colorful Accent 6"/>
<w:LsdException Locked="false" Priority="52"
Name="Grid Table 7 Colorful Accent 6"/>
<w:LsdException Locked="false" Priority="46" Name="List Table 1 Light"/>
<w:LsdException Locked="false" Priority="47" Name="List Table 2"/>
<w:LsdException Locked="false" Priority="48" Name="List Table 3"/>
<w:LsdException Locked="false" Priority="49" Name="List Table 4"/>
<w:LsdException Locked="false" Priority="50" Name="List Table 5 Dark"/>
<w:LsdException Locked="false" Priority="51" Name="List Table 6 Colorful"/>
<w:LsdException Locked="false" Priority="52" Name="List Table 7 Colorful"/>
<w:LsdException Locked="false" Priority="46"
Name="List Table 1 Light Accent 1"/>
<w:LsdException Locked="false" Priority="47" Name="List Table 2 Accent 1"/>
<w:LsdException Locked="false" Priority="48" Name="List Table 3 Accent 1"/>
<w:LsdException Locked="false" Priority="49" Name="List Table 4 Accent 1"/>
<w:LsdException Locked="false" Priority="50" Name="List Table 5 Dark Accent 1"/>
<w:LsdException Locked="false" Priority="51"
Name="List Table 6 Colorful Accent 1"/>
<w:LsdException Locked="false" Priority="52"
Name="List Table 7 Colorful Accent 1"/>
<w:LsdException Locked="false" Priority="46"
Name="List Table 1 Light Accent 2"/>
<w:LsdException Locked="false" Priority="47" Name="List Table 2 Accent 2"/>
<w:LsdException Locked="false" Priority="48" Name="List Table 3 Accent 2"/>
<w:LsdException Locked="false" Priority="49" Name="List Table 4 Accent 2"/>
<w:LsdException Locked="false" Priority="50" Name="List Table 5 Dark Accent 2"/>
<w:LsdException Locked="false" Priority="51"
Name="List Table 6 Colorful Accent 2"/>
<w:LsdException Locked="false" Priority="52"
Name="List Table 7 Colorful Accent 2"/>
<w:LsdException Locked="false" Priority="46"
Name="List Table 1 Light Accent 3"/>
<w:LsdException Locked="false" Priority="47" Name="List Table 2 Accent 3"/>
<w:LsdException Locked="false" Priority="48" Name="List Table 3 Accent 3"/>
<w:LsdException Locked="false" Priority="49" Name="List Table 4 Accent 3"/>
<w:LsdException Locked="false" Priority="50" Name="List Table 5 Dark Accent 3"/>
<w:LsdException Locked="false" Priority="51"
Name="List Table 6 Colorful Accent 3"/>
<w:LsdException Locked="false" Priority="52"
Name="List Table 7 Colorful Accent 3"/>
<w:LsdException Locked="false" Priority="46"
Name="List Table 1 Light Accent 4"/>
<w:LsdException Locked="false" Priority="47" Name="List Table 2 Accent 4"/>
<w:LsdException Locked="false" Priority="48" Name="List Table 3 Accent 4"/>
<w:LsdException Locked="false" Priority="49" Name="List Table 4 Accent 4"/>
<w:LsdException Locked="false" Priority="50" Name="List Table 5 Dark Accent 4"/>
<w:LsdException Locked="false" Priority="51"
Name="List Table 6 Colorful Accent 4"/>
<w:LsdException Locked="false" Priority="52"
Name="List Table 7 Colorful Accent 4"/>
<w:LsdException Locked="false" Priority="46"
Name="List Table 1 Light Accent 5"/>
<w:LsdException Locked="false" Priority="47" Name="List Table 2 Accent 5"/>
<w:LsdException Locked="false" Priority="48" Name="List Table 3 Accent 5"/>
<w:LsdException Locked="false" Priority="49" Name="List Table 4 Accent 5"/>
<w:LsdException Locked="false" Priority="50" Name="List Table 5 Dark Accent 5"/>
<w:LsdException Locked="false" Priority="51"
Name="List Table 6 Colorful Accent 5"/>
<w:LsdException Locked="false" Priority="52"
Name="List Table 7 Colorful Accent 5"/>
<w:LsdException Locked="false" Priority="46"
Name="List Table 1 Light Accent 6"/>
<w:LsdException Locked="false" Priority="47" Name="List Table 2 Accent 6"/>
<w:LsdException Locked="false" Priority="48" Name="List Table 3 Accent 6"/>
<w:LsdException Locked="false" Priority="49" Name="List Table 4 Accent 6"/>
<w:LsdException Locked="false" Priority="50" Name="List Table 5 Dark Accent 6"/>
<w:LsdException Locked="false" Priority="51"
Name="List Table 6 Colorful Accent 6"/>
<w:LsdException Locked="false" Priority="52"
Name="List Table 7 Colorful Accent 6"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="Mention"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="Smart Hyperlink"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="Hashtag"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="Unresolved Mention"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="Smart Link"/>
</w:LatentStyles>
</xml><![endif]-->
<style>
<!--
/* Font Definitions */
@font-face
{font-family:"Cambria Math";
panose-1:2 4 5 3 5 4 6 3 2 4;
mso-font-charset:0;
mso-generic-font-family:roman;
mso-font-pitch:variable;
mso-font-signature:-536870145 1107305727 0 0 415 0;}
@font-face
{font-family:Calibri;
panose-1:2 15 5 2 2 2 4 3 2 4;
mso-font-charset:0;
mso-generic-font-family:swiss;
mso-font-pitch:variable;
mso-font-signature:-536859905 -1073697537 9 0 511 0;}
/* Style Definitions */
p.MsoNormal, li.MsoNormal, div.MsoNormal
{mso-style-unhide:no;
mso-style-qformat:yes;
mso-style-parent:"";
margin:0cm;
margin-bottom:.0001pt;
mso-pagination:widow-orphan;
font-size:12.0pt;
font-family:"Calibri",sans-serif;
mso-ascii-font-family:Calibri;
mso-ascii-theme-font:minor-latin;
mso-fareast-font-family:Calibri;
mso-fareast-theme-font:minor-latin;
mso-hansi-font-family:Calibri;
mso-hansi-theme-font:minor-latin;
mso-bidi-font-family:"Times New Roman";
mso-bidi-theme-font:minor-bidi;
mso-fareast-language:EN-US;}
p
{mso-style-priority:99;
mso-margin-top-alt:auto;
margin-right:0cm;
mso-margin-bottom-alt:auto;
margin-left:0cm;
mso-pagination:widow-orphan;
font-size:12.0pt;
font-family:"Times New Roman",serif;
mso-fareast-font-family:"Times New Roman";}
.MsoChpDefault
{mso-style-type:export-only;
mso-default-props:yes;
font-family:"Calibri",sans-serif;
mso-ascii-font-family:Calibri;
mso-ascii-theme-font:minor-latin;
mso-fareast-font-family:Calibri;
mso-fareast-theme-font:minor-latin;
mso-hansi-font-family:Calibri;
mso-hansi-theme-font:minor-latin;
mso-bidi-font-family:"Times New Roman";
mso-bidi-theme-font:minor-bidi;
mso-fareast-language:EN-US;}
@page WordSection1
{size:595.0pt 842.0pt;
margin:72.0pt 72.0pt 72.0pt 72.0pt;
mso-header-margin:35.4pt;
mso-footer-margin:35.4pt;
mso-paper-source:0;}
div.WordSection1
{page:WordSection1;}
-->
</style>
<!--[if gte mso 10]>
<style>
/* Style Definitions */
table.MsoNormalTable
{mso-style-name:"Table Normal";
mso-tstyle-rowband-size:0;
mso-tstyle-colband-size:0;
mso-style-noshow:yes;
mso-style-priority:99;
mso-style-parent:"";
mso-padding-alt:0cm 5.4pt 0cm 5.4pt;
mso-para-margin:0cm;
mso-para-margin-bottom:.0001pt;
mso-pagination:widow-orphan;
font-size:12.0pt;
font-family:"Calibri",sans-serif;
mso-ascii-font-family:Calibri;
mso-ascii-theme-font:minor-latin;
mso-hansi-font-family:Calibri;
mso-hansi-theme-font:minor-latin;
mso-bidi-font-family:"Times New Roman";
mso-bidi-theme-font:minor-bidi;
mso-fareast-language:EN-US;}
</style>
<![endif]-->
<!--StartFragment-->
<br />
<div style="margin-bottom: 0.0001pt; margin-top: 0cm;">
<span style="font-size: small;">Note that if an application
uses almost all allowed heap memory, we possibly not get that much advantage
from using a cache as an almost full memory will make our application already
slow in processing and response times as it will require a lot of swap between memory and disk. However soft references can still be
used instead of strong references in some circumstances where we want to
prevent out of memory errors.</span><span style="font-size: 13.5pt;"><o:p></o:p></span></div>
<div class="MsoNormal">
<br /></div>
<!--EndFragment--><br />
<pre style="background-color: #f8f9fa;"><pre><span style="color: #cc7832; font-family: "menlo"; font-size: 7.5pt;">package </span><span style="color: #a9b7c6; font-family: "menlo"; font-size: 7.5pt;">references</span><span style="color: #cc7832; font-family: "menlo"; font-size: 7.5pt;">;<o:p></o:p></span></pre>
<pre><span style="color: #cc7832; font-family: "menlo"; font-size: 7.5pt;">import </span><span style="color: #a9b7c6; font-family: "menlo"; font-size: 7.5pt;">java.lang.ref.Reference</span><span style="color: #cc7832; font-family: "menlo"; font-size: 7.5pt;">;</span></pre>
<pre><span style="color: #cc7832; font-family: "menlo"; font-size: 7.5pt;">import </span><span style="color: #a9b7c6; font-family: "menlo"; font-size: 7.5pt;">java.lang.ref.ReferenceQueue</span><span style="color: #cc7832; font-family: "menlo"; font-size: 7.5pt;">;</span></pre>
<pre><span style="color: #cc7832; font-family: "menlo"; font-size: 7.5pt;">import </span><span style="color: #a9b7c6; font-family: "menlo"; font-size: 7.5pt;">java.lang.ref.SoftReference</span><span style="color: #cc7832; font-family: "menlo"; font-size: 7.5pt;">;</span></pre>
<pre><span style="color: #cc7832; font-family: "menlo"; font-size: 7.5pt;">import static </span><span style="color: #a9b7c6; font-family: "menlo"; font-size: 7.5pt;">references.StrongReference.<i>deleteOldDumps</i></span><span style="color: #cc7832; font-family: "menlo"; font-size: 7.5pt;">;</span></pre>
<pre><span style="color: #cc7832; font-family: "menlo"; font-size: 7.5pt;">import static </span><span style="color: #a9b7c6; font-family: "menlo"; font-size: 7.5pt;">references.StrongReference.<i>runGC</i></span><span style="color: #cc7832; font-family: "menlo"; font-size: 7.5pt;">;<o:p></o:p></span></pre>
<pre><span style="color: #cc7832; font-family: "menlo"; font-size: 7.5pt;">public class </span><span style="color: #a9b7c6; font-family: "menlo"; font-size: 7.5pt;">SoftReferenceTest {</span></pre>
<pre><span style="color: #a9b7c6; font-family: "menlo"; font-size: 7.5pt;"> </span><span style="color: #cc7832; font-family: "menlo"; font-size: 7.5pt;">public static void </span><span style="color: #ffc66d; font-family: "menlo"; font-size: 7.5pt;">main</span><span style="color: #a9b7c6; font-family: "menlo"; font-size: 7.5pt;">(String[] args) </span><span style="color: #cc7832; font-family: "menlo"; font-size: 7.5pt;">throws </span><span style="color: #a9b7c6; font-family: "menlo"; font-size: 7.5pt;">InterruptedException {</span></pre>
<pre><span style="color: #a9b7c6; font-family: "menlo"; font-size: 7.5pt;"> <i>deleteOldDumps</i>()</span><span style="color: #cc7832; font-family: "menlo"; font-size: 7.5pt;">;</span></pre>
<pre><span style="color: #cc7832; font-family: "menlo"; font-size: 7.5pt;"> </span><span style="color: #a9b7c6; font-family: "menlo"; font-size: 7.5pt;">A a = </span><span style="color: #cc7832; font-family: "menlo"; font-size: 7.5pt;">new </span><span style="color: #a9b7c6; font-family: "menlo"; font-size: 7.5pt;">A(</span><span style="color: #6a8759; font-family: "menlo"; font-size: 7.5pt;">"a"</span><span style="color: #a9b7c6; font-family: "menlo"; font-size: 7.5pt;">)</span><span style="color: #cc7832; font-family: "menlo"; font-size: 7.5pt;">;</span></pre>
<pre> <span style="color: #a9b7c6; font-family: "menlo"; font-size: 7.5pt;">ReferenceQueue<A> referenceQueue = </span><span style="color: #cc7832; font-family: "menlo"; font-size: 7.5pt;">new </span><span style="color: #a9b7c6; font-family: "menlo"; font-size: 7.5pt;">ReferenceQueue<>()</span><span style="color: #cc7832; font-family: "menlo"; font-size: 7.5pt;">;</span></pre>
<pre><span style="color: #cc7832; font-family: "menlo"; font-size: 7.5pt;"> </span><span style="color: #a9b7c6; font-family: "menlo"; font-size: 7.5pt;">Reference<A> softReference = </span><span style="color: #cc7832; font-family: "menlo"; font-size: 7.5pt;">new </span><span style="color: #a9b7c6; font-family: "menlo"; font-size: 7.5pt;">SoftReference<>(a</span><span style="color: #cc7832; font-family: "menlo"; font-size: 7.5pt;">, </span><span style="color: #a9b7c6; font-family: "menlo"; font-size: 7.5pt;">referenceQueue)</span><span style="color: #cc7832; font-family: "menlo"; font-size: 7.5pt;">;</span></pre>
<pre><span style="color: #cc7832; font-family: "menlo"; font-size: 7.5pt;"> </span><span style="color: #a9b7c6; font-family: "menlo"; font-size: 7.5pt;">HeapDump.<i>dumpHeap</i>(</span><span style="color: #6a8759; font-family: "menlo"; font-size: 7.5pt;">"java/heap-dumps/softRefBeforeGCEligible.hprof"</span><span style="color: #cc7832; font-family: "menlo"; font-size: 7.5pt;">, false</span><span style="color: #a9b7c6; font-family: "menlo"; font-size: 7.5pt;">)</span><span style="color: #cc7832; font-family: "menlo"; font-size: 7.5pt;">;</span></pre>
<pre><span style="color: #cc7832; font-family: "menlo"; font-size: 7.5pt;"> </span><span style="color: #a9b7c6; font-family: "menlo"; font-size: 7.5pt;">a = </span><span style="color: #cc7832; font-family: "menlo"; font-size: 7.5pt;">null;</span></pre>
<pre><span style="color: #cc7832; font-family: "menlo"; font-size: 7.5pt;"> </span><span style="color: #a9b7c6; font-family: "menlo"; font-size: 7.5pt;">System.</span><i><span style="color: #9876aa; font-family: "menlo"; font-size: 7.5pt;">out</span></i><span style="color: #a9b7c6; font-family: "menlo"; font-size: 7.5pt;">.println(</span><span style="color: #6a8759; font-family: "menlo"; font-size: 7.5pt;">"Reference.get() before gc: " </span><span style="color: #a9b7c6; font-family: "menlo"; font-size: 7.5pt;">+ softReference.get())</span><span style="color: #cc7832; font-family: "menlo"; font-size: 7.5pt;">;</span></pre>
<pre><span style="color: #cc7832; font-family: "menlo"; font-size: 7.5pt;"> </span><span style="color: #a9b7c6; font-family: "menlo"; font-size: 7.5pt;">System.</span><i><span style="color: #9876aa; font-family: "menlo"; font-size: 7.5pt;">out</span></i><span style="color: #a9b7c6; font-family: "menlo"; font-size: 7.5pt;">.println(</span><span style="color: #6a8759; font-family: "menlo"; font-size: 7.5pt;">"Referencequeue.poll() before gc: " </span><span style="color: #a9b7c6; font-family: "menlo"; font-size: 7.5pt;">+ referenceQueue.poll())</span><span style="color: #cc7832; font-family: "menlo"; font-size: 7.5pt;">;</span></pre>
<pre><span style="color: #cc7832; font-family: "menlo"; font-size: 7.5pt;"> </span><span style="color: #a9b7c6; font-family: "menlo"; font-size: 7.5pt;">System.</span><i><span style="color: #9876aa; font-family: "menlo"; font-size: 7.5pt;">out</span></i><span style="color: #a9b7c6; font-family: "menlo"; font-size: 7.5pt;">.println(</span><span style="color: #6a8759; font-family: "menlo"; font-size: 7.5pt;">"is enqueued: " </span><span style="color: #a9b7c6; font-family: "menlo"; font-size: 7.5pt;">+ softReference.isEnqueued())</span><span style="color: #cc7832; font-family: "menlo"; font-size: 7.5pt;">;</span></pre>
<pre><span style="color: #cc7832; font-family: "menlo"; font-size: 7.5pt;"> </span><span style="color: #a9b7c6; font-family: "menlo"; font-size: 7.5pt;">HeapDump.<i>dumpHeap</i>(</span><span style="color: #6a8759; font-family: "menlo"; font-size: 7.5pt;">"java/heap-dumps/softRefBeforeGC.hprof"</span><span style="color: #cc7832; font-family: "menlo"; font-size: 7.5pt;">, false</span><span style="color: #a9b7c6; font-family: "menlo"; font-size: 7.5pt;">)</span><span style="color: #cc7832; font-family: "menlo"; font-size: 7.5pt;">;</span></pre>
<pre><span style="color: #cc7832; font-family: "menlo"; font-size: 7.5pt;"> </span><i><span style="color: #a9b7c6; font-family: "menlo"; font-size: 7.5pt;">runGC</span></i><span style="color: #a9b7c6; font-family: "menlo"; font-size: 7.5pt;">()</span><span style="color: #cc7832; font-family: "menlo"; font-size: 7.5pt;">;</span></pre>
<pre><span style="color: #cc7832; font-family: "menlo"; font-size: 7.5pt;"> </span><span style="color: #a9b7c6; font-family: "menlo"; font-size: 7.5pt;">HeapDump.<i>dumpHeap</i>(</span><span style="color: #6a8759; font-family: "menlo"; font-size: 7.5pt;">"java/heap-dumps/softRefAfterGC.hprof"</span><span style="color: #cc7832; font-family: "menlo"; font-size: 7.5pt;">, false</span><span style="color: #a9b7c6; font-family: "menlo"; font-size: 7.5pt;">)</span><span style="color: #cc7832; font-family: "menlo"; font-size: 7.5pt;">;</span></pre>
<pre><span style="color: #cc7832; font-family: "menlo"; font-size: 7.5pt;"> </span><span style="color: #a9b7c6; font-family: "menlo"; font-size: 7.5pt;">System.</span><i><span style="color: #9876aa; font-family: "menlo"; font-size: 7.5pt;">out</span></i><span style="color: #a9b7c6; font-family: "menlo"; font-size: 7.5pt;">.println(</span><span style="color: #6a8759; font-family: "menlo"; font-size: 7.5pt;">"Reference.get() after gc: " </span><span style="color: #a9b7c6; font-family: "menlo"; font-size: 7.5pt;">+ softReference.get())</span><span style="color: #cc7832; font-family: "menlo"; font-size: 7.5pt;">;</span></pre>
<pre><span style="color: #cc7832; font-family: "menlo"; font-size: 7.5pt;"> </span><span style="color: #a9b7c6; font-family: "menlo"; font-size: 7.5pt;">System.</span><i><span style="color: #9876aa; font-family: "menlo"; font-size: 7.5pt;">out</span></i><span style="color: #a9b7c6; font-family: "menlo"; font-size: 7.5pt;">.println(</span><span style="color: #6a8759; font-family: "menlo"; font-size: 7.5pt;">"is enqueued: " </span><span style="color: #a9b7c6; font-family: "menlo"; font-size: 7.5pt;">+ softReference.isEnqueued())</span><span style="color: #cc7832; font-family: "menlo"; font-size: 7.5pt;">;</span></pre>
<pre><span style="color: #cc7832; font-family: "menlo"; font-size: 7.5pt;"> </span><span style="color: #a9b7c6; font-family: "menlo"; font-size: 7.5pt;">Reference polledRef = referenceQueue.poll()</span><span style="color: #cc7832; font-family: "menlo"; font-size: 7.5pt;">;</span></pre>
<pre><span style="color: #cc7832; font-family: "menlo"; font-size: 7.5pt;"> </span><span style="color: #a9b7c6; font-family: "menlo"; font-size: 7.5pt;">System.</span><i><span style="color: #9876aa; font-family: "menlo"; font-size: 7.5pt;">out</span></i><span style="color: #a9b7c6; font-family: "menlo"; font-size: 7.5pt;">.println(</span><span style="color: #6a8759; font-family: "menlo"; font-size: 7.5pt;">"ReferenceQueue.poll() after gc: " </span><span style="color: #a9b7c6; font-family: "menlo"; font-size: 7.5pt;">+ polledRef)</span><span style="color: #cc7832; font-family: "menlo"; font-size: 7.5pt;">;</span></pre>
<pre><span style="color: #cc7832; font-family: "menlo"; font-size: 7.5pt;"> </span><span style="color: #a9b7c6; font-family: "menlo"; font-size: 7.5pt;">}</span></pre>
<pre></pre>
<pre><span style="color: #a9b7c6; font-family: "menlo"; font-size: 7.5pt;"> </span><span style="color: #cc7832; font-family: "menlo"; font-size: 7.5pt;">static class </span><span style="color: #a9b7c6; font-family: "menlo"; font-size: 7.5pt;">A {</span></pre>
<pre><pre style="font-size: 13.3333px;"><span style="color: #a9b7c6; font-family: "menlo"; font-size: 7.5pt;"> String </span><span style="color: #9876aa; font-family: "menlo"; font-size: 7.5pt;">s</span><span style="color: #cc7832; font-family: "menlo"; font-size: 7.5pt;">; </span></pre>
</pre>
<pre><span style="color: #a9b7c6; font-family: "menlo"; font-size: 7.5pt;"> </span><span style="color: #cc7832; font-family: "menlo"; font-size: 7.5pt;">public </span><span style="color: #ffc66d; font-family: "menlo"; font-size: 7.5pt;">A</span><span style="color: #a9b7c6; font-family: "menlo"; font-size: 7.5pt;">(String s) {</span></pre>
<pre><span style="color: #a9b7c6; font-family: "menlo"; font-size: 7.5pt;"> </span><span style="color: #cc7832; font-family: "menlo"; font-size: 7.5pt;">this</span><span style="color: #a9b7c6; font-family: "menlo"; font-size: 7.5pt;">.</span><span style="color: #9876aa; font-family: "menlo"; font-size: 7.5pt;">s </span><span style="color: #a9b7c6; font-family: "menlo"; font-size: 7.5pt;">= s</span><span style="color: #cc7832; font-family: "menlo"; font-size: 7.5pt;">; </span></pre>
<pre><span style="color: #cc7832; font-family: "menlo"; font-size: 7.5pt;"> </span><span style="color: #a9b7c6; font-family: "menlo"; font-size: 7.5pt;">}</span></pre>
<pre><span style="color: #cc7832; font-family: "menlo"; font-size: 7.5pt;"> </span><span style="color: #a9b7c6; font-family: "menlo"; font-size: 7.5pt;">}</span></pre>
<pre><span style="color: #a9b7c6; font-family: "menlo"; font-size: 7.5pt;">}</span></pre>
</pre>
<br />
<br />
The output of the program is:<br />
<pre style="background-color: #2b2b2b;"><span style="color: #a9b7c6; font-family: "menlo";"><span style="font-size: 12px;">Reference.get() before gc: references.SoftReferenceTest$A@5387f9e0
Referencequeue.poll() before gc: null
is enqueued: false
Running GC..
[GC (System.gc()) 26317K->1544K(502784K), 0.0016028 secs]
[Full GC (System.gc()) 1544K->1300K(502784K), 0.0070209 secs]
Finished running GC..
Reference.get() after gc: references.SoftReferenceTest$A@5387f9e0
is enqueued: false
ReferenceQueue.poll() after gc: null</span></span></pre>
<span style="font-family: "times new roman" , serif; font-size: 16px;"><br /></span>
<span style="font-family: "times new roman" , serif; font-size: 16px;">If we check the jhat result after GC, we will see soft reference is not cleared.</span><br />
<br class="Apple-interchange-newline" />
<table align="center" border="1"><tbody>
<tr><th><a href="http://localhost:8000/histo/class">Class</a><br />
<a href="http://localhost:8000/class/0x7156b1ef8" style="font-weight: 400; text-align: start;">class references.SoftReference$A</a></th><th><a href="http://localhost:8000/histo/count">Instance Count</a><br />
1</th><th><a href="http://localhost:8000/histo/size">Total Size</a><br />
8</th></tr>
</tbody></table>
softRefAfterGC.hprof(localhost:8002/histo/)<br />
<b style="font-family: "times new roman", serif; font-size: 18.6667px;"><u><br /></u></b>
<b style="font-family: "times new roman", serif; font-size: 18.6667px;"><u>Phantom References:</u></b><br />
<b style="font-family: "times new roman", serif; font-size: 18.6667px;"><u><br /></u></b>
<br />
<div class="MsoNormal">
<span style="color: black; font-family: "times new roman" , serif;"><span style="font-size: small;"> A phantom reference can be created with java.lang.ref.PhantomReference
class. Unlike weak and soft references whereby we can control how objects
garbage collected, a phantom reference is used for pre-mortem cleanup actions
before GC remove the object. <o:p></o:p></span></span></div>
<div class="MsoNormal">
<span style="color: black; font-family: "times new roman" , serif;"><span style="font-size: small;">It mainly used for a replacement for finalize method which is unreliable
and can slow down the application as JVM uses separate thread pool for
finalization and an object with a finalize method consumes more resources than
a normal object. <o:p></o:p></span></span></div>
<div class="MsoNormal">
<span style="color: black; font-family: "times new roman" , serif;"><span style="font-size: small;">Another problem with finalize method is that it allows the objects to be
resurrected during finalization and for this reason at least two GC cycles need
to be run as first GC makes the object finalizable and the second GC reclaimed
object if it is not resurrected. And between this two GC cycles finalizer
thread must have been run to actually reclaim the object. If the finalizer
thread does not run, more than two number of GC can run and this means the
object will wait to be reclaimed for a long time although it is not used
anymore which can cause an out of memory exception even though most the objects
in heap are garbage.<o:p></o:p></span></span></div>
<div class="MsoNormal">
<br /></div>
<div class="MsoNormal">
<span style="color: black; font-family: "times new roman" , serif;"><span style="font-size: small;">And as per doc;<o:p></o:p></span></span></div>
<div class="MsoNormal">
<span style="font-size: small;"><span style="color: #262626; font-family: "times new roman" , serif;"> You should also use finalization only when
it is absolutely necessary. Finalization is a nondeterministic -- and sometimes
unpredictable -- process. The less you rely on it, the smaller the impact it
will have on the JVM and your application.</span><span style="color: black; font-family: "times new roman" , serif;"><o:p></o:p></span></span></div>
<div class="MsoNormal">
<span style="color: black; font-family: "times new roman" , serif;"><span style="font-size: small;"> <o:p></o:p></span></span></div>
<div class="MsoNormal">
<span style="color: black; font-family: "times new roman" , serif;"><span style="font-size: small;">A phantom reference is enqueud to the reference queue by garbage
collector after it determines that the referent object is phantom reachable
that is has no reference left.<o:p></o:p></span></span></div>
<div class="MsoNormal">
<span style="color: black; font-family: "times new roman" , serif;"><span style="font-size: small;">Note that the time the reference is enqueued is not certain and it can
be any time after GC determines the referent is to reclaimable.<o:p></o:p></span></span></div>
<div class="MsoNormal">
<span style="color: black; font-family: "times new roman" , serif;"><span style="font-size: small;">Note that to prevent resurrection, phantom reference get method always
return null. Also prior to java 9, unlike weak and soft references, phantom
referenced objects (referent) are not automatically cleared and the referent
will stay in memory either until calling clear method to clear it or the
reference itself being garbage collected. With java 9 the referent is
automatically cleared when the reference is enqueued.<o:p></o:p></span></span></div>
<div class="MsoNormal">
<span style="color: black; font-family: "times new roman" , serif;"><span style="font-size: small;"><br />
Note that creating a phantom reference without a reference queue is useless as
the get method returns null and since there is no queue it will never be
enqueued.<o:p></o:p></span></span></div>
<div class="MsoNormal">
<br /></div>
<div class="MsoNormal">
<span style="color: black; font-family: "times new roman" , serif;"><span style="font-size: small;">As an example of using phantom reference to clean up objects you can
check the <a href="https://alvinalexander.com/java/jwarehouse/commons-io-2.0/src/main/java/org/apache/commons/io/FileCleaningTracker.java.shtml"><span style="color: blue;">FileCleaningTracker</span></a> class from apache
commons which uses PhantomReference to delete the file physically if the object
representing the file is cleaned up.<o:p></o:p></span></span></div>
<div class="MsoNormal">
<span style="color: black; font-family: "times new roman" , serif;"><span style="font-size: small;"><br />
Another use case apart from doing a pre-mortem cleanup action could be
determining the time to load a heavy object after another one cleaned up. Since
a phantom reference queued on a reference queue tells us the referent itself
happens to be garbage collected we can use that information to load another
object. However especially before java 9 where the referent still referenced
from the phantom reference itself even after you see the reference in queue we
cannot be sure the object really claimed in terms of memory. Even after java 9
seeing the reference in reference queue does not tell us certainly that the
space that object is using really claimed. Instead it means the space hold by
the referent object will happen to be reclaimed and there is no way to
resurrect it so we can do whatever cleanup operation we want.<o:p></o:p></span></span></div>
<div class="MsoNormal">
<span style="color: black; font-family: "times new roman" , serif;"><span style="font-size: small;"><br />
Let's see an example usage of PhantomReference below where we do a cleanup
operation.<o:p></o:p></span></span></div>
<div class="MsoNormal">
<span style="color: black; font-family: "times new roman" , serif;"><span style="font-size: small;">Note that we used MyFinalizer class which extends PhantomReference and
holds some additional information to be used in clean up after the object
phantom reachable.<o:p></o:p></span></span></div>
<div class="MsoNormal">
<span style="color: black; font-family: "times new roman" , serif;"><span style="font-size: small;">Also note that we used a shutdown hook as a separate thread and force
the phantom reference monitoring thread to finish before the application exit.
For that purpose we used a CountDownLatch in shutdown hook which is a barrier
allowing us to wait another thread to finish.<o:p></o:p></span></span></div>
<div class="MsoNormal">
<span style="color: black; font-family: "times new roman" , serif;"><span style="font-size: small;">Finally, in the monitoring thread we read the reference from reference
queue, do the cleanup operation with the information we set during the creation
of reference. Note that we need to call the clear method of reference after we
finish clean up so that the referent will be set to null and ready to clean up
by GC. If we do not call clean method on reference we will see the referent is
still there. See the shutdown hook thread code which uses reflection to get the
referent. (Do not use reflection to get the referent when using phantom
reference, because it can break the promise of not resurrection of phantom
reference).<o:p></o:p></span></span></div>
<div class="MsoNormal">
<span style="color: black; font-family: "times new roman" , serif;"><span style="font-size: small;">If you run the same code with a jdk version 9 or greater you will see
that the referent is automatically set to null and you do not need to call
reference.clear() method anymore.<o:p></o:p></span></span></div>
<b style="font-family: "times new roman", serif;"><span style="font-size: small;">
<!--[if gte mso 9]><xml>
<o:OfficeDocumentSettings>
<o:AllowPNG/>
</o:OfficeDocumentSettings>
</xml><![endif]-->
<!--[if gte mso 9]><xml>
<w:WordDocument>
<w:View>Normal</w:View>
<w:Zoom>0</w:Zoom>
<w:TrackMoves/>
<w:TrackFormatting/>
<w:PunctuationKerning/>
<w:ValidateAgainstSchemas/>
<w:SaveIfXMLInvalid>false</w:SaveIfXMLInvalid>
<w:IgnoreMixedContent>false</w:IgnoreMixedContent>
<w:AlwaysShowPlaceholderText>false</w:AlwaysShowPlaceholderText>
<w:DoNotPromoteQF/>
<w:LidThemeOther>EN-US</w:LidThemeOther>
<w:LidThemeAsian>X-NONE</w:LidThemeAsian>
<w:LidThemeComplexScript>X-NONE</w:LidThemeComplexScript>
<w:Compatibility>
<w:BreakWrappedTables/>
<w:SnapToGridInCell/>
<w:WrapTextWithPunct/>
<w:UseAsianBreakRules/>
<w:DontGrowAutofit/>
<w:SplitPgBreakAndParaMark/>
<w:EnableOpenTypeKerning/>
<w:DontFlipMirrorIndents/>
<w:OverrideTableStyleHps/>
</w:Compatibility>
<m:mathPr>
<m:mathFont m:val="Cambria Math"/>
<m:brkBin m:val="before"/>
<m:brkBinSub m:val="--"/>
<m:smallFrac m:val="off"/>
<m:dispDef/>
<m:lMargin m:val="0"/>
<m:rMargin m:val="0"/>
<m:defJc m:val="centerGroup"/>
<m:wrapIndent m:val="1440"/>
<m:intLim m:val="subSup"/>
<m:naryLim m:val="undOvr"/>
</m:mathPr></w:WordDocument>
</xml><![endif]--><!--[if gte mso 9]><xml>
<w:LatentStyles DefLockedState="false" DefUnhideWhenUsed="false"
DefSemiHidden="false" DefQFormat="false" DefPriority="99"
LatentStyleCount="376">
<w:LsdException Locked="false" Priority="0" QFormat="true" Name="Normal"/>
<w:LsdException Locked="false" Priority="9" QFormat="true" Name="heading 1"/>
<w:LsdException Locked="false" Priority="9" SemiHidden="true"
UnhideWhenUsed="true" QFormat="true" Name="heading 2"/>
<w:LsdException Locked="false" Priority="9" SemiHidden="true"
UnhideWhenUsed="true" QFormat="true" Name="heading 3"/>
<w:LsdException Locked="false" Priority="9" SemiHidden="true"
UnhideWhenUsed="true" QFormat="true" Name="heading 4"/>
<w:LsdException Locked="false" Priority="9" SemiHidden="true"
UnhideWhenUsed="true" QFormat="true" Name="heading 5"/>
<w:LsdException Locked="false" Priority="9" SemiHidden="true"
UnhideWhenUsed="true" QFormat="true" Name="heading 6"/>
<w:LsdException Locked="false" Priority="9" SemiHidden="true"
UnhideWhenUsed="true" QFormat="true" Name="heading 7"/>
<w:LsdException Locked="false" Priority="9" SemiHidden="true"
UnhideWhenUsed="true" QFormat="true" Name="heading 8"/>
<w:LsdException Locked="false" Priority="9" SemiHidden="true"
UnhideWhenUsed="true" QFormat="true" Name="heading 9"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="index 1"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="index 2"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="index 3"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="index 4"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="index 5"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="index 6"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="index 7"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="index 8"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="index 9"/>
<w:LsdException Locked="false" Priority="39" SemiHidden="true"
UnhideWhenUsed="true" Name="toc 1"/>
<w:LsdException Locked="false" Priority="39" SemiHidden="true"
UnhideWhenUsed="true" Name="toc 2"/>
<w:LsdException Locked="false" Priority="39" SemiHidden="true"
UnhideWhenUsed="true" Name="toc 3"/>
<w:LsdException Locked="false" Priority="39" SemiHidden="true"
UnhideWhenUsed="true" Name="toc 4"/>
<w:LsdException Locked="false" Priority="39" SemiHidden="true"
UnhideWhenUsed="true" Name="toc 5"/>
<w:LsdException Locked="false" Priority="39" SemiHidden="true"
UnhideWhenUsed="true" Name="toc 6"/>
<w:LsdException Locked="false" Priority="39" SemiHidden="true"
UnhideWhenUsed="true" Name="toc 7"/>
<w:LsdException Locked="false" Priority="39" SemiHidden="true"
UnhideWhenUsed="true" Name="toc 8"/>
<w:LsdException Locked="false" Priority="39" SemiHidden="true"
UnhideWhenUsed="true" Name="toc 9"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="Normal Indent"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="footnote text"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="annotation text"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="header"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="footer"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="index heading"/>
<w:LsdException Locked="false" Priority="35" SemiHidden="true"
UnhideWhenUsed="true" QFormat="true" Name="caption"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="table of figures"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="envelope address"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="envelope return"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="footnote reference"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="annotation reference"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="line number"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="page number"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="endnote reference"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="endnote text"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="table of authorities"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="macro"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="toa heading"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="List"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="List Bullet"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="List Number"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="List 2"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="List 3"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="List 4"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="List 5"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="List Bullet 2"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="List Bullet 3"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="List Bullet 4"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="List Bullet 5"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="List Number 2"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="List Number 3"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="List Number 4"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="List Number 5"/>
<w:LsdException Locked="false" Priority="10" QFormat="true" Name="Title"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="Closing"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="Signature"/>
<w:LsdException Locked="false" Priority="1" SemiHidden="true"
UnhideWhenUsed="true" Name="Default Paragraph Font"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="Body Text"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="Body Text Indent"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="List Continue"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="List Continue 2"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="List Continue 3"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="List Continue 4"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="List Continue 5"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="Message Header"/>
<w:LsdException Locked="false" Priority="11" QFormat="true" Name="Subtitle"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="Salutation"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="Date"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="Body Text First Indent"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="Body Text First Indent 2"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="Note Heading"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="Body Text 2"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="Body Text 3"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="Body Text Indent 2"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="Body Text Indent 3"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="Block Text"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="Hyperlink"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="FollowedHyperlink"/>
<w:LsdException Locked="false" Priority="22" QFormat="true" Name="Strong"/>
<w:LsdException Locked="false" Priority="20" QFormat="true" Name="Emphasis"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="Document Map"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="Plain Text"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="E-mail Signature"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="HTML Top of Form"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="HTML Bottom of Form"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="Normal (Web)"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="HTML Acronym"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="HTML Address"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="HTML Cite"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="HTML Code"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="HTML Definition"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="HTML Keyboard"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
QFormat="true" Name="HTML Preformatted"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="HTML Sample"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="HTML Typewriter"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="HTML Variable"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="Normal Table"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="annotation subject"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="No List"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="Outline List 1"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="Outline List 2"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="Outline List 3"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="Table Simple 1"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="Table Simple 2"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="Table Simple 3"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="Table Classic 1"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="Table Classic 2"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="Table Classic 3"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="Table Classic 4"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="Table Colorful 1"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="Table Colorful 2"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="Table Colorful 3"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="Table Columns 1"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="Table Columns 2"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="Table Columns 3"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="Table Columns 4"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="Table Columns 5"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="Table Grid 1"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="Table Grid 2"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="Table Grid 3"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="Table Grid 4"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="Table Grid 5"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="Table Grid 6"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="Table Grid 7"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="Table Grid 8"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="Table List 1"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="Table List 2"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="Table List 3"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="Table List 4"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="Table List 5"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="Table List 6"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="Table List 7"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="Table List 8"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="Table 3D effects 1"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="Table 3D effects 2"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="Table 3D effects 3"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="Table Contemporary"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="Table Elegant"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="Table Professional"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="Table Subtle 1"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="Table Subtle 2"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="Table Web 1"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="Table Web 2"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="Table Web 3"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="Balloon Text"/>
<w:LsdException Locked="false" Priority="39" Name="Table Grid"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="Table Theme"/>
<w:LsdException Locked="false" SemiHidden="true" Name="Placeholder Text"/>
<w:LsdException Locked="false" Priority="1" QFormat="true" Name="No Spacing"/>
<w:LsdException Locked="false" Priority="60" Name="Light Shading"/>
<w:LsdException Locked="false" Priority="61" Name="Light List"/>
<w:LsdException Locked="false" Priority="62" Name="Light Grid"/>
<w:LsdException Locked="false" Priority="63" Name="Medium Shading 1"/>
<w:LsdException Locked="false" Priority="64" Name="Medium Shading 2"/>
<w:LsdException Locked="false" Priority="65" Name="Medium List 1"/>
<w:LsdException Locked="false" Priority="66" Name="Medium List 2"/>
<w:LsdException Locked="false" Priority="67" Name="Medium Grid 1"/>
<w:LsdException Locked="false" Priority="68" Name="Medium Grid 2"/>
<w:LsdException Locked="false" Priority="69" Name="Medium Grid 3"/>
<w:LsdException Locked="false" Priority="70" Name="Dark List"/>
<w:LsdException Locked="false" Priority="71" Name="Colorful Shading"/>
<w:LsdException Locked="false" Priority="72" Name="Colorful List"/>
<w:LsdException Locked="false" Priority="73" Name="Colorful Grid"/>
<w:LsdException Locked="false" Priority="60" Name="Light Shading Accent 1"/>
<w:LsdException Locked="false" Priority="61" Name="Light List Accent 1"/>
<w:LsdException Locked="false" Priority="62" Name="Light Grid Accent 1"/>
<w:LsdException Locked="false" Priority="63" Name="Medium Shading 1 Accent 1"/>
<w:LsdException Locked="false" Priority="64" Name="Medium Shading 2 Accent 1"/>
<w:LsdException Locked="false" Priority="65" Name="Medium List 1 Accent 1"/>
<w:LsdException Locked="false" SemiHidden="true" Name="Revision"/>
<w:LsdException Locked="false" Priority="34" QFormat="true"
Name="List Paragraph"/>
<w:LsdException Locked="false" Priority="29" QFormat="true" Name="Quote"/>
<w:LsdException Locked="false" Priority="30" QFormat="true"
Name="Intense Quote"/>
<w:LsdException Locked="false" Priority="66" Name="Medium List 2 Accent 1"/>
<w:LsdException Locked="false" Priority="67" Name="Medium Grid 1 Accent 1"/>
<w:LsdException Locked="false" Priority="68" Name="Medium Grid 2 Accent 1"/>
<w:LsdException Locked="false" Priority="69" Name="Medium Grid 3 Accent 1"/>
<w:LsdException Locked="false" Priority="70" Name="Dark List Accent 1"/>
<w:LsdException Locked="false" Priority="71" Name="Colorful Shading Accent 1"/>
<w:LsdException Locked="false" Priority="72" Name="Colorful List Accent 1"/>
<w:LsdException Locked="false" Priority="73" Name="Colorful Grid Accent 1"/>
<w:LsdException Locked="false" Priority="60" Name="Light Shading Accent 2"/>
<w:LsdException Locked="false" Priority="61" Name="Light List Accent 2"/>
<w:LsdException Locked="false" Priority="62" Name="Light Grid Accent 2"/>
<w:LsdException Locked="false" Priority="63" Name="Medium Shading 1 Accent 2"/>
<w:LsdException Locked="false" Priority="64" Name="Medium Shading 2 Accent 2"/>
<w:LsdException Locked="false" Priority="65" Name="Medium List 1 Accent 2"/>
<w:LsdException Locked="false" Priority="66" Name="Medium List 2 Accent 2"/>
<w:LsdException Locked="false" Priority="67" Name="Medium Grid 1 Accent 2"/>
<w:LsdException Locked="false" Priority="68" Name="Medium Grid 2 Accent 2"/>
<w:LsdException Locked="false" Priority="69" Name="Medium Grid 3 Accent 2"/>
<w:LsdException Locked="false" Priority="70" Name="Dark List Accent 2"/>
<w:LsdException Locked="false" Priority="71" Name="Colorful Shading Accent 2"/>
<w:LsdException Locked="false" Priority="72" Name="Colorful List Accent 2"/>
<w:LsdException Locked="false" Priority="73" Name="Colorful Grid Accent 2"/>
<w:LsdException Locked="false" Priority="60" Name="Light Shading Accent 3"/>
<w:LsdException Locked="false" Priority="61" Name="Light List Accent 3"/>
<w:LsdException Locked="false" Priority="62" Name="Light Grid Accent 3"/>
<w:LsdException Locked="false" Priority="63" Name="Medium Shading 1 Accent 3"/>
<w:LsdException Locked="false" Priority="64" Name="Medium Shading 2 Accent 3"/>
<w:LsdException Locked="false" Priority="65" Name="Medium List 1 Accent 3"/>
<w:LsdException Locked="false" Priority="66" Name="Medium List 2 Accent 3"/>
<w:LsdException Locked="false" Priority="67" Name="Medium Grid 1 Accent 3"/>
<w:LsdException Locked="false" Priority="68" Name="Medium Grid 2 Accent 3"/>
<w:LsdException Locked="false" Priority="69" Name="Medium Grid 3 Accent 3"/>
<w:LsdException Locked="false" Priority="70" Name="Dark List Accent 3"/>
<w:LsdException Locked="false" Priority="71" Name="Colorful Shading Accent 3"/>
<w:LsdException Locked="false" Priority="72" Name="Colorful List Accent 3"/>
<w:LsdException Locked="false" Priority="73" Name="Colorful Grid Accent 3"/>
<w:LsdException Locked="false" Priority="60" Name="Light Shading Accent 4"/>
<w:LsdException Locked="false" Priority="61" Name="Light List Accent 4"/>
<w:LsdException Locked="false" Priority="62" Name="Light Grid Accent 4"/>
<w:LsdException Locked="false" Priority="63" Name="Medium Shading 1 Accent 4"/>
<w:LsdException Locked="false" Priority="64" Name="Medium Shading 2 Accent 4"/>
<w:LsdException Locked="false" Priority="65" Name="Medium List 1 Accent 4"/>
<w:LsdException Locked="false" Priority="66" Name="Medium List 2 Accent 4"/>
<w:LsdException Locked="false" Priority="67" Name="Medium Grid 1 Accent 4"/>
<w:LsdException Locked="false" Priority="68" Name="Medium Grid 2 Accent 4"/>
<w:LsdException Locked="false" Priority="69" Name="Medium Grid 3 Accent 4"/>
<w:LsdException Locked="false" Priority="70" Name="Dark List Accent 4"/>
<w:LsdException Locked="false" Priority="71" Name="Colorful Shading Accent 4"/>
<w:LsdException Locked="false" Priority="72" Name="Colorful List Accent 4"/>
<w:LsdException Locked="false" Priority="73" Name="Colorful Grid Accent 4"/>
<w:LsdException Locked="false" Priority="60" Name="Light Shading Accent 5"/>
<w:LsdException Locked="false" Priority="61" Name="Light List Accent 5"/>
<w:LsdException Locked="false" Priority="62" Name="Light Grid Accent 5"/>
<w:LsdException Locked="false" Priority="63" Name="Medium Shading 1 Accent 5"/>
<w:LsdException Locked="false" Priority="64" Name="Medium Shading 2 Accent 5"/>
<w:LsdException Locked="false" Priority="65" Name="Medium List 1 Accent 5"/>
<w:LsdException Locked="false" Priority="66" Name="Medium List 2 Accent 5"/>
<w:LsdException Locked="false" Priority="67" Name="Medium Grid 1 Accent 5"/>
<w:LsdException Locked="false" Priority="68" Name="Medium Grid 2 Accent 5"/>
<w:LsdException Locked="false" Priority="69" Name="Medium Grid 3 Accent 5"/>
<w:LsdException Locked="false" Priority="70" Name="Dark List Accent 5"/>
<w:LsdException Locked="false" Priority="71" Name="Colorful Shading Accent 5"/>
<w:LsdException Locked="false" Priority="72" Name="Colorful List Accent 5"/>
<w:LsdException Locked="false" Priority="73" Name="Colorful Grid Accent 5"/>
<w:LsdException Locked="false" Priority="60" Name="Light Shading Accent 6"/>
<w:LsdException Locked="false" Priority="61" Name="Light List Accent 6"/>
<w:LsdException Locked="false" Priority="62" Name="Light Grid Accent 6"/>
<w:LsdException Locked="false" Priority="63" Name="Medium Shading 1 Accent 6"/>
<w:LsdException Locked="false" Priority="64" Name="Medium Shading 2 Accent 6"/>
<w:LsdException Locked="false" Priority="65" Name="Medium List 1 Accent 6"/>
<w:LsdException Locked="false" Priority="66" Name="Medium List 2 Accent 6"/>
<w:LsdException Locked="false" Priority="67" Name="Medium Grid 1 Accent 6"/>
<w:LsdException Locked="false" Priority="68" Name="Medium Grid 2 Accent 6"/>
<w:LsdException Locked="false" Priority="69" Name="Medium Grid 3 Accent 6"/>
<w:LsdException Locked="false" Priority="70" Name="Dark List Accent 6"/>
<w:LsdException Locked="false" Priority="71" Name="Colorful Shading Accent 6"/>
<w:LsdException Locked="false" Priority="72" Name="Colorful List Accent 6"/>
<w:LsdException Locked="false" Priority="73" Name="Colorful Grid Accent 6"/>
<w:LsdException Locked="false" Priority="19" QFormat="true"
Name="Subtle Emphasis"/>
<w:LsdException Locked="false" Priority="21" QFormat="true"
Name="Intense Emphasis"/>
<w:LsdException Locked="false" Priority="31" QFormat="true"
Name="Subtle Reference"/>
<w:LsdException Locked="false" Priority="32" QFormat="true"
Name="Intense Reference"/>
<w:LsdException Locked="false" Priority="33" QFormat="true" Name="Book Title"/>
<w:LsdException Locked="false" Priority="37" SemiHidden="true"
UnhideWhenUsed="true" Name="Bibliography"/>
<w:LsdException Locked="false" Priority="39" SemiHidden="true"
UnhideWhenUsed="true" QFormat="true" Name="TOC Heading"/>
<w:LsdException Locked="false" Priority="41" Name="Plain Table 1"/>
<w:LsdException Locked="false" Priority="42" Name="Plain Table 2"/>
<w:LsdException Locked="false" Priority="43" Name="Plain Table 3"/>
<w:LsdException Locked="false" Priority="44" Name="Plain Table 4"/>
<w:LsdException Locked="false" Priority="45" Name="Plain Table 5"/>
<w:LsdException Locked="false" Priority="40" Name="Grid Table Light"/>
<w:LsdException Locked="false" Priority="46" Name="Grid Table 1 Light"/>
<w:LsdException Locked="false" Priority="47" Name="Grid Table 2"/>
<w:LsdException Locked="false" Priority="48" Name="Grid Table 3"/>
<w:LsdException Locked="false" Priority="49" Name="Grid Table 4"/>
<w:LsdException Locked="false" Priority="50" Name="Grid Table 5 Dark"/>
<w:LsdException Locked="false" Priority="51" Name="Grid Table 6 Colorful"/>
<w:LsdException Locked="false" Priority="52" Name="Grid Table 7 Colorful"/>
<w:LsdException Locked="false" Priority="46"
Name="Grid Table 1 Light Accent 1"/>
<w:LsdException Locked="false" Priority="47" Name="Grid Table 2 Accent 1"/>
<w:LsdException Locked="false" Priority="48" Name="Grid Table 3 Accent 1"/>
<w:LsdException Locked="false" Priority="49" Name="Grid Table 4 Accent 1"/>
<w:LsdException Locked="false" Priority="50" Name="Grid Table 5 Dark Accent 1"/>
<w:LsdException Locked="false" Priority="51"
Name="Grid Table 6 Colorful Accent 1"/>
<w:LsdException Locked="false" Priority="52"
Name="Grid Table 7 Colorful Accent 1"/>
<w:LsdException Locked="false" Priority="46"
Name="Grid Table 1 Light Accent 2"/>
<w:LsdException Locked="false" Priority="47" Name="Grid Table 2 Accent 2"/>
<w:LsdException Locked="false" Priority="48" Name="Grid Table 3 Accent 2"/>
<w:LsdException Locked="false" Priority="49" Name="Grid Table 4 Accent 2"/>
<w:LsdException Locked="false" Priority="50" Name="Grid Table 5 Dark Accent 2"/>
<w:LsdException Locked="false" Priority="51"
Name="Grid Table 6 Colorful Accent 2"/>
<w:LsdException Locked="false" Priority="52"
Name="Grid Table 7 Colorful Accent 2"/>
<w:LsdException Locked="false" Priority="46"
Name="Grid Table 1 Light Accent 3"/>
<w:LsdException Locked="false" Priority="47" Name="Grid Table 2 Accent 3"/>
<w:LsdException Locked="false" Priority="48" Name="Grid Table 3 Accent 3"/>
<w:LsdException Locked="false" Priority="49" Name="Grid Table 4 Accent 3"/>
<w:LsdException Locked="false" Priority="50" Name="Grid Table 5 Dark Accent 3"/>
<w:LsdException Locked="false" Priority="51"
Name="Grid Table 6 Colorful Accent 3"/>
<w:LsdException Locked="false" Priority="52"
Name="Grid Table 7 Colorful Accent 3"/>
<w:LsdException Locked="false" Priority="46"
Name="Grid Table 1 Light Accent 4"/>
<w:LsdException Locked="false" Priority="47" Name="Grid Table 2 Accent 4"/>
<w:LsdException Locked="false" Priority="48" Name="Grid Table 3 Accent 4"/>
<w:LsdException Locked="false" Priority="49" Name="Grid Table 4 Accent 4"/>
<w:LsdException Locked="false" Priority="50" Name="Grid Table 5 Dark Accent 4"/>
<w:LsdException Locked="false" Priority="51"
Name="Grid Table 6 Colorful Accent 4"/>
<w:LsdException Locked="false" Priority="52"
Name="Grid Table 7 Colorful Accent 4"/>
<w:LsdException Locked="false" Priority="46"
Name="Grid Table 1 Light Accent 5"/>
<w:LsdException Locked="false" Priority="47" Name="Grid Table 2 Accent 5"/>
<w:LsdException Locked="false" Priority="48" Name="Grid Table 3 Accent 5"/>
<w:LsdException Locked="false" Priority="49" Name="Grid Table 4 Accent 5"/>
<w:LsdException Locked="false" Priority="50" Name="Grid Table 5 Dark Accent 5"/>
<w:LsdException Locked="false" Priority="51"
Name="Grid Table 6 Colorful Accent 5"/>
<w:LsdException Locked="false" Priority="52"
Name="Grid Table 7 Colorful Accent 5"/>
<w:LsdException Locked="false" Priority="46"
Name="Grid Table 1 Light Accent 6"/>
<w:LsdException Locked="false" Priority="47" Name="Grid Table 2 Accent 6"/>
<w:LsdException Locked="false" Priority="48" Name="Grid Table 3 Accent 6"/>
<w:LsdException Locked="false" Priority="49" Name="Grid Table 4 Accent 6"/>
<w:LsdException Locked="false" Priority="50" Name="Grid Table 5 Dark Accent 6"/>
<w:LsdException Locked="false" Priority="51"
Name="Grid Table 6 Colorful Accent 6"/>
<w:LsdException Locked="false" Priority="52"
Name="Grid Table 7 Colorful Accent 6"/>
<w:LsdException Locked="false" Priority="46" Name="List Table 1 Light"/>
<w:LsdException Locked="false" Priority="47" Name="List Table 2"/>
<w:LsdException Locked="false" Priority="48" Name="List Table 3"/>
<w:LsdException Locked="false" Priority="49" Name="List Table 4"/>
<w:LsdException Locked="false" Priority="50" Name="List Table 5 Dark"/>
<w:LsdException Locked="false" Priority="51" Name="List Table 6 Colorful"/>
<w:LsdException Locked="false" Priority="52" Name="List Table 7 Colorful"/>
<w:LsdException Locked="false" Priority="46"
Name="List Table 1 Light Accent 1"/>
<w:LsdException Locked="false" Priority="47" Name="List Table 2 Accent 1"/>
<w:LsdException Locked="false" Priority="48" Name="List Table 3 Accent 1"/>
<w:LsdException Locked="false" Priority="49" Name="List Table 4 Accent 1"/>
<w:LsdException Locked="false" Priority="50" Name="List Table 5 Dark Accent 1"/>
<w:LsdException Locked="false" Priority="51"
Name="List Table 6 Colorful Accent 1"/>
<w:LsdException Locked="false" Priority="52"
Name="List Table 7 Colorful Accent 1"/>
<w:LsdException Locked="false" Priority="46"
Name="List Table 1 Light Accent 2"/>
<w:LsdException Locked="false" Priority="47" Name="List Table 2 Accent 2"/>
<w:LsdException Locked="false" Priority="48" Name="List Table 3 Accent 2"/>
<w:LsdException Locked="false" Priority="49" Name="List Table 4 Accent 2"/>
<w:LsdException Locked="false" Priority="50" Name="List Table 5 Dark Accent 2"/>
<w:LsdException Locked="false" Priority="51"
Name="List Table 6 Colorful Accent 2"/>
<w:LsdException Locked="false" Priority="52"
Name="List Table 7 Colorful Accent 2"/>
<w:LsdException Locked="false" Priority="46"
Name="List Table 1 Light Accent 3"/>
<w:LsdException Locked="false" Priority="47" Name="List Table 2 Accent 3"/>
<w:LsdException Locked="false" Priority="48" Name="List Table 3 Accent 3"/>
<w:LsdException Locked="false" Priority="49" Name="List Table 4 Accent 3"/>
<w:LsdException Locked="false" Priority="50" Name="List Table 5 Dark Accent 3"/>
<w:LsdException Locked="false" Priority="51"
Name="List Table 6 Colorful Accent 3"/>
<w:LsdException Locked="false" Priority="52"
Name="List Table 7 Colorful Accent 3"/>
<w:LsdException Locked="false" Priority="46"
Name="List Table 1 Light Accent 4"/>
<w:LsdException Locked="false" Priority="47" Name="List Table 2 Accent 4"/>
<w:LsdException Locked="false" Priority="48" Name="List Table 3 Accent 4"/>
<w:LsdException Locked="false" Priority="49" Name="List Table 4 Accent 4"/>
<w:LsdException Locked="false" Priority="50" Name="List Table 5 Dark Accent 4"/>
<w:LsdException Locked="false" Priority="51"
Name="List Table 6 Colorful Accent 4"/>
<w:LsdException Locked="false" Priority="52"
Name="List Table 7 Colorful Accent 4"/>
<w:LsdException Locked="false" Priority="46"
Name="List Table 1 Light Accent 5"/>
<w:LsdException Locked="false" Priority="47" Name="List Table 2 Accent 5"/>
<w:LsdException Locked="false" Priority="48" Name="List Table 3 Accent 5"/>
<w:LsdException Locked="false" Priority="49" Name="List Table 4 Accent 5"/>
<w:LsdException Locked="false" Priority="50" Name="List Table 5 Dark Accent 5"/>
<w:LsdException Locked="false" Priority="51"
Name="List Table 6 Colorful Accent 5"/>
<w:LsdException Locked="false" Priority="52"
Name="List Table 7 Colorful Accent 5"/>
<w:LsdException Locked="false" Priority="46"
Name="List Table 1 Light Accent 6"/>
<w:LsdException Locked="false" Priority="47" Name="List Table 2 Accent 6"/>
<w:LsdException Locked="false" Priority="48" Name="List Table 3 Accent 6"/>
<w:LsdException Locked="false" Priority="49" Name="List Table 4 Accent 6"/>
<w:LsdException Locked="false" Priority="50" Name="List Table 5 Dark Accent 6"/>
<w:LsdException Locked="false" Priority="51"
Name="List Table 6 Colorful Accent 6"/>
<w:LsdException Locked="false" Priority="52"
Name="List Table 7 Colorful Accent 6"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="Mention"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="Smart Hyperlink"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="Hashtag"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="Unresolved Mention"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="Smart Link"/>
</w:LatentStyles>
</xml><![endif]-->
<style>
<!--
/* Font Definitions */
@font-face
{font-family:"Cambria Math";
panose-1:2 4 5 3 5 4 6 3 2 4;
mso-font-charset:0;
mso-generic-font-family:roman;
mso-font-pitch:variable;
mso-font-signature:-536870145 1107305727 0 0 415 0;}
@font-face
{font-family:Calibri;
panose-1:2 15 5 2 2 2 4 3 2 4;
mso-font-charset:0;
mso-generic-font-family:swiss;
mso-font-pitch:variable;
mso-font-signature:-536859905 -1073697537 9 0 511 0;}
/* Style Definitions */
p.MsoNormal, li.MsoNormal, div.MsoNormal
{mso-style-unhide:no;
mso-style-qformat:yes;
mso-style-parent:"";
margin:0cm;
margin-bottom:.0001pt;
mso-pagination:widow-orphan;
font-size:12.0pt;
font-family:"Calibri",sans-serif;
mso-ascii-font-family:Calibri;
mso-ascii-theme-font:minor-latin;
mso-fareast-font-family:Calibri;
mso-fareast-theme-font:minor-latin;
mso-hansi-font-family:Calibri;
mso-hansi-theme-font:minor-latin;
mso-bidi-font-family:"Times New Roman";
mso-bidi-theme-font:minor-bidi;
mso-fareast-language:EN-US;}
.MsoChpDefault
{mso-style-type:export-only;
mso-default-props:yes;
font-family:"Calibri",sans-serif;
mso-ascii-font-family:Calibri;
mso-ascii-theme-font:minor-latin;
mso-fareast-font-family:Calibri;
mso-fareast-theme-font:minor-latin;
mso-hansi-font-family:Calibri;
mso-hansi-theme-font:minor-latin;
mso-bidi-font-family:"Times New Roman";
mso-bidi-theme-font:minor-bidi;
mso-fareast-language:EN-US;}
@page WordSection1
{size:595.0pt 842.0pt;
margin:72.0pt 72.0pt 72.0pt 72.0pt;
mso-header-margin:35.4pt;
mso-footer-margin:35.4pt;
mso-paper-source:0;}
div.WordSection1
{page:WordSection1;}
-->
</style>
<!--[if gte mso 10]>
<style>
/* Style Definitions */
table.MsoNormalTable
{mso-style-name:"Table Normal";
mso-tstyle-rowband-size:0;
mso-tstyle-colband-size:0;
mso-style-noshow:yes;
mso-style-priority:99;
mso-style-parent:"";
mso-padding-alt:0cm 5.4pt 0cm 5.4pt;
mso-para-margin:0cm;
mso-para-margin-bottom:.0001pt;
mso-pagination:widow-orphan;
font-size:12.0pt;
font-family:"Calibri",sans-serif;
mso-ascii-font-family:Calibri;
mso-ascii-theme-font:minor-latin;
mso-hansi-font-family:Calibri;
mso-hansi-theme-font:minor-latin;
mso-bidi-font-family:"Times New Roman";
mso-bidi-theme-font:minor-bidi;
mso-fareast-language:EN-US;}
</style>
<![endif]-->
<!--StartFragment-->
<!--EndFragment--></span></b><br />
<div class="MsoNormal">
<br /></div>
<br />
<div style="background: rgb(248, 249, 250); border: 1pt solid rgb(234, 236, 240); font-family: Georgia, Utopia, "Palatino Linotype", Palatino, serif; padding: 12pt;">
<div class="MsoNormal" style="border: none; line-height: 15.6pt; margin-bottom: 0cm; padding: 0cm;">
<pre><span style="font-size: xx-small;"><span style="color: #a9b7c6; font-family: "menlo";"><pre style="color: #a9b7c6; margin-bottom: 12pt;"><span style="font-size: xx-small;"><span style="color: #cc7832; font-family: "menlo";">package </span><span style="font-family: "menlo";">references</span><span style="color: #cc7832; font-family: "menlo";">;
import </span><span style="font-family: "menlo";">java.lang.ref.PhantomReference;</span><span style="color: #cc7832; font-family: "menlo";">
import </span><span style="font-family: "menlo";">java.lang.ref.Reference;</span><span style="color: #cc7832; font-family: "menlo";">
import </span><span style="font-family: "menlo";">java.lang.ref.ReferenceQueue</span><span style="color: #cc7832; font-family: "menlo";">;
import </span><span style="font-family: "menlo";">java.util.concurrent.CountDownLatch</span><span style="color: #cc7832; font-family: "menlo";">;
import </span><span style="font-family: "menlo";">java.util.concurrent.ExecutorService</span><span style="color: #cc7832; font-family: "menlo";">;
import </span><span style="font-family: "menlo";">java.util.concurrent.Executors</span><span style="color: #cc7832; font-family: "menlo";">;
import static </span><span style="font-family: "menlo";">references.StrongReference.<i>deleteOldDumps</i></span><span style="color: #cc7832; font-family: "menlo";">;
import static </span><span style="font-family: "menlo";">references.StrongReference.<i>runGC</i></span><span style="color: #cc7832; font-family: "menlo";">;</span></span></pre>
<pre style="color: #a9b7c6; margin-bottom: 12pt;"><span style="font-size: xx-small;"><span style="color: #cc7832; font-family: "menlo";">public class </span><span style="font-family: "menlo";">PhantomRefTest {
</span><span style="color: #cc7832; font-family: "menlo";">private volatile static boolean </span><i><span style="color: #9876aa; font-family: "menlo";">finishing </span></i><span style="font-family: "menlo";">= </span><span style="color: #cc7832; font-family: "menlo";">false;
private static final long </span><i><span style="color: #9876aa; font-family: "menlo";">WAIT_TIME_FOR_REMOVING_PHANTOM_REFERENCE_MS </span></i><span style="font-family: "menlo";">= </span><span style="color: #6897bb; font-family: "menlo";">5000L</span><span style="color: #cc7832; font-family: "menlo";">;</span></span></pre>
<pre style="color: #a9b7c6; margin-bottom: 12pt;"><span style="font-size: xx-small;"><span style="color: #cc7832; font-family: "menlo";">
public static void </span><span style="color: #ffc66d; font-family: "menlo";">main</span><span style="font-family: "menlo";">(String[] args) </span><span style="color: #cc7832; font-family: "menlo";">throws </span><span style="font-family: "menlo";">InterruptedException {
<i>deleteOldDumps</i>()</span><span style="color: #cc7832; font-family: "menlo";">;
</span><span style="font-family: "menlo";">PhantomRefTest phantomRefTest = </span><span style="color: #cc7832; font-family: "menlo";">new </span><span style="font-family: "menlo";">PhantomRefTest()</span><span style="color: #cc7832; font-family: "menlo";">;
</span><span style="font-family: "menlo";">A a = phantomRefTest.</span><span style="color: #cc7832; font-family: "menlo";">new </span><span style="font-family: "menlo";">A(</span><span style="color: #6a8759; font-family: "menlo";">"a"</span><span style="font-family: "menlo";">)</span><span style="color: #cc7832; font-family: "menlo";">;
</span><span style="font-family: "menlo";">ReferenceQueue<A> referenceQueue = </span><span style="color: #cc7832; font-family: "menlo";">new </span><span style="font-family: "menlo";">ReferenceQueue<>()</span><span style="color: #cc7832; font-family: "menlo";">;
</span><span style="font-family: "menlo";">String someInfoToUseInCleanUp = </span><span style="color: #6a8759; font-family: "menlo";">"some info"</span><span style="color: #cc7832; font-family: "menlo";">;
</span><span style="font-family: "menlo";">Reference<A> reference = phantomRefTest.</span><span style="color: #cc7832; font-family: "menlo";">new </span><span style="font-family: "menlo";">MyFinalizer(a</span><span style="color: #cc7832; font-family: "menlo";">, </span><span style="font-family: "menlo";">someInfoToUseInCleanUp</span><span style="color: #cc7832; font-family: "menlo";">, </span><span style="font-family: "menlo";">referenceQueue)</span><span style="color: #cc7832; font-family: "menlo";">;
</span><span style="font-family: "menlo";">HeapDump.<i>dumpHeap</i>(</span><span style="color: #6a8759; font-family: "menlo";">"java/heap-dumps/phantomRefBeforeGCEligible.hprof"</span><span style="color: #cc7832; font-family: "menlo";">, false</span><span style="font-family: "menlo";">)</span><span style="color: #cc7832; font-family: "menlo";">;
</span><span style="font-family: "menlo";">a = </span><span style="color: #cc7832; font-family: "menlo";">null;
</span><span style="font-family: "menlo";">System.</span><i><span style="color: #9876aa; font-family: "menlo";">out</span></i><span style="font-family: "menlo";">.println(</span><span style="color: #6a8759; font-family: "menlo";">"Phantom reference always return null: " </span><span style="font-family: "menlo";">+ reference.get())</span><span style="color: #cc7832; font-family: "menlo";">;
</span><span style="font-family: "menlo";">System.</span><i><span style="color: #9876aa; font-family: "menlo";">out</span></i><span style="font-family: "menlo";">.println(</span><span style="color: #6a8759; font-family: "menlo";">"Phantom reference queue return null before GC: " </span><span style="font-family: "menlo";">+ referenceQueue.poll())</span><span style="color: #cc7832; font-family: "menlo";">;
</span><span style="font-family: "menlo";">HeapDump.<i>dumpHeap</i>(</span><span style="color: #6a8759; font-family: "menlo";">"java/heap-dumps/phantomRefBeforeGC.hprof"</span><span style="color: #cc7832; font-family: "menlo";">, false</span><span style="font-family: "menlo";">)</span><span style="color: #cc7832; font-family: "menlo";">;
</span><i><span style="font-family: "menlo";">runGC</span></i><span style="font-family: "menlo";">()</span><span style="color: #cc7832; font-family: "menlo";">;
</span><span style="font-family: "menlo";">HeapDump.<i>dumpHeap</i>(</span><span style="color: #6a8759; font-family: "menlo";">"java/heap-dumps/phantomRefAfterGC.hprof"</span><span style="color: #cc7832; font-family: "menlo";">, false</span><span style="font-family: "menlo";">)</span><span style="color: #cc7832; font-family: "menlo";">;
</span><span style="font-family: "menlo";">CountDownLatch countDownLatch = </span><span style="color: #cc7832; font-family: "menlo";">new </span><span style="font-family: "menlo";">CountDownLatch(</span><span style="color: #6897bb; font-family: "menlo";">1</span><span style="font-family: "menlo";">)</span><span style="color: #cc7832; font-family: "menlo";">;
</span><span style="font-family: "menlo";">Runtime.<i>getRuntime</i>().addShutdownHook(</span><span style="color: #cc7832; font-family: "menlo";">new </span><span style="font-family: "menlo";">Thread(() -> {
System.</span><i><span style="color: #9876aa; font-family: "menlo";">out</span></i><span style="font-family: "menlo";">.println(</span><span style="color: #6a8759; font-family: "menlo";">"Caught shutdown hook, finishing phantom reference monitoring!"</span><span style="font-family: "menlo";">)</span><span style="color: #cc7832; font-family: "menlo";">;
</span><i><span style="color: #9876aa; font-family: "menlo";">finishing </span></i><span style="font-family: "menlo";">= </span><span style="color: #cc7832; font-family: "menlo";">true;
try </span><span style="font-family: "menlo";">{
</span><span style="color: #b389c5; font-family: "menlo";">countDownLatch</span><span style="font-family: "menlo";">.await()</span><span style="color: #cc7832; font-family: "menlo";">;
</span><span style="font-family: "menlo";">HeapDump.<i>dumpHeap</i>(</span><span style="color: #6a8759; font-family: "menlo";">"java/heap-dumps/phantomRefAfterCleanUp.hprof"</span><span style="color: #cc7832; font-family: "menlo";">, false</span><span style="font-family: "menlo";">)</span><span style="color: #cc7832; font-family: "menlo";">;
</span><span style="color: grey; font-family: "menlo";">//if you check internal referent here (by looking with debugger), i
//it will be null as we cleared it.
//If we would not call finalizer.clear() in monitoring thread here we will see the object value.
//Note that after java 9 the referent cleared internally not waiting the
//phantomref object to be cleared.
</span><span style="font-family: "menlo";">System.</span><i><span style="color: #9876aa; font-family: "menlo";">out</span></i><span style="font-family: "menlo";">.println(</span><span style="color: #6a8759; font-family: "menlo";">"Getting internal referent by reflection as reference.get() always null</span></span><span style="color: #6a8759; font-family: "menlo"; font-size: xx-small;">"); </span>
<span style="font-size: xx-small;"><span style="color: #6a8759; font-family: "menlo";"> </span><span style="font-family: "menlo";">Field referentField = Reference.</span><span style="color: #cc7832; font-family: "menlo";">class</span><span style="font-family: "menlo";">.getDeclaredField(</span><span style="color: #6a8759; font-family: "menlo";">"referent"</span><span style="font-family: "menlo";">)</span><span style="color: #cc7832; font-family: "menlo";">;
</span><span style="font-family: "menlo";">referentField.setAccessible(</span><span style="color: #cc7832; font-family: "menlo";">true</span><span style="font-family: "menlo";">)</span><span style="color: #cc7832; font-family: "menlo";">;
</span><span style="font-family: "menlo";">A referent = (A) referentField.get(</span><span style="color: #b389c5; font-family: "menlo";">reference</span><span style="font-family: "menlo";">)</span><span style="color: #cc7832; font-family: "menlo";">;
</span><span style="font-family: "menlo";">System.</span><i><span style="color: #9876aa; font-family: "menlo";">out</span></i><span style="font-family: "menlo";">.println(</span><span style="color: #6a8759; font-family: "menlo";">"Check referent after clean up: " </span><span style="font-family: "menlo";">+ (referent == </span><span style="color: #cc7832; font-family: "menlo";">null </span><span style="font-family: "menlo";">? </span><span style="color: #cc7832; font-family: "menlo";">null </span><span style="font-family: "menlo";">: referent.s))</span><span style="color: #cc7832; font-family: "menlo";">;
</span><span style="font-family: "menlo";">} </span><span style="color: #cc7832; font-family: "menlo";">catch </span><span style="font-family: "menlo";">(InterruptedException | NoSuchFieldException | IllegalAccessException e) {
e.printStackTrace()</span><span style="color: #cc7832; font-family: "menlo";">;
</span><span style="font-family: "menlo";">}
System.</span><i><span style="color: #9876aa; font-family: "menlo";">out</span></i><span style="font-family: "menlo";">.println(</span><span style="color: #6a8759; font-family: "menlo";">"Finished all running threads. Exiting!"</span><span style="font-family: "menlo";">)</span><span style="color: #cc7832; font-family: "menlo";">;
</span><span style="font-family: "menlo";">}))</span><span style="color: #cc7832; font-family: "menlo";">;</span></span></pre>
<pre style="margin-bottom: 12pt;"><span style="color: #a9b7c6; font-size: xx-small;"><span style="color: #cc7832; font-family: "menlo";"> </span></span><span style="font-size: xx-small;"><span style="color: #a9b7c6;">phantomRefTest.monitorPhantomReference(referenceQueue</span><span style="color: #cc7832; font-family: "menlo";">, </span><span style="color: #a9b7c6; font-family: "menlo";">reference</span><span style="color: #cc7832; font-family: "menlo";">, </span><span style="font-family: "menlo";"><span style="color: #a9b7c6;">countDownLatch)</span><span style="color: #cc7832;">;</span></span></span></pre>
<pre style="color: #a9b7c6; margin-bottom: 12pt;"><span style="font-size: xx-small;"><span style="color: #cc7832; font-family: "menlo";"> </span><span style="font-family: "menlo";">}</span></span></pre>
<pre style="color: #a9b7c6; margin-bottom: 12pt;"><span style="font-size: xx-small;"><span style="color: #cc7832; font-family: "menlo";">private void </span><span style="color: #ffc66d; font-family: "menlo";">monitorPhantomReference</span><span style="font-family: "menlo";">(ReferenceQueue<A> referenceQueue</span><span style="color: #cc7832; font-family: "menlo";">, </span><span style="font-family: "menlo";">Reference<A> reference</span><span style="color: #cc7832; font-family: "menlo";">,</span></span></pre>
<pre style="color: #a9b7c6; margin-bottom: 12pt;"><span style="font-size: xx-small;"><span style="color: #cc7832; font-family: "menlo";"> </span><span style="font-family: "menlo";">CountDownLatch latch) {
ExecutorService executorService = </span><span style="color: #cc7832; font-family: "menlo";">null;
try </span><span style="font-family: "menlo";">{
executorService = Executors.<i>newSingleThreadExecutor</i>()</span><span style="color: #cc7832; font-family: "menlo";">;
</span><span style="font-family: "menlo";">Runnable runnable = () -> {
</span><span style="color: #cc7832; font-family: "menlo";">try </span><span style="font-family: "menlo";">{
</span><span style="color: #cc7832; font-family: "menlo";">while </span><span style="font-family: "menlo";">(!</span><i><span style="color: #9876aa; font-family: "menlo";">finishing</span></i><span style="font-family: "menlo";">) {
</span><span style="color: #cc7832; font-family: "menlo";">try </span><span style="font-family: "menlo";">{
System.</span><i><span style="color: #9876aa; font-family: "menlo";">out</span></i><span style="font-family: "menlo";">.println(</span><span style="color: #6a8759; font-family: "menlo";">"Start reading phantom reference from queue!"</span><span style="font-family: "menlo";">)</span><span style="color: #cc7832; font-family: "menlo";">;
</span><span style="font-family: "menlo";">MyFinalizer finalizer = (MyFinalizer) </span><span style="color: #b389c5; font-family: "menlo";">referenceQueue</span><span style="font-family: "menlo";">.
remove(</span><i><span style="color: #9876aa; font-family: "menlo";">WAIT_TIME_FOR_REMOVING_PHANTOM_REFERENCE_MS</span></i><span style="font-family: "menlo";">)</span><span style="color: #cc7832; font-family: "menlo";">;
if </span><span style="font-family: "menlo";">(finalizer != </span><span style="color: #cc7832; font-family: "menlo";">null</span><span style="font-family: "menlo";">) {
System.</span><i><span style="color: #9876aa; font-family: "menlo";">out</span></i><span style="font-family: "menlo";">.println(</span><span style="color: #6a8759; font-family: "menlo";">"We got the phantom referenced object in the queue"</span><span style="font-family: "menlo";">)</span><span style="color: #cc7832; font-family: "menlo";">;
</span><span style="font-family: "menlo";">System.</span><i><span style="color: #9876aa; font-family: "menlo";">out</span></i><span style="font-family: "menlo";">.println(</span><span style="color: #6a8759; font-family: "menlo";">"Reference queue return the same ref object: " </span><span style="font-family: "menlo";">+
(finalizer == </span><span style="color: #b389c5; font-family: "menlo";">reference</span><span style="font-family: "menlo";">))</span><span style="color: #cc7832; font-family: "menlo";">;
</span><span style="font-family: "menlo";">System.</span><i><span style="color: #9876aa; font-family: "menlo";">out</span></i><span style="font-family: "menlo";">.println(</span><span style="color: #6a8759; font-family: "menlo";">"Phantom reference always return null: " </span><span style="font-family: "menlo";">+
finalizer.get())</span><span style="color: #cc7832; font-family: "menlo";">;
</span><span style="font-family: "menlo";">finalizer.cleanUp()</span><span style="color: #cc7832; font-family: "menlo";">;</span></span></pre>
<pre style="color: #a9b7c6; margin-bottom: 12pt;"><span style="font-size: xx-small;"><span style="color: #cc7832; font-family: "menlo";"> </span><span style="color: grey; font-family: "menlo";">//if you do not call this, it will be cleared after phantomref
//object itself cleared. It is cleared automatically after java9</span></span><pre style="margin-bottom: 12pt;"> <span style="font-size: xx-small;">finalizer.clear()<span style="color: #cc7832; font-family: "menlo";">;</span></span></pre>
<span style="font-size: xx-small;"><span style="color: grey; font-family: "menlo";"> </span><span style="font-family: "menlo";">} </span><span style="color: #cc7832; font-family: "menlo";">catch</span><span style="font-family: "menlo";">(IllegalArgumentException e){
e.printStackTrace()</span><span style="color: #cc7832; font-family: "menlo";">;
continue;
</span><span style="font-family: "menlo";">} </span><span style="color: #cc7832; font-family: "menlo";">catch</span><span style="font-family: "menlo";">(InterruptedException e){
</span><span style="color: #cc7832; font-family: "menlo";">continue;
</span><span style="font-family: "menlo";">}
}
System.</span><i><span style="color: #9876aa; font-family: "menlo";">out</span></i><span style="font-family: "menlo";">.println(</span><span style="color: #6a8759; font-family: "menlo";">"Exiting phantom reference monitoring thread!"</span><span style="font-family: "menlo";">)</span><span style="color: #cc7832; font-family: "menlo";">;
</span><span style="font-family: "menlo";">} </span><span style="color: #cc7832; font-family: "menlo";">catch</span><span style="font-family: "menlo";">(Exception e){
e.printStackTrace()</span><span style="color: #cc7832; font-family: "menlo";">;
</span><span style="font-family: "menlo";">} </span><span style="color: #cc7832; font-family: "menlo";">finally</span><span style="font-family: "menlo";">{
System.</span><i><span style="color: #9876aa; font-family: "menlo";">out</span></i><span style="font-family: "menlo";">.println(</span><span style="color: #6a8759; font-family: "menlo";">"Counting down the latch in phantom</span></span></pre>
<pre style="color: #a9b7c6; margin-bottom: 12pt;"><span style="font-size: xx-small;"><span style="color: #6a8759; font-family: "menlo";"> reference monitoring thread!"</span><span style="font-family: "menlo";">)</span><span style="color: #cc7832; font-family: "menlo";">;
</span><span style="color: #b389c5; font-family: "menlo";">latch</span><span style="font-family: "menlo";">.countDown()</span><span style="color: #cc7832; font-family: "menlo";">;
</span><span style="font-family: "menlo";">}
} </span><span style="color: #cc7832; font-family: "menlo";">;
</span><span style="color: #b389c5; font-family: "menlo";">executorService</span><span style="font-family: "menlo";">.submit(</span><span style="color: #b389c5; font-family: "menlo";">runnable</span><span style="font-family: "menlo";">)</span><span style="color: #cc7832; font-family: "menlo";">;
</span><span style="font-family: "menlo";">} </span><span style="color: #cc7832; font-family: "menlo";">catch</span><span style="font-family: "menlo";">(Exception e){
e.printStackTrace()</span><span style="color: #cc7832; font-family: "menlo";">;
</span><span style="font-family: "menlo";">} </span><span style="color: #cc7832; font-family: "menlo";">finally</span><span style="font-family: "menlo";">{
</span><span style="color: #cc7832; font-family: "menlo";">if </span><span style="font-family: "menlo";">(executorService != </span><span style="color: #cc7832; font-family: "menlo";">null</span><span style="font-family: "menlo";">) {
executorService.shutdown()</span><span style="color: #cc7832; font-family: "menlo";">;
</span><span style="font-family: "menlo";">}
}
}
</span><span style="color: #cc7832; font-family: "menlo";">private class </span><span style="font-family: "menlo";">A {
</span><span style="color: #cc7832; font-family: "menlo";">public </span><span style="color: #ffc66d; font-family: "menlo";">A</span><span style="font-family: "menlo";">(String s) {
</span><span style="color: #cc7832; font-family: "menlo";">this</span><span style="font-family: "menlo";">.</span><span style="color: #9876aa; font-family: "menlo";">s </span><span style="font-family: "menlo";">= s</span><span style="color: #cc7832; font-family: "menlo";">;
</span><span style="font-family: "menlo";">}
String </span><span style="color: #9876aa; font-family: "menlo";">s</span><span style="color: #cc7832; font-family: "menlo";">;
</span><span style="font-family: "menlo";">}
</span><i><span style="color: #629755; font-family: "menlo";">/** </span></i></span><i style="font-size: x-small;"><span style="color: #629755; font-family: "menlo";">The object will be phantomly reachable only when you have</span></i></pre>
<pre style="color: #a9b7c6; margin-bottom: 12pt;"><i style="font-size: x-small;"><span style="color: #629755; font-family: "menlo";"> no reference from your app. </span></i><i style="font-size: x-small;"><span style="color: #629755; font-family: "menlo";">*/</span></i></pre>
<pre style="color: #a9b7c6; margin-bottom: 12pt;"><span style="font-size: xx-small;"><i><span style="color: #629755; font-family: "menlo";"> </span></i><span style="color: #cc7832; font-family: "menlo";">private class </span><span style="font-family: "menlo";">MyFinalizer </span><span style="color: #cc7832; font-family: "menlo";">extends </span><span style="font-family: "menlo";">PhantomReference<A> {
String </span><span style="color: #9876aa; font-family: "menlo";">someInfoToUseInCleanUp</span><span style="color: #cc7832; font-family: "menlo";">;</span><i><span style="color: #629755; font-family: "menlo";">
</span></i><span style="color: #cc7832; font-family: "menlo";">public </span><span style="color: #ffc66d; font-family: "menlo";">MyFinalizer</span><span style="font-family: "menlo";">(A referent</span><span style="color: #cc7832; font-family: "menlo";">, </span><span style="font-family: "menlo";">String someInfo</span><span style="color: #cc7832; font-family: "menlo";">, </span><span style="font-family: "menlo";">ReferenceQueue<? </span><span style="color: #cc7832; font-family: "menlo";">super </span><span style="font-family: "menlo";">A> q) {
</span><span style="color: #cc7832; font-family: "menlo";">super</span><span style="font-family: "menlo";">(referent</span><span style="color: #cc7832; font-family: "menlo";">, </span><span style="font-family: "menlo";">q)</span><span style="color: #cc7832; font-family: "menlo";">;
this</span><span style="font-family: "menlo";">.</span><span style="color: #9876aa; font-family: "menlo";">someInfoToUseInCleanUp </span><span style="font-family: "menlo";">= someInfo</span><span style="color: #cc7832; font-family: "menlo";">;
</span><span style="font-family: "menlo";">}
</span><span style="color: #cc7832; font-family: "menlo";">public void </span><span style="color: #ffc66d; font-family: "menlo";">cleanUp</span><span style="font-family: "menlo";">() {
System.</span><i><span style="color: #9876aa; font-family: "menlo";">out</span></i><span style="font-family: "menlo";">.println(</span><span style="color: #6a8759; font-family: "menlo";">"Clean up resources with info " </span><span style="font-family: "menlo";">+ </span><span style="color: #9876aa; font-family: "menlo";">someInfoToUseInCleanUp</span><span style="font-family: "menlo";">)</span><span style="color: #cc7832; font-family: "menlo";">;
</span></span><span style="font-family: "menlo";"><span style="font-size: xx-small;">}
}
}</span>
</span></pre>
</span></span></pre>
</div>
</div>
<br />
<span style="font-family: "times new roman" , serif;"><br /></span>
<span style="font-family: "times new roman" , serif;">The output of the program is;</span><br />
<pre style="background-color: #2b2b2b;"><span style="color: white; font-family: "times new roman" , serif;"><span style="white-space: normal;">Phantom reference always return null: null</span></span>
<span style="color: white; font-family: "times new roman" , serif;"><span style="white-space: normal;">Phantom reference queue return null before GC: null</span></span>
<span style="color: white; font-family: "times new roman" , serif;"><span style="white-space: normal;">Running GC..</span></span>
<span style="color: white; font-family: "times new roman" , serif;"><span style="white-space: normal;">Finished running GC..</span></span>
<span style="color: white; font-family: "times new roman" , serif;"><span style="white-space: normal;">Start reading phantom reference from queue!</span></span>
<span style="color: white; font-family: "times new roman" , serif;"><span style="white-space: normal;">We got the phantom referenced object in the queue</span></span>
<span style="color: white; font-family: "times new roman" , serif;"><span style="white-space: normal;">Reference queue return the same ref object: true</span></span>
<span style="color: white; font-family: "times new roman" , serif;"><span style="white-space: normal;">Phantom reference always return null: null</span></span>
<span style="color: white; font-family: "times new roman" , serif;"><span style="white-space: normal;">Clean up resources with info some info</span></span>
<span style="color: white; font-family: "times new roman" , serif;"><span style="white-space: normal;">Start reading phantom reference from queue!</span></span>
<span style="color: white; font-family: "times new roman" , serif;"><span style="white-space: normal;">Start reading phantom reference from queue!</span></span>
<span style="color: white; font-family: "times new roman" , serif;"><span style="white-space: normal;">Caught shutdown hook, finishing phantom reference monitoring!</span></span>
<span style="color: white; font-family: "times new roman" , serif;"><span style="white-space: normal;">Exiting phantom reference monitoring thread!</span></span>
<span style="color: white; font-family: "times new roman" , serif;"><span style="white-space: normal;">Counting down the latch in phantom reference monitoring thread!</span></span>
<span style="color: white; font-family: "times new roman" , serif;"><span style="white-space: normal;">Getting internal referent by reflection as reference.get() always return null</span></span>
<span style="color: white; font-family: "times new roman" , serif;"><span style="white-space: normal;">Check referent after clean up: null</span></span>
<span style="color: white; font-family: "times new roman" , serif;"><span style="white-space: normal;">Finished all running threads. Exiting!</span></span></pre>
<span style="font-family: "times new roman" , serif;"><br /></span>
<!--[if gte mso 9]><xml>
<o:OfficeDocumentSettings>
<o:AllowPNG/>
</o:OfficeDocumentSettings>
</xml><![endif]-->
<!--[if gte mso 9]><xml>
<w:WordDocument>
<w:View>Normal</w:View>
<w:Zoom>0</w:Zoom>
<w:TrackMoves/>
<w:TrackFormatting/>
<w:PunctuationKerning/>
<w:ValidateAgainstSchemas/>
<w:SaveIfXMLInvalid>false</w:SaveIfXMLInvalid>
<w:IgnoreMixedContent>false</w:IgnoreMixedContent>
<w:AlwaysShowPlaceholderText>false</w:AlwaysShowPlaceholderText>
<w:DoNotPromoteQF/>
<w:LidThemeOther>EN-US</w:LidThemeOther>
<w:LidThemeAsian>X-NONE</w:LidThemeAsian>
<w:LidThemeComplexScript>X-NONE</w:LidThemeComplexScript>
<w:Compatibility>
<w:BreakWrappedTables/>
<w:SnapToGridInCell/>
<w:WrapTextWithPunct/>
<w:UseAsianBreakRules/>
<w:DontGrowAutofit/>
<w:SplitPgBreakAndParaMark/>
<w:EnableOpenTypeKerning/>
<w:DontFlipMirrorIndents/>
<w:OverrideTableStyleHps/>
</w:Compatibility>
<m:mathPr>
<m:mathFont m:val="Cambria Math"/>
<m:brkBin m:val="before"/>
<m:brkBinSub m:val="--"/>
<m:smallFrac m:val="off"/>
<m:dispDef/>
<m:lMargin m:val="0"/>
<m:rMargin m:val="0"/>
<m:defJc m:val="centerGroup"/>
<m:wrapIndent m:val="1440"/>
<m:intLim m:val="subSup"/>
<m:naryLim m:val="undOvr"/>
</m:mathPr></w:WordDocument>
</xml><![endif]--><!--[if gte mso 9]><xml>
<w:LatentStyles DefLockedState="false" DefUnhideWhenUsed="false"
DefSemiHidden="false" DefQFormat="false" DefPriority="99"
LatentStyleCount="376">
<w:LsdException Locked="false" Priority="0" QFormat="true" Name="Normal"/>
<w:LsdException Locked="false" Priority="9" QFormat="true" Name="heading 1"/>
<w:LsdException Locked="false" Priority="9" SemiHidden="true"
UnhideWhenUsed="true" QFormat="true" Name="heading 2"/>
<w:LsdException Locked="false" Priority="9" SemiHidden="true"
UnhideWhenUsed="true" QFormat="true" Name="heading 3"/>
<w:LsdException Locked="false" Priority="9" SemiHidden="true"
UnhideWhenUsed="true" QFormat="true" Name="heading 4"/>
<w:LsdException Locked="false" Priority="9" SemiHidden="true"
UnhideWhenUsed="true" QFormat="true" Name="heading 5"/>
<w:LsdException Locked="false" Priority="9" SemiHidden="true"
UnhideWhenUsed="true" QFormat="true" Name="heading 6"/>
<w:LsdException Locked="false" Priority="9" SemiHidden="true"
UnhideWhenUsed="true" QFormat="true" Name="heading 7"/>
<w:LsdException Locked="false" Priority="9" SemiHidden="true"
UnhideWhenUsed="true" QFormat="true" Name="heading 8"/>
<w:LsdException Locked="false" Priority="9" SemiHidden="true"
UnhideWhenUsed="true" QFormat="true" Name="heading 9"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="index 1"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="index 2"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="index 3"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="index 4"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="index 5"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="index 6"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="index 7"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="index 8"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="index 9"/>
<w:LsdException Locked="false" Priority="39" SemiHidden="true"
UnhideWhenUsed="true" Name="toc 1"/>
<w:LsdException Locked="false" Priority="39" SemiHidden="true"
UnhideWhenUsed="true" Name="toc 2"/>
<w:LsdException Locked="false" Priority="39" SemiHidden="true"
UnhideWhenUsed="true" Name="toc 3"/>
<w:LsdException Locked="false" Priority="39" SemiHidden="true"
UnhideWhenUsed="true" Name="toc 4"/>
<w:LsdException Locked="false" Priority="39" SemiHidden="true"
UnhideWhenUsed="true" Name="toc 5"/>
<w:LsdException Locked="false" Priority="39" SemiHidden="true"
UnhideWhenUsed="true" Name="toc 6"/>
<w:LsdException Locked="false" Priority="39" SemiHidden="true"
UnhideWhenUsed="true" Name="toc 7"/>
<w:LsdException Locked="false" Priority="39" SemiHidden="true"
UnhideWhenUsed="true" Name="toc 8"/>
<w:LsdException Locked="false" Priority="39" SemiHidden="true"
UnhideWhenUsed="true" Name="toc 9"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="Normal Indent"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="footnote text"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="annotation text"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="header"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="footer"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="index heading"/>
<w:LsdException Locked="false" Priority="35" SemiHidden="true"
UnhideWhenUsed="true" QFormat="true" Name="caption"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="table of figures"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="envelope address"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="envelope return"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="footnote reference"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="annotation reference"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="line number"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="page number"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="endnote reference"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="endnote text"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="table of authorities"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="macro"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="toa heading"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="List"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="List Bullet"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="List Number"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="List 2"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="List 3"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="List 4"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="List 5"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="List Bullet 2"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="List Bullet 3"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="List Bullet 4"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="List Bullet 5"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="List Number 2"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="List Number 3"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="List Number 4"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="List Number 5"/>
<w:LsdException Locked="false" Priority="10" QFormat="true" Name="Title"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="Closing"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="Signature"/>
<w:LsdException Locked="false" Priority="1" SemiHidden="true"
UnhideWhenUsed="true" Name="Default Paragraph Font"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="Body Text"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="Body Text Indent"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="List Continue"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="List Continue 2"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="List Continue 3"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="List Continue 4"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="List Continue 5"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="Message Header"/>
<w:LsdException Locked="false" Priority="11" QFormat="true" Name="Subtitle"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="Salutation"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="Date"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="Body Text First Indent"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="Body Text First Indent 2"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="Note Heading"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="Body Text 2"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="Body Text 3"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="Body Text Indent 2"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="Body Text Indent 3"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="Block Text"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="Hyperlink"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="FollowedHyperlink"/>
<w:LsdException Locked="false" Priority="22" QFormat="true" Name="Strong"/>
<w:LsdException Locked="false" Priority="20" QFormat="true" Name="Emphasis"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="Document Map"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="Plain Text"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="E-mail Signature"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="HTML Top of Form"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="HTML Bottom of Form"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="Normal (Web)"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="HTML Acronym"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="HTML Address"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="HTML Cite"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="HTML Code"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="HTML Definition"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="HTML Keyboard"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
QFormat="true" Name="HTML Preformatted"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="HTML Sample"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="HTML Typewriter"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="HTML Variable"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="Normal Table"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="annotation subject"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="No List"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="Outline List 1"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="Outline List 2"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="Outline List 3"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="Table Simple 1"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="Table Simple 2"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="Table Simple 3"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="Table Classic 1"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="Table Classic 2"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="Table Classic 3"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="Table Classic 4"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="Table Colorful 1"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="Table Colorful 2"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="Table Colorful 3"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="Table Columns 1"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="Table Columns 2"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="Table Columns 3"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="Table Columns 4"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="Table Columns 5"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="Table Grid 1"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="Table Grid 2"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="Table Grid 3"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="Table Grid 4"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="Table Grid 5"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="Table Grid 6"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="Table Grid 7"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="Table Grid 8"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="Table List 1"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="Table List 2"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="Table List 3"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="Table List 4"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="Table List 5"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="Table List 6"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="Table List 7"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="Table List 8"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="Table 3D effects 1"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="Table 3D effects 2"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="Table 3D effects 3"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="Table Contemporary"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="Table Elegant"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="Table Professional"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="Table Subtle 1"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="Table Subtle 2"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="Table Web 1"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="Table Web 2"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="Table Web 3"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="Balloon Text"/>
<w:LsdException Locked="false" Priority="39" Name="Table Grid"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="Table Theme"/>
<w:LsdException Locked="false" SemiHidden="true" Name="Placeholder Text"/>
<w:LsdException Locked="false" Priority="1" QFormat="true" Name="No Spacing"/>
<w:LsdException Locked="false" Priority="60" Name="Light Shading"/>
<w:LsdException Locked="false" Priority="61" Name="Light List"/>
<w:LsdException Locked="false" Priority="62" Name="Light Grid"/>
<w:LsdException Locked="false" Priority="63" Name="Medium Shading 1"/>
<w:LsdException Locked="false" Priority="64" Name="Medium Shading 2"/>
<w:LsdException Locked="false" Priority="65" Name="Medium List 1"/>
<w:LsdException Locked="false" Priority="66" Name="Medium List 2"/>
<w:LsdException Locked="false" Priority="67" Name="Medium Grid 1"/>
<w:LsdException Locked="false" Priority="68" Name="Medium Grid 2"/>
<w:LsdException Locked="false" Priority="69" Name="Medium Grid 3"/>
<w:LsdException Locked="false" Priority="70" Name="Dark List"/>
<w:LsdException Locked="false" Priority="71" Name="Colorful Shading"/>
<w:LsdException Locked="false" Priority="72" Name="Colorful List"/>
<w:LsdException Locked="false" Priority="73" Name="Colorful Grid"/>
<w:LsdException Locked="false" Priority="60" Name="Light Shading Accent 1"/>
<w:LsdException Locked="false" Priority="61" Name="Light List Accent 1"/>
<w:LsdException Locked="false" Priority="62" Name="Light Grid Accent 1"/>
<w:LsdException Locked="false" Priority="63" Name="Medium Shading 1 Accent 1"/>
<w:LsdException Locked="false" Priority="64" Name="Medium Shading 2 Accent 1"/>
<w:LsdException Locked="false" Priority="65" Name="Medium List 1 Accent 1"/>
<w:LsdException Locked="false" SemiHidden="true" Name="Revision"/>
<w:LsdException Locked="false" Priority="34" QFormat="true"
Name="List Paragraph"/>
<w:LsdException Locked="false" Priority="29" QFormat="true" Name="Quote"/>
<w:LsdException Locked="false" Priority="30" QFormat="true"
Name="Intense Quote"/>
<w:LsdException Locked="false" Priority="66" Name="Medium List 2 Accent 1"/>
<w:LsdException Locked="false" Priority="67" Name="Medium Grid 1 Accent 1"/>
<w:LsdException Locked="false" Priority="68" Name="Medium Grid 2 Accent 1"/>
<w:LsdException Locked="false" Priority="69" Name="Medium Grid 3 Accent 1"/>
<w:LsdException Locked="false" Priority="70" Name="Dark List Accent 1"/>
<w:LsdException Locked="false" Priority="71" Name="Colorful Shading Accent 1"/>
<w:LsdException Locked="false" Priority="72" Name="Colorful List Accent 1"/>
<w:LsdException Locked="false" Priority="73" Name="Colorful Grid Accent 1"/>
<w:LsdException Locked="false" Priority="60" Name="Light Shading Accent 2"/>
<w:LsdException Locked="false" Priority="61" Name="Light List Accent 2"/>
<w:LsdException Locked="false" Priority="62" Name="Light Grid Accent 2"/>
<w:LsdException Locked="false" Priority="63" Name="Medium Shading 1 Accent 2"/>
<w:LsdException Locked="false" Priority="64" Name="Medium Shading 2 Accent 2"/>
<w:LsdException Locked="false" Priority="65" Name="Medium List 1 Accent 2"/>
<w:LsdException Locked="false" Priority="66" Name="Medium List 2 Accent 2"/>
<w:LsdException Locked="false" Priority="67" Name="Medium Grid 1 Accent 2"/>
<w:LsdException Locked="false" Priority="68" Name="Medium Grid 2 Accent 2"/>
<w:LsdException Locked="false" Priority="69" Name="Medium Grid 3 Accent 2"/>
<w:LsdException Locked="false" Priority="70" Name="Dark List Accent 2"/>
<w:LsdException Locked="false" Priority="71" Name="Colorful Shading Accent 2"/>
<w:LsdException Locked="false" Priority="72" Name="Colorful List Accent 2"/>
<w:LsdException Locked="false" Priority="73" Name="Colorful Grid Accent 2"/>
<w:LsdException Locked="false" Priority="60" Name="Light Shading Accent 3"/>
<w:LsdException Locked="false" Priority="61" Name="Light List Accent 3"/>
<w:LsdException Locked="false" Priority="62" Name="Light Grid Accent 3"/>
<w:LsdException Locked="false" Priority="63" Name="Medium Shading 1 Accent 3"/>
<w:LsdException Locked="false" Priority="64" Name="Medium Shading 2 Accent 3"/>
<w:LsdException Locked="false" Priority="65" Name="Medium List 1 Accent 3"/>
<w:LsdException Locked="false" Priority="66" Name="Medium List 2 Accent 3"/>
<w:LsdException Locked="false" Priority="67" Name="Medium Grid 1 Accent 3"/>
<w:LsdException Locked="false" Priority="68" Name="Medium Grid 2 Accent 3"/>
<w:LsdException Locked="false" Priority="69" Name="Medium Grid 3 Accent 3"/>
<w:LsdException Locked="false" Priority="70" Name="Dark List Accent 3"/>
<w:LsdException Locked="false" Priority="71" Name="Colorful Shading Accent 3"/>
<w:LsdException Locked="false" Priority="72" Name="Colorful List Accent 3"/>
<w:LsdException Locked="false" Priority="73" Name="Colorful Grid Accent 3"/>
<w:LsdException Locked="false" Priority="60" Name="Light Shading Accent 4"/>
<w:LsdException Locked="false" Priority="61" Name="Light List Accent 4"/>
<w:LsdException Locked="false" Priority="62" Name="Light Grid Accent 4"/>
<w:LsdException Locked="false" Priority="63" Name="Medium Shading 1 Accent 4"/>
<w:LsdException Locked="false" Priority="64" Name="Medium Shading 2 Accent 4"/>
<w:LsdException Locked="false" Priority="65" Name="Medium List 1 Accent 4"/>
<w:LsdException Locked="false" Priority="66" Name="Medium List 2 Accent 4"/>
<w:LsdException Locked="false" Priority="67" Name="Medium Grid 1 Accent 4"/>
<w:LsdException Locked="false" Priority="68" Name="Medium Grid 2 Accent 4"/>
<w:LsdException Locked="false" Priority="69" Name="Medium Grid 3 Accent 4"/>
<w:LsdException Locked="false" Priority="70" Name="Dark List Accent 4"/>
<w:LsdException Locked="false" Priority="71" Name="Colorful Shading Accent 4"/>
<w:LsdException Locked="false" Priority="72" Name="Colorful List Accent 4"/>
<w:LsdException Locked="false" Priority="73" Name="Colorful Grid Accent 4"/>
<w:LsdException Locked="false" Priority="60" Name="Light Shading Accent 5"/>
<w:LsdException Locked="false" Priority="61" Name="Light List Accent 5"/>
<w:LsdException Locked="false" Priority="62" Name="Light Grid Accent 5"/>
<w:LsdException Locked="false" Priority="63" Name="Medium Shading 1 Accent 5"/>
<w:LsdException Locked="false" Priority="64" Name="Medium Shading 2 Accent 5"/>
<w:LsdException Locked="false" Priority="65" Name="Medium List 1 Accent 5"/>
<w:LsdException Locked="false" Priority="66" Name="Medium List 2 Accent 5"/>
<w:LsdException Locked="false" Priority="67" Name="Medium Grid 1 Accent 5"/>
<w:LsdException Locked="false" Priority="68" Name="Medium Grid 2 Accent 5"/>
<w:LsdException Locked="false" Priority="69" Name="Medium Grid 3 Accent 5"/>
<w:LsdException Locked="false" Priority="70" Name="Dark List Accent 5"/>
<w:LsdException Locked="false" Priority="71" Name="Colorful Shading Accent 5"/>
<w:LsdException Locked="false" Priority="72" Name="Colorful List Accent 5"/>
<w:LsdException Locked="false" Priority="73" Name="Colorful Grid Accent 5"/>
<w:LsdException Locked="false" Priority="60" Name="Light Shading Accent 6"/>
<w:LsdException Locked="false" Priority="61" Name="Light List Accent 6"/>
<w:LsdException Locked="false" Priority="62" Name="Light Grid Accent 6"/>
<w:LsdException Locked="false" Priority="63" Name="Medium Shading 1 Accent 6"/>
<w:LsdException Locked="false" Priority="64" Name="Medium Shading 2 Accent 6"/>
<w:LsdException Locked="false" Priority="65" Name="Medium List 1 Accent 6"/>
<w:LsdException Locked="false" Priority="66" Name="Medium List 2 Accent 6"/>
<w:LsdException Locked="false" Priority="67" Name="Medium Grid 1 Accent 6"/>
<w:LsdException Locked="false" Priority="68" Name="Medium Grid 2 Accent 6"/>
<w:LsdException Locked="false" Priority="69" Name="Medium Grid 3 Accent 6"/>
<w:LsdException Locked="false" Priority="70" Name="Dark List Accent 6"/>
<w:LsdException Locked="false" Priority="71" Name="Colorful Shading Accent 6"/>
<w:LsdException Locked="false" Priority="72" Name="Colorful List Accent 6"/>
<w:LsdException Locked="false" Priority="73" Name="Colorful Grid Accent 6"/>
<w:LsdException Locked="false" Priority="19" QFormat="true"
Name="Subtle Emphasis"/>
<w:LsdException Locked="false" Priority="21" QFormat="true"
Name="Intense Emphasis"/>
<w:LsdException Locked="false" Priority="31" QFormat="true"
Name="Subtle Reference"/>
<w:LsdException Locked="false" Priority="32" QFormat="true"
Name="Intense Reference"/>
<w:LsdException Locked="false" Priority="33" QFormat="true" Name="Book Title"/>
<w:LsdException Locked="false" Priority="37" SemiHidden="true"
UnhideWhenUsed="true" Name="Bibliography"/>
<w:LsdException Locked="false" Priority="39" SemiHidden="true"
UnhideWhenUsed="true" QFormat="true" Name="TOC Heading"/>
<w:LsdException Locked="false" Priority="41" Name="Plain Table 1"/>
<w:LsdException Locked="false" Priority="42" Name="Plain Table 2"/>
<w:LsdException Locked="false" Priority="43" Name="Plain Table 3"/>
<w:LsdException Locked="false" Priority="44" Name="Plain Table 4"/>
<w:LsdException Locked="false" Priority="45" Name="Plain Table 5"/>
<w:LsdException Locked="false" Priority="40" Name="Grid Table Light"/>
<w:LsdException Locked="false" Priority="46" Name="Grid Table 1 Light"/>
<w:LsdException Locked="false" Priority="47" Name="Grid Table 2"/>
<w:LsdException Locked="false" Priority="48" Name="Grid Table 3"/>
<w:LsdException Locked="false" Priority="49" Name="Grid Table 4"/>
<w:LsdException Locked="false" Priority="50" Name="Grid Table 5 Dark"/>
<w:LsdException Locked="false" Priority="51" Name="Grid Table 6 Colorful"/>
<w:LsdException Locked="false" Priority="52" Name="Grid Table 7 Colorful"/>
<w:LsdException Locked="false" Priority="46"
Name="Grid Table 1 Light Accent 1"/>
<w:LsdException Locked="false" Priority="47" Name="Grid Table 2 Accent 1"/>
<w:LsdException Locked="false" Priority="48" Name="Grid Table 3 Accent 1"/>
<w:LsdException Locked="false" Priority="49" Name="Grid Table 4 Accent 1"/>
<w:LsdException Locked="false" Priority="50" Name="Grid Table 5 Dark Accent 1"/>
<w:LsdException Locked="false" Priority="51"
Name="Grid Table 6 Colorful Accent 1"/>
<w:LsdException Locked="false" Priority="52"
Name="Grid Table 7 Colorful Accent 1"/>
<w:LsdException Locked="false" Priority="46"
Name="Grid Table 1 Light Accent 2"/>
<w:LsdException Locked="false" Priority="47" Name="Grid Table 2 Accent 2"/>
<w:LsdException Locked="false" Priority="48" Name="Grid Table 3 Accent 2"/>
<w:LsdException Locked="false" Priority="49" Name="Grid Table 4 Accent 2"/>
<w:LsdException Locked="false" Priority="50" Name="Grid Table 5 Dark Accent 2"/>
<w:LsdException Locked="false" Priority="51"
Name="Grid Table 6 Colorful Accent 2"/>
<w:LsdException Locked="false" Priority="52"
Name="Grid Table 7 Colorful Accent 2"/>
<w:LsdException Locked="false" Priority="46"
Name="Grid Table 1 Light Accent 3"/>
<w:LsdException Locked="false" Priority="47" Name="Grid Table 2 Accent 3"/>
<w:LsdException Locked="false" Priority="48" Name="Grid Table 3 Accent 3"/>
<w:LsdException Locked="false" Priority="49" Name="Grid Table 4 Accent 3"/>
<w:LsdException Locked="false" Priority="50" Name="Grid Table 5 Dark Accent 3"/>
<w:LsdException Locked="false" Priority="51"
Name="Grid Table 6 Colorful Accent 3"/>
<w:LsdException Locked="false" Priority="52"
Name="Grid Table 7 Colorful Accent 3"/>
<w:LsdException Locked="false" Priority="46"
Name="Grid Table 1 Light Accent 4"/>
<w:LsdException Locked="false" Priority="47" Name="Grid Table 2 Accent 4"/>
<w:LsdException Locked="false" Priority="48" Name="Grid Table 3 Accent 4"/>
<w:LsdException Locked="false" Priority="49" Name="Grid Table 4 Accent 4"/>
<w:LsdException Locked="false" Priority="50" Name="Grid Table 5 Dark Accent 4"/>
<w:LsdException Locked="false" Priority="51"
Name="Grid Table 6 Colorful Accent 4"/>
<w:LsdException Locked="false" Priority="52"
Name="Grid Table 7 Colorful Accent 4"/>
<w:LsdException Locked="false" Priority="46"
Name="Grid Table 1 Light Accent 5"/>
<w:LsdException Locked="false" Priority="47" Name="Grid Table 2 Accent 5"/>
<w:LsdException Locked="false" Priority="48" Name="Grid Table 3 Accent 5"/>
<w:LsdException Locked="false" Priority="49" Name="Grid Table 4 Accent 5"/>
<w:LsdException Locked="false" Priority="50" Name="Grid Table 5 Dark Accent 5"/>
<w:LsdException Locked="false" Priority="51"
Name="Grid Table 6 Colorful Accent 5"/>
<w:LsdException Locked="false" Priority="52"
Name="Grid Table 7 Colorful Accent 5"/>
<w:LsdException Locked="false" Priority="46"
Name="Grid Table 1 Light Accent 6"/>
<w:LsdException Locked="false" Priority="47" Name="Grid Table 2 Accent 6"/>
<w:LsdException Locked="false" Priority="48" Name="Grid Table 3 Accent 6"/>
<w:LsdException Locked="false" Priority="49" Name="Grid Table 4 Accent 6"/>
<w:LsdException Locked="false" Priority="50" Name="Grid Table 5 Dark Accent 6"/>
<w:LsdException Locked="false" Priority="51"
Name="Grid Table 6 Colorful Accent 6"/>
<w:LsdException Locked="false" Priority="52"
Name="Grid Table 7 Colorful Accent 6"/>
<w:LsdException Locked="false" Priority="46" Name="List Table 1 Light"/>
<w:LsdException Locked="false" Priority="47" Name="List Table 2"/>
<w:LsdException Locked="false" Priority="48" Name="List Table 3"/>
<w:LsdException Locked="false" Priority="49" Name="List Table 4"/>
<w:LsdException Locked="false" Priority="50" Name="List Table 5 Dark"/>
<w:LsdException Locked="false" Priority="51" Name="List Table 6 Colorful"/>
<w:LsdException Locked="false" Priority="52" Name="List Table 7 Colorful"/>
<w:LsdException Locked="false" Priority="46"
Name="List Table 1 Light Accent 1"/>
<w:LsdException Locked="false" Priority="47" Name="List Table 2 Accent 1"/>
<w:LsdException Locked="false" Priority="48" Name="List Table 3 Accent 1"/>
<w:LsdException Locked="false" Priority="49" Name="List Table 4 Accent 1"/>
<w:LsdException Locked="false" Priority="50" Name="List Table 5 Dark Accent 1"/>
<w:LsdException Locked="false" Priority="51"
Name="List Table 6 Colorful Accent 1"/>
<w:LsdException Locked="false" Priority="52"
Name="List Table 7 Colorful Accent 1"/>
<w:LsdException Locked="false" Priority="46"
Name="List Table 1 Light Accent 2"/>
<w:LsdException Locked="false" Priority="47" Name="List Table 2 Accent 2"/>
<w:LsdException Locked="false" Priority="48" Name="List Table 3 Accent 2"/>
<w:LsdException Locked="false" Priority="49" Name="List Table 4 Accent 2"/>
<w:LsdException Locked="false" Priority="50" Name="List Table 5 Dark Accent 2"/>
<w:LsdException Locked="false" Priority="51"
Name="List Table 6 Colorful Accent 2"/>
<w:LsdException Locked="false" Priority="52"
Name="List Table 7 Colorful Accent 2"/>
<w:LsdException Locked="false" Priority="46"
Name="List Table 1 Light Accent 3"/>
<w:LsdException Locked="false" Priority="47" Name="List Table 2 Accent 3"/>
<w:LsdException Locked="false" Priority="48" Name="List Table 3 Accent 3"/>
<w:LsdException Locked="false" Priority="49" Name="List Table 4 Accent 3"/>
<w:LsdException Locked="false" Priority="50" Name="List Table 5 Dark Accent 3"/>
<w:LsdException Locked="false" Priority="51"
Name="List Table 6 Colorful Accent 3"/>
<w:LsdException Locked="false" Priority="52"
Name="List Table 7 Colorful Accent 3"/>
<w:LsdException Locked="false" Priority="46"
Name="List Table 1 Light Accent 4"/>
<w:LsdException Locked="false" Priority="47" Name="List Table 2 Accent 4"/>
<w:LsdException Locked="false" Priority="48" Name="List Table 3 Accent 4"/>
<w:LsdException Locked="false" Priority="49" Name="List Table 4 Accent 4"/>
<w:LsdException Locked="false" Priority="50" Name="List Table 5 Dark Accent 4"/>
<w:LsdException Locked="false" Priority="51"
Name="List Table 6 Colorful Accent 4"/>
<w:LsdException Locked="false" Priority="52"
Name="List Table 7 Colorful Accent 4"/>
<w:LsdException Locked="false" Priority="46"
Name="List Table 1 Light Accent 5"/>
<w:LsdException Locked="false" Priority="47" Name="List Table 2 Accent 5"/>
<w:LsdException Locked="false" Priority="48" Name="List Table 3 Accent 5"/>
<w:LsdException Locked="false" Priority="49" Name="List Table 4 Accent 5"/>
<w:LsdException Locked="false" Priority="50" Name="List Table 5 Dark Accent 5"/>
<w:LsdException Locked="false" Priority="51"
Name="List Table 6 Colorful Accent 5"/>
<w:LsdException Locked="false" Priority="52"
Name="List Table 7 Colorful Accent 5"/>
<w:LsdException Locked="false" Priority="46"
Name="List Table 1 Light Accent 6"/>
<w:LsdException Locked="false" Priority="47" Name="List Table 2 Accent 6"/>
<w:LsdException Locked="false" Priority="48" Name="List Table 3 Accent 6"/>
<w:LsdException Locked="false" Priority="49" Name="List Table 4 Accent 6"/>
<w:LsdException Locked="false" Priority="50" Name="List Table 5 Dark Accent 6"/>
<w:LsdException Locked="false" Priority="51"
Name="List Table 6 Colorful Accent 6"/>
<w:LsdException Locked="false" Priority="52"
Name="List Table 7 Colorful Accent 6"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="Mention"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="Smart Hyperlink"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="Hashtag"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="Unresolved Mention"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="Smart Link"/>
</w:LatentStyles>
</xml><![endif]-->
<style>
<!--
/* Font Definitions */
@font-face
{font-family:"Cambria Math";
panose-1:2 4 5 3 5 4 6 3 2 4;
mso-font-charset:0;
mso-generic-font-family:roman;
mso-font-pitch:variable;
mso-font-signature:-536870145 1107305727 0 0 415 0;}
@font-face
{font-family:Calibri;
panose-1:2 15 5 2 2 2 4 3 2 4;
mso-font-charset:0;
mso-generic-font-family:swiss;
mso-font-pitch:variable;
mso-font-signature:-536859905 -1073697537 9 0 511 0;}
/* Style Definitions */
p.MsoNormal, li.MsoNormal, div.MsoNormal
{mso-style-unhide:no;
mso-style-qformat:yes;
mso-style-parent:"";
margin:0cm;
margin-bottom:.0001pt;
mso-pagination:widow-orphan;
font-size:12.0pt;
font-family:"Calibri",sans-serif;
mso-ascii-font-family:Calibri;
mso-ascii-theme-font:minor-latin;
mso-fareast-font-family:Calibri;
mso-fareast-theme-font:minor-latin;
mso-hansi-font-family:Calibri;
mso-hansi-theme-font:minor-latin;
mso-bidi-font-family:"Times New Roman";
mso-bidi-theme-font:minor-bidi;
mso-fareast-language:EN-US;}
p
{mso-style-priority:99;
mso-margin-top-alt:auto;
margin-right:0cm;
mso-margin-bottom-alt:auto;
margin-left:0cm;
mso-pagination:widow-orphan;
font-size:12.0pt;
font-family:"Times New Roman",serif;
mso-fareast-font-family:"Times New Roman";}
.MsoChpDefault
{mso-style-type:export-only;
mso-default-props:yes;
font-family:"Calibri",sans-serif;
mso-ascii-font-family:Calibri;
mso-ascii-theme-font:minor-latin;
mso-fareast-font-family:Calibri;
mso-fareast-theme-font:minor-latin;
mso-hansi-font-family:Calibri;
mso-hansi-theme-font:minor-latin;
mso-bidi-font-family:"Times New Roman";
mso-bidi-theme-font:minor-bidi;
mso-fareast-language:EN-US;}
@page WordSection1
{size:595.0pt 842.0pt;
margin:72.0pt 72.0pt 72.0pt 72.0pt;
mso-header-margin:35.4pt;
mso-footer-margin:35.4pt;
mso-paper-source:0;}
div.WordSection1
{page:WordSection1;}
-->
</style>
<!--[if gte mso 10]>
<style>
/* Style Definitions */
table.MsoNormalTable
{mso-style-name:"Table Normal";
mso-tstyle-rowband-size:0;
mso-tstyle-colband-size:0;
mso-style-noshow:yes;
mso-style-priority:99;
mso-style-parent:"";
mso-padding-alt:0cm 5.4pt 0cm 5.4pt;
mso-para-margin:0cm;
mso-para-margin-bottom:.0001pt;
mso-pagination:widow-orphan;
font-size:12.0pt;
font-family:"Calibri",sans-serif;
mso-ascii-font-family:Calibri;
mso-ascii-theme-font:minor-latin;
mso-hansi-font-family:Calibri;
mso-hansi-theme-font:minor-latin;
mso-bidi-font-family:"Times New Roman";
mso-bidi-theme-font:minor-bidi;
mso-fareast-language:EN-US;}
</style>
<![endif]-->
<!--StartFragment-->
<br />
<div style="margin-bottom: 0.0001pt; margin-top: 0cm;">
<span style="font-size: small;">Note that we run the program from command line and exit with
ctrl+c when the monitoring thread is running inside the loop. And we see that
the shutdown thread set finishing to true and waits the monitoring thread to
exit so that no code interrupted but finished as it should finish.<o:p></o:p></span></div>
<div style="margin-bottom: 0.0001pt; margin-top: 0cm;">
<br /></div>
<div style="margin-bottom: 0.0001pt; margin-top: 0cm;">
<span style="font-size: small;">The web interface of jhat we
will see the below 5 results for 5 different hprof files.<o:p></o:p></span></div>
<!--EndFragment--><br />
<div class="MsoNormal">
<br /></div>
<table align="center" border="1"><tbody>
<tr><th><a href="http://localhost:8000/histo/class">Class</a><br />
<a href="http://localhost:8000/class/0x7156b1ef8" style="font-weight: 400; text-align: start;">class references.PhantomReference$A</a></th><th><a href="http://localhost:8000/histo/count">Instance Count</a><br />
1</th><th><a href="http://localhost:8000/histo/size">Total Size</a><br />
16</th></tr>
</tbody></table>
phantomRefBeforeGCEligible.hprof(localhost:8000/histo/)<br />
<div>
<br />
<div>
<table align="center" border="1"><tbody>
<tr><th><a href="http://localhost:8000/histo/class">Class</a><br />
<a href="http://localhost:8000/class/0x7156b1ef8" style="font-weight: 400; text-align: start;">class references.PhantomReference$A</a></th><th><a href="http://localhost:8000/histo/count">Instance Count</a><br />
1</th><th><a href="http://localhost:8000/histo/size">Total Size</a><br />
16</th></tr>
</tbody></table>
phantomRefBeforeGC.hprof(localhost:8001/histo/)</div>
<div>
<br /></div>
<div>
<table align="center" border="1"><tbody>
<tr><th><a href="http://localhost:8000/histo/class">Class</a><br />
<a href="http://localhost:8000/class/0x7156b1ef8" style="font-weight: 400; text-align: start;">class references.PhantomReference$A</a></th><th><a href="http://localhost:8000/histo/count">Instance Count</a><br />
1</th><th><a href="http://localhost:8000/histo/size">Total Size</a><br />
16</th></tr>
</tbody></table>
phantomRefAfterGC.hprof(localhost:8002/histo/)<br />
<table align="center" border="1"><tbody>
<tr><th><a href="http://localhost:8000/histo/class">Class</a><br />
<a href="http://localhost:8000/class/0x7156b1ef8" style="font-weight: 400; text-align: start;">class references.PhantomReference$A</a></th><th><a href="http://localhost:8000/histo/count">Instance Count</a><br />
0</th><th><a href="http://localhost:8000/histo/size">Total Size</a><br />
0</th></tr>
</tbody></table>
phantomRefAfterCleanUp.hprof(localhost:8003/histo/)<br />
<table align="center" border="1"><tbody>
<tr><th><a href="http://localhost:8000/histo/class">Class</a><br />
<a href="http://localhost:8000/class/0x7156b1ef8" style="font-weight: 400; text-align: start;">class references.PhantomReference$A</a></th><th><a href="http://localhost:8000/histo/count">Instance Count</a><br />
1</th><th><a href="http://localhost:8000/histo/size">Total Size</a><br />
16</th></tr>
</tbody></table>
phantomRefAfterCleanUp.hprof(localhost:8004/histo/)<br />
(for the case reference.clear() method not called)<br />
<br />
<div style="margin-bottom: .0001pt; margin: 0cm;">
<span style="color: black;"><span style="font-size: small;">Note that we have a total size greater than the previous examples
(16 bytes whils it was 8). This is because we used a non-static inner class
which has reference to the outer class. For more information about object
retained spaces you can check <a href="http://www.aligelenler.com/2015/01/actual-memory-consumption-of-java.html" target="_blank">this</a> post.<o:p></o:p></span></span></div>
<div style="-webkit-text-stroke-width: 0px; font-variant-caps: normal; font-variant-ligatures: normal; margin-bottom: .0001pt; margin: 0cm; orphans: 2; text-align: start; text-decoration-color: initial; text-decoration-style: initial; widows: 2; word-spacing: 0px;">
<br /></div>
<div style="-webkit-text-stroke-width: 0px; font-variant-caps: normal; font-variant-ligatures: normal; margin-bottom: .0001pt; margin: 0cm; orphans: 2; text-align: start; text-decoration-color: initial; text-decoration-style: initial; widows: 2; word-spacing: 0px;">
<span style="color: black;"><span style="font-size: small;">From jhat result we see that
instance is still occupy space even after GC run. Because the first GC makes
the referent phantom reachable and let you do cleanup operation by getting the
reference from the queue. After cleaning up the reference by reference.clear
method, if we run GC we will see that the object is really cleaned up from
memory.<o:p></o:p></span></span></div>
<div style="-webkit-text-stroke-width: 0px; font-variant-caps: normal; font-variant-ligatures: normal; margin-bottom: .0001pt; margin: 0cm; orphans: 2; text-align: start; text-decoration-color: initial; text-decoration-style: initial; widows: 2; word-spacing: 0px;">
<br /></div>
<div style="-webkit-text-stroke-width: 0px; font-variant-caps: normal; font-variant-ligatures: normal; margin-bottom: .0001pt; margin: 0cm; orphans: 2; text-align: start; text-decoration-color: initial; text-decoration-style: initial; widows: 2; word-spacing: 0px;">
<span style="color: black;"><span style="font-size: small;">If we run the same class with
jdk11, we will see that the object is already cleared when we get the reference
from reference queue (without calling the reference.clear() method). We can now
see the contents of hprof file using visualVM as jhat is removed starting with
jdk9. If we look at the result of phantomRefAfterGC.hprof, wee see that the
referent is cleared even though clear method not called explicitly unlike the
results of jdk8.<o:p></o:p></span></span></div>
<div style="-webkit-text-stroke-width: 0px; font-variant-caps: normal; font-variant-ligatures: normal; margin-bottom: .0001pt; margin: 0cm; orphans: 2; text-align: start; text-decoration-color: initial; text-decoration-style: initial; widows: 2; word-spacing: 0px;">
<br /></div>
<div style="-webkit-text-stroke-width: 0px; font-variant-caps: normal; font-variant-ligatures: normal; margin-bottom: .0001pt; margin: 0cm; orphans: 2; text-align: start; text-decoration-color: initial; text-decoration-style: initial; widows: 2; word-spacing: 0px;">
<span style="color: black;"><span style="font-size: small;">This tells us </span></span>that with jdk version greater than 8 we might now
use the phantom reference even for loading a large object when we can get the
previous object reference as at that time it is removed from memory. But be
sure checking the memory snapshot for your environment to be sure the object is
really removed.</div>
<!--[if gte mso 9]><xml>
<o:OfficeDocumentSettings>
<o:AllowPNG/>
</o:OfficeDocumentSettings>
</xml><![endif]-->
<!--[if gte mso 9]><xml>
<w:WordDocument>
<w:View>Normal</w:View>
<w:Zoom>0</w:Zoom>
<w:TrackMoves/>
<w:TrackFormatting/>
<w:PunctuationKerning/>
<w:ValidateAgainstSchemas/>
<w:SaveIfXMLInvalid>false</w:SaveIfXMLInvalid>
<w:IgnoreMixedContent>false</w:IgnoreMixedContent>
<w:AlwaysShowPlaceholderText>false</w:AlwaysShowPlaceholderText>
<w:DoNotPromoteQF/>
<w:LidThemeOther>EN-US</w:LidThemeOther>
<w:LidThemeAsian>X-NONE</w:LidThemeAsian>
<w:LidThemeComplexScript>X-NONE</w:LidThemeComplexScript>
<w:Compatibility>
<w:BreakWrappedTables/>
<w:SnapToGridInCell/>
<w:WrapTextWithPunct/>
<w:UseAsianBreakRules/>
<w:DontGrowAutofit/>
<w:SplitPgBreakAndParaMark/>
<w:EnableOpenTypeKerning/>
<w:DontFlipMirrorIndents/>
<w:OverrideTableStyleHps/>
</w:Compatibility>
<m:mathPr>
<m:mathFont m:val="Cambria Math"/>
<m:brkBin m:val="before"/>
<m:brkBinSub m:val="--"/>
<m:smallFrac m:val="off"/>
<m:dispDef/>
<m:lMargin m:val="0"/>
<m:rMargin m:val="0"/>
<m:defJc m:val="centerGroup"/>
<m:wrapIndent m:val="1440"/>
<m:intLim m:val="subSup"/>
<m:naryLim m:val="undOvr"/>
</m:mathPr></w:WordDocument>
</xml><![endif]--><!--[if gte mso 9]><xml>
<w:LatentStyles DefLockedState="false" DefUnhideWhenUsed="false"
DefSemiHidden="false" DefQFormat="false" DefPriority="99"
LatentStyleCount="376">
<w:LsdException Locked="false" Priority="0" QFormat="true" Name="Normal"/>
<w:LsdException Locked="false" Priority="9" QFormat="true" Name="heading 1"/>
<w:LsdException Locked="false" Priority="9" SemiHidden="true"
UnhideWhenUsed="true" QFormat="true" Name="heading 2"/>
<w:LsdException Locked="false" Priority="9" SemiHidden="true"
UnhideWhenUsed="true" QFormat="true" Name="heading 3"/>
<w:LsdException Locked="false" Priority="9" SemiHidden="true"
UnhideWhenUsed="true" QFormat="true" Name="heading 4"/>
<w:LsdException Locked="false" Priority="9" SemiHidden="true"
UnhideWhenUsed="true" QFormat="true" Name="heading 5"/>
<w:LsdException Locked="false" Priority="9" SemiHidden="true"
UnhideWhenUsed="true" QFormat="true" Name="heading 6"/>
<w:LsdException Locked="false" Priority="9" SemiHidden="true"
UnhideWhenUsed="true" QFormat="true" Name="heading 7"/>
<w:LsdException Locked="false" Priority="9" SemiHidden="true"
UnhideWhenUsed="true" QFormat="true" Name="heading 8"/>
<w:LsdException Locked="false" Priority="9" SemiHidden="true"
UnhideWhenUsed="true" QFormat="true" Name="heading 9"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="index 1"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="index 2"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="index 3"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="index 4"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="index 5"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="index 6"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="index 7"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="index 8"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="index 9"/>
<w:LsdException Locked="false" Priority="39" SemiHidden="true"
UnhideWhenUsed="true" Name="toc 1"/>
<w:LsdException Locked="false" Priority="39" SemiHidden="true"
UnhideWhenUsed="true" Name="toc 2"/>
<w:LsdException Locked="false" Priority="39" SemiHidden="true"
UnhideWhenUsed="true" Name="toc 3"/>
<w:LsdException Locked="false" Priority="39" SemiHidden="true"
UnhideWhenUsed="true" Name="toc 4"/>
<w:LsdException Locked="false" Priority="39" SemiHidden="true"
UnhideWhenUsed="true" Name="toc 5"/>
<w:LsdException Locked="false" Priority="39" SemiHidden="true"
UnhideWhenUsed="true" Name="toc 6"/>
<w:LsdException Locked="false" Priority="39" SemiHidden="true"
UnhideWhenUsed="true" Name="toc 7"/>
<w:LsdException Locked="false" Priority="39" SemiHidden="true"
UnhideWhenUsed="true" Name="toc 8"/>
<w:LsdException Locked="false" Priority="39" SemiHidden="true"
UnhideWhenUsed="true" Name="toc 9"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="Normal Indent"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="footnote text"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="annotation text"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="header"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="footer"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="index heading"/>
<w:LsdException Locked="false" Priority="35" SemiHidden="true"
UnhideWhenUsed="true" QFormat="true" Name="caption"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="table of figures"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="envelope address"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="envelope return"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="footnote reference"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="annotation reference"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="line number"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="page number"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="endnote reference"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="endnote text"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="table of authorities"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="macro"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="toa heading"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="List"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="List Bullet"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="List Number"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="List 2"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="List 3"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="List 4"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="List 5"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="List Bullet 2"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="List Bullet 3"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="List Bullet 4"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="List Bullet 5"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="List Number 2"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="List Number 3"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="List Number 4"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="List Number 5"/>
<w:LsdException Locked="false" Priority="10" QFormat="true" Name="Title"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="Closing"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="Signature"/>
<w:LsdException Locked="false" Priority="1" SemiHidden="true"
UnhideWhenUsed="true" Name="Default Paragraph Font"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="Body Text"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="Body Text Indent"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="List Continue"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="List Continue 2"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="List Continue 3"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="List Continue 4"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="List Continue 5"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="Message Header"/>
<w:LsdException Locked="false" Priority="11" QFormat="true" Name="Subtitle"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="Salutation"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="Date"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="Body Text First Indent"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="Body Text First Indent 2"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="Note Heading"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="Body Text 2"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="Body Text 3"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="Body Text Indent 2"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="Body Text Indent 3"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="Block Text"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="Hyperlink"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="FollowedHyperlink"/>
<w:LsdException Locked="false" Priority="22" QFormat="true" Name="Strong"/>
<w:LsdException Locked="false" Priority="20" QFormat="true" Name="Emphasis"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="Document Map"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="Plain Text"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="E-mail Signature"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="HTML Top of Form"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="HTML Bottom of Form"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="Normal (Web)"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="HTML Acronym"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="HTML Address"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="HTML Cite"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="HTML Code"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="HTML Definition"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="HTML Keyboard"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
QFormat="true" Name="HTML Preformatted"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="HTML Sample"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="HTML Typewriter"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="HTML Variable"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="Normal Table"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="annotation subject"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="No List"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="Outline List 1"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="Outline List 2"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="Outline List 3"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="Table Simple 1"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="Table Simple 2"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="Table Simple 3"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="Table Classic 1"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="Table Classic 2"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="Table Classic 3"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="Table Classic 4"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="Table Colorful 1"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="Table Colorful 2"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="Table Colorful 3"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="Table Columns 1"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="Table Columns 2"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="Table Columns 3"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="Table Columns 4"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="Table Columns 5"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="Table Grid 1"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="Table Grid 2"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="Table Grid 3"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="Table Grid 4"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="Table Grid 5"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="Table Grid 6"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="Table Grid 7"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="Table Grid 8"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="Table List 1"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="Table List 2"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="Table List 3"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="Table List 4"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="Table List 5"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="Table List 6"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="Table List 7"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="Table List 8"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="Table 3D effects 1"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="Table 3D effects 2"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="Table 3D effects 3"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="Table Contemporary"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="Table Elegant"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="Table Professional"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="Table Subtle 1"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="Table Subtle 2"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="Table Web 1"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="Table Web 2"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="Table Web 3"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="Balloon Text"/>
<w:LsdException Locked="false" Priority="39" Name="Table Grid"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="Table Theme"/>
<w:LsdException Locked="false" SemiHidden="true" Name="Placeholder Text"/>
<w:LsdException Locked="false" Priority="1" QFormat="true" Name="No Spacing"/>
<w:LsdException Locked="false" Priority="60" Name="Light Shading"/>
<w:LsdException Locked="false" Priority="61" Name="Light List"/>
<w:LsdException Locked="false" Priority="62" Name="Light Grid"/>
<w:LsdException Locked="false" Priority="63" Name="Medium Shading 1"/>
<w:LsdException Locked="false" Priority="64" Name="Medium Shading 2"/>
<w:LsdException Locked="false" Priority="65" Name="Medium List 1"/>
<w:LsdException Locked="false" Priority="66" Name="Medium List 2"/>
<w:LsdException Locked="false" Priority="67" Name="Medium Grid 1"/>
<w:LsdException Locked="false" Priority="68" Name="Medium Grid 2"/>
<w:LsdException Locked="false" Priority="69" Name="Medium Grid 3"/>
<w:LsdException Locked="false" Priority="70" Name="Dark List"/>
<w:LsdException Locked="false" Priority="71" Name="Colorful Shading"/>
<w:LsdException Locked="false" Priority="72" Name="Colorful List"/>
<w:LsdException Locked="false" Priority="73" Name="Colorful Grid"/>
<w:LsdException Locked="false" Priority="60" Name="Light Shading Accent 1"/>
<w:LsdException Locked="false" Priority="61" Name="Light List Accent 1"/>
<w:LsdException Locked="false" Priority="62" Name="Light Grid Accent 1"/>
<w:LsdException Locked="false" Priority="63" Name="Medium Shading 1 Accent 1"/>
<w:LsdException Locked="false" Priority="64" Name="Medium Shading 2 Accent 1"/>
<w:LsdException Locked="false" Priority="65" Name="Medium List 1 Accent 1"/>
<w:LsdException Locked="false" SemiHidden="true" Name="Revision"/>
<w:LsdException Locked="false" Priority="34" QFormat="true"
Name="List Paragraph"/>
<w:LsdException Locked="false" Priority="29" QFormat="true" Name="Quote"/>
<w:LsdException Locked="false" Priority="30" QFormat="true"
Name="Intense Quote"/>
<w:LsdException Locked="false" Priority="66" Name="Medium List 2 Accent 1"/>
<w:LsdException Locked="false" Priority="67" Name="Medium Grid 1 Accent 1"/>
<w:LsdException Locked="false" Priority="68" Name="Medium Grid 2 Accent 1"/>
<w:LsdException Locked="false" Priority="69" Name="Medium Grid 3 Accent 1"/>
<w:LsdException Locked="false" Priority="70" Name="Dark List Accent 1"/>
<w:LsdException Locked="false" Priority="71" Name="Colorful Shading Accent 1"/>
<w:LsdException Locked="false" Priority="72" Name="Colorful List Accent 1"/>
<w:LsdException Locked="false" Priority="73" Name="Colorful Grid Accent 1"/>
<w:LsdException Locked="false" Priority="60" Name="Light Shading Accent 2"/>
<w:LsdException Locked="false" Priority="61" Name="Light List Accent 2"/>
<w:LsdException Locked="false" Priority="62" Name="Light Grid Accent 2"/>
<w:LsdException Locked="false" Priority="63" Name="Medium Shading 1 Accent 2"/>
<w:LsdException Locked="false" Priority="64" Name="Medium Shading 2 Accent 2"/>
<w:LsdException Locked="false" Priority="65" Name="Medium List 1 Accent 2"/>
<w:LsdException Locked="false" Priority="66" Name="Medium List 2 Accent 2"/>
<w:LsdException Locked="false" Priority="67" Name="Medium Grid 1 Accent 2"/>
<w:LsdException Locked="false" Priority="68" Name="Medium Grid 2 Accent 2"/>
<w:LsdException Locked="false" Priority="69" Name="Medium Grid 3 Accent 2"/>
<w:LsdException Locked="false" Priority="70" Name="Dark List Accent 2"/>
<w:LsdException Locked="false" Priority="71" Name="Colorful Shading Accent 2"/>
<w:LsdException Locked="false" Priority="72" Name="Colorful List Accent 2"/>
<w:LsdException Locked="false" Priority="73" Name="Colorful Grid Accent 2"/>
<w:LsdException Locked="false" Priority="60" Name="Light Shading Accent 3"/>
<w:LsdException Locked="false" Priority="61" Name="Light List Accent 3"/>
<w:LsdException Locked="false" Priority="62" Name="Light Grid Accent 3"/>
<w:LsdException Locked="false" Priority="63" Name="Medium Shading 1 Accent 3"/>
<w:LsdException Locked="false" Priority="64" Name="Medium Shading 2 Accent 3"/>
<w:LsdException Locked="false" Priority="65" Name="Medium List 1 Accent 3"/>
<w:LsdException Locked="false" Priority="66" Name="Medium List 2 Accent 3"/>
<w:LsdException Locked="false" Priority="67" Name="Medium Grid 1 Accent 3"/>
<w:LsdException Locked="false" Priority="68" Name="Medium Grid 2 Accent 3"/>
<w:LsdException Locked="false" Priority="69" Name="Medium Grid 3 Accent 3"/>
<w:LsdException Locked="false" Priority="70" Name="Dark List Accent 3"/>
<w:LsdException Locked="false" Priority="71" Name="Colorful Shading Accent 3"/>
<w:LsdException Locked="false" Priority="72" Name="Colorful List Accent 3"/>
<w:LsdException Locked="false" Priority="73" Name="Colorful Grid Accent 3"/>
<w:LsdException Locked="false" Priority="60" Name="Light Shading Accent 4"/>
<w:LsdException Locked="false" Priority="61" Name="Light List Accent 4"/>
<w:LsdException Locked="false" Priority="62" Name="Light Grid Accent 4"/>
<w:LsdException Locked="false" Priority="63" Name="Medium Shading 1 Accent 4"/>
<w:LsdException Locked="false" Priority="64" Name="Medium Shading 2 Accent 4"/>
<w:LsdException Locked="false" Priority="65" Name="Medium List 1 Accent 4"/>
<w:LsdException Locked="false" Priority="66" Name="Medium List 2 Accent 4"/>
<w:LsdException Locked="false" Priority="67" Name="Medium Grid 1 Accent 4"/>
<w:LsdException Locked="false" Priority="68" Name="Medium Grid 2 Accent 4"/>
<w:LsdException Locked="false" Priority="69" Name="Medium Grid 3 Accent 4"/>
<w:LsdException Locked="false" Priority="70" Name="Dark List Accent 4"/>
<w:LsdException Locked="false" Priority="71" Name="Colorful Shading Accent 4"/>
<w:LsdException Locked="false" Priority="72" Name="Colorful List Accent 4"/>
<w:LsdException Locked="false" Priority="73" Name="Colorful Grid Accent 4"/>
<w:LsdException Locked="false" Priority="60" Name="Light Shading Accent 5"/>
<w:LsdException Locked="false" Priority="61" Name="Light List Accent 5"/>
<w:LsdException Locked="false" Priority="62" Name="Light Grid Accent 5"/>
<w:LsdException Locked="false" Priority="63" Name="Medium Shading 1 Accent 5"/>
<w:LsdException Locked="false" Priority="64" Name="Medium Shading 2 Accent 5"/>
<w:LsdException Locked="false" Priority="65" Name="Medium List 1 Accent 5"/>
<w:LsdException Locked="false" Priority="66" Name="Medium List 2 Accent 5"/>
<w:LsdException Locked="false" Priority="67" Name="Medium Grid 1 Accent 5"/>
<w:LsdException Locked="false" Priority="68" Name="Medium Grid 2 Accent 5"/>
<w:LsdException Locked="false" Priority="69" Name="Medium Grid 3 Accent 5"/>
<w:LsdException Locked="false" Priority="70" Name="Dark List Accent 5"/>
<w:LsdException Locked="false" Priority="71" Name="Colorful Shading Accent 5"/>
<w:LsdException Locked="false" Priority="72" Name="Colorful List Accent 5"/>
<w:LsdException Locked="false" Priority="73" Name="Colorful Grid Accent 5"/>
<w:LsdException Locked="false" Priority="60" Name="Light Shading Accent 6"/>
<w:LsdException Locked="false" Priority="61" Name="Light List Accent 6"/>
<w:LsdException Locked="false" Priority="62" Name="Light Grid Accent 6"/>
<w:LsdException Locked="false" Priority="63" Name="Medium Shading 1 Accent 6"/>
<w:LsdException Locked="false" Priority="64" Name="Medium Shading 2 Accent 6"/>
<w:LsdException Locked="false" Priority="65" Name="Medium List 1 Accent 6"/>
<w:LsdException Locked="false" Priority="66" Name="Medium List 2 Accent 6"/>
<w:LsdException Locked="false" Priority="67" Name="Medium Grid 1 Accent 6"/>
<w:LsdException Locked="false" Priority="68" Name="Medium Grid 2 Accent 6"/>
<w:LsdException Locked="false" Priority="69" Name="Medium Grid 3 Accent 6"/>
<w:LsdException Locked="false" Priority="70" Name="Dark List Accent 6"/>
<w:LsdException Locked="false" Priority="71" Name="Colorful Shading Accent 6"/>
<w:LsdException Locked="false" Priority="72" Name="Colorful List Accent 6"/>
<w:LsdException Locked="false" Priority="73" Name="Colorful Grid Accent 6"/>
<w:LsdException Locked="false" Priority="19" QFormat="true"
Name="Subtle Emphasis"/>
<w:LsdException Locked="false" Priority="21" QFormat="true"
Name="Intense Emphasis"/>
<w:LsdException Locked="false" Priority="31" QFormat="true"
Name="Subtle Reference"/>
<w:LsdException Locked="false" Priority="32" QFormat="true"
Name="Intense Reference"/>
<w:LsdException Locked="false" Priority="33" QFormat="true" Name="Book Title"/>
<w:LsdException Locked="false" Priority="37" SemiHidden="true"
UnhideWhenUsed="true" Name="Bibliography"/>
<w:LsdException Locked="false" Priority="39" SemiHidden="true"
UnhideWhenUsed="true" QFormat="true" Name="TOC Heading"/>
<w:LsdException Locked="false" Priority="41" Name="Plain Table 1"/>
<w:LsdException Locked="false" Priority="42" Name="Plain Table 2"/>
<w:LsdException Locked="false" Priority="43" Name="Plain Table 3"/>
<w:LsdException Locked="false" Priority="44" Name="Plain Table 4"/>
<w:LsdException Locked="false" Priority="45" Name="Plain Table 5"/>
<w:LsdException Locked="false" Priority="40" Name="Grid Table Light"/>
<w:LsdException Locked="false" Priority="46" Name="Grid Table 1 Light"/>
<w:LsdException Locked="false" Priority="47" Name="Grid Table 2"/>
<w:LsdException Locked="false" Priority="48" Name="Grid Table 3"/>
<w:LsdException Locked="false" Priority="49" Name="Grid Table 4"/>
<w:LsdException Locked="false" Priority="50" Name="Grid Table 5 Dark"/>
<w:LsdException Locked="false" Priority="51" Name="Grid Table 6 Colorful"/>
<w:LsdException Locked="false" Priority="52" Name="Grid Table 7 Colorful"/>
<w:LsdException Locked="false" Priority="46"
Name="Grid Table 1 Light Accent 1"/>
<w:LsdException Locked="false" Priority="47" Name="Grid Table 2 Accent 1"/>
<w:LsdException Locked="false" Priority="48" Name="Grid Table 3 Accent 1"/>
<w:LsdException Locked="false" Priority="49" Name="Grid Table 4 Accent 1"/>
<w:LsdException Locked="false" Priority="50" Name="Grid Table 5 Dark Accent 1"/>
<w:LsdException Locked="false" Priority="51"
Name="Grid Table 6 Colorful Accent 1"/>
<w:LsdException Locked="false" Priority="52"
Name="Grid Table 7 Colorful Accent 1"/>
<w:LsdException Locked="false" Priority="46"
Name="Grid Table 1 Light Accent 2"/>
<w:LsdException Locked="false" Priority="47" Name="Grid Table 2 Accent 2"/>
<w:LsdException Locked="false" Priority="48" Name="Grid Table 3 Accent 2"/>
<w:LsdException Locked="false" Priority="49" Name="Grid Table 4 Accent 2"/>
<w:LsdException Locked="false" Priority="50" Name="Grid Table 5 Dark Accent 2"/>
<w:LsdException Locked="false" Priority="51"
Name="Grid Table 6 Colorful Accent 2"/>
<w:LsdException Locked="false" Priority="52"
Name="Grid Table 7 Colorful Accent 2"/>
<w:LsdException Locked="false" Priority="46"
Name="Grid Table 1 Light Accent 3"/>
<w:LsdException Locked="false" Priority="47" Name="Grid Table 2 Accent 3"/>
<w:LsdException Locked="false" Priority="48" Name="Grid Table 3 Accent 3"/>
<w:LsdException Locked="false" Priority="49" Name="Grid Table 4 Accent 3"/>
<w:LsdException Locked="false" Priority="50" Name="Grid Table 5 Dark Accent 3"/>
<w:LsdException Locked="false" Priority="51"
Name="Grid Table 6 Colorful Accent 3"/>
<w:LsdException Locked="false" Priority="52"
Name="Grid Table 7 Colorful Accent 3"/>
<w:LsdException Locked="false" Priority="46"
Name="Grid Table 1 Light Accent 4"/>
<w:LsdException Locked="false" Priority="47" Name="Grid Table 2 Accent 4"/>
<w:LsdException Locked="false" Priority="48" Name="Grid Table 3 Accent 4"/>
<w:LsdException Locked="false" Priority="49" Name="Grid Table 4 Accent 4"/>
<w:LsdException Locked="false" Priority="50" Name="Grid Table 5 Dark Accent 4"/>
<w:LsdException Locked="false" Priority="51"
Name="Grid Table 6 Colorful Accent 4"/>
<w:LsdException Locked="false" Priority="52"
Name="Grid Table 7 Colorful Accent 4"/>
<w:LsdException Locked="false" Priority="46"
Name="Grid Table 1 Light Accent 5"/>
<w:LsdException Locked="false" Priority="47" Name="Grid Table 2 Accent 5"/>
<w:LsdException Locked="false" Priority="48" Name="Grid Table 3 Accent 5"/>
<w:LsdException Locked="false" Priority="49" Name="Grid Table 4 Accent 5"/>
<w:LsdException Locked="false" Priority="50" Name="Grid Table 5 Dark Accent 5"/>
<w:LsdException Locked="false" Priority="51"
Name="Grid Table 6 Colorful Accent 5"/>
<w:LsdException Locked="false" Priority="52"
Name="Grid Table 7 Colorful Accent 5"/>
<w:LsdException Locked="false" Priority="46"
Name="Grid Table 1 Light Accent 6"/>
<w:LsdException Locked="false" Priority="47" Name="Grid Table 2 Accent 6"/>
<w:LsdException Locked="false" Priority="48" Name="Grid Table 3 Accent 6"/>
<w:LsdException Locked="false" Priority="49" Name="Grid Table 4 Accent 6"/>
<w:LsdException Locked="false" Priority="50" Name="Grid Table 5 Dark Accent 6"/>
<w:LsdException Locked="false" Priority="51"
Name="Grid Table 6 Colorful Accent 6"/>
<w:LsdException Locked="false" Priority="52"
Name="Grid Table 7 Colorful Accent 6"/>
<w:LsdException Locked="false" Priority="46" Name="List Table 1 Light"/>
<w:LsdException Locked="false" Priority="47" Name="List Table 2"/>
<w:LsdException Locked="false" Priority="48" Name="List Table 3"/>
<w:LsdException Locked="false" Priority="49" Name="List Table 4"/>
<w:LsdException Locked="false" Priority="50" Name="List Table 5 Dark"/>
<w:LsdException Locked="false" Priority="51" Name="List Table 6 Colorful"/>
<w:LsdException Locked="false" Priority="52" Name="List Table 7 Colorful"/>
<w:LsdException Locked="false" Priority="46"
Name="List Table 1 Light Accent 1"/>
<w:LsdException Locked="false" Priority="47" Name="List Table 2 Accent 1"/>
<w:LsdException Locked="false" Priority="48" Name="List Table 3 Accent 1"/>
<w:LsdException Locked="false" Priority="49" Name="List Table 4 Accent 1"/>
<w:LsdException Locked="false" Priority="50" Name="List Table 5 Dark Accent 1"/>
<w:LsdException Locked="false" Priority="51"
Name="List Table 6 Colorful Accent 1"/>
<w:LsdException Locked="false" Priority="52"
Name="List Table 7 Colorful Accent 1"/>
<w:LsdException Locked="false" Priority="46"
Name="List Table 1 Light Accent 2"/>
<w:LsdException Locked="false" Priority="47" Name="List Table 2 Accent 2"/>
<w:LsdException Locked="false" Priority="48" Name="List Table 3 Accent 2"/>
<w:LsdException Locked="false" Priority="49" Name="List Table 4 Accent 2"/>
<w:LsdException Locked="false" Priority="50" Name="List Table 5 Dark Accent 2"/>
<w:LsdException Locked="false" Priority="51"
Name="List Table 6 Colorful Accent 2"/>
<w:LsdException Locked="false" Priority="52"
Name="List Table 7 Colorful Accent 2"/>
<w:LsdException Locked="false" Priority="46"
Name="List Table 1 Light Accent 3"/>
<w:LsdException Locked="false" Priority="47" Name="List Table 2 Accent 3"/>
<w:LsdException Locked="false" Priority="48" Name="List Table 3 Accent 3"/>
<w:LsdException Locked="false" Priority="49" Name="List Table 4 Accent 3"/>
<w:LsdException Locked="false" Priority="50" Name="List Table 5 Dark Accent 3"/>
<w:LsdException Locked="false" Priority="51"
Name="List Table 6 Colorful Accent 3"/>
<w:LsdException Locked="false" Priority="52"
Name="List Table 7 Colorful Accent 3"/>
<w:LsdException Locked="false" Priority="46"
Name="List Table 1 Light Accent 4"/>
<w:LsdException Locked="false" Priority="47" Name="List Table 2 Accent 4"/>
<w:LsdException Locked="false" Priority="48" Name="List Table 3 Accent 4"/>
<w:LsdException Locked="false" Priority="49" Name="List Table 4 Accent 4"/>
<w:LsdException Locked="false" Priority="50" Name="List Table 5 Dark Accent 4"/>
<w:LsdException Locked="false" Priority="51"
Name="List Table 6 Colorful Accent 4"/>
<w:LsdException Locked="false" Priority="52"
Name="List Table 7 Colorful Accent 4"/>
<w:LsdException Locked="false" Priority="46"
Name="List Table 1 Light Accent 5"/>
<w:LsdException Locked="false" Priority="47" Name="List Table 2 Accent 5"/>
<w:LsdException Locked="false" Priority="48" Name="List Table 3 Accent 5"/>
<w:LsdException Locked="false" Priority="49" Name="List Table 4 Accent 5"/>
<w:LsdException Locked="false" Priority="50" Name="List Table 5 Dark Accent 5"/>
<w:LsdException Locked="false" Priority="51"
Name="List Table 6 Colorful Accent 5"/>
<w:LsdException Locked="false" Priority="52"
Name="List Table 7 Colorful Accent 5"/>
<w:LsdException Locked="false" Priority="46"
Name="List Table 1 Light Accent 6"/>
<w:LsdException Locked="false" Priority="47" Name="List Table 2 Accent 6"/>
<w:LsdException Locked="false" Priority="48" Name="List Table 3 Accent 6"/>
<w:LsdException Locked="false" Priority="49" Name="List Table 4 Accent 6"/>
<w:LsdException Locked="false" Priority="50" Name="List Table 5 Dark Accent 6"/>
<w:LsdException Locked="false" Priority="51"
Name="List Table 6 Colorful Accent 6"/>
<w:LsdException Locked="false" Priority="52"
Name="List Table 7 Colorful Accent 6"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="Mention"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="Smart Hyperlink"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="Hashtag"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="Unresolved Mention"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="Smart Link"/>
</w:LatentStyles>
</xml><![endif]-->
<style>
<!--
/* Font Definitions */
@font-face
{font-family:"Cambria Math";
panose-1:2 4 5 3 5 4 6 3 2 4;
mso-font-charset:0;
mso-generic-font-family:roman;
mso-font-pitch:variable;
mso-font-signature:-536870145 1107305727 0 0 415 0;}
@font-face
{font-family:Calibri;
panose-1:2 15 5 2 2 2 4 3 2 4;
mso-font-charset:0;
mso-generic-font-family:swiss;
mso-font-pitch:variable;
mso-font-signature:-536859905 -1073697537 9 0 511 0;}
/* Style Definitions */
p.MsoNormal, li.MsoNormal, div.MsoNormal
{mso-style-unhide:no;
mso-style-qformat:yes;
mso-style-parent:"";
margin:0cm;
margin-bottom:.0001pt;
mso-pagination:widow-orphan;
font-size:12.0pt;
font-family:"Calibri",sans-serif;
mso-ascii-font-family:Calibri;
mso-ascii-theme-font:minor-latin;
mso-fareast-font-family:Calibri;
mso-fareast-theme-font:minor-latin;
mso-hansi-font-family:Calibri;
mso-hansi-theme-font:minor-latin;
mso-bidi-font-family:"Times New Roman";
mso-bidi-theme-font:minor-bidi;
mso-fareast-language:EN-US;}
a:link, span.MsoHyperlink
{mso-style-noshow:yes;
mso-style-priority:99;
color:blue;
text-decoration:underline;
text-underline:single;}
a:visited, span.MsoHyperlinkFollowed
{mso-style-noshow:yes;
mso-style-priority:99;
color:#954F72;
mso-themecolor:followedhyperlink;
text-decoration:underline;
text-underline:single;}
p
{mso-style-priority:99;
mso-margin-top-alt:auto;
margin-right:0cm;
mso-margin-bottom-alt:auto;
margin-left:0cm;
mso-pagination:widow-orphan;
font-size:12.0pt;
font-family:"Times New Roman",serif;
mso-fareast-font-family:"Times New Roman";}
.MsoChpDefault
{mso-style-type:export-only;
mso-default-props:yes;
font-family:"Calibri",sans-serif;
mso-ascii-font-family:Calibri;
mso-ascii-theme-font:minor-latin;
mso-fareast-font-family:Calibri;
mso-fareast-theme-font:minor-latin;
mso-hansi-font-family:Calibri;
mso-hansi-theme-font:minor-latin;
mso-bidi-font-family:"Times New Roman";
mso-bidi-theme-font:minor-bidi;
mso-fareast-language:EN-US;}
@page WordSection1
{size:595.0pt 842.0pt;
margin:72.0pt 72.0pt 72.0pt 72.0pt;
mso-header-margin:35.4pt;
mso-footer-margin:35.4pt;
mso-paper-source:0;}
div.WordSection1
{page:WordSection1;}
-->
</style>
<!--[if gte mso 10]>
<style>
/* Style Definitions */
table.MsoNormalTable
{mso-style-name:"Table Normal";
mso-tstyle-rowband-size:0;
mso-tstyle-colband-size:0;
mso-style-noshow:yes;
mso-style-priority:99;
mso-style-parent:"";
mso-padding-alt:0cm 5.4pt 0cm 5.4pt;
mso-para-margin:0cm;
mso-para-margin-bottom:.0001pt;
mso-pagination:widow-orphan;
font-size:12.0pt;
font-family:"Calibri",sans-serif;
mso-ascii-font-family:Calibri;
mso-ascii-theme-font:minor-latin;
mso-hansi-font-family:Calibri;
mso-hansi-theme-font:minor-latin;
mso-bidi-font-family:"Times New Roman";
mso-bidi-theme-font:minor-bidi;
mso-fareast-language:EN-US;}
</style>
<![endif]-->
<!--StartFragment-->
<!--EndFragment--><br />
<div class="MsoNormal">
<br /></div>
<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgfytwjhOC94eksUkewVK6XmNiXxWzTECQNqCwO1kpksxsYybXYM0K6qcAedvY1Rh86thM6tPLSkQC1YUG-xt3GxkR5SxThIRKz-TQzwVwVs5Cvd552dbADOf4zNcrJlnd-eSjzST7Lfp9f/s1600/Screenshot+2019-08-24+at+13.38.03.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" data-original-height="1000" data-original-width="1600" height="250" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgfytwjhOC94eksUkewVK6XmNiXxWzTECQNqCwO1kpksxsYybXYM0K6qcAedvY1Rh86thM6tPLSkQC1YUG-xt3GxkR5SxThIRKz-TQzwVwVs5Cvd552dbADOf4zNcrJlnd-eSjzST7Lfp9f/s400/Screenshot+2019-08-24+at+13.38.03.png" width="400" /></a></div>
<div class="separator" style="clear: both; text-align: center;">
<span style="text-align: start;">phantomRefAfterGC.hprof(with jdk11)</span></div>
<div class="separator" style="clear: both; text-align: center;">
<span style="text-align: start;"><br /></span></div>
<div class="MsoNormal">
<span style="font-size: small;"><span style="color: black; font-family: "times new roman" , serif;">Note that with jdk 11 our reflection code will get the below warning.
This implies in coming releases reflection might not work anymore.</span> </span></div>
<br />
<div style="margin-bottom: .0001pt; margin: 0cm; tab-stops: 45.8pt 91.6pt 137.4pt 183.2pt 229.0pt 274.8pt 320.6pt 366.4pt 412.2pt 458.0pt 503.8pt 549.6pt 595.4pt 641.2pt 687.0pt 732.8pt;">
<span style="color: red; font-family: "times"; font-size: 7.5pt;">WARNING: An illegal reflective access operation has occurred</span><span style="color: black; font-family: "times"; font-size: 10.0pt;"><o:p></o:p></span></div>
<div style="margin-bottom: .0001pt; margin: 0cm; tab-stops: 45.8pt 91.6pt 137.4pt 183.2pt 229.0pt 274.8pt 320.6pt 366.4pt 412.2pt 458.0pt 503.8pt 549.6pt 595.4pt 641.2pt 687.0pt 732.8pt;">
<span style="color: red; font-family: "times"; font-size: 7.5pt;">WARNING: Illegal reflective access by references.PhantomRefTest
(file:/myblog/out/production/java/) to field java.lang.ref.Reference.referent</span><span style="color: black; font-family: "times"; font-size: 10.0pt;"><o:p></o:p></span></div>
<div style="margin-bottom: .0001pt; margin: 0cm; tab-stops: 45.8pt 91.6pt 137.4pt 183.2pt 229.0pt 274.8pt 320.6pt 366.4pt 412.2pt 458.0pt 503.8pt 549.6pt 595.4pt 641.2pt 687.0pt 732.8pt;">
<span style="color: red; font-family: "times"; font-size: 7.5pt;">WARNING: Please consider reporting this to the maintainers of
references.PhantomRefTest</span><span style="color: black; font-family: "times"; font-size: 10.0pt;"><o:p></o:p></span></div>
<div style="margin-bottom: .0001pt; margin: 0cm; tab-stops: 45.8pt 91.6pt 137.4pt 183.2pt 229.0pt 274.8pt 320.6pt 366.4pt 412.2pt 458.0pt 503.8pt 549.6pt 595.4pt 641.2pt 687.0pt 732.8pt;">
<span style="color: red; font-family: "times"; font-size: 7.5pt;">WARNING: Use --illegal-access=warn to enable warnings of further
illegal reflective access operations</span><span style="color: black; font-family: "times"; font-size: 10.0pt;"><o:p></o:p></span></div>
<div style="margin-bottom: .0001pt; margin: 0cm; tab-stops: 45.8pt 91.6pt 137.4pt 183.2pt 229.0pt 274.8pt 320.6pt 366.4pt 412.2pt 458.0pt 503.8pt 549.6pt 595.4pt 641.2pt 687.0pt 732.8pt;">
<span style="color: red; font-family: "times"; font-size: 7.5pt;">WARNING: All illegal access operations will be denied in a future
release</span><span style="color: black; font-family: "times"; font-size: 10.0pt;"><o:p></o:p></span></div>
<!--[if gte mso 9]><xml>
<o:OfficeDocumentSettings>
<o:AllowPNG/>
</o:OfficeDocumentSettings>
</xml><![endif]-->
<!--[if gte mso 9]><xml>
<w:WordDocument>
<w:View>Normal</w:View>
<w:Zoom>0</w:Zoom>
<w:TrackMoves/>
<w:TrackFormatting/>
<w:PunctuationKerning/>
<w:ValidateAgainstSchemas/>
<w:SaveIfXMLInvalid>false</w:SaveIfXMLInvalid>
<w:IgnoreMixedContent>false</w:IgnoreMixedContent>
<w:AlwaysShowPlaceholderText>false</w:AlwaysShowPlaceholderText>
<w:DoNotPromoteQF/>
<w:LidThemeOther>EN-US</w:LidThemeOther>
<w:LidThemeAsian>X-NONE</w:LidThemeAsian>
<w:LidThemeComplexScript>X-NONE</w:LidThemeComplexScript>
<w:Compatibility>
<w:BreakWrappedTables/>
<w:SnapToGridInCell/>
<w:WrapTextWithPunct/>
<w:UseAsianBreakRules/>
<w:DontGrowAutofit/>
<w:SplitPgBreakAndParaMark/>
<w:EnableOpenTypeKerning/>
<w:DontFlipMirrorIndents/>
<w:OverrideTableStyleHps/>
</w:Compatibility>
<m:mathPr>
<m:mathFont m:val="Cambria Math"/>
<m:brkBin m:val="before"/>
<m:brkBinSub m:val="--"/>
<m:smallFrac m:val="off"/>
<m:dispDef/>
<m:lMargin m:val="0"/>
<m:rMargin m:val="0"/>
<m:defJc m:val="centerGroup"/>
<m:wrapIndent m:val="1440"/>
<m:intLim m:val="subSup"/>
<m:naryLim m:val="undOvr"/>
</m:mathPr></w:WordDocument>
</xml><![endif]--><!--[if gte mso 9]><xml>
<w:LatentStyles DefLockedState="false" DefUnhideWhenUsed="false"
DefSemiHidden="false" DefQFormat="false" DefPriority="99"
LatentStyleCount="376">
<w:LsdException Locked="false" Priority="0" QFormat="true" Name="Normal"/>
<w:LsdException Locked="false" Priority="9" QFormat="true" Name="heading 1"/>
<w:LsdException Locked="false" Priority="9" SemiHidden="true"
UnhideWhenUsed="true" QFormat="true" Name="heading 2"/>
<w:LsdException Locked="false" Priority="9" SemiHidden="true"
UnhideWhenUsed="true" QFormat="true" Name="heading 3"/>
<w:LsdException Locked="false" Priority="9" SemiHidden="true"
UnhideWhenUsed="true" QFormat="true" Name="heading 4"/>
<w:LsdException Locked="false" Priority="9" SemiHidden="true"
UnhideWhenUsed="true" QFormat="true" Name="heading 5"/>
<w:LsdException Locked="false" Priority="9" SemiHidden="true"
UnhideWhenUsed="true" QFormat="true" Name="heading 6"/>
<w:LsdException Locked="false" Priority="9" SemiHidden="true"
UnhideWhenUsed="true" QFormat="true" Name="heading 7"/>
<w:LsdException Locked="false" Priority="9" SemiHidden="true"
UnhideWhenUsed="true" QFormat="true" Name="heading 8"/>
<w:LsdException Locked="false" Priority="9" SemiHidden="true"
UnhideWhenUsed="true" QFormat="true" Name="heading 9"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="index 1"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="index 2"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="index 3"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="index 4"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="index 5"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="index 6"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="index 7"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="index 8"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="index 9"/>
<w:LsdException Locked="false" Priority="39" SemiHidden="true"
UnhideWhenUsed="true" Name="toc 1"/>
<w:LsdException Locked="false" Priority="39" SemiHidden="true"
UnhideWhenUsed="true" Name="toc 2"/>
<w:LsdException Locked="false" Priority="39" SemiHidden="true"
UnhideWhenUsed="true" Name="toc 3"/>
<w:LsdException Locked="false" Priority="39" SemiHidden="true"
UnhideWhenUsed="true" Name="toc 4"/>
<w:LsdException Locked="false" Priority="39" SemiHidden="true"
UnhideWhenUsed="true" Name="toc 5"/>
<w:LsdException Locked="false" Priority="39" SemiHidden="true"
UnhideWhenUsed="true" Name="toc 6"/>
<w:LsdException Locked="false" Priority="39" SemiHidden="true"
UnhideWhenUsed="true" Name="toc 7"/>
<w:LsdException Locked="false" Priority="39" SemiHidden="true"
UnhideWhenUsed="true" Name="toc 8"/>
<w:LsdException Locked="false" Priority="39" SemiHidden="true"
UnhideWhenUsed="true" Name="toc 9"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="Normal Indent"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="footnote text"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="annotation text"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="header"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="footer"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="index heading"/>
<w:LsdException Locked="false" Priority="35" SemiHidden="true"
UnhideWhenUsed="true" QFormat="true" Name="caption"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="table of figures"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="envelope address"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="envelope return"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="footnote reference"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="annotation reference"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="line number"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="page number"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="endnote reference"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="endnote text"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="table of authorities"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="macro"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="toa heading"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="List"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="List Bullet"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="List Number"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="List 2"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="List 3"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="List 4"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="List 5"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="List Bullet 2"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="List Bullet 3"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="List Bullet 4"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="List Bullet 5"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="List Number 2"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="List Number 3"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="List Number 4"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="List Number 5"/>
<w:LsdException Locked="false" Priority="10" QFormat="true" Name="Title"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="Closing"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="Signature"/>
<w:LsdException Locked="false" Priority="1" SemiHidden="true"
UnhideWhenUsed="true" Name="Default Paragraph Font"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="Body Text"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="Body Text Indent"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="List Continue"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="List Continue 2"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="List Continue 3"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="List Continue 4"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="List Continue 5"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="Message Header"/>
<w:LsdException Locked="false" Priority="11" QFormat="true" Name="Subtitle"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="Salutation"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="Date"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="Body Text First Indent"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="Body Text First Indent 2"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="Note Heading"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="Body Text 2"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="Body Text 3"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="Body Text Indent 2"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="Body Text Indent 3"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="Block Text"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="Hyperlink"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="FollowedHyperlink"/>
<w:LsdException Locked="false" Priority="22" QFormat="true" Name="Strong"/>
<w:LsdException Locked="false" Priority="20" QFormat="true" Name="Emphasis"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="Document Map"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="Plain Text"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="E-mail Signature"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="HTML Top of Form"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="HTML Bottom of Form"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="Normal (Web)"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="HTML Acronym"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="HTML Address"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="HTML Cite"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="HTML Code"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="HTML Definition"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="HTML Keyboard"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
QFormat="true" Name="HTML Preformatted"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="HTML Sample"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="HTML Typewriter"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="HTML Variable"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="Normal Table"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="annotation subject"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="No List"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="Outline List 1"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="Outline List 2"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="Outline List 3"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="Table Simple 1"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="Table Simple 2"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="Table Simple 3"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="Table Classic 1"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="Table Classic 2"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="Table Classic 3"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="Table Classic 4"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="Table Colorful 1"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="Table Colorful 2"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="Table Colorful 3"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="Table Columns 1"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="Table Columns 2"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="Table Columns 3"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="Table Columns 4"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="Table Columns 5"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="Table Grid 1"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="Table Grid 2"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="Table Grid 3"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="Table Grid 4"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="Table Grid 5"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="Table Grid 6"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="Table Grid 7"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="Table Grid 8"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="Table List 1"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="Table List 2"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="Table List 3"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="Table List 4"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="Table List 5"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="Table List 6"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="Table List 7"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="Table List 8"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="Table 3D effects 1"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="Table 3D effects 2"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="Table 3D effects 3"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="Table Contemporary"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="Table Elegant"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="Table Professional"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="Table Subtle 1"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="Table Subtle 2"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="Table Web 1"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="Table Web 2"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="Table Web 3"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="Balloon Text"/>
<w:LsdException Locked="false" Priority="39" Name="Table Grid"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="Table Theme"/>
<w:LsdException Locked="false" SemiHidden="true" Name="Placeholder Text"/>
<w:LsdException Locked="false" Priority="1" QFormat="true" Name="No Spacing"/>
<w:LsdException Locked="false" Priority="60" Name="Light Shading"/>
<w:LsdException Locked="false" Priority="61" Name="Light List"/>
<w:LsdException Locked="false" Priority="62" Name="Light Grid"/>
<w:LsdException Locked="false" Priority="63" Name="Medium Shading 1"/>
<w:LsdException Locked="false" Priority="64" Name="Medium Shading 2"/>
<w:LsdException Locked="false" Priority="65" Name="Medium List 1"/>
<w:LsdException Locked="false" Priority="66" Name="Medium List 2"/>
<w:LsdException Locked="false" Priority="67" Name="Medium Grid 1"/>
<w:LsdException Locked="false" Priority="68" Name="Medium Grid 2"/>
<w:LsdException Locked="false" Priority="69" Name="Medium Grid 3"/>
<w:LsdException Locked="false" Priority="70" Name="Dark List"/>
<w:LsdException Locked="false" Priority="71" Name="Colorful Shading"/>
<w:LsdException Locked="false" Priority="72" Name="Colorful List"/>
<w:LsdException Locked="false" Priority="73" Name="Colorful Grid"/>
<w:LsdException Locked="false" Priority="60" Name="Light Shading Accent 1"/>
<w:LsdException Locked="false" Priority="61" Name="Light List Accent 1"/>
<w:LsdException Locked="false" Priority="62" Name="Light Grid Accent 1"/>
<w:LsdException Locked="false" Priority="63" Name="Medium Shading 1 Accent 1"/>
<w:LsdException Locked="false" Priority="64" Name="Medium Shading 2 Accent 1"/>
<w:LsdException Locked="false" Priority="65" Name="Medium List 1 Accent 1"/>
<w:LsdException Locked="false" SemiHidden="true" Name="Revision"/>
<w:LsdException Locked="false" Priority="34" QFormat="true"
Name="List Paragraph"/>
<w:LsdException Locked="false" Priority="29" QFormat="true" Name="Quote"/>
<w:LsdException Locked="false" Priority="30" QFormat="true"
Name="Intense Quote"/>
<w:LsdException Locked="false" Priority="66" Name="Medium List 2 Accent 1"/>
<w:LsdException Locked="false" Priority="67" Name="Medium Grid 1 Accent 1"/>
<w:LsdException Locked="false" Priority="68" Name="Medium Grid 2 Accent 1"/>
<w:LsdException Locked="false" Priority="69" Name="Medium Grid 3 Accent 1"/>
<w:LsdException Locked="false" Priority="70" Name="Dark List Accent 1"/>
<w:LsdException Locked="false" Priority="71" Name="Colorful Shading Accent 1"/>
<w:LsdException Locked="false" Priority="72" Name="Colorful List Accent 1"/>
<w:LsdException Locked="false" Priority="73" Name="Colorful Grid Accent 1"/>
<w:LsdException Locked="false" Priority="60" Name="Light Shading Accent 2"/>
<w:LsdException Locked="false" Priority="61" Name="Light List Accent 2"/>
<w:LsdException Locked="false" Priority="62" Name="Light Grid Accent 2"/>
<w:LsdException Locked="false" Priority="63" Name="Medium Shading 1 Accent 2"/>
<w:LsdException Locked="false" Priority="64" Name="Medium Shading 2 Accent 2"/>
<w:LsdException Locked="false" Priority="65" Name="Medium List 1 Accent 2"/>
<w:LsdException Locked="false" Priority="66" Name="Medium List 2 Accent 2"/>
<w:LsdException Locked="false" Priority="67" Name="Medium Grid 1 Accent 2"/>
<w:LsdException Locked="false" Priority="68" Name="Medium Grid 2 Accent 2"/>
<w:LsdException Locked="false" Priority="69" Name="Medium Grid 3 Accent 2"/>
<w:LsdException Locked="false" Priority="70" Name="Dark List Accent 2"/>
<w:LsdException Locked="false" Priority="71" Name="Colorful Shading Accent 2"/>
<w:LsdException Locked="false" Priority="72" Name="Colorful List Accent 2"/>
<w:LsdException Locked="false" Priority="73" Name="Colorful Grid Accent 2"/>
<w:LsdException Locked="false" Priority="60" Name="Light Shading Accent 3"/>
<w:LsdException Locked="false" Priority="61" Name="Light List Accent 3"/>
<w:LsdException Locked="false" Priority="62" Name="Light Grid Accent 3"/>
<w:LsdException Locked="false" Priority="63" Name="Medium Shading 1 Accent 3"/>
<w:LsdException Locked="false" Priority="64" Name="Medium Shading 2 Accent 3"/>
<w:LsdException Locked="false" Priority="65" Name="Medium List 1 Accent 3"/>
<w:LsdException Locked="false" Priority="66" Name="Medium List 2 Accent 3"/>
<w:LsdException Locked="false" Priority="67" Name="Medium Grid 1 Accent 3"/>
<w:LsdException Locked="false" Priority="68" Name="Medium Grid 2 Accent 3"/>
<w:LsdException Locked="false" Priority="69" Name="Medium Grid 3 Accent 3"/>
<w:LsdException Locked="false" Priority="70" Name="Dark List Accent 3"/>
<w:LsdException Locked="false" Priority="71" Name="Colorful Shading Accent 3"/>
<w:LsdException Locked="false" Priority="72" Name="Colorful List Accent 3"/>
<w:LsdException Locked="false" Priority="73" Name="Colorful Grid Accent 3"/>
<w:LsdException Locked="false" Priority="60" Name="Light Shading Accent 4"/>
<w:LsdException Locked="false" Priority="61" Name="Light List Accent 4"/>
<w:LsdException Locked="false" Priority="62" Name="Light Grid Accent 4"/>
<w:LsdException Locked="false" Priority="63" Name="Medium Shading 1 Accent 4"/>
<w:LsdException Locked="false" Priority="64" Name="Medium Shading 2 Accent 4"/>
<w:LsdException Locked="false" Priority="65" Name="Medium List 1 Accent 4"/>
<w:LsdException Locked="false" Priority="66" Name="Medium List 2 Accent 4"/>
<w:LsdException Locked="false" Priority="67" Name="Medium Grid 1 Accent 4"/>
<w:LsdException Locked="false" Priority="68" Name="Medium Grid 2 Accent 4"/>
<w:LsdException Locked="false" Priority="69" Name="Medium Grid 3 Accent 4"/>
<w:LsdException Locked="false" Priority="70" Name="Dark List Accent 4"/>
<w:LsdException Locked="false" Priority="71" Name="Colorful Shading Accent 4"/>
<w:LsdException Locked="false" Priority="72" Name="Colorful List Accent 4"/>
<w:LsdException Locked="false" Priority="73" Name="Colorful Grid Accent 4"/>
<w:LsdException Locked="false" Priority="60" Name="Light Shading Accent 5"/>
<w:LsdException Locked="false" Priority="61" Name="Light List Accent 5"/>
<w:LsdException Locked="false" Priority="62" Name="Light Grid Accent 5"/>
<w:LsdException Locked="false" Priority="63" Name="Medium Shading 1 Accent 5"/>
<w:LsdException Locked="false" Priority="64" Name="Medium Shading 2 Accent 5"/>
<w:LsdException Locked="false" Priority="65" Name="Medium List 1 Accent 5"/>
<w:LsdException Locked="false" Priority="66" Name="Medium List 2 Accent 5"/>
<w:LsdException Locked="false" Priority="67" Name="Medium Grid 1 Accent 5"/>
<w:LsdException Locked="false" Priority="68" Name="Medium Grid 2 Accent 5"/>
<w:LsdException Locked="false" Priority="69" Name="Medium Grid 3 Accent 5"/>
<w:LsdException Locked="false" Priority="70" Name="Dark List Accent 5"/>
<w:LsdException Locked="false" Priority="71" Name="Colorful Shading Accent 5"/>
<w:LsdException Locked="false" Priority="72" Name="Colorful List Accent 5"/>
<w:LsdException Locked="false" Priority="73" Name="Colorful Grid Accent 5"/>
<w:LsdException Locked="false" Priority="60" Name="Light Shading Accent 6"/>
<w:LsdException Locked="false" Priority="61" Name="Light List Accent 6"/>
<w:LsdException Locked="false" Priority="62" Name="Light Grid Accent 6"/>
<w:LsdException Locked="false" Priority="63" Name="Medium Shading 1 Accent 6"/>
<w:LsdException Locked="false" Priority="64" Name="Medium Shading 2 Accent 6"/>
<w:LsdException Locked="false" Priority="65" Name="Medium List 1 Accent 6"/>
<w:LsdException Locked="false" Priority="66" Name="Medium List 2 Accent 6"/>
<w:LsdException Locked="false" Priority="67" Name="Medium Grid 1 Accent 6"/>
<w:LsdException Locked="false" Priority="68" Name="Medium Grid 2 Accent 6"/>
<w:LsdException Locked="false" Priority="69" Name="Medium Grid 3 Accent 6"/>
<w:LsdException Locked="false" Priority="70" Name="Dark List Accent 6"/>
<w:LsdException Locked="false" Priority="71" Name="Colorful Shading Accent 6"/>
<w:LsdException Locked="false" Priority="72" Name="Colorful List Accent 6"/>
<w:LsdException Locked="false" Priority="73" Name="Colorful Grid Accent 6"/>
<w:LsdException Locked="false" Priority="19" QFormat="true"
Name="Subtle Emphasis"/>
<w:LsdException Locked="false" Priority="21" QFormat="true"
Name="Intense Emphasis"/>
<w:LsdException Locked="false" Priority="31" QFormat="true"
Name="Subtle Reference"/>
<w:LsdException Locked="false" Priority="32" QFormat="true"
Name="Intense Reference"/>
<w:LsdException Locked="false" Priority="33" QFormat="true" Name="Book Title"/>
<w:LsdException Locked="false" Priority="37" SemiHidden="true"
UnhideWhenUsed="true" Name="Bibliography"/>
<w:LsdException Locked="false" Priority="39" SemiHidden="true"
UnhideWhenUsed="true" QFormat="true" Name="TOC Heading"/>
<w:LsdException Locked="false" Priority="41" Name="Plain Table 1"/>
<w:LsdException Locked="false" Priority="42" Name="Plain Table 2"/>
<w:LsdException Locked="false" Priority="43" Name="Plain Table 3"/>
<w:LsdException Locked="false" Priority="44" Name="Plain Table 4"/>
<w:LsdException Locked="false" Priority="45" Name="Plain Table 5"/>
<w:LsdException Locked="false" Priority="40" Name="Grid Table Light"/>
<w:LsdException Locked="false" Priority="46" Name="Grid Table 1 Light"/>
<w:LsdException Locked="false" Priority="47" Name="Grid Table 2"/>
<w:LsdException Locked="false" Priority="48" Name="Grid Table 3"/>
<w:LsdException Locked="false" Priority="49" Name="Grid Table 4"/>
<w:LsdException Locked="false" Priority="50" Name="Grid Table 5 Dark"/>
<w:LsdException Locked="false" Priority="51" Name="Grid Table 6 Colorful"/>
<w:LsdException Locked="false" Priority="52" Name="Grid Table 7 Colorful"/>
<w:LsdException Locked="false" Priority="46"
Name="Grid Table 1 Light Accent 1"/>
<w:LsdException Locked="false" Priority="47" Name="Grid Table 2 Accent 1"/>
<w:LsdException Locked="false" Priority="48" Name="Grid Table 3 Accent 1"/>
<w:LsdException Locked="false" Priority="49" Name="Grid Table 4 Accent 1"/>
<w:LsdException Locked="false" Priority="50" Name="Grid Table 5 Dark Accent 1"/>
<w:LsdException Locked="false" Priority="51"
Name="Grid Table 6 Colorful Accent 1"/>
<w:LsdException Locked="false" Priority="52"
Name="Grid Table 7 Colorful Accent 1"/>
<w:LsdException Locked="false" Priority="46"
Name="Grid Table 1 Light Accent 2"/>
<w:LsdException Locked="false" Priority="47" Name="Grid Table 2 Accent 2"/>
<w:LsdException Locked="false" Priority="48" Name="Grid Table 3 Accent 2"/>
<w:LsdException Locked="false" Priority="49" Name="Grid Table 4 Accent 2"/>
<w:LsdException Locked="false" Priority="50" Name="Grid Table 5 Dark Accent 2"/>
<w:LsdException Locked="false" Priority="51"
Name="Grid Table 6 Colorful Accent 2"/>
<w:LsdException Locked="false" Priority="52"
Name="Grid Table 7 Colorful Accent 2"/>
<w:LsdException Locked="false" Priority="46"
Name="Grid Table 1 Light Accent 3"/>
<w:LsdException Locked="false" Priority="47" Name="Grid Table 2 Accent 3"/>
<w:LsdException Locked="false" Priority="48" Name="Grid Table 3 Accent 3"/>
<w:LsdException Locked="false" Priority="49" Name="Grid Table 4 Accent 3"/>
<w:LsdException Locked="false" Priority="50" Name="Grid Table 5 Dark Accent 3"/>
<w:LsdException Locked="false" Priority="51"
Name="Grid Table 6 Colorful Accent 3"/>
<w:LsdException Locked="false" Priority="52"
Name="Grid Table 7 Colorful Accent 3"/>
<w:LsdException Locked="false" Priority="46"
Name="Grid Table 1 Light Accent 4"/>
<w:LsdException Locked="false" Priority="47" Name="Grid Table 2 Accent 4"/>
<w:LsdException Locked="false" Priority="48" Name="Grid Table 3 Accent 4"/>
<w:LsdException Locked="false" Priority="49" Name="Grid Table 4 Accent 4"/>
<w:LsdException Locked="false" Priority="50" Name="Grid Table 5 Dark Accent 4"/>
<w:LsdException Locked="false" Priority="51"
Name="Grid Table 6 Colorful Accent 4"/>
<w:LsdException Locked="false" Priority="52"
Name="Grid Table 7 Colorful Accent 4"/>
<w:LsdException Locked="false" Priority="46"
Name="Grid Table 1 Light Accent 5"/>
<w:LsdException Locked="false" Priority="47" Name="Grid Table 2 Accent 5"/>
<w:LsdException Locked="false" Priority="48" Name="Grid Table 3 Accent 5"/>
<w:LsdException Locked="false" Priority="49" Name="Grid Table 4 Accent 5"/>
<w:LsdException Locked="false" Priority="50" Name="Grid Table 5 Dark Accent 5"/>
<w:LsdException Locked="false" Priority="51"
Name="Grid Table 6 Colorful Accent 5"/>
<w:LsdException Locked="false" Priority="52"
Name="Grid Table 7 Colorful Accent 5"/>
<w:LsdException Locked="false" Priority="46"
Name="Grid Table 1 Light Accent 6"/>
<w:LsdException Locked="false" Priority="47" Name="Grid Table 2 Accent 6"/>
<w:LsdException Locked="false" Priority="48" Name="Grid Table 3 Accent 6"/>
<w:LsdException Locked="false" Priority="49" Name="Grid Table 4 Accent 6"/>
<w:LsdException Locked="false" Priority="50" Name="Grid Table 5 Dark Accent 6"/>
<w:LsdException Locked="false" Priority="51"
Name="Grid Table 6 Colorful Accent 6"/>
<w:LsdException Locked="false" Priority="52"
Name="Grid Table 7 Colorful Accent 6"/>
<w:LsdException Locked="false" Priority="46" Name="List Table 1 Light"/>
<w:LsdException Locked="false" Priority="47" Name="List Table 2"/>
<w:LsdException Locked="false" Priority="48" Name="List Table 3"/>
<w:LsdException Locked="false" Priority="49" Name="List Table 4"/>
<w:LsdException Locked="false" Priority="50" Name="List Table 5 Dark"/>
<w:LsdException Locked="false" Priority="51" Name="List Table 6 Colorful"/>
<w:LsdException Locked="false" Priority="52" Name="List Table 7 Colorful"/>
<w:LsdException Locked="false" Priority="46"
Name="List Table 1 Light Accent 1"/>
<w:LsdException Locked="false" Priority="47" Name="List Table 2 Accent 1"/>
<w:LsdException Locked="false" Priority="48" Name="List Table 3 Accent 1"/>
<w:LsdException Locked="false" Priority="49" Name="List Table 4 Accent 1"/>
<w:LsdException Locked="false" Priority="50" Name="List Table 5 Dark Accent 1"/>
<w:LsdException Locked="false" Priority="51"
Name="List Table 6 Colorful Accent 1"/>
<w:LsdException Locked="false" Priority="52"
Name="List Table 7 Colorful Accent 1"/>
<w:LsdException Locked="false" Priority="46"
Name="List Table 1 Light Accent 2"/>
<w:LsdException Locked="false" Priority="47" Name="List Table 2 Accent 2"/>
<w:LsdException Locked="false" Priority="48" Name="List Table 3 Accent 2"/>
<w:LsdException Locked="false" Priority="49" Name="List Table 4 Accent 2"/>
<w:LsdException Locked="false" Priority="50" Name="List Table 5 Dark Accent 2"/>
<w:LsdException Locked="false" Priority="51"
Name="List Table 6 Colorful Accent 2"/>
<w:LsdException Locked="false" Priority="52"
Name="List Table 7 Colorful Accent 2"/>
<w:LsdException Locked="false" Priority="46"
Name="List Table 1 Light Accent 3"/>
<w:LsdException Locked="false" Priority="47" Name="List Table 2 Accent 3"/>
<w:LsdException Locked="false" Priority="48" Name="List Table 3 Accent 3"/>
<w:LsdException Locked="false" Priority="49" Name="List Table 4 Accent 3"/>
<w:LsdException Locked="false" Priority="50" Name="List Table 5 Dark Accent 3"/>
<w:LsdException Locked="false" Priority="51"
Name="List Table 6 Colorful Accent 3"/>
<w:LsdException Locked="false" Priority="52"
Name="List Table 7 Colorful Accent 3"/>
<w:LsdException Locked="false" Priority="46"
Name="List Table 1 Light Accent 4"/>
<w:LsdException Locked="false" Priority="47" Name="List Table 2 Accent 4"/>
<w:LsdException Locked="false" Priority="48" Name="List Table 3 Accent 4"/>
<w:LsdException Locked="false" Priority="49" Name="List Table 4 Accent 4"/>
<w:LsdException Locked="false" Priority="50" Name="List Table 5 Dark Accent 4"/>
<w:LsdException Locked="false" Priority="51"
Name="List Table 6 Colorful Accent 4"/>
<w:LsdException Locked="false" Priority="52"
Name="List Table 7 Colorful Accent 4"/>
<w:LsdException Locked="false" Priority="46"
Name="List Table 1 Light Accent 5"/>
<w:LsdException Locked="false" Priority="47" Name="List Table 2 Accent 5"/>
<w:LsdException Locked="false" Priority="48" Name="List Table 3 Accent 5"/>
<w:LsdException Locked="false" Priority="49" Name="List Table 4 Accent 5"/>
<w:LsdException Locked="false" Priority="50" Name="List Table 5 Dark Accent 5"/>
<w:LsdException Locked="false" Priority="51"
Name="List Table 6 Colorful Accent 5"/>
<w:LsdException Locked="false" Priority="52"
Name="List Table 7 Colorful Accent 5"/>
<w:LsdException Locked="false" Priority="46"
Name="List Table 1 Light Accent 6"/>
<w:LsdException Locked="false" Priority="47" Name="List Table 2 Accent 6"/>
<w:LsdException Locked="false" Priority="48" Name="List Table 3 Accent 6"/>
<w:LsdException Locked="false" Priority="49" Name="List Table 4 Accent 6"/>
<w:LsdException Locked="false" Priority="50" Name="List Table 5 Dark Accent 6"/>
<w:LsdException Locked="false" Priority="51"
Name="List Table 6 Colorful Accent 6"/>
<w:LsdException Locked="false" Priority="52"
Name="List Table 7 Colorful Accent 6"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="Mention"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="Smart Hyperlink"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="Hashtag"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="Unresolved Mention"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="Smart Link"/>
</w:LatentStyles>
</xml><![endif]-->
<style>
<!--
/* Font Definitions */
@font-face
{font-family:"Cambria Math";
panose-1:2 4 5 3 5 4 6 3 2 4;
mso-font-charset:0;
mso-generic-font-family:roman;
mso-font-pitch:variable;
mso-font-signature:-536870145 1107305727 0 0 415 0;}
@font-face
{font-family:Calibri;
panose-1:2 15 5 2 2 2 4 3 2 4;
mso-font-charset:0;
mso-generic-font-family:swiss;
mso-font-pitch:variable;
mso-font-signature:-536859905 -1073697537 9 0 511 0;}
@font-face
{font-family:Times;
panose-1:0 0 5 0 0 0 0 2 0 0;
mso-font-charset:0;
mso-generic-font-family:auto;
mso-font-pitch:variable;
mso-font-signature:-536870145 1342185562 0 0 415 0;}
/* Style Definitions */
p.MsoNormal, li.MsoNormal, div.MsoNormal
{mso-style-unhide:no;
mso-style-qformat:yes;
mso-style-parent:"";
margin:0cm;
margin-bottom:.0001pt;
mso-pagination:widow-orphan;
font-size:12.0pt;
font-family:"Calibri",sans-serif;
mso-ascii-font-family:Calibri;
mso-ascii-theme-font:minor-latin;
mso-fareast-font-family:Calibri;
mso-fareast-theme-font:minor-latin;
mso-hansi-font-family:Calibri;
mso-hansi-theme-font:minor-latin;
mso-bidi-font-family:"Times New Roman";
mso-bidi-theme-font:minor-bidi;
mso-fareast-language:EN-US;}
p
{mso-style-priority:99;
mso-margin-top-alt:auto;
margin-right:0cm;
mso-margin-bottom-alt:auto;
margin-left:0cm;
mso-pagination:widow-orphan;
font-size:12.0pt;
font-family:"Times New Roman",serif;
mso-fareast-font-family:"Times New Roman";}
.MsoChpDefault
{mso-style-type:export-only;
mso-default-props:yes;
font-family:"Calibri",sans-serif;
mso-ascii-font-family:Calibri;
mso-ascii-theme-font:minor-latin;
mso-fareast-font-family:Calibri;
mso-fareast-theme-font:minor-latin;
mso-hansi-font-family:Calibri;
mso-hansi-theme-font:minor-latin;
mso-bidi-font-family:"Times New Roman";
mso-bidi-theme-font:minor-bidi;
mso-fareast-language:EN-US;}
@page WordSection1
{size:595.0pt 842.0pt;
margin:72.0pt 72.0pt 72.0pt 72.0pt;
mso-header-margin:35.4pt;
mso-footer-margin:35.4pt;
mso-paper-source:0;}
div.WordSection1
{page:WordSection1;}
-->
</style>
<!--[if gte mso 10]>
<style>
/* Style Definitions */
table.MsoNormalTable
{mso-style-name:"Table Normal";
mso-tstyle-rowband-size:0;
mso-tstyle-colband-size:0;
mso-style-noshow:yes;
mso-style-priority:99;
mso-style-parent:"";
mso-padding-alt:0cm 5.4pt 0cm 5.4pt;
mso-para-margin:0cm;
mso-para-margin-bottom:.0001pt;
mso-pagination:widow-orphan;
font-size:12.0pt;
font-family:"Calibri",sans-serif;
mso-ascii-font-family:Calibri;
mso-ascii-theme-font:minor-latin;
mso-hansi-font-family:Calibri;
mso-hansi-theme-font:minor-latin;
mso-bidi-font-family:"Times New Roman";
mso-bidi-theme-font:minor-bidi;
mso-fareast-language:EN-US;}
</style>
<![endif]-->
<!--StartFragment-->
<!--EndFragment--><br />
<div class="MsoNormal">
<br /></div>
</div>
</div>
<div>
<b style="font-family: "times new roman", serif; font-size: 18.6667px;"><u>Conclusion:</u></b></div>
<div>
<b style="font-family: "times new roman", serif; font-size: 18.6667px;"><span style="font-family: "times"; font-size: small; font-weight: 400;"><br /></span></b></div>
<div>
<b style="font-family: "times new roman", serif; font-size: 18.6667px;"><span style="font-family: "times"; font-size: small; font-weight: 400;"> </span></b><span style="font-size: 13.5pt;">
</span><span style="font-size: small;">We see different types of references in java. An ordinary reference is a
strong reference which is the default type for all java objects. Weak and soft
references help to control how objects are garbage collected while phantom
reference helps to do some clean up operation when GC decides to remove and
object from memory. You can find the source code for this post <a href="https://github.com/agelenler/myblog/tree/master/java/src/references" target="_blank"><span style="color: #954f72;">here</span></a>.</span><br />
<!--[if gte mso 9]><xml>
<o:OfficeDocumentSettings>
<o:AllowPNG/>
</o:OfficeDocumentSettings>
</xml><![endif]-->
<!--[if gte mso 9]><xml>
<w:WordDocument>
<w:View>Normal</w:View>
<w:Zoom>0</w:Zoom>
<w:TrackMoves/>
<w:TrackFormatting/>
<w:PunctuationKerning/>
<w:ValidateAgainstSchemas/>
<w:SaveIfXMLInvalid>false</w:SaveIfXMLInvalid>
<w:IgnoreMixedContent>false</w:IgnoreMixedContent>
<w:AlwaysShowPlaceholderText>false</w:AlwaysShowPlaceholderText>
<w:DoNotPromoteQF/>
<w:LidThemeOther>EN-US</w:LidThemeOther>
<w:LidThemeAsian>X-NONE</w:LidThemeAsian>
<w:LidThemeComplexScript>X-NONE</w:LidThemeComplexScript>
<w:Compatibility>
<w:BreakWrappedTables/>
<w:SnapToGridInCell/>
<w:WrapTextWithPunct/>
<w:UseAsianBreakRules/>
<w:DontGrowAutofit/>
<w:SplitPgBreakAndParaMark/>
<w:EnableOpenTypeKerning/>
<w:DontFlipMirrorIndents/>
<w:OverrideTableStyleHps/>
</w:Compatibility>
<m:mathPr>
<m:mathFont m:val="Cambria Math"/>
<m:brkBin m:val="before"/>
<m:brkBinSub m:val="--"/>
<m:smallFrac m:val="off"/>
<m:dispDef/>
<m:lMargin m:val="0"/>
<m:rMargin m:val="0"/>
<m:defJc m:val="centerGroup"/>
<m:wrapIndent m:val="1440"/>
<m:intLim m:val="subSup"/>
<m:naryLim m:val="undOvr"/>
</m:mathPr></w:WordDocument>
</xml><![endif]--><!--[if gte mso 9]><xml>
<w:LatentStyles DefLockedState="false" DefUnhideWhenUsed="false"
DefSemiHidden="false" DefQFormat="false" DefPriority="99"
LatentStyleCount="376">
<w:LsdException Locked="false" Priority="0" QFormat="true" Name="Normal"/>
<w:LsdException Locked="false" Priority="9" QFormat="true" Name="heading 1"/>
<w:LsdException Locked="false" Priority="9" SemiHidden="true"
UnhideWhenUsed="true" QFormat="true" Name="heading 2"/>
<w:LsdException Locked="false" Priority="9" SemiHidden="true"
UnhideWhenUsed="true" QFormat="true" Name="heading 3"/>
<w:LsdException Locked="false" Priority="9" SemiHidden="true"
UnhideWhenUsed="true" QFormat="true" Name="heading 4"/>
<w:LsdException Locked="false" Priority="9" SemiHidden="true"
UnhideWhenUsed="true" QFormat="true" Name="heading 5"/>
<w:LsdException Locked="false" Priority="9" SemiHidden="true"
UnhideWhenUsed="true" QFormat="true" Name="heading 6"/>
<w:LsdException Locked="false" Priority="9" SemiHidden="true"
UnhideWhenUsed="true" QFormat="true" Name="heading 7"/>
<w:LsdException Locked="false" Priority="9" SemiHidden="true"
UnhideWhenUsed="true" QFormat="true" Name="heading 8"/>
<w:LsdException Locked="false" Priority="9" SemiHidden="true"
UnhideWhenUsed="true" QFormat="true" Name="heading 9"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="index 1"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="index 2"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="index 3"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="index 4"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="index 5"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="index 6"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="index 7"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="index 8"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="index 9"/>
<w:LsdException Locked="false" Priority="39" SemiHidden="true"
UnhideWhenUsed="true" Name="toc 1"/>
<w:LsdException Locked="false" Priority="39" SemiHidden="true"
UnhideWhenUsed="true" Name="toc 2"/>
<w:LsdException Locked="false" Priority="39" SemiHidden="true"
UnhideWhenUsed="true" Name="toc 3"/>
<w:LsdException Locked="false" Priority="39" SemiHidden="true"
UnhideWhenUsed="true" Name="toc 4"/>
<w:LsdException Locked="false" Priority="39" SemiHidden="true"
UnhideWhenUsed="true" Name="toc 5"/>
<w:LsdException Locked="false" Priority="39" SemiHidden="true"
UnhideWhenUsed="true" Name="toc 6"/>
<w:LsdException Locked="false" Priority="39" SemiHidden="true"
UnhideWhenUsed="true" Name="toc 7"/>
<w:LsdException Locked="false" Priority="39" SemiHidden="true"
UnhideWhenUsed="true" Name="toc 8"/>
<w:LsdException Locked="false" Priority="39" SemiHidden="true"
UnhideWhenUsed="true" Name="toc 9"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="Normal Indent"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="footnote text"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="annotation text"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="header"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="footer"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="index heading"/>
<w:LsdException Locked="false" Priority="35" SemiHidden="true"
UnhideWhenUsed="true" QFormat="true" Name="caption"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="table of figures"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="envelope address"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="envelope return"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="footnote reference"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="annotation reference"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="line number"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="page number"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="endnote reference"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="endnote text"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="table of authorities"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="macro"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="toa heading"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="List"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="List Bullet"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="List Number"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="List 2"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="List 3"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="List 4"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="List 5"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="List Bullet 2"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="List Bullet 3"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="List Bullet 4"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="List Bullet 5"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="List Number 2"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="List Number 3"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="List Number 4"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="List Number 5"/>
<w:LsdException Locked="false" Priority="10" QFormat="true" Name="Title"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="Closing"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="Signature"/>
<w:LsdException Locked="false" Priority="1" SemiHidden="true"
UnhideWhenUsed="true" Name="Default Paragraph Font"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="Body Text"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="Body Text Indent"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="List Continue"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="List Continue 2"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="List Continue 3"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="List Continue 4"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="List Continue 5"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="Message Header"/>
<w:LsdException Locked="false" Priority="11" QFormat="true" Name="Subtitle"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="Salutation"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="Date"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="Body Text First Indent"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="Body Text First Indent 2"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="Note Heading"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="Body Text 2"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="Body Text 3"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="Body Text Indent 2"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="Body Text Indent 3"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="Block Text"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="Hyperlink"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="FollowedHyperlink"/>
<w:LsdException Locked="false" Priority="22" QFormat="true" Name="Strong"/>
<w:LsdException Locked="false" Priority="20" QFormat="true" Name="Emphasis"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="Document Map"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="Plain Text"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="E-mail Signature"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="HTML Top of Form"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="HTML Bottom of Form"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="Normal (Web)"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="HTML Acronym"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="HTML Address"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="HTML Cite"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="HTML Code"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="HTML Definition"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="HTML Keyboard"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
QFormat="true" Name="HTML Preformatted"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="HTML Sample"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="HTML Typewriter"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="HTML Variable"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="Normal Table"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="annotation subject"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="No List"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="Outline List 1"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="Outline List 2"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="Outline List 3"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="Table Simple 1"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="Table Simple 2"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="Table Simple 3"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="Table Classic 1"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="Table Classic 2"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="Table Classic 3"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="Table Classic 4"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="Table Colorful 1"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="Table Colorful 2"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="Table Colorful 3"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="Table Columns 1"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="Table Columns 2"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="Table Columns 3"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="Table Columns 4"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="Table Columns 5"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="Table Grid 1"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="Table Grid 2"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="Table Grid 3"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="Table Grid 4"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="Table Grid 5"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="Table Grid 6"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="Table Grid 7"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="Table Grid 8"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="Table List 1"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="Table List 2"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="Table List 3"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="Table List 4"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="Table List 5"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="Table List 6"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="Table List 7"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="Table List 8"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="Table 3D effects 1"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="Table 3D effects 2"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="Table 3D effects 3"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="Table Contemporary"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="Table Elegant"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="Table Professional"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="Table Subtle 1"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="Table Subtle 2"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="Table Web 1"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="Table Web 2"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="Table Web 3"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="Balloon Text"/>
<w:LsdException Locked="false" Priority="39" Name="Table Grid"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="Table Theme"/>
<w:LsdException Locked="false" SemiHidden="true" Name="Placeholder Text"/>
<w:LsdException Locked="false" Priority="1" QFormat="true" Name="No Spacing"/>
<w:LsdException Locked="false" Priority="60" Name="Light Shading"/>
<w:LsdException Locked="false" Priority="61" Name="Light List"/>
<w:LsdException Locked="false" Priority="62" Name="Light Grid"/>
<w:LsdException Locked="false" Priority="63" Name="Medium Shading 1"/>
<w:LsdException Locked="false" Priority="64" Name="Medium Shading 2"/>
<w:LsdException Locked="false" Priority="65" Name="Medium List 1"/>
<w:LsdException Locked="false" Priority="66" Name="Medium List 2"/>
<w:LsdException Locked="false" Priority="67" Name="Medium Grid 1"/>
<w:LsdException Locked="false" Priority="68" Name="Medium Grid 2"/>
<w:LsdException Locked="false" Priority="69" Name="Medium Grid 3"/>
<w:LsdException Locked="false" Priority="70" Name="Dark List"/>
<w:LsdException Locked="false" Priority="71" Name="Colorful Shading"/>
<w:LsdException Locked="false" Priority="72" Name="Colorful List"/>
<w:LsdException Locked="false" Priority="73" Name="Colorful Grid"/>
<w:LsdException Locked="false" Priority="60" Name="Light Shading Accent 1"/>
<w:LsdException Locked="false" Priority="61" Name="Light List Accent 1"/>
<w:LsdException Locked="false" Priority="62" Name="Light Grid Accent 1"/>
<w:LsdException Locked="false" Priority="63" Name="Medium Shading 1 Accent 1"/>
<w:LsdException Locked="false" Priority="64" Name="Medium Shading 2 Accent 1"/>
<w:LsdException Locked="false" Priority="65" Name="Medium List 1 Accent 1"/>
<w:LsdException Locked="false" SemiHidden="true" Name="Revision"/>
<w:LsdException Locked="false" Priority="34" QFormat="true"
Name="List Paragraph"/>
<w:LsdException Locked="false" Priority="29" QFormat="true" Name="Quote"/>
<w:LsdException Locked="false" Priority="30" QFormat="true"
Name="Intense Quote"/>
<w:LsdException Locked="false" Priority="66" Name="Medium List 2 Accent 1"/>
<w:LsdException Locked="false" Priority="67" Name="Medium Grid 1 Accent 1"/>
<w:LsdException Locked="false" Priority="68" Name="Medium Grid 2 Accent 1"/>
<w:LsdException Locked="false" Priority="69" Name="Medium Grid 3 Accent 1"/>
<w:LsdException Locked="false" Priority="70" Name="Dark List Accent 1"/>
<w:LsdException Locked="false" Priority="71" Name="Colorful Shading Accent 1"/>
<w:LsdException Locked="false" Priority="72" Name="Colorful List Accent 1"/>
<w:LsdException Locked="false" Priority="73" Name="Colorful Grid Accent 1"/>
<w:LsdException Locked="false" Priority="60" Name="Light Shading Accent 2"/>
<w:LsdException Locked="false" Priority="61" Name="Light List Accent 2"/>
<w:LsdException Locked="false" Priority="62" Name="Light Grid Accent 2"/>
<w:LsdException Locked="false" Priority="63" Name="Medium Shading 1 Accent 2"/>
<w:LsdException Locked="false" Priority="64" Name="Medium Shading 2 Accent 2"/>
<w:LsdException Locked="false" Priority="65" Name="Medium List 1 Accent 2"/>
<w:LsdException Locked="false" Priority="66" Name="Medium List 2 Accent 2"/>
<w:LsdException Locked="false" Priority="67" Name="Medium Grid 1 Accent 2"/>
<w:LsdException Locked="false" Priority="68" Name="Medium Grid 2 Accent 2"/>
<w:LsdException Locked="false" Priority="69" Name="Medium Grid 3 Accent 2"/>
<w:LsdException Locked="false" Priority="70" Name="Dark List Accent 2"/>
<w:LsdException Locked="false" Priority="71" Name="Colorful Shading Accent 2"/>
<w:LsdException Locked="false" Priority="72" Name="Colorful List Accent 2"/>
<w:LsdException Locked="false" Priority="73" Name="Colorful Grid Accent 2"/>
<w:LsdException Locked="false" Priority="60" Name="Light Shading Accent 3"/>
<w:LsdException Locked="false" Priority="61" Name="Light List Accent 3"/>
<w:LsdException Locked="false" Priority="62" Name="Light Grid Accent 3"/>
<w:LsdException Locked="false" Priority="63" Name="Medium Shading 1 Accent 3"/>
<w:LsdException Locked="false" Priority="64" Name="Medium Shading 2 Accent 3"/>
<w:LsdException Locked="false" Priority="65" Name="Medium List 1 Accent 3"/>
<w:LsdException Locked="false" Priority="66" Name="Medium List 2 Accent 3"/>
<w:LsdException Locked="false" Priority="67" Name="Medium Grid 1 Accent 3"/>
<w:LsdException Locked="false" Priority="68" Name="Medium Grid 2 Accent 3"/>
<w:LsdException Locked="false" Priority="69" Name="Medium Grid 3 Accent 3"/>
<w:LsdException Locked="false" Priority="70" Name="Dark List Accent 3"/>
<w:LsdException Locked="false" Priority="71" Name="Colorful Shading Accent 3"/>
<w:LsdException Locked="false" Priority="72" Name="Colorful List Accent 3"/>
<w:LsdException Locked="false" Priority="73" Name="Colorful Grid Accent 3"/>
<w:LsdException Locked="false" Priority="60" Name="Light Shading Accent 4"/>
<w:LsdException Locked="false" Priority="61" Name="Light List Accent 4"/>
<w:LsdException Locked="false" Priority="62" Name="Light Grid Accent 4"/>
<w:LsdException Locked="false" Priority="63" Name="Medium Shading 1 Accent 4"/>
<w:LsdException Locked="false" Priority="64" Name="Medium Shading 2 Accent 4"/>
<w:LsdException Locked="false" Priority="65" Name="Medium List 1 Accent 4"/>
<w:LsdException Locked="false" Priority="66" Name="Medium List 2 Accent 4"/>
<w:LsdException Locked="false" Priority="67" Name="Medium Grid 1 Accent 4"/>
<w:LsdException Locked="false" Priority="68" Name="Medium Grid 2 Accent 4"/>
<w:LsdException Locked="false" Priority="69" Name="Medium Grid 3 Accent 4"/>
<w:LsdException Locked="false" Priority="70" Name="Dark List Accent 4"/>
<w:LsdException Locked="false" Priority="71" Name="Colorful Shading Accent 4"/>
<w:LsdException Locked="false" Priority="72" Name="Colorful List Accent 4"/>
<w:LsdException Locked="false" Priority="73" Name="Colorful Grid Accent 4"/>
<w:LsdException Locked="false" Priority="60" Name="Light Shading Accent 5"/>
<w:LsdException Locked="false" Priority="61" Name="Light List Accent 5"/>
<w:LsdException Locked="false" Priority="62" Name="Light Grid Accent 5"/>
<w:LsdException Locked="false" Priority="63" Name="Medium Shading 1 Accent 5"/>
<w:LsdException Locked="false" Priority="64" Name="Medium Shading 2 Accent 5"/>
<w:LsdException Locked="false" Priority="65" Name="Medium List 1 Accent 5"/>
<w:LsdException Locked="false" Priority="66" Name="Medium List 2 Accent 5"/>
<w:LsdException Locked="false" Priority="67" Name="Medium Grid 1 Accent 5"/>
<w:LsdException Locked="false" Priority="68" Name="Medium Grid 2 Accent 5"/>
<w:LsdException Locked="false" Priority="69" Name="Medium Grid 3 Accent 5"/>
<w:LsdException Locked="false" Priority="70" Name="Dark List Accent 5"/>
<w:LsdException Locked="false" Priority="71" Name="Colorful Shading Accent 5"/>
<w:LsdException Locked="false" Priority="72" Name="Colorful List Accent 5"/>
<w:LsdException Locked="false" Priority="73" Name="Colorful Grid Accent 5"/>
<w:LsdException Locked="false" Priority="60" Name="Light Shading Accent 6"/>
<w:LsdException Locked="false" Priority="61" Name="Light List Accent 6"/>
<w:LsdException Locked="false" Priority="62" Name="Light Grid Accent 6"/>
<w:LsdException Locked="false" Priority="63" Name="Medium Shading 1 Accent 6"/>
<w:LsdException Locked="false" Priority="64" Name="Medium Shading 2 Accent 6"/>
<w:LsdException Locked="false" Priority="65" Name="Medium List 1 Accent 6"/>
<w:LsdException Locked="false" Priority="66" Name="Medium List 2 Accent 6"/>
<w:LsdException Locked="false" Priority="67" Name="Medium Grid 1 Accent 6"/>
<w:LsdException Locked="false" Priority="68" Name="Medium Grid 2 Accent 6"/>
<w:LsdException Locked="false" Priority="69" Name="Medium Grid 3 Accent 6"/>
<w:LsdException Locked="false" Priority="70" Name="Dark List Accent 6"/>
<w:LsdException Locked="false" Priority="71" Name="Colorful Shading Accent 6"/>
<w:LsdException Locked="false" Priority="72" Name="Colorful List Accent 6"/>
<w:LsdException Locked="false" Priority="73" Name="Colorful Grid Accent 6"/>
<w:LsdException Locked="false" Priority="19" QFormat="true"
Name="Subtle Emphasis"/>
<w:LsdException Locked="false" Priority="21" QFormat="true"
Name="Intense Emphasis"/>
<w:LsdException Locked="false" Priority="31" QFormat="true"
Name="Subtle Reference"/>
<w:LsdException Locked="false" Priority="32" QFormat="true"
Name="Intense Reference"/>
<w:LsdException Locked="false" Priority="33" QFormat="true" Name="Book Title"/>
<w:LsdException Locked="false" Priority="37" SemiHidden="true"
UnhideWhenUsed="true" Name="Bibliography"/>
<w:LsdException Locked="false" Priority="39" SemiHidden="true"
UnhideWhenUsed="true" QFormat="true" Name="TOC Heading"/>
<w:LsdException Locked="false" Priority="41" Name="Plain Table 1"/>
<w:LsdException Locked="false" Priority="42" Name="Plain Table 2"/>
<w:LsdException Locked="false" Priority="43" Name="Plain Table 3"/>
<w:LsdException Locked="false" Priority="44" Name="Plain Table 4"/>
<w:LsdException Locked="false" Priority="45" Name="Plain Table 5"/>
<w:LsdException Locked="false" Priority="40" Name="Grid Table Light"/>
<w:LsdException Locked="false" Priority="46" Name="Grid Table 1 Light"/>
<w:LsdException Locked="false" Priority="47" Name="Grid Table 2"/>
<w:LsdException Locked="false" Priority="48" Name="Grid Table 3"/>
<w:LsdException Locked="false" Priority="49" Name="Grid Table 4"/>
<w:LsdException Locked="false" Priority="50" Name="Grid Table 5 Dark"/>
<w:LsdException Locked="false" Priority="51" Name="Grid Table 6 Colorful"/>
<w:LsdException Locked="false" Priority="52" Name="Grid Table 7 Colorful"/>
<w:LsdException Locked="false" Priority="46"
Name="Grid Table 1 Light Accent 1"/>
<w:LsdException Locked="false" Priority="47" Name="Grid Table 2 Accent 1"/>
<w:LsdException Locked="false" Priority="48" Name="Grid Table 3 Accent 1"/>
<w:LsdException Locked="false" Priority="49" Name="Grid Table 4 Accent 1"/>
<w:LsdException Locked="false" Priority="50" Name="Grid Table 5 Dark Accent 1"/>
<w:LsdException Locked="false" Priority="51"
Name="Grid Table 6 Colorful Accent 1"/>
<w:LsdException Locked="false" Priority="52"
Name="Grid Table 7 Colorful Accent 1"/>
<w:LsdException Locked="false" Priority="46"
Name="Grid Table 1 Light Accent 2"/>
<w:LsdException Locked="false" Priority="47" Name="Grid Table 2 Accent 2"/>
<w:LsdException Locked="false" Priority="48" Name="Grid Table 3 Accent 2"/>
<w:LsdException Locked="false" Priority="49" Name="Grid Table 4 Accent 2"/>
<w:LsdException Locked="false" Priority="50" Name="Grid Table 5 Dark Accent 2"/>
<w:LsdException Locked="false" Priority="51"
Name="Grid Table 6 Colorful Accent 2"/>
<w:LsdException Locked="false" Priority="52"
Name="Grid Table 7 Colorful Accent 2"/>
<w:LsdException Locked="false" Priority="46"
Name="Grid Table 1 Light Accent 3"/>
<w:LsdException Locked="false" Priority="47" Name="Grid Table 2 Accent 3"/>
<w:LsdException Locked="false" Priority="48" Name="Grid Table 3 Accent 3"/>
<w:LsdException Locked="false" Priority="49" Name="Grid Table 4 Accent 3"/>
<w:LsdException Locked="false" Priority="50" Name="Grid Table 5 Dark Accent 3"/>
<w:LsdException Locked="false" Priority="51"
Name="Grid Table 6 Colorful Accent 3"/>
<w:LsdException Locked="false" Priority="52"
Name="Grid Table 7 Colorful Accent 3"/>
<w:LsdException Locked="false" Priority="46"
Name="Grid Table 1 Light Accent 4"/>
<w:LsdException Locked="false" Priority="47" Name="Grid Table 2 Accent 4"/>
<w:LsdException Locked="false" Priority="48" Name="Grid Table 3 Accent 4"/>
<w:LsdException Locked="false" Priority="49" Name="Grid Table 4 Accent 4"/>
<w:LsdException Locked="false" Priority="50" Name="Grid Table 5 Dark Accent 4"/>
<w:LsdException Locked="false" Priority="51"
Name="Grid Table 6 Colorful Accent 4"/>
<w:LsdException Locked="false" Priority="52"
Name="Grid Table 7 Colorful Accent 4"/>
<w:LsdException Locked="false" Priority="46"
Name="Grid Table 1 Light Accent 5"/>
<w:LsdException Locked="false" Priority="47" Name="Grid Table 2 Accent 5"/>
<w:LsdException Locked="false" Priority="48" Name="Grid Table 3 Accent 5"/>
<w:LsdException Locked="false" Priority="49" Name="Grid Table 4 Accent 5"/>
<w:LsdException Locked="false" Priority="50" Name="Grid Table 5 Dark Accent 5"/>
<w:LsdException Locked="false" Priority="51"
Name="Grid Table 6 Colorful Accent 5"/>
<w:LsdException Locked="false" Priority="52"
Name="Grid Table 7 Colorful Accent 5"/>
<w:LsdException Locked="false" Priority="46"
Name="Grid Table 1 Light Accent 6"/>
<w:LsdException Locked="false" Priority="47" Name="Grid Table 2 Accent 6"/>
<w:LsdException Locked="false" Priority="48" Name="Grid Table 3 Accent 6"/>
<w:LsdException Locked="false" Priority="49" Name="Grid Table 4 Accent 6"/>
<w:LsdException Locked="false" Priority="50" Name="Grid Table 5 Dark Accent 6"/>
<w:LsdException Locked="false" Priority="51"
Name="Grid Table 6 Colorful Accent 6"/>
<w:LsdException Locked="false" Priority="52"
Name="Grid Table 7 Colorful Accent 6"/>
<w:LsdException Locked="false" Priority="46" Name="List Table 1 Light"/>
<w:LsdException Locked="false" Priority="47" Name="List Table 2"/>
<w:LsdException Locked="false" Priority="48" Name="List Table 3"/>
<w:LsdException Locked="false" Priority="49" Name="List Table 4"/>
<w:LsdException Locked="false" Priority="50" Name="List Table 5 Dark"/>
<w:LsdException Locked="false" Priority="51" Name="List Table 6 Colorful"/>
<w:LsdException Locked="false" Priority="52" Name="List Table 7 Colorful"/>
<w:LsdException Locked="false" Priority="46"
Name="List Table 1 Light Accent 1"/>
<w:LsdException Locked="false" Priority="47" Name="List Table 2 Accent 1"/>
<w:LsdException Locked="false" Priority="48" Name="List Table 3 Accent 1"/>
<w:LsdException Locked="false" Priority="49" Name="List Table 4 Accent 1"/>
<w:LsdException Locked="false" Priority="50" Name="List Table 5 Dark Accent 1"/>
<w:LsdException Locked="false" Priority="51"
Name="List Table 6 Colorful Accent 1"/>
<w:LsdException Locked="false" Priority="52"
Name="List Table 7 Colorful Accent 1"/>
<w:LsdException Locked="false" Priority="46"
Name="List Table 1 Light Accent 2"/>
<w:LsdException Locked="false" Priority="47" Name="List Table 2 Accent 2"/>
<w:LsdException Locked="false" Priority="48" Name="List Table 3 Accent 2"/>
<w:LsdException Locked="false" Priority="49" Name="List Table 4 Accent 2"/>
<w:LsdException Locked="false" Priority="50" Name="List Table 5 Dark Accent 2"/>
<w:LsdException Locked="false" Priority="51"
Name="List Table 6 Colorful Accent 2"/>
<w:LsdException Locked="false" Priority="52"
Name="List Table 7 Colorful Accent 2"/>
<w:LsdException Locked="false" Priority="46"
Name="List Table 1 Light Accent 3"/>
<w:LsdException Locked="false" Priority="47" Name="List Table 2 Accent 3"/>
<w:LsdException Locked="false" Priority="48" Name="List Table 3 Accent 3"/>
<w:LsdException Locked="false" Priority="49" Name="List Table 4 Accent 3"/>
<w:LsdException Locked="false" Priority="50" Name="List Table 5 Dark Accent 3"/>
<w:LsdException Locked="false" Priority="51"
Name="List Table 6 Colorful Accent 3"/>
<w:LsdException Locked="false" Priority="52"
Name="List Table 7 Colorful Accent 3"/>
<w:LsdException Locked="false" Priority="46"
Name="List Table 1 Light Accent 4"/>
<w:LsdException Locked="false" Priority="47" Name="List Table 2 Accent 4"/>
<w:LsdException Locked="false" Priority="48" Name="List Table 3 Accent 4"/>
<w:LsdException Locked="false" Priority="49" Name="List Table 4 Accent 4"/>
<w:LsdException Locked="false" Priority="50" Name="List Table 5 Dark Accent 4"/>
<w:LsdException Locked="false" Priority="51"
Name="List Table 6 Colorful Accent 4"/>
<w:LsdException Locked="false" Priority="52"
Name="List Table 7 Colorful Accent 4"/>
<w:LsdException Locked="false" Priority="46"
Name="List Table 1 Light Accent 5"/>
<w:LsdException Locked="false" Priority="47" Name="List Table 2 Accent 5"/>
<w:LsdException Locked="false" Priority="48" Name="List Table 3 Accent 5"/>
<w:LsdException Locked="false" Priority="49" Name="List Table 4 Accent 5"/>
<w:LsdException Locked="false" Priority="50" Name="List Table 5 Dark Accent 5"/>
<w:LsdException Locked="false" Priority="51"
Name="List Table 6 Colorful Accent 5"/>
<w:LsdException Locked="false" Priority="52"
Name="List Table 7 Colorful Accent 5"/>
<w:LsdException Locked="false" Priority="46"
Name="List Table 1 Light Accent 6"/>
<w:LsdException Locked="false" Priority="47" Name="List Table 2 Accent 6"/>
<w:LsdException Locked="false" Priority="48" Name="List Table 3 Accent 6"/>
<w:LsdException Locked="false" Priority="49" Name="List Table 4 Accent 6"/>
<w:LsdException Locked="false" Priority="50" Name="List Table 5 Dark Accent 6"/>
<w:LsdException Locked="false" Priority="51"
Name="List Table 6 Colorful Accent 6"/>
<w:LsdException Locked="false" Priority="52"
Name="List Table 7 Colorful Accent 6"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="Mention"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="Smart Hyperlink"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="Hashtag"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="Unresolved Mention"/>
<w:LsdException Locked="false" SemiHidden="true" UnhideWhenUsed="true"
Name="Smart Link"/>
</w:LatentStyles>
</xml><![endif]-->
<style>
<!--
/* Font Definitions */
@font-face
{font-family:"Cambria Math";
panose-1:2 4 5 3 5 4 6 3 2 4;
mso-font-charset:0;
mso-generic-font-family:roman;
mso-font-pitch:variable;
mso-font-signature:-536870145 1107305727 0 0 415 0;}
@font-face
{font-family:Calibri;
panose-1:2 15 5 2 2 2 4 3 2 4;
mso-font-charset:0;
mso-generic-font-family:swiss;
mso-font-pitch:variable;
mso-font-signature:-536859905 -1073697537 9 0 511 0;}
/* Style Definitions */
p.MsoNormal, li.MsoNormal, div.MsoNormal
{mso-style-unhide:no;
mso-style-qformat:yes;
mso-style-parent:"";
margin:0cm;
margin-bottom:.0001pt;
mso-pagination:widow-orphan;
font-size:12.0pt;
font-family:"Calibri",sans-serif;
mso-ascii-font-family:Calibri;
mso-ascii-theme-font:minor-latin;
mso-fareast-font-family:Calibri;
mso-fareast-theme-font:minor-latin;
mso-hansi-font-family:Calibri;
mso-hansi-theme-font:minor-latin;
mso-bidi-font-family:"Times New Roman";
mso-bidi-theme-font:minor-bidi;
mso-fareast-language:EN-US;}
a:link, span.MsoHyperlink
{mso-style-noshow:yes;
mso-style-priority:99;
color:blue;
text-decoration:underline;
text-underline:single;}
a:visited, span.MsoHyperlinkFollowed
{mso-style-noshow:yes;
mso-style-priority:99;
color:#954F72;
mso-themecolor:followedhyperlink;
text-decoration:underline;
text-underline:single;}
p
{mso-style-priority:99;
mso-margin-top-alt:auto;
margin-right:0cm;
mso-margin-bottom-alt:auto;
margin-left:0cm;
mso-pagination:widow-orphan;
font-size:12.0pt;
font-family:"Times New Roman",serif;
mso-fareast-font-family:"Times New Roman";}
.MsoChpDefault
{mso-style-type:export-only;
mso-default-props:yes;
font-family:"Calibri",sans-serif;
mso-ascii-font-family:Calibri;
mso-ascii-theme-font:minor-latin;
mso-fareast-font-family:Calibri;
mso-fareast-theme-font:minor-latin;
mso-hansi-font-family:Calibri;
mso-hansi-theme-font:minor-latin;
mso-bidi-font-family:"Times New Roman";
mso-bidi-theme-font:minor-bidi;
mso-fareast-language:EN-US;}
@page WordSection1
{size:595.0pt 842.0pt;
margin:72.0pt 72.0pt 72.0pt 72.0pt;
mso-header-margin:35.4pt;
mso-footer-margin:35.4pt;
mso-paper-source:0;}
div.WordSection1
{page:WordSection1;}
-->
</style>
<!--[if gte mso 10]>
<style>
/* Style Definitions */
table.MsoNormalTable
{mso-style-name:"Table Normal";
mso-tstyle-rowband-size:0;
mso-tstyle-colband-size:0;
mso-style-noshow:yes;
mso-style-priority:99;
mso-style-parent:"";
mso-padding-alt:0cm 5.4pt 0cm 5.4pt;
mso-para-margin:0cm;
mso-para-margin-bottom:.0001pt;
mso-pagination:widow-orphan;
font-size:12.0pt;
font-family:"Calibri",sans-serif;
mso-ascii-font-family:Calibri;
mso-ascii-theme-font:minor-latin;
mso-hansi-font-family:Calibri;
mso-hansi-theme-font:minor-latin;
mso-bidi-font-family:"Times New Roman";
mso-bidi-theme-font:minor-bidi;
mso-fareast-language:EN-US;}
</style>
<![endif]-->
<!--StartFragment-->
<br />
<div style="margin-bottom: 0.0001pt; margin-top: 0cm;">
<br /></div>
<!--EndFragment--></div>
<b style="font-family: "times new roman", serif; font-size: 18.6667px;"><u>References:</u></b><br />
<ul type="disc">
<li class="MsoNormal" style="line-height: normal;"><span style="font-size: x-small;">https://alvinalexander.com/java/jwarehouse/commons-io-2.0/src/main/java/org/apache/commons/io/FileCleaningTracker.java.shtml</span></li>
<li class="MsoNormal" style="line-height: normal;"><span style="font-size: x-small;">https://www.ibm.com/developerworks/java/library/j-jtp11225/</span></li>
<li class="MsoNormal" style="line-height: normal;"><span style="font-size: x-small;">https://dzone.com/articles/weak-soft-and-phantom-references-in-java-and-why-they-matter</span></li>
<li class="MsoNormal" style="line-height: normal;"><span style="font-size: x-small;">https://blogs.oracle.com/sundararajan/programmatically-dumping-heap-from-java-applications</span></li>
</ul>
<br />
<style type="text/css">
p.p1 {margin: 0.0px 0.0px 0.0px 0.0px; font: 9.0px Menlo; color: #a9b7c6}
p.p2 {margin: 0.0px 0.0px 0.0px 0.0px; font: 9.0px Menlo; color: #cc7832}
p.p3 {margin: 0.0px 0.0px 0.0px 0.0px; font: 9.0px Menlo; color: #6a8759}
p.p4 {margin: 0.0px 0.0px 0.0px 0.0px; font: 9.0px Menlo; color: #808080}
p.p5 {margin: 0.0px 0.0px 0.0px 0.0px; font: 10.0px Courier; color: #cc7832}
p.p6 {margin: 0.0px 0.0px 0.0px 0.0px; font: 10.0px Courier; color: #a9b7c6}
p.p7 {margin: 0.0px 0.0px 14.2px 0.0px; font: 9.0px Menlo; color: #a9b7c6}
span.s1 {color: #cc7832}
span.s2 {font: 10.0px Courier; color: #a9b7c6}
span.s3 {color: #9876aa}
span.s4 {color: #a9b7c6}
span.s5 {color: #6897bb}
span.s6 {font: 10.0px Courier; color: #cc7832}
span.s7 {color: #ffc66d}
span.s8 {font: 10.0px Courier}
span.s9 {font: 10.0px Courier; color: #808080}
span.s10 {color: #6a8759}
span.s11 {font: 9.0px Menlo; color: #a9b7c6}
span.s12 {font: 9.0px Menlo; color: #cc7832}
span.s13 {font: 9.0px Menlo}
span.s14 {font: 9.0px Menlo; color: #9876aa}
</style><style type="text/css">
@page { size: 8.27in 11.69in; margin: 0.79in }
p { margin-bottom: 0.1in; line-height: 115%; background: transparent }
</style><style type="text/css">
@page { size: 8.27in 11.69in; margin: 0.79in }
p { margin-bottom: 0.1in; line-height: 115%; background: transparent }
</style></div>
</div>
<style>
<!--
/* Font Definitions */
@font-face
{font-family:"Cambria Math";
panose-1:2 4 5 3 5 4 6 3 2 4;
mso-font-charset:0;
mso-generic-font-family:roman;
mso-font-pitch:variable;
mso-font-signature:-536870145 1107305727 0 0 415 0;}
@font-face
{font-family:Calibri;
panose-1:2 15 5 2 2 2 4 3 2 4;
mso-font-charset:0;
mso-generic-font-family:swiss;
mso-font-pitch:variable;
mso-font-signature:-536859905 -1073697537 9 0 511 0;}
@font-face
{font-family:Menlo;
panose-1:2 11 6 9 3 8 4 2 2 4;
mso-font-charset:0;
mso-generic-font-family:modern;
mso-font-pitch:fixed;
mso-font-signature:-436198657 -771687941 33554472 0 479 0;}
/* Style Definitions */
p.MsoNormal, li.MsoNormal, div.MsoNormal
{mso-style-unhide:no;
mso-style-qformat:yes;
mso-style-parent:"";
margin:0cm;
margin-bottom:.0001pt;
mso-pagination:widow-orphan;
font-size:12.0pt;
font-family:"Calibri",sans-serif;
mso-ascii-font-family:Calibri;
mso-ascii-theme-font:minor-latin;
mso-fareast-font-family:Calibri;
mso-fareast-theme-font:minor-latin;
mso-hansi-font-family:Calibri;
mso-hansi-theme-font:minor-latin;
mso-bidi-font-family:"Times New Roman";
mso-bidi-theme-font:minor-bidi;
mso-fareast-language:EN-US;}
p
{mso-style-noshow:yes;
mso-style-priority:99;
mso-margin-top-alt:auto;
margin-right:0cm;
mso-margin-bottom-alt:auto;
margin-left:0cm;
mso-pagination:widow-orphan;
font-size:12.0pt;
font-family:"Times New Roman",serif;
mso-fareast-font-family:"Times New Roman";}
pre
{mso-style-noshow:yes;
mso-style-priority:99;
mso-style-link:"HTML Preformatted Char";
margin:0cm;
margin-bottom:.0001pt;
mso-pagination:widow-orphan;
tab-stops:45.8pt 91.6pt 137.4pt 183.2pt 229.0pt 274.8pt 320.6pt 366.4pt 412.2pt 458.0pt 503.8pt 549.6pt 595.4pt 641.2pt 687.0pt 732.8pt;
font-size:10.0pt;
font-family:"Courier New";
mso-fareast-font-family:"Times New Roman";}
span.HTMLPreformattedChar
{mso-style-name:"HTML Preformatted Char";
mso-style-noshow:yes;
mso-style-priority:99;
mso-style-unhide:no;
mso-style-locked:yes;
mso-style-link:"HTML Preformatted";
mso-ansi-font-size:10.0pt;
mso-bidi-font-size:10.0pt;
font-family:"Courier New";
mso-ascii-font-family:"Courier New";
mso-fareast-font-family:"Times New Roman";
mso-hansi-font-family:"Courier New";
mso-bidi-font-family:"Courier New";
mso-fareast-language:EN-GB;}
.MsoChpDefault
{mso-style-type:export-only;
mso-default-props:yes;
font-family:"Calibri",sans-serif;
mso-ascii-font-family:Calibri;
mso-ascii-theme-font:minor-latin;
mso-fareast-font-family:Calibri;
mso-fareast-theme-font:minor-latin;
mso-hansi-font-family:Calibri;
mso-hansi-theme-font:minor-latin;
mso-bidi-font-family:"Times New Roman";
mso-bidi-theme-font:minor-bidi;
mso-fareast-language:EN-US;}
@page WordSection1
{size:595.0pt 842.0pt;
margin:72.0pt 72.0pt 72.0pt 72.0pt;
mso-header-margin:35.4pt;
mso-footer-margin:35.4pt;
mso-paper-source:0;}
div.WordSection1
{page:WordSection1;}
-->
</style><style>
<!--
/* Font Definitions */
@font-face
{font-family:"Cambria Math";
panose-1:2 4 5 3 5 4 6 3 2 4;
mso-font-charset:0;
mso-generic-font-family:roman;
mso-font-pitch:variable;
mso-font-signature:-536870145 1107305727 0 0 415 0;}
@font-face
{font-family:Calibri;
panose-1:2 15 5 2 2 2 4 3 2 4;
mso-font-charset:0;
mso-generic-font-family:swiss;
mso-font-pitch:variable;
mso-font-signature:-536859905 -1073697537 9 0 511 0;}
@font-face
{font-family:Menlo;
panose-1:2 11 6 9 3 8 4 2 2 4;
mso-font-charset:0;
mso-generic-font-family:modern;
mso-font-pitch:fixed;
mso-font-signature:-436198657 -771687941 33554472 0 479 0;}
/* Style Definitions */
p.MsoNormal, li.MsoNormal, div.MsoNormal
{mso-style-unhide:no;
mso-style-qformat:yes;
mso-style-parent:"";
margin:0cm;
margin-bottom:.0001pt;
mso-pagination:widow-orphan;
font-size:12.0pt;
font-family:"Calibri",sans-serif;
mso-ascii-font-family:Calibri;
mso-ascii-theme-font:minor-latin;
mso-fareast-font-family:Calibri;
mso-fareast-theme-font:minor-latin;
mso-hansi-font-family:Calibri;
mso-hansi-theme-font:minor-latin;
mso-bidi-font-family:"Times New Roman";
mso-bidi-theme-font:minor-bidi;
mso-fareast-language:EN-US;}
pre
{mso-style-noshow:yes;
mso-style-priority:99;
mso-style-link:"HTML Preformatted Char";
margin:0cm;
margin-bottom:.0001pt;
mso-pagination:widow-orphan;
font-size:10.0pt;
font-family:"Courier New";
mso-fareast-font-family:"Times New Roman";}
span.HTMLPreformattedChar
{mso-style-name:"HTML Preformatted Char";
mso-style-noshow:yes;
mso-style-priority:99;
mso-style-unhide:no;
mso-style-locked:yes;
mso-style-link:"HTML Preformatted";
mso-ansi-font-size:10.0pt;
mso-bidi-font-size:10.0pt;
font-family:"Courier New";
mso-ascii-font-family:"Courier New";
mso-fareast-font-family:"Times New Roman";
mso-hansi-font-family:"Courier New";
mso-bidi-font-family:"Courier New";
mso-fareast-language:EN-GB;}
.MsoChpDefault
{mso-style-type:export-only;
mso-default-props:yes;
font-family:"Calibri",sans-serif;
mso-ascii-font-family:Calibri;
mso-ascii-theme-font:minor-latin;
mso-fareast-font-family:Calibri;
mso-fareast-theme-font:minor-latin;
mso-hansi-font-family:Calibri;
mso-hansi-theme-font:minor-latin;
mso-bidi-font-family:"Times New Roman";
mso-bidi-theme-font:minor-bidi;
mso-fareast-language:EN-US;}
@page WordSection1
{size:595.0pt 842.0pt;
margin:72.0pt 72.0pt 72.0pt 72.0pt;
mso-header-margin:35.4pt;
mso-footer-margin:35.4pt;
mso-paper-source:0;}
div.WordSection1
{page:WordSection1;}
-->
</style><style>
<!--
/* Font Definitions */
@font-face
{font-family:"Cambria Math";
panose-1:2 4 5 3 5 4 6 3 2 4;
mso-font-charset:0;
mso-generic-font-family:roman;
mso-font-pitch:variable;
mso-font-signature:-536870145 1107305727 0 0 415 0;}
@font-face
{font-family:Calibri;
panose-1:2 15 5 2 2 2 4 3 2 4;
mso-font-charset:0;
mso-generic-font-family:swiss;
mso-font-pitch:variable;
mso-font-signature:-536859905 -1073697537 9 0 511 0;}
@font-face
{font-family:Menlo;
panose-1:2 11 6 9 3 8 4 2 2 4;
mso-font-charset:0;
mso-generic-font-family:modern;
mso-font-pitch:fixed;
mso-font-signature:-436198657 -771687941 33554472 0 479 0;}
/* Style Definitions */
p.MsoNormal, li.MsoNormal, div.MsoNormal
{mso-style-unhide:no;
mso-style-qformat:yes;
mso-style-parent:"";
margin:0cm;
margin-bottom:.0001pt;
mso-pagination:widow-orphan;
font-size:12.0pt;
font-family:"Calibri",sans-serif;
mso-ascii-font-family:Calibri;
mso-ascii-theme-font:minor-latin;
mso-fareast-font-family:Calibri;
mso-fareast-theme-font:minor-latin;
mso-hansi-font-family:Calibri;
mso-hansi-theme-font:minor-latin;
mso-bidi-font-family:"Times New Roman";
mso-bidi-theme-font:minor-bidi;
mso-fareast-language:EN-US;}
pre
{mso-style-noshow:yes;
mso-style-priority:99;
mso-style-link:"HTML Preformatted Char";
margin:0cm;
margin-bottom:.0001pt;
mso-pagination:widow-orphan;
font-size:10.0pt;
font-family:"Courier New";
mso-fareast-font-family:"Times New Roman";}
span.HTMLPreformattedChar
{mso-style-name:"HTML Preformatted Char";
mso-style-noshow:yes;
mso-style-priority:99;
mso-style-unhide:no;
mso-style-locked:yes;
mso-style-link:"HTML Preformatted";
mso-ansi-font-size:10.0pt;
mso-bidi-font-size:10.0pt;
font-family:"Courier New";
mso-ascii-font-family:"Courier New";
mso-fareast-font-family:"Times New Roman";
mso-hansi-font-family:"Courier New";
mso-bidi-font-family:"Courier New";
mso-fareast-language:EN-GB;}
.MsoChpDefault
{mso-style-type:export-only;
mso-default-props:yes;
font-family:"Calibri",sans-serif;
mso-ascii-font-family:Calibri;
mso-ascii-theme-font:minor-latin;
mso-fareast-font-family:Calibri;
mso-fareast-theme-font:minor-latin;
mso-hansi-font-family:Calibri;
mso-hansi-theme-font:minor-latin;
mso-bidi-font-family:"Times New Roman";
mso-bidi-theme-font:minor-bidi;
mso-fareast-language:EN-US;}
@page WordSection1
{size:595.0pt 842.0pt;
margin:72.0pt 72.0pt 72.0pt 72.0pt;
mso-header-margin:35.4pt;
mso-footer-margin:35.4pt;
mso-paper-source:0;}
div.WordSection1
{page:WordSection1;}
-->
</style><br />
<style>
<!--
/* Font Definitions */
@font-face
{font-family:"Cambria Math";
panose-1:2 4 5 3 5 4 6 3 2 4;
mso-font-charset:0;
mso-generic-font-family:roman;
mso-font-pitch:variable;
mso-font-signature:-536870145 1107305727 0 0 415 0;}
@font-face
{font-family:Calibri;
panose-1:2 15 5 2 2 2 4 3 2 4;
mso-font-charset:0;
mso-generic-font-family:swiss;
mso-font-pitch:variable;
mso-font-signature:-536859905 -1073697537 9 0 511 0;}
@font-face
{font-family:Menlo;
panose-1:2 11 6 9 3 8 4 2 2 4;
mso-font-charset:0;
mso-generic-font-family:modern;
mso-font-pitch:fixed;
mso-font-signature:-436198657 -771687941 33554472 0 479 0;}
/* Style Definitions */
p.MsoNormal, li.MsoNormal, div.MsoNormal
{mso-style-unhide:no;
mso-style-qformat:yes;
mso-style-parent:"";
margin:0cm;
margin-bottom:.0001pt;
mso-pagination:widow-orphan;
font-size:12.0pt;
font-family:"Calibri",sans-serif;
mso-ascii-font-family:Calibri;
mso-ascii-theme-font:minor-latin;
mso-fareast-font-family:Calibri;
mso-fareast-theme-font:minor-latin;
mso-hansi-font-family:Calibri;
mso-hansi-theme-font:minor-latin;
mso-bidi-font-family:"Times New Roman";
mso-bidi-theme-font:minor-bidi;
mso-fareast-language:EN-US;}
pre
{mso-style-noshow:yes;
mso-style-priority:99;
mso-style-link:"HTML Preformatted Char";
margin:0cm;
margin-bottom:.0001pt;
mso-pagination:widow-orphan;
font-size:10.0pt;
font-family:"Courier New";
mso-fareast-font-family:"Times New Roman";}
span.HTMLPreformattedChar
{mso-style-name:"HTML Preformatted Char";
mso-style-noshow:yes;
mso-style-priority:99;
mso-style-unhide:no;
mso-style-locked:yes;
mso-style-link:"HTML Preformatted";
mso-ansi-font-size:10.0pt;
mso-bidi-font-size:10.0pt;
font-family:"Courier New";
mso-ascii-font-family:"Courier New";
mso-fareast-font-family:"Times New Roman";
mso-hansi-font-family:"Courier New";
mso-bidi-font-family:"Courier New";
mso-fareast-language:EN-GB;}
.MsoChpDefault
{mso-style-type:export-only;
mso-default-props:yes;
font-family:"Calibri",sans-serif;
mso-ascii-font-family:Calibri;
mso-ascii-theme-font:minor-latin;
mso-fareast-font-family:Calibri;
mso-fareast-theme-font:minor-latin;
mso-hansi-font-family:Calibri;
mso-hansi-theme-font:minor-latin;
mso-bidi-font-family:"Times New Roman";
mso-bidi-theme-font:minor-bidi;
mso-fareast-language:EN-US;}
@page WordSection1
{size:595.0pt 842.0pt;
margin:72.0pt 72.0pt 72.0pt 72.0pt;
mso-header-margin:35.4pt;
mso-footer-margin:35.4pt;
mso-paper-source:0;}
div.WordSection1
{page:WordSection1;}
-->
</style><br />
<style>
<!--
/* Font Definitions */
@font-face
{font-family:"Cambria Math";
panose-1:2 4 5 3 5 4 6 3 2 4;
mso-font-charset:0;
mso-generic-font-family:roman;
mso-font-pitch:variable;
mso-font-signature:-536870145 1107305727 0 0 415 0;}
@font-face
{font-family:Calibri;
panose-1:2 15 5 2 2 2 4 3 2 4;
mso-font-charset:0;
mso-generic-font-family:swiss;
mso-font-pitch:variable;
mso-font-signature:-536859905 -1073697537 9 0 511 0;}
/* Style Definitions */
p.MsoNormal, li.MsoNormal, div.MsoNormal
{mso-style-unhide:no;
mso-style-qformat:yes;
mso-style-parent:"";
margin:0cm;
margin-bottom:.0001pt;
mso-pagination:widow-orphan;
font-size:12.0pt;
font-family:"Calibri",sans-serif;
mso-ascii-font-family:Calibri;
mso-ascii-theme-font:minor-latin;
mso-fareast-font-family:Calibri;
mso-fareast-theme-font:minor-latin;
mso-hansi-font-family:Calibri;
mso-hansi-theme-font:minor-latin;
mso-bidi-font-family:"Times New Roman";
mso-bidi-theme-font:minor-bidi;
mso-fareast-language:EN-US;}
.MsoChpDefault
{mso-style-type:export-only;
mso-default-props:yes;
font-family:"Calibri",sans-serif;
mso-ascii-font-family:Calibri;
mso-ascii-theme-font:minor-latin;
mso-fareast-font-family:Calibri;
mso-fareast-theme-font:minor-latin;
mso-hansi-font-family:Calibri;
mso-hansi-theme-font:minor-latin;
mso-bidi-font-family:"Times New Roman";
mso-bidi-theme-font:minor-bidi;
mso-fareast-language:EN-US;}
@page WordSection1
{size:595.0pt 842.0pt;
margin:72.0pt 72.0pt 72.0pt 72.0pt;
mso-header-margin:35.4pt;
mso-footer-margin:35.4pt;
mso-paper-source:0;}
div.WordSection1
{page:WordSection1;}
-->
</style><style>
<!--
/* Font Definitions */
@font-face
{font-family:"Cambria Math";
panose-1:2 4 5 3 5 4 6 3 2 4;
mso-font-charset:0;
mso-generic-font-family:roman;
mso-font-pitch:variable;
mso-font-signature:-536870145 1107305727 0 0 415 0;}
@font-face
{font-family:Calibri;
panose-1:2 15 5 2 2 2 4 3 2 4;
mso-font-charset:0;
mso-generic-font-family:swiss;
mso-font-pitch:variable;
mso-font-signature:-536859905 -1073697537 9 0 511 0;}
@font-face
{font-family:Times;
panose-1:0 0 5 0 0 0 0 2 0 0;
mso-font-charset:0;
mso-generic-font-family:auto;
mso-font-pitch:variable;
mso-font-signature:-536870145 1342185562 0 0 415 0;}
/* Style Definitions */
p.MsoNormal, li.MsoNormal, div.MsoNormal
{mso-style-unhide:no;
mso-style-qformat:yes;
mso-style-parent:"";
margin:0cm;
margin-bottom:.0001pt;
mso-pagination:widow-orphan;
font-size:12.0pt;
font-family:"Calibri",sans-serif;
mso-ascii-font-family:Calibri;
mso-ascii-theme-font:minor-latin;
mso-fareast-font-family:Calibri;
mso-fareast-theme-font:minor-latin;
mso-hansi-font-family:Calibri;
mso-hansi-theme-font:minor-latin;
mso-bidi-font-family:"Times New Roman";
mso-bidi-theme-font:minor-bidi;
mso-fareast-language:EN-US;}
p
{mso-style-priority:99;
mso-margin-top-alt:auto;
margin-right:0cm;
mso-margin-bottom-alt:auto;
margin-left:0cm;
mso-pagination:widow-orphan;
font-size:12.0pt;
font-family:"Times New Roman",serif;
mso-fareast-font-family:"Times New Roman";}
.MsoChpDefault
{mso-style-type:export-only;
mso-default-props:yes;
font-family:"Calibri",sans-serif;
mso-ascii-font-family:Calibri;
mso-ascii-theme-font:minor-latin;
mso-fareast-font-family:Calibri;
mso-fareast-theme-font:minor-latin;
mso-hansi-font-family:Calibri;
mso-hansi-theme-font:minor-latin;
mso-bidi-font-family:"Times New Roman";
mso-bidi-theme-font:minor-bidi;
mso-fareast-language:EN-US;}
@page WordSection1
{size:612.0pt 792.0pt;
margin:72.0pt 72.0pt 72.0pt 72.0pt;
mso-header-margin:36.0pt;
mso-footer-margin:36.0pt;
mso-paper-source:0;}
div.WordSection1
{page:WordSection1;}
-->
</style><style>
<!--
/* Font Definitions */
@font-face
{font-family:"Cambria Math";
panose-1:2 4 5 3 5 4 6 3 2 4;
mso-font-charset:0;
mso-generic-font-family:roman;
mso-font-pitch:variable;
mso-font-signature:-536870145 1107305727 0 0 415 0;}
@font-face
{font-family:Calibri;
panose-1:2 15 5 2 2 2 4 3 2 4;
mso-font-charset:0;
mso-generic-font-family:swiss;
mso-font-pitch:variable;
mso-font-signature:-536859905 -1073697537 9 0 511 0;}
/* Style Definitions */
p.MsoNormal, li.MsoNormal, div.MsoNormal
{mso-style-unhide:no;
mso-style-qformat:yes;
mso-style-parent:"";
margin:0cm;
margin-bottom:.0001pt;
mso-pagination:widow-orphan;
font-size:12.0pt;
font-family:"Calibri",sans-serif;
mso-ascii-font-family:Calibri;
mso-ascii-theme-font:minor-latin;
mso-fareast-font-family:Calibri;
mso-fareast-theme-font:minor-latin;
mso-hansi-font-family:Calibri;
mso-hansi-theme-font:minor-latin;
mso-bidi-font-family:"Times New Roman";
mso-bidi-theme-font:minor-bidi;
mso-fareast-language:EN-US;}
.MsoChpDefault
{mso-style-type:export-only;
mso-default-props:yes;
font-family:"Calibri",sans-serif;
mso-ascii-font-family:Calibri;
mso-ascii-theme-font:minor-latin;
mso-fareast-font-family:Calibri;
mso-fareast-theme-font:minor-latin;
mso-hansi-font-family:Calibri;
mso-hansi-theme-font:minor-latin;
mso-bidi-font-family:"Times New Roman";
mso-bidi-theme-font:minor-bidi;
mso-fareast-language:EN-US;}
@page WordSection1
{size:595.0pt 842.0pt;
margin:72.0pt 72.0pt 72.0pt 72.0pt;
mso-header-margin:35.4pt;
mso-footer-margin:35.4pt;
mso-paper-source:0;}
div.WordSection1
{page:WordSection1;}
-->
</style><style>
<!--
/* Font Definitions */
@font-face
{font-family:"Cambria Math";
panose-1:2 4 5 3 5 4 6 3 2 4;
mso-font-charset:0;
mso-generic-font-family:roman;
mso-font-pitch:variable;
mso-font-signature:-536870145 1107305727 0 0 415 0;}
@font-face
{font-family:Calibri;
panose-1:2 15 5 2 2 2 4 3 2 4;
mso-font-charset:0;
mso-generic-font-family:swiss;
mso-font-pitch:variable;
mso-font-signature:-536859905 -1073697537 9 0 511 0;}
/* Style Definitions */
p.MsoNormal, li.MsoNormal, div.MsoNormal
{mso-style-unhide:no;
mso-style-qformat:yes;
mso-style-parent:"";
margin:0cm;
margin-bottom:.0001pt;
mso-pagination:widow-orphan;
font-size:12.0pt;
font-family:"Calibri",sans-serif;
mso-ascii-font-family:Calibri;
mso-ascii-theme-font:minor-latin;
mso-fareast-font-family:Calibri;
mso-fareast-theme-font:minor-latin;
mso-hansi-font-family:Calibri;
mso-hansi-theme-font:minor-latin;
mso-bidi-font-family:"Times New Roman";
mso-bidi-theme-font:minor-bidi;
mso-fareast-language:EN-US;}
p
{mso-style-priority:99;
mso-margin-top-alt:auto;
margin-right:0cm;
mso-margin-bottom-alt:auto;
margin-left:0cm;
mso-pagination:widow-orphan;
font-size:12.0pt;
font-family:"Times New Roman",serif;
mso-fareast-font-family:"Times New Roman";}
.MsoChpDefault
{mso-style-type:export-only;
mso-default-props:yes;
font-family:"Calibri",sans-serif;
mso-ascii-font-family:Calibri;
mso-ascii-theme-font:minor-latin;
mso-fareast-font-family:Calibri;
mso-fareast-theme-font:minor-latin;
mso-hansi-font-family:Calibri;
mso-hansi-theme-font:minor-latin;
mso-bidi-font-family:"Times New Roman";
mso-bidi-theme-font:minor-bidi;
mso-fareast-language:EN-US;}
@page WordSection1
{size:595.0pt 842.0pt;
margin:72.0pt 72.0pt 72.0pt 72.0pt;
mso-header-margin:35.4pt;
mso-footer-margin:35.4pt;
mso-paper-source:0;}
div.WordSection1
{page:WordSection1;}
-->
</style><style>
<!--
/* Font Definitions */
@font-face
{font-family:"Cambria Math";
panose-1:2 4 5 3 5 4 6 3 2 4;
mso-font-charset:0;
mso-generic-font-family:roman;
mso-font-pitch:variable;
mso-font-signature:-536870145 1107305727 0 0 415 0;}
@font-face
{font-family:Calibri;
panose-1:2 15 5 2 2 2 4 3 2 4;
mso-font-charset:0;
mso-generic-font-family:swiss;
mso-font-pitch:variable;
mso-font-signature:-536859905 -1073697537 9 0 511 0;}
/* Style Definitions */
p.MsoNormal, li.MsoNormal, div.MsoNormal
{mso-style-unhide:no;
mso-style-qformat:yes;
mso-style-parent:"";
margin:0cm;
margin-bottom:.0001pt;
mso-pagination:widow-orphan;
font-size:12.0pt;
font-family:"Calibri",sans-serif;
mso-ascii-font-family:Calibri;
mso-ascii-theme-font:minor-latin;
mso-fareast-font-family:Calibri;
mso-fareast-theme-font:minor-latin;
mso-hansi-font-family:Calibri;
mso-hansi-theme-font:minor-latin;
mso-bidi-font-family:"Times New Roman";
mso-bidi-theme-font:minor-bidi;
mso-fareast-language:EN-US;}
.MsoChpDefault
{mso-style-type:export-only;
mso-default-props:yes;
font-family:"Calibri",sans-serif;
mso-ascii-font-family:Calibri;
mso-ascii-theme-font:minor-latin;
mso-fareast-font-family:Calibri;
mso-fareast-theme-font:minor-latin;
mso-hansi-font-family:Calibri;
mso-hansi-theme-font:minor-latin;
mso-bidi-font-family:"Times New Roman";
mso-bidi-theme-font:minor-bidi;
mso-fareast-language:EN-US;}
@page WordSection1
{size:595.0pt 842.0pt;
margin:72.0pt 72.0pt 72.0pt 72.0pt;
mso-header-margin:35.4pt;
mso-footer-margin:35.4pt;
mso-paper-source:0;}
div.WordSection1
{page:WordSection1;}
-->
</style><style>
<!--
/* Font Definitions */
@font-face
{font-family:"Cambria Math";
panose-1:2 4 5 3 5 4 6 3 2 4;
mso-font-charset:0;
mso-generic-font-family:roman;
mso-font-pitch:variable;
mso-font-signature:-536870145 1107305727 0 0 415 0;}
@font-face
{font-family:Calibri;
panose-1:2 15 5 2 2 2 4 3 2 4;
mso-font-charset:0;
mso-generic-font-family:swiss;
mso-font-pitch:variable;
mso-font-signature:-536859905 -1073697537 9 0 511 0;}
/* Style Definitions */
p.MsoNormal, li.MsoNormal, div.MsoNormal
{mso-style-unhide:no;
mso-style-qformat:yes;
mso-style-parent:"";
margin:0cm;
margin-bottom:.0001pt;
mso-pagination:widow-orphan;
font-size:12.0pt;
font-family:"Calibri",sans-serif;
mso-ascii-font-family:Calibri;
mso-ascii-theme-font:minor-latin;
mso-fareast-font-family:Calibri;
mso-fareast-theme-font:minor-latin;
mso-hansi-font-family:Calibri;
mso-hansi-theme-font:minor-latin;
mso-bidi-font-family:"Times New Roman";
mso-bidi-theme-font:minor-bidi;
mso-fareast-language:EN-US;}
a:link, span.MsoHyperlink
{mso-style-noshow:yes;
mso-style-priority:99;
color:blue;
text-decoration:underline;
text-underline:single;}
a:visited, span.MsoHyperlinkFollowed
{mso-style-noshow:yes;
mso-style-priority:99;
color:#954F72;
mso-themecolor:followedhyperlink;
text-decoration:underline;
text-underline:single;}
p
{mso-style-priority:99;
mso-margin-top-alt:auto;
margin-right:0cm;
mso-margin-bottom-alt:auto;
margin-left:0cm;
mso-pagination:widow-orphan;
font-size:12.0pt;
font-family:"Times New Roman",serif;
mso-fareast-font-family:"Times New Roman";}
.MsoChpDefault
{mso-style-type:export-only;
mso-default-props:yes;
font-family:"Calibri",sans-serif;
mso-ascii-font-family:Calibri;
mso-ascii-theme-font:minor-latin;
mso-fareast-font-family:Calibri;
mso-fareast-theme-font:minor-latin;
mso-hansi-font-family:Calibri;
mso-hansi-theme-font:minor-latin;
mso-bidi-font-family:"Times New Roman";
mso-bidi-theme-font:minor-bidi;
mso-fareast-language:EN-US;}
@page WordSection1
{size:595.0pt 842.0pt;
margin:72.0pt 72.0pt 72.0pt 72.0pt;
mso-header-margin:35.4pt;
mso-footer-margin:35.4pt;
mso-paper-source:0;}
div.WordSection1
{page:WordSection1;}
-->
</style>Ali Gelenlerhttp://www.blogger.com/profile/09439697648573423668noreply@blogger.com0tag:blogger.com,1999:blog-3858181542467916490.post-69121323655933790512018-04-30T22:24:00.000+03:002019-08-11T13:53:45.819+03:00A Simple Spring Boot Docker Application<div class="MsoNormal" style="line-height: normal; margin-bottom: 0cm;">
<br />
<span style="color: black; font-family: "times new roman" , "serif"; font-size: 14pt;"><b><u>Introduction:</u></b><o:p></o:p></span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: 0cm;">
<b><u><span style="color: black; font-family: "times new roman" , "serif"; font-size: 8pt;"><br /></span></u></b><span style="color: black; font-family: "times new roman" , "serif"; font-size: 13.5pt;"> </span><span style="color: black; font-family: "times new roman" , "serif"; font-size: 8pt;"> </span><span style="color: black; font-family: "times new roman" , "serif"; font-size: 12pt;">In this write I will share a simple spring boot application which will build a docker image and push it to docker hub. I will then use the maven to build and push the docker image automatically. I will also mention on how to pass JVM parameters to the app in docker container and debug the application using JAVA_OPTS variable.</span><br />
<span style="color: black; font-family: "times new roman" , "serif"; font-size: 12pt;"><br /></span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: 0cm;">
<span style="color: black; font-family: "times new roman" , "serif"; font-size: 13.5pt;"> </span><b><u><span style="color: black; font-family: "times new roman" , "serif"; font-size: 14pt;">Implementation:</span></u></b><br />
<b><u><span style="color: black; font-family: "times new roman" , "serif"; font-size: 14pt;"><br /></span></u></b>
<span style="color: black; font-family: "times new roman" , "serif"; font-size: 8pt;"> </span><span style="color: black; font-family: "times new roman" , "serif"; font-size: 12pt;">First we need a docker environment to be able to build and run docker images. For this example I used the Oracle VM VirtualBox which can be downloaded <a href="http://www.oracle.com/technetwork/server-storage/virtualbox/downloads/index.html" target="_blank">here</a>. Also I used <a href="https://docs.docker.com/toolbox/toolbox_install_windows/" target="_blank">docker toolbox</a> to run docker commands. After running VirtualBox remember to go the Networks-> Port Forwarding section on GUI of VirtualBox and set the 8080:8080 and 5005:5005 port forwardings which we will need in our example.</span><br />
<br />
<span style="color: black; font-family: "times new roman" , "serif"; font-size: 13.5pt;"> </span><span style="color: black; font-family: "times new roman" , "serif"; font-size: 8pt;"> </span><span style="color: black; font-family: "times new roman" , "serif"; font-size: 12pt;">We then will simply create a basic spring boot application with a main class as below;</span><br />
<div style="background: rgb(248, 249, 250); border: 1pt solid rgb(234, 236, 240); orphans: 2; padding: 12pt; text-align: start; text-decoration-color: initial; text-decoration-style: initial; text-indent: 0px; widows: 2;">
<div class="MsoNormal" style="background: rgb(248, 249, 250); border: none; line-height: 15.6pt; margin-bottom: 0cm; padding: 0cm;">
<span style="font-family: "courier new";"><span style="font-size: 12px;"><b>@SpringBootApplication</b></span></span><br />
<span style="font-family: "courier new";"><span style="font-size: 12px;"><b>@RestController</b></span></span><br />
<span style="font-family: "courier new";"><span style="font-size: 12px;"><b>public class DemoApplication {</b></span></span><br />
<span style="font-family: "courier new";"><span style="font-size: 12px;"><b> @RequestMapping("/")</b></span></span><br />
<span style="font-family: "courier new";"><span style="font-size: 12px;"><b> public String home() {</b></span></span><br />
<span style="font-family: "courier new";"><span style="font-size: 12px;"><b> return "Hello Docker";</b></span></span><br />
<span style="font-family: "courier new";"><span style="font-size: 12px;"><b> }</b></span></span><br />
<span style="font-family: "courier new";"><span style="font-size: 12px;"><b><br /></b></span></span>
<span style="font-family: "courier new";"><span style="font-size: 12px;"><b> public static void main(String[] args) {</b></span></span><br />
<span style="font-family: "courier new";"><span style="font-size: 12px;"><b> SpringApplication.run(DemoApplication.class, args);</b></span></span><br />
<span style="font-family: "courier new";"><span style="font-size: 12px;"><b> }</b></span></span><br />
<span style="font-family: "courier new";"><span style="font-size: 12px;"><b>}</b></span></span></div>
</div>
<span style="color: black; font-family: "times new roman" , "serif"; font-size: 12pt;"><br /></span>
<span style="color: black; font-family: "times new roman" , "serif"; font-size: 13.5pt;"> </span><span style="color: black; font-family: "times new roman" , "serif"; font-size: 8pt;"> </span><span style="color: black; font-family: "times new roman" , "serif"; font-size: 12pt;">Next we will create a Dockerfile directly under the project folder as below;</span><br />
<div>
<br /></div>
<div>
<span style="color: black;"></span><br />
<div style="background: rgb(248, 249, 250); border: 1pt solid rgb(234, 236, 240); padding: 12pt;">
<div class="MsoNormal" style="background-attachment: initial; background-clip: initial; background-image: initial; background-origin: initial; background-position: initial; background-repeat: initial; background-size: initial; border: none; line-height: 15.6pt; margin-bottom: 0cm; padding: 0cm;">
<span style="color: black;"><span style="font-family: "courier new";"><span style="font-size: 12px;"><b>FROM openjdk:8-jdk-alpine</b></span></span></span><br />
<span style="color: black;"><span style="font-family: "courier new";"><span style="font-size: 12px;"><b>VOLUME /tmp</b></span></span></span><br />
<span style="color: black;"><span style="font-family: "courier new";"><span style="font-size: 12px;"><b>ARG JAR_FILE</b></span></span></span><br />
<span style="color: black;"><span style="font-family: "courier new";"><span style="font-size: 12px;"><b>ADD ${JAR_FILE} app.jar</b></span></span></span><br />
<span style="color: black;"><span style="font-family: "courier new";"><span style="font-size: 12px;"><b>ENTRYPOINT exec java -jar /app.jar</b></span></span></span></div>
</div>
<span style="color: black;">
</span></div>
<div>
<span style="color: black; font-family: "times new roman" , "serif"; font-size: 12pt;"><br /></span></div>
<div>
<span style="color: black; font-family: "times new roman" , "serif"; font-size: 12pt;">This Dockerfile will create a docker image from the jdk-alpine base image and add our runnable spring boot jar to the image and as an entry point simply run java -jar command to run the application jar.</span></div>
<div>
<span style="color: black; font-family: "times new roman" , "serif"; font-size: 12pt;"><br /></span></div>
<div>
<span style="color: black; font-family: "times new roman" , "serif"; font-size: 12pt;">To be able to run this Dockerfile automatically we will use the spotify's dockerfile-maven plugin, so we need the following plugin definitions in pom.xml.</span></div>
<div>
<br /></div>
<div>
<span style="color: black;"></span><br />
<div>
<span style="color: black;"><span style="color: black;"></span></span><br />
<div style="background: rgb(248, 249, 250); border: 1pt solid rgb(234, 236, 240); padding: 12pt;">
<div class="MsoNormal" style="background-attachment: initial; background-clip: initial; background-image: initial; background-origin: initial; background-position: initial; background-repeat: initial; background-size: initial; border: none; line-height: 15.6pt; margin-bottom: 0cm; padding: 0cm;">
<span style="color: black;"><span style="color: black;"><span style="font-family: "courier new";"><span style="font-size: 12px;"><b><build></b></span></span></span></span><br />
<span style="color: black;"><span style="color: black;"><span style="font-family: "courier new";"><span style="font-size: 12px;"><b> <plugins></b></span></span></span></span><br />
<span style="color: black;"><span style="color: black;"><span style="font-family: "courier new";"><span style="font-size: 12px;"><b> <plugin></b></span></span></span></span><br />
<span style="color: black;"><span style="color: black;"><span style="font-family: "courier new";"><span style="font-size: 12px;"><b><span style="white-space: pre;"> </span><groupId>org.springframework.boot</groupId></b></span></span></span></span><br />
<span style="color: black;"><span style="color: black;"><span style="font-family: "courier new";"><span style="font-size: 12px;"><b><span style="white-space: pre;"> </span><artifactId>spring-boot-maven-plugin</artifactId></b></span></span></span></span><br />
<span style="color: black;"><span style="color: black;"><span style="font-family: "courier new";"><span style="font-size: 12px;"><b> <version>${spring-boot.version}</version></b></span></span></span></span><br />
<span style="color: black;"><span style="color: black;"><span style="font-family: "courier new";"><span style="font-size: 12px;"><b> </plugin></b></span></span></span></span><br />
<span style="color: black;"><span style="color: black;"><span style="font-family: "courier new";"><span style="font-size: 12px;"><b> <plugin></b></span></span></span></span><br />
<span style="color: black;"><span style="color: black;"><span style="font-family: "courier new";"><span style="font-size: 12px;"><b><span style="white-space: pre;"> </span><groupId>com.spotify</groupId></b></span></span></span></span><br />
<span style="color: black;"><span style="color: black;"><span style="font-family: "courier new";"><span style="font-size: 12px;"><b><span style="white-space: pre;"> </span><artifactId>dockerfile-maven-plugin</artifactId></b></span></span></span></span><br />
<span style="color: black;"><span style="color: black;"><span style="font-family: "courier new";"><span style="font-size: 12px;"><b><span style="white-space: pre;"> </span><version>1.3.6</version></b></span></span></span></span><br />
<span style="color: black;"><span style="color: black;"><span style="font-family: "courier new";"><span style="font-size: 12px;"><b><span style="white-space: pre;"> </span><configuration></b></span></span></span></span><br />
<span style="color: black;"><span style="color: black;"><span style="font-family: "courier new";"><span style="font-size: 12px;"><b><span style="white-space: pre;"> </span> <repository>${docker.image.prefix}/${project.artifactId}</repository></b></span></span></span></span><br />
<span style="color: black;"><span style="color: black;"><span style="font-family: "courier new";"><span style="font-size: 12px;"><b><span style="white-space: pre;"> </span> <buildArgs></b></span></span></span></span><br />
<span style="color: black;"><span style="color: black;"><span style="font-family: "courier new";"><span style="font-size: 12px;"><b><span style="white-space: pre;"> </span><JAR_FILE>target/${project.build.finalName}.jar</JAR_FILE></b></span></span></span></span><br />
<span style="color: black;"><span style="color: black;"><span style="font-family: "courier new";"><span style="font-size: 12px;"><b><span style="white-space: pre;"> </span> </buildArgs></b></span></span></span></span><br />
<span style="color: black;"><span style="color: black;"><span style="font-family: "courier new";"><span style="font-size: 12px;"><b><span style="white-space: pre;"> </span></configuration></b></span></span></span></span><br />
<span style="color: black;"><span style="color: black;"><span style="font-family: "courier new";"><span style="font-size: 12px;"><b><span style="white-space: pre;"> </span><executions></b></span></span></span></span><br />
<span style="color: black;"><span style="color: black;"><span style="font-family: "courier new";"><span style="font-size: 12px;"><b><span style="white-space: pre;"> </span><execution></b></span></span></span></span><br />
<span style="color: black;"><span style="color: black;"><span style="font-family: "courier new";"><span style="font-size: 12px;"><b><span style="white-space: pre;"> </span> <id>default</id></b></span></span></span></span><br />
<span style="color: black;"><span style="color: black;"><span style="font-family: "courier new";"><span style="font-size: 12px;"><b><span style="white-space: pre;"> </span> <phase>install</phase></b></span></span></span></span><br />
<span style="color: black;"><span style="color: black;"><span style="font-family: "courier new";"><span style="font-size: 12px;"><b><span style="white-space: pre;"> </span> <goals></b></span></span></span></span><br />
<span style="color: black;"><span style="color: black;"><span style="font-family: "courier new";"><span style="font-size: 12px;"><b><span style="white-space: pre;"> </span> <goal>build</goal></b></span></span></span></span><br />
<span style="color: black;"><span style="color: black;"><span style="font-family: "courier new";"><span style="font-size: 12px;"><b><span style="white-space: pre;"> </span> <goal>push</goal></b></span></span></span></span><br />
<span style="color: black;"><span style="color: black;"><span style="font-family: "courier new";"><span style="font-size: 12px;"><b><span style="white-space: pre;"> </span> </goals></b></span></span></span></span><br />
<span style="color: black;"><span style="color: black;"><span style="font-family: "courier new";"><span style="font-size: 12px;"><b><span style="white-space: pre;"> </span></execution></b></span></span></span></span><br />
<span style="color: black;"><span style="color: black;"><span style="font-family: "courier new";"><span style="font-size: 12px;"><b><span style="white-space: pre;"> </span></executions></b></span></span></span></span><br />
<span style="color: black;"><span style="color: black;"><span style="font-family: "courier new";"><span style="font-size: 12px;"><b> </plugin></b></span></span></span></span><br />
<span style="color: black;"><span style="color: black;"><span style="font-family: "courier new";"><span style="font-size: 12px;"><b> </plugins></b></span></span></span></span><br />
<span style="color: black;"><span style="color: black;"><span style="font-family: "courier new";"><span style="font-size: 12px;"><b></build></b></span></span></span></span></div>
</div>
<span style="color: black;"><span style="color: black;">
</span></span></div>
<span style="color: black;">
</span></div>
<div>
<div>
<div style="color: black; font-family: "times new roman", serif;">
<br /></div>
<div style="color: black; font-family: "times new roman", serif;">
The dockerfile-maven-plugin will build and push the docker image to the specified docker hub repository. It will add our spring boot runnable jar which is under the target directory to the docker image. Remember to change the repository section which defined using pom properties above by ${docker.image.prefix}/${project.artifactId} which in the end point to agelenler/demo-docker docker hub repo. You need to create your own docker hub repo and change pom file according to that.</div>
<div style="color: black; font-family: "times new roman", serif;">
<br /></div>
<div style="color: black; font-family: "times new roman", serif;">
By running mvn clean install command we will automatically create and push our spring boot app docker image to the docker hub.</div>
<div style="color: black; font-family: "times new roman", serif;">
<br /></div>
<div style="color: black; font-family: "times new roman", serif;">
When you run the mvn clean install command you will see the newly created image both on your local docker environment and on the docker hub repo.</div>
<div style="color: black; font-family: "times new roman", serif;">
<br /></div>
<div style="color: black; font-family: "times new roman", serif;">
<span style="color: black; font-family: "times new roman" , "serif"; font-size: 13.5pt;"> </span><b style="font-family: "Times New Roman";"><u><span style="color: black; font-family: "times new roman" , "serif"; font-size: 14pt;">Run using docker compose:</span></u></b></div>
<div style="color: black; font-family: "times new roman", serif;">
<br /></div>
<div style="color: black; font-family: "times new roman", serif;">
Let's run our image using a docker-compose file. Create a file named demo-compose.yml as below.</div>
<div style="color: black; font-family: "times new roman", serif;">
<br /></div>
<div style="color: black; font-family: "times new roman", serif;">
<div style="background-color: #f8f9fa; font-family: "Times New Roman";">
<span style="font-family: "courier new";"><span style="font-size: 12px;"><b>#</b></span></span></div>
<div style="background-color: #f8f9fa; font-family: "Times New Roman";">
<span style="font-family: "courier new";"><span style="font-size: 12px;"><b># Docker Compose for Demo Service</b></span></span></div>
<div style="background-color: #f8f9fa; font-family: "Times New Roman";">
<span style="font-family: "courier new";"><span style="font-size: 12px;"><b>#</b></span></span></div>
<div style="background-color: #f8f9fa; font-family: "Times New Roman";">
<span style="font-family: "courier new";"><span style="font-size: 12px;"><b>version: "2"</b></span></span></div>
<div style="background-color: #f8f9fa; font-family: "Times New Roman";">
<span style="font-family: "courier new";"><span style="font-size: 12px;"><b>services:</b></span></span></div>
<div style="background-color: #f8f9fa; font-family: "Times New Roman";">
<span style="font-family: "courier new";"><span style="font-size: 12px;"><b> demo:</b></span></span></div>
<div style="background-color: #f8f9fa; font-family: "Times New Roman";">
<span style="font-family: "courier new";"><span style="font-size: 12px;"><b> image: agelenler/demo-docker</b></span></span></div>
<div style="background-color: #f8f9fa; font-family: "Times New Roman";">
<span style="font-family: "courier new";"><span style="font-size: 12px;"><b> ports:</b></span></span></div>
<div style="background-color: #f8f9fa; font-family: "Times New Roman";">
<span style="font-family: "courier new";"><span style="font-size: 12px;"><b> - "8181:8181"</b></span></span></div>
<div style="background-color: #f8f9fa; font-family: "Times New Roman";">
<span style="font-family: "courier new";"><span style="font-size: 12px;"><b> - "5005:5005"</b></span></span></div>
<div style="background-color: #f8f9fa; font-family: "Times New Roman";">
<span style="font-family: "courier new";"><span style="font-size: 12px;"><b> environment:</b></span></span></div>
<div style="background-color: #f8f9fa; font-family: "Times New Roman";">
<span style="font-family: "courier new";"><span style="font-size: 12px;"><b> - "JAVA_OPTS=agentlib:jdwp=transport=dt_socket,address=5005,server=y,suspend=n"</b></span></span></div>
</div>
<div style="color: black; font-family: "times new roman", serif;">
<br /></div>
<div style="color: black; font-family: "times new roman", serif;">
Open your docker toolbox and first see the image that we just build using "docker images" command.</div>
<div style="color: black; font-family: "times new roman", serif;">
<br /></div>
<div style="color: black; font-family: "times new roman", serif;">
Then run the following command under the folder that includes demo-compose.yml file.</div>
<div style="color: black; font-family: "times new roman", serif;">
<br /></div>
<div style="color: black;">
<div style="background-color: #f8f9fa;">
<span style="font-family: "courier new";"><span style="font-size: 12px;"><b>docker-compose.exe -f demo-compose.yml up</b></span></span></div>
</div>
<div style="color: black; font-family: "times new roman", serif;">
<br /></div>
<div style="color: black; font-family: "times new roman", serif;">
This will run our application and we point our browser to http://localhost:8080 we will see the Hello Docker message.</div>
<div style="color: black; font-family: "times new roman", serif;">
<br /></div>
<div style="color: black; font-family: "times new roman", serif;">
As you see we added a JAVA_OPTS variable to be able to debug our application on 5005 port which use <a href="https://docs.oracle.com/javase/8/docs/technotes/guides/jpda/conninv.html#Invocation" target="_blank">JPDA transport.</a> When you add a breakpoint to your IDE say for example to the home method you will see that debugging is not working even though we passed required environment variable to our docker compose file. </div>
<div style="color: black; font-family: "times new roman", serif;">
<br /></div>
<div style="color: black; font-family: "times new roman", serif;">
<b style="font-family: "Times New Roman";"><u><span style="color: black; font-family: "times new roman" , "serif"; font-size: 14pt;">How to use JAVA_OPTS in Docker:</span></u></b></div>
<div style="color: black; font-family: "times new roman", serif;">
<b style="font-family: "Times New Roman";"><u><span style="color: black; font-family: "times new roman" , "serif"; font-size: 14pt;"><br /></span></u></b></div>
<div style="color: black; font-family: "times new roman", serif;">
So what can we do to use JAVA_OPTS in docker environment which can be used to set JVM or JPDA transport variables ?</div>
<div style="color: black; font-family: "times new roman", serif;">
<br /></div>
<div style="color: black; font-family: "times new roman", serif;">
We need to modify our Dockerfile and use a placeholder for JAVA_OPTS as below.</div>
<div style="color: black; font-family: "times new roman", serif;">
<b style="font-family: "Times New Roman";"><u><span style="color: black; font-family: "times new roman" , "serif"; font-size: 14pt;"><br /></span></u></b></div>
<div style="color: black;">
<div style="background-color: #f8f9fa;">
<span style="font-family: "courier new";"><span style="font-size: 12px;"><b>FROM openjdk:8-jdk-alpine</b></span></span></div>
<div style="background-color: #f8f9fa;">
<span style="font-family: "courier new";"><span style="font-size: 12px;"><b>VOLUME /tmp</b></span></span></div>
<div style="background-color: #f8f9fa;">
<span style="font-family: "courier new";"><span style="font-size: 12px;"><b>ARG JAR_FILE</b></span></span></div>
<div style="background-color: #f8f9fa;">
<span style="font-family: "courier new";"><span style="font-size: 12px;"><b>ADD ${JAR_FILE} app.jar</b></span></span></div>
<div style="background-color: #f8f9fa;">
<span style="font-family: "courier new";"><span style="font-size: 12px;"><b>ENTRYPOINT exec java $JAVA_OPTS -jar /app.jar</b></span></span></div>
</div>
<div style="color: black; font-family: "times new roman", serif;">
<b style="font-family: "Times New Roman";"><u><span style="color: black; font-family: "times new roman" , "serif"; font-size: 14pt;"><br /></span></u></b></div>
<div>
<div style="color: black; font-family: "times new roman", serif;">
By this $JAVA_OPTS placeholder we will be able to pass JAVA_OPTS variables to our docker container.</div>
<div style="color: black; font-family: "times new roman", serif;">
<br /></div>
<div style="color: black; font-family: "times new roman", serif;">
<b style="font-family: "Times New Roman";"><u><span style="color: black; font-family: "times new roman" , "serif"; font-size: 14pt;">Conclusion:</span></u></b></div>
<div style="color: black; font-family: "times new roman", serif;">
<b style="font-family: "Times New Roman";"><u><span style="color: black; font-family: "times new roman" , "serif"; font-size: 14pt;"><br /></span></u></b></div>
<div style="color: black; font-family: "times new roman", serif;">
In this post we examined the steps required to create and run a docker image from a simple spring boot application. We first need a docker environment like VirtualBox and do the required port forwarding operations. Then simply create a spring boot application and create a Dockerfile to use the output of this application. We then used the spotify dockerfile-maven plugin to automatically build and push our docker image to our local docker environment and docker hub, and used a simple docker-compose file to run our docker image. Finally we saw how to enable passing JVM parameters to a docker container. Note that we need to do 8080:8080 and 5005:5005 port forwardings both on VirtualBox and on docker container as the request first goes through VirtualBox and then forwarded through the docker container inside the virtual box and finally our application run inside this container.<br />
<br />
You can download a full source code <a href="https://github.com/agelenler/myblog/tree/master/dockerproject" target="_blank">here</a>.</div>
<div style="color: black; font-family: "times new roman", serif;">
<br /></div>
<div>
<div class="MsoNormal" style="color: black; font-family: "Times New Roman"; line-height: normal; margin-bottom: 0cm;">
<b><u><span style="color: black; font-family: "times new roman" , "serif"; font-size: 14pt;">References:</span></u></b><span style="color: black; font-family: "times new roman" , "serif"; font-size: 14pt;"><o:p></o:p></span></div>
<ul type="disc">
<li class="MsoNormal" style="line-height: normal;"><span style="color: #333333; font-family: "times new roman" , serif;"><span style="font-size: 13.3333px;"><b><i><u>https://spring.io/guides/gs/spring-boot-docker/</u></i></b></span></span></li>
<li class="MsoNormal" style="line-height: normal;"><span style="color: #333333; font-family: "times new roman" , serif;"><span style="font-size: 13.3333px;"><b><i><u>https://docs.oracle.com/javase/8/docs/technotes/guides/jpda/conninv.html#Invocation</u></i></b></span></span></li>
<li class="MsoNormal" style="line-height: normal;"><span style="color: #333333; font-family: "times new roman" , serif;"><span style="color: #333333; font-family: "times new roman" , serif; font-size: 13.3333px;"><b><i><u>https://docs.docker.com/toolbox/toolbox_install_windows/</u></i></b></span></span></li>
<li class="MsoNormal" style="line-height: normal;"><span style="color: #333333; font-family: "times new roman" , serif;"><span style="font-size: 13.3333px;"><b><i><u>https://github.com/spotify/dockerfile-maven</u></i></b></span></span></li>
</ul>
</div>
</div>
</div>
</div>
</div>
Ali Gelenlerhttp://www.blogger.com/profile/09439697648573423668noreply@blogger.com0tag:blogger.com,1999:blog-3858181542467916490.post-66352836667215624292017-02-25T04:26:00.002+03:002019-11-23T00:31:13.471+03:00Volatile variable, false sharing and @Contented<div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm;">
</div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm;">
</div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm;">
</div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm;">
</div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm;">
<br />
<div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm;">
<span style="color: black; font-family: "times new roman" , "serif"; font-size: 14.0pt;"> <b><u>Introduction:</u></b><o:p></o:p></span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm;">
<b><u><span style="color: black; font-family: "times new roman" , "serif"; font-size: 8.0pt;"><br />
</span></u></b><span style="color: black; font-family: "times new roman" , "serif"; font-size: 13.5pt;"> </span><span style="color: black; font-family: "times new roman" , "serif"; font-size: 8.0pt;"> </span><span style="color: black; font-family: "times new roman" , "serif"; font-size: 12.0pt;">Today I will try to explain the use of
volatile variable in java while touching the concepts of cache lines, false
sharing and the new java 8 annotation @Contented. We will also see how to
use @Contended in java 9. Lets first look at the use cases that we can and
cannot use volatile.<o:p></o:p></span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm;">
<span style="color: black; font-family: "times new roman" , "serif"; font-size: 8.0pt;"><br />
</span><span style="color: black; font-family: "times new roman" , "serif"; font-size: 13.5pt;"> </span><b><u><span style="color: black; font-family: "times new roman" , "serif"; font-size: 14.0pt;">Use of volatile:</span></u></b><span style="color: black; font-family: "times new roman" , "serif"; font-size: 14.0pt;"><o:p></o:p></span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm;">
<b><u><span style="color: black; font-family: "times new roman" , "serif"; font-size: 8.0pt;"><br />
</span></u></b><span style="color: black; font-family: "times new roman" , "serif"; font-size: 13.5pt;"> </span><span style="color: black; font-family: "times new roman" , "serif"; font-size: 8.0pt;"> </span><span style="color: black; font-family: "times new roman" , "serif"; font-size: 12.0pt;">Volatile variables came into our life with
java 5. It generally provides a lock-free mechanism for concurrent
applications. Below you can find a list of characteristics of a volatile
variable.<o:p></o:p></span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm;">
<span style="color: black; font-family: "times new roman" , "serif"; font-size: 12.0pt;"><br />
1.) Happens-before guarentee; A write to a volatile variable happens before any
subsequent read.<o:p></o:p></span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm;">
<br /></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm;">
<span style="color: black; font-family: "times new roman" , "serif"; font-size: 12.0pt;">2.) No reordering: JVM can normally reorder your code for various reasons
like performance which may cause problems for concurrent application. If you
define a variable as volatile you tell the JVM not to reorder that variable.<o:p></o:p></span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm;">
<span style="color: black; font-family: "times new roman" , "serif"; font-size: 12.0pt;"><br />
3.) Guarenteed visibility: This is actually a result of happens-before
principle. In multithreaded applications which operates on an multi CPU
environment, each thread may copy variable from main memory into the CPU cache
to increase performance. In that case if a thread change a variable,
another thread may not see the latest version of that variable. To solve
that issue we can define the variable as volatile, and any change made by a
thread guarenteed to be visible to all of the threads.<o:p></o:p></span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm;">
<span style="color: black; font-family: "times new roman" , "serif"; font-size: 12.0pt;"><br />
4.) Atomic read of long and double variables: This is about to become obsolete
point since its only related with 32 bit operating systems or 32 bit java
virtual machines. The point is the long and double variables are 64 bit lenght
in java and in 32 bit systems there is no way of reading the 64 bit variable at
once. So there should be 2 subsequent reads to get a value of 64 bit variable.
If we use volatile modifier we can guarentee an atomic read operation on long
or double values. As I said however for 64 bit environments there is no such
requirement.<o:p></o:p></span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm;">
<span style="color: black; font-family: "times new roman" , "serif"; font-size: 12.0pt;"><br />
Those are the abilities that volatile modifier added to java. On the other hand
we should aware that volatile modifier does not bring us the atomicity, you can
only use the volatile variable if you are making an assignment. For example we
cannot use it on a variable which is incremented by multiple threads. Say 2
independent thread read a volatile variable at the same time and increment the
value by one, then flushed it to the main memory since its a volatile variable.
In this case we possibly see only one increment since we did not use any
synchronization on the variable. Volatile does not provide that ability, we
should use synchronized keyword which provides a monitor lock and guarentees an
ordered access to the variable by multiple threads.<o:p></o:p></span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm;">
<span style="color: black; font-family: "times new roman" , "serif"; font-size: 12.0pt;"><br />
We can use volatile modifier for common variables like flags between threads or
can use it in double checked locking idiom in singleton pattern which is broken
without a volatile variable as a result of a java memory model behaviour.</span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm;">
<br /></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm;">
<br /></div>
<div style="background: #F8F9FA; border: solid #EAECF0 1.0pt; mso-border-alt: solid #EAECF0 .5pt; mso-element: para-border-div; padding: 12.0pt 12.0pt 12.0pt 12.0pt;">
<div class="MsoNormal" style="background: #F8F9FA; border: none; line-height: 15.6pt; margin-bottom: .0001pt; margin-bottom: 0cm; mso-border-alt: solid #EAECF0 .5pt; mso-padding-alt: 12.0pt 12.0pt 12.0pt 12.0pt; padding: 0cm; tab-stops: 45.8pt 91.6pt 137.4pt 183.2pt 229.0pt 274.8pt 320.6pt 366.4pt 412.2pt 458.0pt 503.8pt 549.6pt 595.4pt 641.2pt 687.0pt 732.8pt;">
<b><span style="color: black; font-family: "courier new"; font-size: 9.0pt;">public class</span></b><span style="color: black; font-family: "courier new"; font-size: 9.0pt;"> <b>DoubleCheckedLocking</b>{<o:p></o:p></span></div>
<div class="MsoNormal" style="background: #F8F9FA; border: none; line-height: 15.6pt; margin-bottom: .0001pt; margin-bottom: 0cm; mso-border-alt: solid #EAECF0 .5pt; mso-padding-alt: 12.0pt 12.0pt 12.0pt 12.0pt; padding: 0cm; tab-stops: 45.8pt 91.6pt 137.4pt 183.2pt 229.0pt 274.8pt 320.6pt 366.4pt 412.2pt 458.0pt 503.8pt 549.6pt 595.4pt 641.2pt 687.0pt 732.8pt;">
<span style="color: black; font-family: "courier new"; font-size: 9.0pt;"><span style="mso-spacerun: yes;"> </span><b>private</b>
<b>volatile</b> Singleton singleton;<o:p></o:p></span></div>
<div class="MsoNormal" style="background: #F8F9FA; border: none; line-height: 15.6pt; margin-bottom: .0001pt; margin-bottom: 0cm; mso-border-alt: solid #EAECF0 .5pt; mso-padding-alt: 12.0pt 12.0pt 12.0pt 12.0pt; padding: 0cm; tab-stops: 45.8pt 91.6pt 137.4pt 183.2pt 229.0pt 274.8pt 320.6pt 366.4pt 412.2pt 458.0pt 503.8pt 549.6pt 595.4pt 641.2pt 687.0pt 732.8pt;">
<span style="color: black; font-family: "courier new"; font-size: 9.0pt;"><span style="mso-spacerun: yes;"> </span><b>public</b>
Singleton getSingleton() {<o:p></o:p></span></div>
<div class="MsoNormal" style="background: #F8F9FA; border: none; line-height: 15.6pt; margin-bottom: .0001pt; margin-bottom: 0cm; mso-border-alt: solid #EAECF0 .5pt; mso-padding-alt: 12.0pt 12.0pt 12.0pt 12.0pt; padding: 0cm; tab-stops: 45.8pt 91.6pt 137.4pt 183.2pt 229.0pt 274.8pt 320.6pt 366.4pt 412.2pt 458.0pt 503.8pt 549.6pt 595.4pt 641.2pt 687.0pt 732.8pt;">
<span style="color: black; font-family: "courier new"; font-size: 9.0pt;"><span style="mso-spacerun: yes;"> </span><b>if</b>
(singleton == <b>null</b>) {<o:p></o:p></span></div>
<div class="MsoNormal" style="background: #F8F9FA; border: none; line-height: 15.6pt; margin-bottom: .0001pt; margin-bottom: 0cm; mso-border-alt: solid #EAECF0 .5pt; mso-padding-alt: 12.0pt 12.0pt 12.0pt 12.0pt; padding: 0cm; tab-stops: 45.8pt 91.6pt 137.4pt 183.2pt 229.0pt 274.8pt 320.6pt 366.4pt 412.2pt 458.0pt 503.8pt 549.6pt 595.4pt 641.2pt 687.0pt 732.8pt;">
<span style="color: black; font-family: "courier new"; font-size: 9.0pt;"><span style="mso-spacerun: yes;"> </span><b>synchronized</b>(<b>this</b>)
{<o:p></o:p></span></div>
<div class="MsoNormal" style="background: #F8F9FA; border: none; line-height: 15.6pt; margin-bottom: .0001pt; margin-bottom: 0cm; mso-border-alt: solid #EAECF0 .5pt; mso-padding-alt: 12.0pt 12.0pt 12.0pt 12.0pt; padding: 0cm; tab-stops: 45.8pt 91.6pt 137.4pt 183.2pt 229.0pt 274.8pt 320.6pt 366.4pt 412.2pt 458.0pt 503.8pt 549.6pt 595.4pt 641.2pt 687.0pt 732.8pt;">
<span style="color: black; font-family: "courier new"; font-size: 9.0pt;"><span style="mso-spacerun: yes;"> </span><b>if</b>
(singleton == <b>null</b>) {<o:p></o:p></span></div>
<div class="MsoNormal" style="background: #F8F9FA; border: none; line-height: 15.6pt; margin-bottom: .0001pt; margin-bottom: 0cm; mso-border-alt: solid #EAECF0 .5pt; mso-padding-alt: 12.0pt 12.0pt 12.0pt 12.0pt; padding: 0cm; tab-stops: 45.8pt 91.6pt 137.4pt 183.2pt 229.0pt 274.8pt 320.6pt 366.4pt 412.2pt 458.0pt 503.8pt 549.6pt 595.4pt 641.2pt 687.0pt 732.8pt;">
<span style="color: black; font-family: "courier new"; font-size: 9.0pt;"><span style="mso-spacerun: yes;">
</span>singleton= <b>new</b> Singleton ();<o:p></o:p></span></div>
<div class="MsoNormal" style="background: #F8F9FA; border: none; line-height: 15.6pt; margin-bottom: .0001pt; margin-bottom: 0cm; mso-border-alt: solid #EAECF0 .5pt; mso-padding-alt: 12.0pt 12.0pt 12.0pt 12.0pt; padding: 0cm; tab-stops: 45.8pt 91.6pt 137.4pt 183.2pt 229.0pt 274.8pt 320.6pt 366.4pt 412.2pt 458.0pt 503.8pt 549.6pt 595.4pt 641.2pt 687.0pt 732.8pt;">
<span style="color: black; font-family: "courier new"; font-size: 9.0pt;"><span style="mso-spacerun: yes;">
</span>}<o:p></o:p></span></div>
<div class="MsoNormal" style="background: #F8F9FA; border: none; line-height: 15.6pt; margin-bottom: .0001pt; margin-bottom: 0cm; mso-border-alt: solid #EAECF0 .5pt; mso-padding-alt: 12.0pt 12.0pt 12.0pt 12.0pt; padding: 0cm; tab-stops: 45.8pt 91.6pt 137.4pt 183.2pt 229.0pt 274.8pt 320.6pt 366.4pt 412.2pt 458.0pt 503.8pt 549.6pt 595.4pt 641.2pt 687.0pt 732.8pt;">
<span style="color: black; font-family: "courier new"; font-size: 9.0pt;"><span style="mso-spacerun: yes;"> </span>}<o:p></o:p></span></div>
<div class="MsoNormal" style="background: #F8F9FA; border: none; line-height: 15.6pt; margin-bottom: .0001pt; margin-bottom: 0cm; mso-border-alt: solid #EAECF0 .5pt; mso-padding-alt: 12.0pt 12.0pt 12.0pt 12.0pt; padding: 0cm; tab-stops: 45.8pt 91.6pt 137.4pt 183.2pt 229.0pt 274.8pt 320.6pt 366.4pt 412.2pt 458.0pt 503.8pt 549.6pt 595.4pt 641.2pt 687.0pt 732.8pt;">
<span style="color: black; font-family: "courier new"; font-size: 9.0pt;"><span style="mso-spacerun: yes;"> </span>}<o:p></o:p></span></div>
<div class="MsoNormal" style="background: #F8F9FA; border: none; line-height: 15.6pt; margin-bottom: .0001pt; margin-bottom: 0cm; mso-border-alt: solid #EAECF0 .5pt; mso-padding-alt: 12.0pt 12.0pt 12.0pt 12.0pt; padding: 0cm; tab-stops: 45.8pt 91.6pt 137.4pt 183.2pt 229.0pt 274.8pt 320.6pt 366.4pt 412.2pt 458.0pt 503.8pt 549.6pt 595.4pt 641.2pt 687.0pt 732.8pt;">
<span style="color: black; font-family: "courier new"; font-size: 9.0pt;"><span style="mso-spacerun: yes;"> </span><b>return</b>
singleton;<o:p></o:p></span></div>
<div class="MsoNormal" style="background: #F8F9FA; border: none; line-height: 15.6pt; margin-bottom: .0001pt; margin-bottom: 0cm; mso-border-alt: solid #EAECF0 .5pt; mso-padding-alt: 12.0pt 12.0pt 12.0pt 12.0pt; padding: 0cm; tab-stops: 45.8pt 91.6pt 137.4pt 183.2pt 229.0pt 274.8pt 320.6pt 366.4pt 412.2pt 458.0pt 503.8pt 549.6pt 595.4pt 641.2pt 687.0pt 732.8pt;">
<span style="color: black; font-family: "courier new"; font-size: 9.0pt;"><span style="mso-spacerun: yes;"> </span>} }<o:p></o:p></span></div>
</div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm;">
<span style="color: black; font-family: "times new roman" , "serif"; font-size: 13.5pt;"><br />
</span><span style="color: black; font-family: "times new roman" , "serif"; font-size: 12.0pt;">At this point lets go into the some details about cpu cache, cache lines
and false sharing. <o:p></o:p></span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm;">
<span style="color: black; font-family: "times new roman" , "serif"; font-size: 13.5pt;"><br />
</span><b><u><span style="color: black; font-family: "times new roman" , "serif"; font-size: 14.0pt;">CPU Cache:</span></u></b><span style="color: black; font-family: "times new roman" , "serif"; font-size: 14.0pt;"><o:p></o:p></span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm;">
<span style="color: black; font-family: "times new roman" , "serif"; font-size: 13.5pt;"><br />
</span><span style="color: black; font-family: "times new roman" , "serif"; font-size: 12.0pt;">Generally speaking in multi core environment each cpu has its own
cache which takes in place betweeen the cpu and the main memory. Although the
situation may change depending on the cpu architecture which is
different for each of the vendor, the cpu cache is generally consist of 3
caches L1, L2, and L3 where L1 is the closest one to CPU, L3 is closest to main
memory.<o:p></o:p></span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm;">
<span style="color: black; font-family: "times new roman" , "serif"; font-size: 12.0pt;"><br />
L1-cache is the fastest one and usually it takes place in the processor chip.
The size capacity is typically in between 8KB-64KB and it uses SRAM which is
faster than DRAM which generally used in main memory.<o:p></o:p></span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm;">
<span style="color: black; font-family: "times new roman" , "serif"; font-size: 12.0pt;">L2-cache comes between the L1-cache and the RAM and has a bigger storage
capacity typically in between 64KB-4MB.<o:p></o:p></span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm;">
<span style="color: black; font-family: "times new roman" , "serif"; font-size: 12.0pt;">L3-cache comes after L2 cache and its closer to RAM. L3-cache are generally
exists on motherboard instead of the processor and it is used to keep the
common data between multiple cores.<o:p></o:p></span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm;">
<span style="color: black; font-family: "times new roman" , "serif"; font-size: 12.0pt;"><br />
During the data fetching first the L1-cache is looked up, then L2-cache, then
L3-cache and at the end if the data cannot be found in CPU cache, it is read
from the main memory.<o:p></o:p></span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm;">
<br /></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm;">
<span style="color: black; font-family: "times new roman" , "serif"; font-size: 12.0pt;">So we can say that read performance of a volatile variable will possibly be
worse than a normal variable, since to be able to read the variable we should
go to the main memory instead of cpu cache in many cases.<o:p></o:p></span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm;">
<span style="color: black; font-family: "times new roman" , "serif"; font-size: 12.0pt;"><br />
For cpu caching there exists different strategies in multi core environment.
For example a replicated cache holds all the keys in all nodes, on the other
hand a distributed cache holds keys only on some of the nodes to provide
redundancy and fault tolerance and it provides a more scalable solution. You
can find more information on this </span><a href="https://docs.oracle.com/cd/E15357_01/coh.360/e15723/cache_intro.htm#COHDG5049"><span style="color: blue; font-family: "times new roman" , "serif"; font-size: 12.0pt;">here</span></a><span style="color: black; font-family: "times new roman" , "serif"; font-size: 12.0pt;">.<o:p></o:p></span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm;">
<span style="color: black; font-family: "times new roman" , "serif"; font-size: 12.0pt;"><br />
Now, lets go deeper on cpu caching by examining the cache lines and the false
sharing concepts.<o:p></o:p></span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm;">
<span style="color: black; font-family: "times new roman" , "serif"; font-size: 13.5pt;"><br />
</span><b><u><span style="color: black; font-family: "times new roman" , "serif"; font-size: 14.0pt;">Cache Lines and False Sharing:</span></u></b><span style="color: black; font-family: "times new roman" , "serif"; font-size: 14.0pt;"><o:p></o:p></span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm;">
<b><u><span style="color: black; font-family: "times new roman" , "serif"; font-size: 8.0pt;"><br />
</span></u></b><span style="color: black; font-family: "times new roman" , "serif"; font-size: 13.5pt;"> </span><span style="color: black; font-family: "times new roman" , "serif"; font-size: 12.0pt;">CPU's read memory in some block of bytes, usually 64 bytes. We call this
block of bytes as cache lines. Generally a cpu maintain consistency on cache
line basis, that means if any single byte of a cache line is changed all cache
line is invalited and this invalidation takes place for all cpu's in
cluster. <o:p></o:p></span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm;">
<span style="color: black; font-family: "times new roman" , "serif"; font-size: 12.0pt;"><br />
For example let's say we have 2 threads which are operates on 2 different cores
in a multi-core environment. If we have a shared variable x which is read by
thread 1 and thread 2, both thread will put that variable into their cpu cache
line's. Then if thread 1 updates the variable x thread 1's cache line must be
invalidated and also thread 2 told to invalidate its cache line. This is an
expected behaviour and it is called true sharing. Here if we make the variable
x volatile we can guarentee that behaviour, on the other hand for non-volatile
variables, since we will not force the cpu to flush its memory barrier we may
not see the invalidation. <o:p></o:p></span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm;">
<span style="color: black; font-family: "times new roman" , "serif"; font-size: 12.0pt;"><br />
Say we have an additional y variable in the same cache line with x. Say thread
1 updates x and thread 2 does only want to operate on y. However both thread
has the cache line that holds x and y, since we read 64 bit block of memory.
Even in that case thread 2 told to invalidate its cache because of the change
in variable x which thread 2 does not matter. This situation is called false
sharing.<o:p></o:p></span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm;">
<span style="color: black; font-family: "times new roman" , "serif"; font-size: 12.0pt;"><br />
Say we have 2 independent variables x and y which are not shared between thread
1 and thread 2. Thread 1 operates on x and thread 2 operates on y. If x and y
are still in the same cache line, any change to x or y will invalidate the
cache line's in thread 1 and thread 2's cpu caches which is also false
sharing. <o:p></o:p></span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm;">
<span style="color: black; font-family: "times new roman" , "serif"; font-size: 12.0pt;"><br />
If this false sharing start to happen many times, our system can suffer
performance problems since a cpu will need to wait the cache line to be loaded
while it would do many iterations in that time. This is called stall and it can
cause a silence performance problem.<o:p></o:p></span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm;">
<span style="color: black; font-family: "times new roman" , "serif"; font-size: 12.0pt;"><br />
To solve this performance problem and to prevent from false-sharing we can try
padding technique or even better use the new @Contended annotation which comes
by java 8. Let's explain them in detail.<o:p></o:p></span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm;">
<span style="color: black; font-family: "times new roman" , "serif"; font-size: 13.5pt;"><br />
</span><b><u><span style="color: black; font-family: "times new roman" , "serif"; font-size: 14.0pt;">Padding and @Contended:</span></u></b><span style="color: black; font-family: "times new roman" , "serif"; font-size: 14.0pt;"><o:p></o:p></span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm;">
<span style="color: black; font-family: "times new roman" , "serif"; font-size: 13.5pt;"><br />
</span><span style="color: black; font-family: "times new roman" , "serif"; font-size: 12.0pt;">The main point that causes false sharing is unintentionally sharing
variables in cache lines. To prevent it we can try to pad our data structure or
variable to span the whole cache line. For example if we have a 64 bit cache
line and a int variable which consumes 4 bytes we can use 7 dummy long
variables and 1 dummy int variable along with our targeted int variable to span
whole 64 bit space. In that case we will hold only our int variable with some
dummy variables in the cache line. See below;<o:p></o:p></span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm;">
<br /></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm;">
<br /></div>
<div style="background: #F8F9FA; border: solid #EAECF0 1.0pt; mso-border-alt: solid #EAECF0 .5pt; mso-element: para-border-div; padding: 12.0pt 12.0pt 12.0pt 12.0pt;">
<div class="MsoNormal" style="background: #F8F9FA; border: none; line-height: 15.6pt; margin-bottom: .0001pt; margin-bottom: 0cm; mso-border-alt: solid #EAECF0 .5pt; mso-padding-alt: 12.0pt 12.0pt 12.0pt 12.0pt; padding: 0cm; tab-stops: 45.8pt 91.6pt 137.4pt 183.2pt 229.0pt 274.8pt 320.6pt 366.4pt 412.2pt 458.0pt 503.8pt 549.6pt 595.4pt 641.2pt 687.0pt 732.8pt;">
<span style="color: black; font-family: "courier new"; font-size: 9.0pt;">public class TestPadding {<o:p></o:p></span></div>
<div class="MsoNormal" style="background: #F8F9FA; border: none; line-height: 15.6pt; margin-bottom: .0001pt; margin-bottom: 0cm; mso-border-alt: solid #EAECF0 .5pt; mso-padding-alt: 12.0pt 12.0pt 12.0pt 12.0pt; padding: 0cm; tab-stops: 45.8pt 91.6pt 137.4pt 183.2pt 229.0pt 274.8pt 320.6pt 366.4pt 412.2pt 458.0pt 503.8pt 549.6pt 595.4pt 641.2pt 687.0pt 732.8pt;">
<span style="color: black; font-family: "courier new"; font-size: 9.0pt;"> private volatile int myValue;<o:p></o:p></span></div>
<div class="MsoNormal" style="background: #F8F9FA; border: none; line-height: 15.6pt; margin-bottom: .0001pt; margin-bottom: 0cm; mso-border-alt: solid #EAECF0 .5pt; mso-padding-alt: 12.0pt 12.0pt 12.0pt 12.0pt; padding: 0cm; tab-stops: 45.8pt 91.6pt 137.4pt 183.2pt 229.0pt 274.8pt 320.6pt 366.4pt 412.2pt 458.0pt 503.8pt 549.6pt 595.4pt 641.2pt 687.0pt 732.8pt;">
<span style="color: black; font-family: "courier new"; font-size: 9.0pt;"> private volatile int
dummyInt;<o:p></o:p></span></div>
<div class="MsoNormal" style="background: #F8F9FA; border: none; line-height: 15.6pt; margin-bottom: .0001pt; margin-bottom: 0cm; mso-border-alt: solid #EAECF0 .5pt; mso-padding-alt: 12.0pt 12.0pt 12.0pt 12.0pt; padding: 0cm; tab-stops: 45.8pt 91.6pt 137.4pt 183.2pt 229.0pt 274.8pt 320.6pt 366.4pt 412.2pt 458.0pt 503.8pt 549.6pt 595.4pt 641.2pt 687.0pt 732.8pt;">
<span style="color: black; font-family: "courier new"; font-size: 9.0pt;"> private volatile long
dummyLong1;<o:p></o:p></span></div>
<div class="MsoNormal" style="background: #F8F9FA; border: none; line-height: 15.6pt; margin-bottom: .0001pt; margin-bottom: 0cm; mso-border-alt: solid #EAECF0 .5pt; mso-padding-alt: 12.0pt 12.0pt 12.0pt 12.0pt; padding: 0cm; tab-stops: 45.8pt 91.6pt 137.4pt 183.2pt 229.0pt 274.8pt 320.6pt 366.4pt 412.2pt 458.0pt 503.8pt 549.6pt 595.4pt 641.2pt 687.0pt 732.8pt;">
<span style="color: black; font-family: "courier new"; font-size: 9.0pt;"> private volatile long
dummyLong2;<o:p></o:p></span></div>
<div class="MsoNormal" style="background: #F8F9FA; border: none; line-height: 15.6pt; margin-bottom: .0001pt; margin-bottom: 0cm; mso-border-alt: solid #EAECF0 .5pt; mso-padding-alt: 12.0pt 12.0pt 12.0pt 12.0pt; padding: 0cm; tab-stops: 45.8pt 91.6pt 137.4pt 183.2pt 229.0pt 274.8pt 320.6pt 366.4pt 412.2pt 458.0pt 503.8pt 549.6pt 595.4pt 641.2pt 687.0pt 732.8pt;">
<span style="color: black; font-family: "courier new"; font-size: 9.0pt;"> private volatile long
dummyLong3;<o:p></o:p></span></div>
<div class="MsoNormal" style="background: #F8F9FA; border: none; line-height: 15.6pt; margin-bottom: .0001pt; margin-bottom: 0cm; mso-border-alt: solid #EAECF0 .5pt; mso-padding-alt: 12.0pt 12.0pt 12.0pt 12.0pt; padding: 0cm; tab-stops: 45.8pt 91.6pt 137.4pt 183.2pt 229.0pt 274.8pt 320.6pt 366.4pt 412.2pt 458.0pt 503.8pt 549.6pt 595.4pt 641.2pt 687.0pt 732.8pt;">
<span style="color: black; font-family: "courier new"; font-size: 9.0pt;"> private volatile long
dummyLong4;<o:p></o:p></span></div>
<div class="MsoNormal" style="background: #F8F9FA; border: none; line-height: 15.6pt; margin-bottom: .0001pt; margin-bottom: 0cm; mso-border-alt: solid #EAECF0 .5pt; mso-padding-alt: 12.0pt 12.0pt 12.0pt 12.0pt; padding: 0cm; tab-stops: 45.8pt 91.6pt 137.4pt 183.2pt 229.0pt 274.8pt 320.6pt 366.4pt 412.2pt 458.0pt 503.8pt 549.6pt 595.4pt 641.2pt 687.0pt 732.8pt;">
<span style="color: black; font-family: "courier new"; font-size: 9.0pt;"> private volatile long
dummyLong5;<o:p></o:p></span></div>
<div class="MsoNormal" style="background: #F8F9FA; border: none; line-height: 15.6pt; margin-bottom: .0001pt; margin-bottom: 0cm; mso-border-alt: solid #EAECF0 .5pt; mso-padding-alt: 12.0pt 12.0pt 12.0pt 12.0pt; padding: 0cm; tab-stops: 45.8pt 91.6pt 137.4pt 183.2pt 229.0pt 274.8pt 320.6pt 366.4pt 412.2pt 458.0pt 503.8pt 549.6pt 595.4pt 641.2pt 687.0pt 732.8pt;">
<span style="color: black; font-family: "courier new"; font-size: 9.0pt;"> private volatile long
dummyLong6;<o:p></o:p></span></div>
<div class="MsoNormal" style="background: #F8F9FA; border: none; line-height: 15.6pt; margin-bottom: .0001pt; margin-bottom: 0cm; mso-border-alt: solid #EAECF0 .5pt; mso-padding-alt: 12.0pt 12.0pt 12.0pt 12.0pt; padding: 0cm; tab-stops: 45.8pt 91.6pt 137.4pt 183.2pt 229.0pt 274.8pt 320.6pt 366.4pt 412.2pt 458.0pt 503.8pt 549.6pt 595.4pt 641.2pt 687.0pt 732.8pt;">
<span style="color: black; font-family: "courier new"; font-size: 9.0pt;"> private volatile long
dummyLong7;<o:p></o:p></span></div>
<div class="MsoNormal" style="background: #F8F9FA; border: none; line-height: 15.6pt; margin-bottom: .0001pt; margin-bottom: 0cm; mso-border-alt: solid #EAECF0 .5pt; mso-padding-alt: 12.0pt 12.0pt 12.0pt 12.0pt; padding: 0cm; tab-stops: 45.8pt 91.6pt 137.4pt 183.2pt 229.0pt 274.8pt 320.6pt 366.4pt 412.2pt 458.0pt 503.8pt 549.6pt 595.4pt 641.2pt 687.0pt 732.8pt;">
<span style="color: black; font-family: "courier new"; font-size: 9.0pt;">}<o:p></o:p></span></div>
<div class="MsoNormal" style="background: #F8F9FA; border: none; line-height: 15.6pt; margin-bottom: .0001pt; margin-bottom: 0cm; mso-border-alt: solid #EAECF0 .5pt; mso-padding-alt: 12.0pt 12.0pt 12.0pt 12.0pt; padding: 0cm; tab-stops: 45.8pt 91.6pt 137.4pt 183.2pt 229.0pt 274.8pt 320.6pt 366.4pt 412.2pt 458.0pt 503.8pt 549.6pt 595.4pt 641.2pt 687.0pt 732.8pt;">
<br /></div>
</div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm;">
<br /></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm;">
<span style="color: black; font-family: "times new roman" , "serif"; font-size: 12.0pt;">The problem with this approach is, the JVM could possibly eliminate or
reorder the unused fields or the objects could not take place on heap. To get
rid of this problem we can use volatile modifier as I did above, but this also
does not guarentee the elimination in some cases. Also we should carefully
investigate the machine and JVM details whether its a 32 or 64 bit environment
and determine the real cache line size. We should also be sure how much space
our objects hold by checking CompresedOops jvm variable and checking the data
structure in detail (you can see my previous post about actual memory
consumption </span><a href="http://www.aligelenler.com/2015/01/actual-memory-consumption-of-java.html"><span style="color: blue; font-family: "times new roman" , "serif"; font-size: 12.0pt;">here</span></a><span style="color: black; font-family: "times new roman" , "serif"; font-size: 12.0pt;">) which are all are not
easy and time consuming jobs.<o:p></o:p></span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm;">
<span style="color: black; font-family: "times new roman" , "serif"; font-size: 12.0pt;"><br />
A better approach is to use the @Contented annotation which actually do a
similar operation in a safer manner delegating the job to the JVM.<o:p></o:p></span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm;">
<span style="color: black; font-family: "times new roman" , "serif"; font-size: 12.0pt;"><br />
As an aim of in </span><a href="http://openjdk.java.net/jeps/142"><span style="color: blue; font-family: "times new roman" , "serif"; font-size: 12.0pt;">JEP 142</span></a><span style="color: black; font-family: "times new roman" , "serif"; font-size: 12.0pt;">, we can annotate the
fields or classes by @Contented annotation which we think a candidate for false
sharing. JEP 142 generally depends on making the padding at class loading time
and touching to Allocation Code (to be sure the allocation of objects are
correctly aligned), JIT (to know which allocations need to be aligned) and GC
(to be sure the object remains aligned after GC)<o:p></o:p></span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm;">
<span style="color: black; font-family: "" "helvetica" "" , "serif"; font-size: 12.0pt;"><br />
</span><span style="color: black; font-family: "times new roman" , "serif"; font-size: 12.0pt;">This annotation is a hint for JVM to place the annotated sections in
different cache lines. The result may contain padding or a combination of
padding with an aligned allocation. The side effect is of course an increased
memory usage since we are using additional space for padding.<o:p></o:p></span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm;">
<span style="color: black; font-family: "times new roman" , "serif"; font-size: 12.0pt;"><br />
Note that Contended annotation does not work on user classpath by default
and only work for classes on bootclasspath. So we need to
add -XX:-RestrictContended VM argument on JVM startup.<o:p></o:p></span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm;">
<br /></div>
<div style="background: #F8F9FA; border: solid #EAECF0 1.0pt; mso-border-alt: solid #EAECF0 .5pt; mso-element: para-border-div; padding: 12.0pt 12.0pt 12.0pt 12.0pt;">
<div class="MsoNormal" style="background: #F8F9FA; border: none; line-height: 15.6pt; margin-bottom: .0001pt; margin-bottom: 0cm; mso-border-alt: solid #EAECF0 .5pt; mso-padding-alt: 12.0pt 12.0pt 12.0pt 12.0pt; padding: 0cm; tab-stops: 45.8pt 91.6pt 137.4pt 183.2pt 229.0pt 274.8pt 320.6pt 366.4pt 412.2pt 458.0pt 503.8pt 549.6pt 595.4pt 641.2pt 687.0pt 732.8pt;">
<span style="color: black; font-family: "courier new"; font-size: 9.0pt;">public class TestContended {<o:p></o:p></span></div>
<div class="MsoNormal" style="background: #F8F9FA; border: none; line-height: 15.6pt; margin-bottom: .0001pt; margin-bottom: 0cm; mso-border-alt: solid #EAECF0 .5pt; mso-padding-alt: 12.0pt 12.0pt 12.0pt 12.0pt; padding: 0cm; tab-stops: 45.8pt 91.6pt 137.4pt 183.2pt 229.0pt 274.8pt 320.6pt 366.4pt 412.2pt 458.0pt 503.8pt 549.6pt 595.4pt 641.2pt 687.0pt 732.8pt;">
<span style="color: black; font-family: "courier new"; font-size: 9.0pt;"> private String str1;<o:p></o:p></span></div>
<div class="MsoNormal" style="background: #F8F9FA; border: none; line-height: 15.6pt; margin-bottom: .0001pt; margin-bottom: 0cm; mso-border-alt: solid #EAECF0 .5pt; mso-padding-alt: 12.0pt 12.0pt 12.0pt 12.0pt; padding: 0cm; tab-stops: 45.8pt 91.6pt 137.4pt 183.2pt 229.0pt 274.8pt 320.6pt 366.4pt 412.2pt 458.0pt 503.8pt 549.6pt 595.4pt 641.2pt 687.0pt 732.8pt;">
<br /></div>
<div class="MsoNormal" style="background: #F8F9FA; border: none; line-height: 15.6pt; margin-bottom: .0001pt; margin-bottom: 0cm; mso-border-alt: solid #EAECF0 .5pt; mso-padding-alt: 12.0pt 12.0pt 12.0pt 12.0pt; padding: 0cm; tab-stops: 45.8pt 91.6pt 137.4pt 183.2pt 229.0pt 274.8pt 320.6pt 366.4pt 412.2pt 458.0pt 503.8pt 549.6pt 595.4pt 641.2pt 687.0pt 732.8pt;">
<span style="color: black; font-family: "courier new"; font-size: 9.0pt;"> @Contended<o:p></o:p></span></div>
<div class="MsoNormal" style="background: #F8F9FA; border: none; line-height: 15.6pt; margin-bottom: .0001pt; margin-bottom: 0cm; mso-border-alt: solid #EAECF0 .5pt; mso-padding-alt: 12.0pt 12.0pt 12.0pt 12.0pt; padding: 0cm; tab-stops: 45.8pt 91.6pt 137.4pt 183.2pt 229.0pt 274.8pt 320.6pt 366.4pt 412.2pt 458.0pt 503.8pt 549.6pt 595.4pt 641.2pt 687.0pt 732.8pt;">
<span style="color: black; font-family: "courier new"; font-size: 9.0pt;"> private String str2;<o:p></o:p></span></div>
<div class="MsoNormal" style="background: #F8F9FA; border: none; line-height: 15.6pt; margin-bottom: .0001pt; margin-bottom: 0cm; mso-border-alt: solid #EAECF0 .5pt; mso-padding-alt: 12.0pt 12.0pt 12.0pt 12.0pt; padding: 0cm; tab-stops: 45.8pt 91.6pt 137.4pt 183.2pt 229.0pt 274.8pt 320.6pt 366.4pt 412.2pt 458.0pt 503.8pt 549.6pt 595.4pt 641.2pt 687.0pt 732.8pt;">
<br /></div>
<div class="MsoNormal" style="background: #F8F9FA; border: none; line-height: 15.6pt; margin-bottom: .0001pt; margin-bottom: 0cm; mso-border-alt: solid #EAECF0 .5pt; mso-padding-alt: 12.0pt 12.0pt 12.0pt 12.0pt; padding: 0cm; tab-stops: 45.8pt 91.6pt 137.4pt 183.2pt 229.0pt 274.8pt 320.6pt 366.4pt 412.2pt 458.0pt 503.8pt 549.6pt 595.4pt 641.2pt 687.0pt 732.8pt;">
<span style="color: black; font-family: "courier new"; font-size: 9.0pt;"> @Contended<o:p></o:p></span></div>
<div class="MsoNormal" style="background: #F8F9FA; border: none; line-height: 15.6pt; margin-bottom: .0001pt; margin-bottom: 0cm; mso-border-alt: solid #EAECF0 .5pt; mso-padding-alt: 12.0pt 12.0pt 12.0pt 12.0pt; padding: 0cm; tab-stops: 45.8pt 91.6pt 137.4pt 183.2pt 229.0pt 274.8pt 320.6pt 366.4pt 412.2pt 458.0pt 503.8pt 549.6pt 595.4pt 641.2pt 687.0pt 732.8pt;">
<span style="color: black; font-family: "courier new"; font-size: 9.0pt;"> private int x;<o:p></o:p></span></div>
<div class="MsoNormal" style="background: #F8F9FA; border: none; line-height: 15.6pt; margin-bottom: .0001pt; margin-bottom: 0cm; mso-border-alt: solid #EAECF0 .5pt; mso-padding-alt: 12.0pt 12.0pt 12.0pt 12.0pt; padding: 0cm; tab-stops: 45.8pt 91.6pt 137.4pt 183.2pt 229.0pt 274.8pt 320.6pt 366.4pt 412.2pt 458.0pt 503.8pt 549.6pt 595.4pt 641.2pt 687.0pt 732.8pt;">
<span style="color: black; font-family: "courier new"; font-size: 9.0pt;">}<o:p></o:p></span></div>
</div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm;">
<br /></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm;">
<span style="color: black; font-family: "times new roman" , "serif"; font-size: 12.0pt;">In this example we wanted to keep str2 in a padded cache line and x in a
different padded cache line.<o:p></o:p></span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm;">
<br /></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm;">
<span style="color: black; font-family: "times new roman" , "serif"; font-size: 12.0pt;">If we want to keep 2 variable in the same cache line we can force it by
defining a value for Contended annotation like below.<o:p></o:p></span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm;">
<br /></div>
<div style="background: #F8F9FA; border: solid #EAECF0 1.0pt; mso-border-alt: solid #EAECF0 .5pt; mso-element: para-border-div; padding: 12.0pt 12.0pt 12.0pt 12.0pt;">
<div class="MsoNormal" style="background: #F8F9FA; border: none; line-height: 15.6pt; margin-bottom: .0001pt; margin-bottom: 0cm; mso-border-alt: solid #EAECF0 .5pt; mso-padding-alt: 12.0pt 12.0pt 12.0pt 12.0pt; padding: 0cm; tab-stops: 45.8pt 91.6pt 137.4pt 183.2pt 229.0pt 274.8pt 320.6pt 366.4pt 412.2pt 458.0pt 503.8pt 549.6pt 595.4pt 641.2pt 687.0pt 732.8pt;">
<span style="color: black; font-family: "courier new"; font-size: 9.0pt;">public class TestContended {<o:p></o:p></span></div>
<div class="MsoNormal" style="background: #F8F9FA; border: none; line-height: 15.6pt; margin-bottom: .0001pt; margin-bottom: 0cm; mso-border-alt: solid #EAECF0 .5pt; mso-padding-alt: 12.0pt 12.0pt 12.0pt 12.0pt; padding: 0cm; tab-stops: 45.8pt 91.6pt 137.4pt 183.2pt 229.0pt 274.8pt 320.6pt 366.4pt 412.2pt 458.0pt 503.8pt 549.6pt 595.4pt 641.2pt 687.0pt 732.8pt;">
<span style="color: black; font-family: "courier new"; font-size: 9.0pt;"> @Contended("test")<o:p></o:p></span></div>
<div class="MsoNormal" style="background: #F8F9FA; border: none; line-height: 15.6pt; margin-bottom: .0001pt; margin-bottom: 0cm; mso-border-alt: solid #EAECF0 .5pt; mso-padding-alt: 12.0pt 12.0pt 12.0pt 12.0pt; padding: 0cm; tab-stops: 45.8pt 91.6pt 137.4pt 183.2pt 229.0pt 274.8pt 320.6pt 366.4pt 412.2pt 458.0pt 503.8pt 549.6pt 595.4pt 641.2pt 687.0pt 732.8pt;">
<span style="color: black; font-family: "courier new"; font-size: 9.0pt;"> private String str2;<o:p></o:p></span></div>
<div class="MsoNormal" style="background: #F8F9FA; border: none; line-height: 15.6pt; margin-bottom: .0001pt; margin-bottom: 0cm; mso-border-alt: solid #EAECF0 .5pt; mso-padding-alt: 12.0pt 12.0pt 12.0pt 12.0pt; padding: 0cm; tab-stops: 45.8pt 91.6pt 137.4pt 183.2pt 229.0pt 274.8pt 320.6pt 366.4pt 412.2pt 458.0pt 503.8pt 549.6pt 595.4pt 641.2pt 687.0pt 732.8pt;">
<br /></div>
<div class="MsoNormal" style="background: #F8F9FA; border: none; line-height: 15.6pt; margin-bottom: .0001pt; margin-bottom: 0cm; mso-border-alt: solid #EAECF0 .5pt; mso-padding-alt: 12.0pt 12.0pt 12.0pt 12.0pt; padding: 0cm; tab-stops: 45.8pt 91.6pt 137.4pt 183.2pt 229.0pt 274.8pt 320.6pt 366.4pt 412.2pt 458.0pt 503.8pt 549.6pt 595.4pt 641.2pt 687.0pt 732.8pt;">
<span style="color: black; font-family: "courier new"; font-size: 9.0pt;"> @Contended("test")<o:p></o:p></span></div>
<div class="MsoNormal" style="background: #F8F9FA; border: none; line-height: 15.6pt; margin-bottom: .0001pt; margin-bottom: 0cm; mso-border-alt: solid #EAECF0 .5pt; mso-padding-alt: 12.0pt 12.0pt 12.0pt 12.0pt; padding: 0cm; tab-stops: 45.8pt 91.6pt 137.4pt 183.2pt 229.0pt 274.8pt 320.6pt 366.4pt 412.2pt 458.0pt 503.8pt 549.6pt 595.4pt 641.2pt 687.0pt 732.8pt;">
<span style="color: black; font-family: "courier new"; font-size: 9.0pt;"> private int x;<o:p></o:p></span></div>
<div class="MsoNormal" style="background: #F8F9FA; border: none; line-height: 15.6pt; margin-bottom: .0001pt; margin-bottom: 0cm; mso-border-alt: solid #EAECF0 .5pt; mso-padding-alt: 12.0pt 12.0pt 12.0pt 12.0pt; padding: 0cm; tab-stops: 45.8pt 91.6pt 137.4pt 183.2pt 229.0pt 274.8pt 320.6pt 366.4pt 412.2pt 458.0pt 503.8pt 549.6pt 595.4pt 641.2pt 687.0pt 732.8pt;">
<span style="color: black; font-family: "courier new"; font-size: 9.0pt;">}<o:p></o:p></span></div>
</div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm;">
<span style="color: black; font-family: "times new roman" , "serif"; font-size: 12.0pt;"><br />
Note that @Contended annotation already used in many classes like Thread,
ForkJoinPool and ConcurrentHashMap.<o:p></o:p></span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm;">
<br /></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm;">
<span style="color: black; font-family: "times new roman" , "serif"; font-size: 12.0pt;">We can use jol tool to see if Contended annotation work. Add the following
dependency for that.<o:p></o:p></span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm;">
<br /></div>
<div style="background: #F8F9FA; border: solid #EAECF0 1.0pt; mso-border-alt: solid #EAECF0 .5pt; mso-element: para-border-div; padding: 12.0pt 12.0pt 12.0pt 12.0pt;">
<div class="MsoNormal" style="background: #F8F9FA; border: none; line-height: 15.6pt; margin-bottom: .0001pt; margin-bottom: 0cm; mso-border-alt: solid #EAECF0 .5pt; mso-padding-alt: 12.0pt 12.0pt 12.0pt 12.0pt; padding: 0cm; tab-stops: 45.8pt 91.6pt 137.4pt 183.2pt 229.0pt 274.8pt 320.6pt 366.4pt 412.2pt 458.0pt 503.8pt 549.6pt 595.4pt 641.2pt 687.0pt 732.8pt;">
<span style="color: black; font-family: "times new roman" , "serif"; font-size: 9.0pt;"> </span><span style="color: black; font-family: "courier new"; font-size: 9.0pt;"><dependency><o:p></o:p></span></div>
<div class="MsoNormal" style="background: #F8F9FA; border: none; line-height: 15.6pt; margin-bottom: .0001pt; margin-bottom: 0cm; mso-border-alt: solid #EAECF0 .5pt; mso-padding-alt: 12.0pt 12.0pt 12.0pt 12.0pt; padding: 0cm; tab-stops: 45.8pt 91.6pt 137.4pt 183.2pt 229.0pt 274.8pt 320.6pt 366.4pt 412.2pt 458.0pt 503.8pt 549.6pt 595.4pt 641.2pt 687.0pt 732.8pt;">
<span style="color: black; font-family: "courier new"; font-size: 9.0pt;">
<groupId>org.openjdk.jol</groupId><o:p></o:p></span></div>
<div class="MsoNormal" style="background: #F8F9FA; border: none; line-height: 15.6pt; margin-bottom: .0001pt; margin-bottom: 0cm; mso-border-alt: solid #EAECF0 .5pt; mso-padding-alt: 12.0pt 12.0pt 12.0pt 12.0pt; padding: 0cm; tab-stops: 45.8pt 91.6pt 137.4pt 183.2pt 229.0pt 274.8pt 320.6pt 366.4pt 412.2pt 458.0pt 503.8pt 549.6pt 595.4pt 641.2pt 687.0pt 732.8pt;">
<span style="color: black; font-family: "courier new"; font-size: 9.0pt;">
<artifactId>jol-core</artifactId><o:p></o:p></span></div>
<div class="MsoNormal" style="background: #F8F9FA; border: none; line-height: 15.6pt; margin-bottom: .0001pt; margin-bottom: 0cm; mso-border-alt: solid #EAECF0 .5pt; mso-padding-alt: 12.0pt 12.0pt 12.0pt 12.0pt; padding: 0cm; tab-stops: 45.8pt 91.6pt 137.4pt 183.2pt 229.0pt 274.8pt 320.6pt 366.4pt 412.2pt 458.0pt 503.8pt 549.6pt 595.4pt 641.2pt 687.0pt 732.8pt;">
<span style="color: black; font-family: "courier new"; font-size: 9.0pt;">
<version>0.9</version><o:p></o:p></span></div>
<div class="MsoNormal" style="background: #F8F9FA; border: none; line-height: 15.6pt; margin-bottom: .0001pt; margin-bottom: 0cm; mso-border-alt: solid #EAECF0 .5pt; mso-padding-alt: 12.0pt 12.0pt 12.0pt 12.0pt; padding: 0cm; tab-stops: 45.8pt 91.6pt 137.4pt 183.2pt 229.0pt 274.8pt 320.6pt 366.4pt 412.2pt 458.0pt 503.8pt 549.6pt 595.4pt 641.2pt 687.0pt 732.8pt;">
<span style="color: black; font-family: "courier new"; font-size: 9.0pt;"> </dependency><o:p></o:p></span></div>
</div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm;">
<br /></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm;">
<span style="color: black; font-family: "times new roman" , "serif"; font-size: 12.0pt;">And run the following code for the TestPaddingAndContended example
below.<o:p></o:p></span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm;">
<br /></div>
<div style="background: #F8F9FA; border: solid #EAECF0 1.0pt; mso-border-alt: solid #EAECF0 .5pt; mso-element: para-border-div; padding: 12.0pt 12.0pt 12.0pt 12.0pt;">
<div class="MsoNormal" style="background: #F8F9FA; border: none; line-height: 15.6pt; margin-bottom: .0001pt; margin-bottom: 0cm; mso-border-alt: solid #EAECF0 .5pt; mso-padding-alt: 12.0pt 12.0pt 12.0pt 12.0pt; padding: 0cm; tab-stops: 45.8pt 91.6pt 137.4pt 183.2pt 229.0pt 274.8pt 320.6pt 366.4pt 412.2pt 458.0pt 503.8pt 549.6pt 595.4pt 641.2pt 687.0pt 732.8pt;">
<span style="color: black; font-family: "courier new"; font-size: 9.0pt;">System.out.println(VM.current().details());<o:p></o:p></span></div>
<div class="MsoNormal" style="background: #F8F9FA; border: none; line-height: 15.6pt; margin-bottom: .0001pt; margin-bottom: 0cm; mso-border-alt: solid #EAECF0 .5pt; mso-padding-alt: 12.0pt 12.0pt 12.0pt 12.0pt; padding: 0cm; tab-stops: 45.8pt 91.6pt 137.4pt 183.2pt 229.0pt 274.8pt 320.6pt 366.4pt 412.2pt 458.0pt 503.8pt 549.6pt 595.4pt 641.2pt 687.0pt 732.8pt;">
<span style="color: black; font-family: "courier new"; font-size: 9.0pt;">System.out.println(ClassLayout.parseClass(TestPaddingAndContended.class).toPrintable());<o:p></o:p></span></div>
</div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm;">
<br /></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm;">
<span style="color: black; font-family: "times new roman" , "serif"; font-size: 12.0pt;">It will print the following by default (along with the VM details). As we
see no padding took place.<o:p></o:p></span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm;">
<br /></div>
<div style="background: #F8F9FA; border: solid #EAECF0 1.0pt; mso-border-alt: solid #EAECF0 .5pt; mso-element: para-border-div; padding: 12.0pt 12.0pt 12.0pt 12.0pt;">
<div class="MsoNormal" style="background: #F8F9FA; border: none; line-height: 15.6pt; margin-bottom: .0001pt; margin-bottom: 0cm; mso-border-alt: solid #EAECF0 .5pt; mso-padding-alt: 12.0pt 12.0pt 12.0pt 12.0pt; padding: 0cm; tab-stops: 45.8pt 91.6pt 137.4pt 183.2pt 229.0pt 274.8pt 320.6pt 366.4pt 412.2pt 458.0pt 503.8pt 549.6pt 595.4pt 641.2pt 687.0pt 732.8pt;">
<span style="color: black; font-family: "courier new"; font-size: 7.0pt;"> </span><span style="color: black; font-family: "courier new"; font-size: 9.0pt;">falsesharing.TestPaddingAndContended object internals:<o:p></o:p></span></div>
<div class="MsoNormal" style="background: #F8F9FA; border: none; line-height: 15.6pt; margin-bottom: .0001pt; margin-bottom: 0cm; mso-border-alt: solid #EAECF0 .5pt; mso-padding-alt: 12.0pt 12.0pt 12.0pt 12.0pt; padding: 0cm; tab-stops: 45.8pt 91.6pt 137.4pt 183.2pt 229.0pt 274.8pt 320.6pt 366.4pt 412.2pt 458.0pt 503.8pt 549.6pt 595.4pt 641.2pt 687.0pt 732.8pt;">
<br /></div>
<div class="MsoNormal" style="background: #F8F9FA; border: none; line-height: 15.6pt; margin-bottom: .0001pt; margin-bottom: 0cm; mso-border-alt: solid #EAECF0 .5pt; mso-padding-alt: 12.0pt 12.0pt 12.0pt 12.0pt; padding: 0cm; tab-stops: 45.8pt 91.6pt 137.4pt 183.2pt 229.0pt 274.8pt 320.6pt 366.4pt 412.2pt 458.0pt 503.8pt 549.6pt 595.4pt 641.2pt 687.0pt 732.8pt;">
<span style="color: black; font-family: "courier new"; font-size: 9.0pt;"> OFFSET <span style="mso-spacerun: yes;"> </span>SIZE <span style="mso-spacerun: yes;"> </span>TYPE DESCRIPTION
VALUE<o:p></o:p></span></div>
<div class="MsoNormal" style="background: #F8F9FA; border: none; line-height: 15.6pt; margin-bottom: .0001pt; margin-bottom: 0cm; mso-border-alt: solid #EAECF0 .5pt; mso-padding-alt: 12.0pt 12.0pt 12.0pt 12.0pt; padding: 0cm; tab-stops: 45.8pt 91.6pt 137.4pt 183.2pt 229.0pt 274.8pt 320.6pt 366.4pt 412.2pt 458.0pt 503.8pt 549.6pt 595.4pt 641.2pt 687.0pt 732.8pt;">
<br /></div>
<div class="MsoNormal" style="background: #F8F9FA; border: none; line-height: 15.6pt; margin-bottom: .0001pt; margin-bottom: 0cm; mso-border-alt: solid #EAECF0 .5pt; mso-padding-alt: 12.0pt 12.0pt 12.0pt 12.0pt; padding: 0cm; tab-stops: 45.8pt 91.6pt 137.4pt 183.2pt 229.0pt 274.8pt 320.6pt 366.4pt 412.2pt 458.0pt 503.8pt 549.6pt 595.4pt 641.2pt 687.0pt 732.8pt;">
<span style="color: black; font-family: "courier new"; font-size: 9.0pt;"> 0
12 (object header)
<span style="mso-spacerun: yes;"> </span>N/A<o:p></o:p></span></div>
<div class="MsoNormal" style="background: #F8F9FA; border: none; line-height: 15.6pt; margin-bottom: .0001pt; margin-bottom: 0cm; mso-border-alt: solid #EAECF0 .5pt; mso-padding-alt: 12.0pt 12.0pt 12.0pt 12.0pt; padding: 0cm; tab-stops: 45.8pt 91.6pt 137.4pt 183.2pt 229.0pt 274.8pt 320.6pt 366.4pt 412.2pt 458.0pt 503.8pt 549.6pt 595.4pt 641.2pt 687.0pt 732.8pt;">
<br /></div>
<div class="MsoNormal" style="background: #F8F9FA; border: none; line-height: 15.6pt; margin-bottom: .0001pt; margin-bottom: 0cm; mso-border-alt: solid #EAECF0 .5pt; mso-padding-alt: 12.0pt 12.0pt 12.0pt 12.0pt; padding: 0cm; tab-stops: 45.8pt 91.6pt 137.4pt 183.2pt 229.0pt 274.8pt 320.6pt 366.4pt 412.2pt 458.0pt 503.8pt 549.6pt 595.4pt 641.2pt 687.0pt 732.8pt;">
<span style="color: black; font-family: "courier new"; font-size: 9.0pt;"> 12
4 int TestPaddingAndContended.myVolatileValue1
N/A<o:p></o:p></span></div>
<div class="MsoNormal" style="background: #F8F9FA; border: none; line-height: 15.6pt; margin-bottom: .0001pt; margin-bottom: 0cm; mso-border-alt: solid #EAECF0 .5pt; mso-padding-alt: 12.0pt 12.0pt 12.0pt 12.0pt; padding: 0cm; tab-stops: 45.8pt 91.6pt 137.4pt 183.2pt 229.0pt 274.8pt 320.6pt 366.4pt 412.2pt 458.0pt 503.8pt 549.6pt 595.4pt 641.2pt 687.0pt 732.8pt;">
<br /></div>
<div class="MsoNormal" style="background: #F8F9FA; border: none; line-height: 15.6pt; margin-bottom: .0001pt; margin-bottom: 0cm; mso-border-alt: solid #EAECF0 .5pt; mso-padding-alt: 12.0pt 12.0pt 12.0pt 12.0pt; padding: 0cm; tab-stops: 45.8pt 91.6pt 137.4pt 183.2pt 229.0pt 274.8pt 320.6pt 366.4pt 412.2pt 458.0pt 503.8pt 549.6pt 595.4pt 641.2pt 687.0pt 732.8pt;">
<span style="color: black; font-family: "courier new"; font-size: 9.0pt;"> 16
4 int TestPaddingAndContended.myVolatileValue2
N/A<o:p></o:p></span></div>
<div class="MsoNormal" style="background: #F8F9FA; border: none; line-height: 15.6pt; margin-bottom: .0001pt; margin-bottom: 0cm; mso-border-alt: solid #EAECF0 .5pt; mso-padding-alt: 12.0pt 12.0pt 12.0pt 12.0pt; padding: 0cm; tab-stops: 45.8pt 91.6pt 137.4pt 183.2pt 229.0pt 274.8pt 320.6pt 366.4pt 412.2pt 458.0pt 503.8pt 549.6pt 595.4pt 641.2pt 687.0pt 732.8pt;">
<br /></div>
<div class="MsoNormal" style="background: #F8F9FA; border: none; line-height: 15.6pt; margin-bottom: .0001pt; margin-bottom: 0cm; mso-border-alt: solid #EAECF0 .5pt; mso-padding-alt: 12.0pt 12.0pt 12.0pt 12.0pt; padding: 0cm; tab-stops: 45.8pt 91.6pt 137.4pt 183.2pt 229.0pt 274.8pt 320.6pt 366.4pt 412.2pt 458.0pt 503.8pt 549.6pt 595.4pt 641.2pt 687.0pt 732.8pt;">
<span style="color: black; font-family: "courier new"; font-size: 9.0pt;"> 20 <span style="mso-spacerun: yes;"> </span> 4 (loss due
to the next object alignment)<o:p></o:p></span></div>
<div class="MsoNormal" style="background: #F8F9FA; border: none; line-height: 15.6pt; margin-bottom: .0001pt; margin-bottom: 0cm; mso-border-alt: solid #EAECF0 .5pt; mso-padding-alt: 12.0pt 12.0pt 12.0pt 12.0pt; padding: 0cm; tab-stops: 45.8pt 91.6pt 137.4pt 183.2pt 229.0pt 274.8pt 320.6pt 366.4pt 412.2pt 458.0pt 503.8pt 549.6pt 595.4pt 641.2pt 687.0pt 732.8pt;">
<br /></div>
<div class="MsoNormal" style="background: #F8F9FA; border: none; line-height: 15.6pt; margin-bottom: .0001pt; margin-bottom: 0cm; mso-border-alt: solid #EAECF0 .5pt; mso-padding-alt: 12.0pt 12.0pt 12.0pt 12.0pt; padding: 0cm; tab-stops: 45.8pt 91.6pt 137.4pt 183.2pt 229.0pt 274.8pt 320.6pt 366.4pt 412.2pt 458.0pt 503.8pt 549.6pt 595.4pt 641.2pt 687.0pt 732.8pt;">
<span style="color: black; font-family: "courier new"; font-size: 9.0pt;">Instance size: 24 bytes<o:p></o:p></span></div>
<div class="MsoNormal" style="background: #F8F9FA; border: none; line-height: 15.6pt; margin-bottom: .0001pt; margin-bottom: 0cm; mso-border-alt: solid #EAECF0 .5pt; mso-padding-alt: 12.0pt 12.0pt 12.0pt 12.0pt; padding: 0cm; tab-stops: 45.8pt 91.6pt 137.4pt 183.2pt 229.0pt 274.8pt 320.6pt 366.4pt 412.2pt 458.0pt 503.8pt 549.6pt 595.4pt 641.2pt 687.0pt 732.8pt;">
<br /></div>
<div class="MsoNormal" style="background: #F8F9FA; border: none; line-height: 15.6pt; margin-bottom: .0001pt; margin-bottom: 0cm; mso-border-alt: solid #EAECF0 .5pt; mso-padding-alt: 12.0pt 12.0pt 12.0pt 12.0pt; padding: 0cm; tab-stops: 45.8pt 91.6pt 137.4pt 183.2pt 229.0pt 274.8pt 320.6pt 366.4pt 412.2pt 458.0pt 503.8pt 549.6pt 595.4pt 641.2pt 687.0pt 732.8pt;">
<span style="color: black; font-family: "courier new"; font-size: 9.0pt;">Space losses: 0 bytes internal + 4 bytes external = 4
bytes total<o:p></o:p></span></div>
<div class="MsoNormal" style="background: #F8F9FA; border: none; line-height: 15.6pt; margin-bottom: .0001pt; margin-bottom: 0cm; mso-border-alt: solid #EAECF0 .5pt; mso-padding-alt: 12.0pt 12.0pt 12.0pt 12.0pt; padding: 0cm; tab-stops: 45.8pt 91.6pt 137.4pt 183.2pt 229.0pt 274.8pt 320.6pt 366.4pt 412.2pt 458.0pt 503.8pt 549.6pt 595.4pt 641.2pt 687.0pt 732.8pt;">
<br /></div>
</div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm;">
<br /></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm;">
<span style="color: black; font-family: "times new roman" , "serif"; font-size: 12.0pt;">But with -XX:-RestrictContended JVM arg we will see the following.<o:p></o:p></span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm;">
<br /></div>
<div style="background: #F8F9FA; border: solid #EAECF0 1.0pt; mso-border-alt: solid #EAECF0 .5pt; mso-element: para-border-div; padding: 12.0pt 12.0pt 12.0pt 12.0pt;">
<div class="MsoNormal" style="background: #F8F9FA; border: none; line-height: 15.6pt; margin-bottom: .0001pt; margin-bottom: 0cm; mso-border-alt: solid #EAECF0 .5pt; mso-padding-alt: 12.0pt 12.0pt 12.0pt 12.0pt; padding: 0cm; tab-stops: 45.8pt 91.6pt 137.4pt 183.2pt 229.0pt 274.8pt 320.6pt 366.4pt 412.2pt 458.0pt 503.8pt 549.6pt 595.4pt 641.2pt 687.0pt 732.8pt;">
<span style="color: black; font-family: "courier new"; font-size: 9.0pt;">falsesharing.TestPaddingAndContended object internals:<o:p></o:p></span></div>
<div class="MsoNormal" style="background: #F8F9FA; border: none; line-height: 15.6pt; margin-bottom: .0001pt; margin-bottom: 0cm; mso-border-alt: solid #EAECF0 .5pt; mso-padding-alt: 12.0pt 12.0pt 12.0pt 12.0pt; padding: 0cm; tab-stops: 45.8pt 91.6pt 137.4pt 183.2pt 229.0pt 274.8pt 320.6pt 366.4pt 412.2pt 458.0pt 503.8pt 549.6pt 595.4pt 641.2pt 687.0pt 732.8pt;">
<br /></div>
<div class="MsoNormal" style="background: #F8F9FA; border: none; line-height: 15.6pt; margin-bottom: .0001pt; margin-bottom: 0cm; mso-border-alt: solid #EAECF0 .5pt; mso-padding-alt: 12.0pt 12.0pt 12.0pt 12.0pt; padding: 0cm; tab-stops: 45.8pt 91.6pt 137.4pt 183.2pt 229.0pt 274.8pt 320.6pt 366.4pt 412.2pt 458.0pt 503.8pt 549.6pt 595.4pt 641.2pt 687.0pt 732.8pt;">
<span style="color: black; font-family: "courier new"; font-size: 9.0pt;"> OFFSET <span style="mso-spacerun: yes;">
</span>SIZE <span style="mso-spacerun: yes;"> </span><span style="mso-spacerun: yes;"> </span>TYPE DESCRIPTION
VALUE<o:p></o:p></span></div>
<div class="MsoNormal" style="background: #F8F9FA; border: none; line-height: 15.6pt; margin-bottom: .0001pt; margin-bottom: 0cm; mso-border-alt: solid #EAECF0 .5pt; mso-padding-alt: 12.0pt 12.0pt 12.0pt 12.0pt; padding: 0cm; tab-stops: 45.8pt 91.6pt 137.4pt 183.2pt 229.0pt 274.8pt 320.6pt 366.4pt 412.2pt 458.0pt 503.8pt 549.6pt 595.4pt 641.2pt 687.0pt 732.8pt;">
<br /></div>
<div class="MsoNormal" style="background: #F8F9FA; border: none; line-height: 15.6pt; margin-bottom: .0001pt; margin-bottom: 0cm; mso-border-alt: solid #EAECF0 .5pt; mso-padding-alt: 12.0pt 12.0pt 12.0pt 12.0pt; padding: 0cm; tab-stops: 45.8pt 91.6pt 137.4pt 183.2pt 229.0pt 274.8pt 320.6pt 366.4pt 412.2pt 458.0pt 503.8pt 549.6pt 595.4pt 641.2pt 687.0pt 732.8pt;">
<span style="color: black; font-family: "courier new"; font-size: 9.0pt;"> 0 12
<span style="mso-spacerun: yes;"> </span>(object
header)
N/A<o:p></o:p></span></div>
<div class="MsoNormal" style="background: #F8F9FA; border: none; line-height: 15.6pt; margin-bottom: .0001pt; margin-bottom: 0cm; mso-border-alt: solid #EAECF0 .5pt; mso-padding-alt: 12.0pt 12.0pt 12.0pt 12.0pt; padding: 0cm; tab-stops: 45.8pt 91.6pt 137.4pt 183.2pt 229.0pt 274.8pt 320.6pt 366.4pt 412.2pt 458.0pt 503.8pt 549.6pt 595.4pt 641.2pt 687.0pt 732.8pt;">
<br /></div>
<div class="MsoNormal" style="background: #F8F9FA; border: none; line-height: 15.6pt; margin-bottom: .0001pt; margin-bottom: 0cm; mso-border-alt: solid #EAECF0 .5pt; mso-padding-alt: 12.0pt 12.0pt 12.0pt 12.0pt; padding: 0cm; tab-stops: 45.8pt 91.6pt 137.4pt 183.2pt 229.0pt 274.8pt 320.6pt 366.4pt 412.2pt 458.0pt 503.8pt 549.6pt 595.4pt 641.2pt 687.0pt 732.8pt;">
<span style="color: black; font-family: "courier new"; font-size: 9.0pt;"> 12 128
(alignment/padding gap)
<o:p></o:p></span></div>
<div class="MsoNormal" style="background: #F8F9FA; border: none; line-height: 15.6pt; margin-bottom: .0001pt; margin-bottom: 0cm; mso-border-alt: solid #EAECF0 .5pt; mso-padding-alt: 12.0pt 12.0pt 12.0pt 12.0pt; padding: 0cm; tab-stops: 45.8pt 91.6pt 137.4pt 183.2pt 229.0pt 274.8pt 320.6pt 366.4pt 412.2pt 458.0pt 503.8pt 549.6pt 595.4pt 641.2pt 687.0pt 732.8pt;">
<br /></div>
<div class="MsoNormal" style="background: #F8F9FA; border: none; line-height: 15.6pt; margin-bottom: .0001pt; margin-bottom: 0cm; mso-border-alt: solid #EAECF0 .5pt; mso-padding-alt: 12.0pt 12.0pt 12.0pt 12.0pt; padding: 0cm; tab-stops: 45.8pt 91.6pt 137.4pt 183.2pt 229.0pt 274.8pt 320.6pt 366.4pt 412.2pt 458.0pt 503.8pt 549.6pt 595.4pt 641.2pt 687.0pt 732.8pt;">
<span style="color: black; font-family: "courier new"; font-size: 9.0pt;"> 140 4
int TestPaddingAndContended.myVolatileValue1 N/A<o:p></o:p></span></div>
<div class="MsoNormal" style="background: #F8F9FA; border: none; line-height: 15.6pt; margin-bottom: .0001pt; margin-bottom: 0cm; mso-border-alt: solid #EAECF0 .5pt; mso-padding-alt: 12.0pt 12.0pt 12.0pt 12.0pt; padding: 0cm; tab-stops: 45.8pt 91.6pt 137.4pt 183.2pt 229.0pt 274.8pt 320.6pt 366.4pt 412.2pt 458.0pt 503.8pt 549.6pt 595.4pt 641.2pt 687.0pt 732.8pt;">
<br /></div>
<div class="MsoNormal" style="background: #F8F9FA; border: none; line-height: 15.6pt; margin-bottom: .0001pt; margin-bottom: 0cm; mso-border-alt: solid #EAECF0 .5pt; mso-padding-alt: 12.0pt 12.0pt 12.0pt 12.0pt; padding: 0cm; tab-stops: 45.8pt 91.6pt 137.4pt 183.2pt 229.0pt 274.8pt 320.6pt 366.4pt 412.2pt 458.0pt 503.8pt 549.6pt 595.4pt 641.2pt 687.0pt 732.8pt;">
<span style="color: black; font-family: "courier new"; font-size: 9.0pt;"> 144 128
(alignment/padding gap)
<o:p></o:p></span></div>
<div class="MsoNormal" style="background: #F8F9FA; border: none; line-height: 15.6pt; margin-bottom: .0001pt; margin-bottom: 0cm; mso-border-alt: solid #EAECF0 .5pt; mso-padding-alt: 12.0pt 12.0pt 12.0pt 12.0pt; padding: 0cm; tab-stops: 45.8pt 91.6pt 137.4pt 183.2pt 229.0pt 274.8pt 320.6pt 366.4pt 412.2pt 458.0pt 503.8pt 549.6pt 595.4pt 641.2pt 687.0pt 732.8pt;">
<br /></div>
<div class="MsoNormal" style="background: #F8F9FA; border: none; line-height: 15.6pt; margin-bottom: .0001pt; margin-bottom: 0cm; mso-border-alt: solid #EAECF0 .5pt; mso-padding-alt: 12.0pt 12.0pt 12.0pt 12.0pt; padding: 0cm; tab-stops: 45.8pt 91.6pt 137.4pt 183.2pt 229.0pt 274.8pt 320.6pt 366.4pt 412.2pt 458.0pt 503.8pt 549.6pt 595.4pt 641.2pt 687.0pt 732.8pt;">
<span style="color: black; font-family: "courier new"; font-size: 9.0pt;"> 272 4
int TestPaddingAndContended.myVolatileValue2 N/A<o:p></o:p></span></div>
<div class="MsoNormal" style="background: #F8F9FA; border: none; line-height: 15.6pt; margin-bottom: .0001pt; margin-bottom: 0cm; mso-border-alt: solid #EAECF0 .5pt; mso-padding-alt: 12.0pt 12.0pt 12.0pt 12.0pt; padding: 0cm; tab-stops: 45.8pt 91.6pt 137.4pt 183.2pt 229.0pt 274.8pt 320.6pt 366.4pt 412.2pt 458.0pt 503.8pt 549.6pt 595.4pt 641.2pt 687.0pt 732.8pt;">
<br /></div>
<div class="MsoNormal" style="background: #F8F9FA; border: none; line-height: 15.6pt; margin-bottom: .0001pt; margin-bottom: 0cm; mso-border-alt: solid #EAECF0 .5pt; mso-padding-alt: 12.0pt 12.0pt 12.0pt 12.0pt; padding: 0cm; tab-stops: 45.8pt 91.6pt 137.4pt 183.2pt 229.0pt 274.8pt 320.6pt 366.4pt 412.2pt 458.0pt 503.8pt 549.6pt 595.4pt 641.2pt 687.0pt 732.8pt;">
<span style="color: black; font-family: "courier new"; font-size: 9.0pt;"> 276 4
(loss due to the next object alignment)<o:p></o:p></span></div>
<div class="MsoNormal" style="background: #F8F9FA; border: none; line-height: 15.6pt; margin-bottom: .0001pt; margin-bottom: 0cm; mso-border-alt: solid #EAECF0 .5pt; mso-padding-alt: 12.0pt 12.0pt 12.0pt 12.0pt; padding: 0cm; tab-stops: 45.8pt 91.6pt 137.4pt 183.2pt 229.0pt 274.8pt 320.6pt 366.4pt 412.2pt 458.0pt 503.8pt 549.6pt 595.4pt 641.2pt 687.0pt 732.8pt;">
<br /></div>
<div class="MsoNormal" style="background: #F8F9FA; border: none; line-height: 15.6pt; margin-bottom: .0001pt; margin-bottom: 0cm; mso-border-alt: solid #EAECF0 .5pt; mso-padding-alt: 12.0pt 12.0pt 12.0pt 12.0pt; padding: 0cm; tab-stops: 45.8pt 91.6pt 137.4pt 183.2pt 229.0pt 274.8pt 320.6pt 366.4pt 412.2pt 458.0pt 503.8pt 549.6pt 595.4pt 641.2pt 687.0pt 732.8pt;">
<span style="color: black; font-family: "courier new"; font-size: 9.0pt;">Instance size: 280 bytes<o:p></o:p></span></div>
<div class="MsoNormal" style="background: #F8F9FA; border: none; line-height: 15.6pt; margin-bottom: .0001pt; margin-bottom: 0cm; mso-border-alt: solid #EAECF0 .5pt; mso-padding-alt: 12.0pt 12.0pt 12.0pt 12.0pt; padding: 0cm; tab-stops: 45.8pt 91.6pt 137.4pt 183.2pt 229.0pt 274.8pt 320.6pt 366.4pt 412.2pt 458.0pt 503.8pt 549.6pt 595.4pt 641.2pt 687.0pt 732.8pt;">
<span style="color: black; font-family: "courier new"; font-size: 9.0pt;">Space losses: 256 bytes internal + 4 bytes external =
260 bytes total<o:p></o:p></span></div>
</div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm;">
<br /></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm;">
<span style="color: black; font-family: "times new roman" , "serif"; font-size: 12.0pt;">We see that we have 256 bytes space loss because of the padding as a result
of Contended annotation.<o:p></o:p></span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm;">
<span style="color: black; font-family: "times new roman" , "serif"; font-size: 12.0pt;"><br />
Lets finish our job by a concrete and more detailed example. In this example we
will use 2 different int variables, and 2 threads that will do a number of
assignment operation on that variables. If we run the below code for the
following different cases we'll get the below results.<o:p></o:p></span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm;">
<span style="color: black; font-family: "times new roman" , "serif"; font-size: 12.0pt;"><br />
* 2 non-shared volatile int variable without padding, suppose to be
on the same cache line.<o:p></o:p></span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm;">
<span style="color: black; font-family: "times new roman" , "serif"; font-size: 12.0pt;"> Avg. running time: 3.34 sec<o:p></o:p></span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm;">
<br /></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm;">
<span style="color: black; font-family: "times new roman" , "serif"; font-size: 12.0pt;">* 2 non-shared volatile int variable with padding,
suppose to be on different cache line.<o:p></o:p></span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm;">
<span style="color: black; font-family: "times new roman" , "serif"; font-size: 12.0pt;"> Avg. running time: 3.07 sec<o:p></o:p></span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm;">
<br /></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm;">
<span style="color: black; font-family: "times new roman" , "serif"; font-size: 12.0pt;">* 2 non-shared volatile int variable with @Contended,
suppose to be on different cache line.<o:p></o:p></span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm;">
<span style="color: black; font-family: "times new roman" , "serif"; font-size: 12.0pt;"> Avg. running time: 1.39 sec<o:p></o:p></span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm;">
<br /></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm;">
<span style="color: black; font-family: "times new roman" , "serif"; font-size: 12.0pt;">* 2 non-shared non-volatile int variable without padding,
suppose to be on the same cache line.<o:p></o:p></span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm;">
<span style="color: black; font-family: "times new roman" , "serif"; font-size: 12.0pt;"> Avg. running time: 1.11 sec<o:p></o:p></span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm;">
<br /></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm;">
<span style="color: black; font-family: "times new roman" , "serif"; font-size: 12.0pt;">* 2 non-shared non-volatile int variable with padding,
suppose to be on different cache line.<o:p></o:p></span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm;">
<span style="color: black; font-family: "times new roman" , "serif"; font-size: 12.0pt;"> Avg. running time: 1.16 sec<o:p></o:p></span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm;">
<br /></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm;">
<span style="color: black; font-family: "times new roman" , "serif"; font-size: 12.0pt;">As you can see using volatile variable definitely affects the
read/write performance when compared with non-volatile variables. On the other
hand when we use custom padding or @Contended annotation we get a much more
better performance. It is important to note that here the 2 threads may or may
not be running on different cores or they may run on different core at some
percentage and run on the same core at some percentage. And there is no way of
forcing a thread to be run on specific cpu core. Here the aim is to run the
code repeatedly and try to get an avarage result to understand the false
sharing concept. If we increase the iteration time we can see that the padding
and especially the @Contended approach is really improves performance by
preventing false sharing and reducing stall time in cpu. We see a more clear
result by using @Contended since it also takes care of allocation on heap
and warn JIT and GC about the contended objects.<o:p></o:p></span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm;">
<br /></div>
<div style="background: #F8F9FA; border: solid #EAECF0 1.0pt; mso-border-alt: solid #EAECF0 .5pt; mso-element: para-border-div; padding: 12.0pt 12.0pt 12.0pt 12.0pt;">
<div class="MsoNormal" style="background: #F8F9FA; border: none; line-height: 15.6pt; margin-bottom: .0001pt; margin-bottom: 0cm; mso-border-alt: solid #EAECF0 .5pt; mso-padding-alt: 12.0pt 12.0pt 12.0pt 12.0pt; padding: 0cm; tab-stops: 45.8pt 91.6pt 137.4pt 183.2pt 229.0pt 274.8pt 320.6pt 366.4pt 412.2pt 458.0pt 503.8pt 549.6pt 595.4pt 641.2pt 687.0pt 732.8pt;">
<span style="color: black; font-family: "courier new"; font-size: 9.0pt;">package falsesharing;<o:p></o:p></span></div>
<div class="MsoNormal" style="background: #F8F9FA; border: none; line-height: 15.6pt; margin-bottom: .0001pt; margin-bottom: 0cm; mso-border-alt: solid #EAECF0 .5pt; mso-padding-alt: 12.0pt 12.0pt 12.0pt 12.0pt; padding: 0cm; tab-stops: 45.8pt 91.6pt 137.4pt 183.2pt 229.0pt 274.8pt 320.6pt 366.4pt 412.2pt 458.0pt 503.8pt 549.6pt 595.4pt 641.2pt 687.0pt 732.8pt;">
<br /></div>
<div class="MsoNormal" style="background: #F8F9FA; border: none; line-height: 15.6pt; margin-bottom: .0001pt; margin-bottom: 0cm; mso-border-alt: solid #EAECF0 .5pt; mso-padding-alt: 12.0pt 12.0pt 12.0pt 12.0pt; padding: 0cm; tab-stops: 45.8pt 91.6pt 137.4pt 183.2pt 229.0pt 274.8pt 320.6pt 366.4pt 412.2pt 458.0pt 503.8pt 549.6pt 595.4pt 641.2pt 687.0pt 732.8pt;">
<span style="color: black; font-family: "courier new"; font-size: 9.0pt;">import sun.misc.Contended;<o:p></o:p></span></div>
<div class="MsoNormal" style="background: #F8F9FA; border: none; line-height: 15.6pt; margin-bottom: .0001pt; margin-bottom: 0cm; mso-border-alt: solid #EAECF0 .5pt; mso-padding-alt: 12.0pt 12.0pt 12.0pt 12.0pt; padding: 0cm; tab-stops: 45.8pt 91.6pt 137.4pt 183.2pt 229.0pt 274.8pt 320.6pt 366.4pt 412.2pt 458.0pt 503.8pt 549.6pt 595.4pt 641.2pt 687.0pt 732.8pt;">
<br /></div>
<div class="MsoNormal" style="background: #F8F9FA; border: none; line-height: 15.6pt; margin-bottom: .0001pt; margin-bottom: 0cm; mso-border-alt: solid #EAECF0 .5pt; mso-padding-alt: 12.0pt 12.0pt 12.0pt 12.0pt; padding: 0cm; tab-stops: 45.8pt 91.6pt 137.4pt 183.2pt 229.0pt 274.8pt 320.6pt 366.4pt 412.2pt 458.0pt 503.8pt 549.6pt 595.4pt 641.2pt 687.0pt 732.8pt;">
<span style="color: black; font-family: "courier new"; font-size: 9.0pt;">/**<o:p></o:p></span></div>
<div class="MsoNormal" style="background: #F8F9FA; border: none; line-height: 15.6pt; margin-bottom: .0001pt; margin-bottom: 0cm; mso-border-alt: solid #EAECF0 .5pt; mso-padding-alt: 12.0pt 12.0pt 12.0pt 12.0pt; padding: 0cm; tab-stops: 45.8pt 91.6pt 137.4pt 183.2pt 229.0pt 274.8pt 320.6pt 366.4pt 412.2pt 458.0pt 503.8pt 549.6pt 595.4pt 641.2pt 687.0pt 732.8pt;">
<span style="color: black; font-family: "courier new"; font-size: 9.0pt;"><span style="mso-spacerun: yes;"> </span>* This class is
used to test the false sharing concept.<o:p></o:p></span></div>
<div class="MsoNormal" style="background: #F8F9FA; border: none; line-height: 15.6pt; margin-bottom: .0001pt; margin-bottom: 0cm; mso-border-alt: solid #EAECF0 .5pt; mso-padding-alt: 12.0pt 12.0pt 12.0pt 12.0pt; padding: 0cm; tab-stops: 45.8pt 91.6pt 137.4pt 183.2pt 229.0pt 274.8pt 320.6pt 366.4pt 412.2pt 458.0pt 503.8pt 549.6pt 595.4pt 641.2pt 687.0pt 732.8pt;">
<span style="color: black; font-family: "courier new"; font-size: 9.0pt;"><span style="mso-spacerun: yes;"> </span>* It uses 2
threads changing 2 independent int variables.<o:p></o:p></span></div>
<div class="MsoNormal" style="background: #F8F9FA; border: none; line-height: 15.6pt; margin-bottom: .0001pt; margin-bottom: 0cm; mso-border-alt: solid #EAECF0 .5pt; mso-padding-alt: 12.0pt 12.0pt 12.0pt 12.0pt; padding: 0cm; tab-stops: 45.8pt 91.6pt 137.4pt 183.2pt 229.0pt 274.8pt 320.6pt 366.4pt 412.2pt 458.0pt 503.8pt 549.6pt 595.4pt 641.2pt 687.0pt 732.8pt;">
<span style="color: black; font-family: "courier new"; font-size: 9.0pt;"><span style="mso-spacerun: yes;"> </span>* By changing
the variables to volatile and non-volatile,<o:p></o:p></span></div>
<div class="MsoNormal" style="background: #F8F9FA; border: none; line-height: 15.6pt; margin-bottom: .0001pt; margin-bottom: 0cm; mso-border-alt: solid #EAECF0 .5pt; mso-padding-alt: 12.0pt 12.0pt 12.0pt 12.0pt; padding: 0cm; tab-stops: 45.8pt 91.6pt 137.4pt 183.2pt 229.0pt 274.8pt 320.6pt 366.4pt 412.2pt 458.0pt 503.8pt 549.6pt 595.4pt 641.2pt 687.0pt 732.8pt;">
<span style="color: black; font-family: "courier new"; font-size: 9.0pt;"><span style="mso-spacerun: yes;"> </span>* marking and
unmarking the variables as @Contented,<o:p></o:p></span></div>
<div class="MsoNormal" style="background: #F8F9FA; border: none; line-height: 15.6pt; margin-bottom: .0001pt; margin-bottom: 0cm; mso-border-alt: solid #EAECF0 .5pt; mso-padding-alt: 12.0pt 12.0pt 12.0pt 12.0pt; padding: 0cm; tab-stops: 45.8pt 91.6pt 137.4pt 183.2pt 229.0pt 274.8pt 320.6pt 366.4pt 412.2pt 458.0pt 503.8pt 549.6pt 595.4pt 641.2pt 687.0pt 732.8pt;">
<span style="color: black; font-family: "courier new"; font-size: 9.0pt;"><span style="mso-spacerun: yes;"> </span>* and adding 7
long and 1 int variables to span<o:p></o:p></span></div>
<div class="MsoNormal" style="background: #F8F9FA; border: none; line-height: 15.6pt; margin-bottom: .0001pt; margin-bottom: 0cm; mso-border-alt: solid #EAECF0 .5pt; mso-padding-alt: 12.0pt 12.0pt 12.0pt 12.0pt; padding: 0cm; tab-stops: 45.8pt 91.6pt 137.4pt 183.2pt 229.0pt 274.8pt 320.6pt 366.4pt 412.2pt 458.0pt 503.8pt 549.6pt 595.4pt 641.2pt 687.0pt 732.8pt;">
<span style="color: black; font-family: "courier new"; font-size: 9.0pt;"><span style="mso-spacerun: yes;"> </span>* whole cache
line for a volatile value which is 64 bytes.<o:p></o:p></span></div>
<div class="MsoNormal" style="background: #F8F9FA; border: none; line-height: 15.6pt; margin-bottom: .0001pt; margin-bottom: 0cm; mso-border-alt: solid #EAECF0 .5pt; mso-padding-alt: 12.0pt 12.0pt 12.0pt 12.0pt; padding: 0cm; tab-stops: 45.8pt 91.6pt 137.4pt 183.2pt 229.0pt 274.8pt 320.6pt 366.4pt 412.2pt 458.0pt 503.8pt 549.6pt 595.4pt 641.2pt 687.0pt 732.8pt;">
<span style="color: black; font-family: "courier new"; font-size: 9.0pt;"><span style="mso-spacerun: yes;"> </span>* At the bottom
of the class you can find various results<o:p></o:p></span></div>
<div class="MsoNormal" style="background: #F8F9FA; border: none; line-height: 15.6pt; margin-bottom: .0001pt; margin-bottom: 0cm; mso-border-alt: solid #EAECF0 .5pt; mso-padding-alt: 12.0pt 12.0pt 12.0pt 12.0pt; padding: 0cm; tab-stops: 45.8pt 91.6pt 137.4pt 183.2pt 229.0pt 274.8pt 320.6pt 366.4pt 412.2pt 458.0pt 503.8pt 549.6pt 595.4pt 641.2pt 687.0pt 732.8pt;">
<span style="color: black; font-family: "courier new"; font-size: 9.0pt;"><span style="mso-spacerun: yes;"> </span>* of the tests
with this class.<o:p></o:p></span></div>
<div class="MsoNormal" style="background: #F8F9FA; border: none; line-height: 15.6pt; margin-bottom: .0001pt; margin-bottom: 0cm; mso-border-alt: solid #EAECF0 .5pt; mso-padding-alt: 12.0pt 12.0pt 12.0pt 12.0pt; padding: 0cm; tab-stops: 45.8pt 91.6pt 137.4pt 183.2pt 229.0pt 274.8pt 320.6pt 366.4pt 412.2pt 458.0pt 503.8pt 549.6pt 595.4pt 641.2pt 687.0pt 732.8pt;">
<span style="color: black; font-family: "courier new"; font-size: 9.0pt;"><span style="mso-spacerun: yes;"> </span>* Contended
annotation does not work on user classpath<o:p></o:p></span></div>
<div class="MsoNormal" style="background: #F8F9FA; border: none; line-height: 15.6pt; margin-bottom: .0001pt; margin-bottom: 0cm; mso-border-alt: solid #EAECF0 .5pt; mso-padding-alt: 12.0pt 12.0pt 12.0pt 12.0pt; padding: 0cm; tab-stops: 45.8pt 91.6pt 137.4pt 183.2pt 229.0pt 274.8pt 320.6pt 366.4pt 412.2pt 458.0pt 503.8pt 549.6pt 595.4pt 641.2pt 687.0pt 732.8pt;">
<span style="color: black; font-family: "courier new"; font-size: 9.0pt;"><span style="mso-spacerun: yes;"> </span>* by default
and only work for classes on bootclasspath.<o:p></o:p></span></div>
<div class="MsoNormal" style="background: #F8F9FA; border: none; line-height: 15.6pt; margin-bottom: .0001pt; margin-bottom: 0cm; mso-border-alt: solid #EAECF0 .5pt; mso-padding-alt: 12.0pt 12.0pt 12.0pt 12.0pt; padding: 0cm; tab-stops: 45.8pt 91.6pt 137.4pt 183.2pt 229.0pt 274.8pt 320.6pt 366.4pt 412.2pt 458.0pt 503.8pt 549.6pt 595.4pt 641.2pt 687.0pt 732.8pt;">
<span style="color: black; font-family: "courier new"; font-size: 9.0pt;"><span style="mso-spacerun: yes;"> </span>* So we need to
add -XX:-RestrictContended VM argument<o:p></o:p></span></div>
<div class="MsoNormal" style="background: #F8F9FA; border: none; line-height: 15.6pt; margin-bottom: .0001pt; margin-bottom: 0cm; mso-border-alt: solid #EAECF0 .5pt; mso-padding-alt: 12.0pt 12.0pt 12.0pt 12.0pt; padding: 0cm; tab-stops: 45.8pt 91.6pt 137.4pt 183.2pt 229.0pt 274.8pt 320.6pt 366.4pt 412.2pt 458.0pt 503.8pt 549.6pt 595.4pt 641.2pt 687.0pt 732.8pt;">
<span style="color: black; font-family: "courier new"; font-size: 9.0pt;"><span style="mso-spacerun: yes;"> </span>* on JVM
startup.<o:p></o:p></span></div>
<div class="MsoNormal" style="background: #F8F9FA; border: none; line-height: 15.6pt; margin-bottom: .0001pt; margin-bottom: 0cm; mso-border-alt: solid #EAECF0 .5pt; mso-padding-alt: 12.0pt 12.0pt 12.0pt 12.0pt; padding: 0cm; tab-stops: 45.8pt 91.6pt 137.4pt 183.2pt 229.0pt 274.8pt 320.6pt 366.4pt 412.2pt 458.0pt 503.8pt 549.6pt 595.4pt 641.2pt 687.0pt 732.8pt;">
<span style="color: black; font-family: "courier new"; font-size: 9.0pt;"><span style="mso-spacerun: yes;"> </span>* @author Ali
Gelenler<o:p></o:p></span></div>
<div class="MsoNormal" style="background: #F8F9FA; border: none; line-height: 15.6pt; margin-bottom: .0001pt; margin-bottom: 0cm; mso-border-alt: solid #EAECF0 .5pt; mso-padding-alt: 12.0pt 12.0pt 12.0pt 12.0pt; padding: 0cm; tab-stops: 45.8pt 91.6pt 137.4pt 183.2pt 229.0pt 274.8pt 320.6pt 366.4pt 412.2pt 458.0pt 503.8pt 549.6pt 595.4pt 641.2pt 687.0pt 732.8pt;">
<span style="color: black; font-family: "courier new"; font-size: 9.0pt;"><span style="mso-spacerun: yes;"> </span>*/<o:p></o:p></span></div>
<div class="MsoNormal" style="background: #F8F9FA; border: none; line-height: 15.6pt; margin-bottom: .0001pt; margin-bottom: 0cm; mso-border-alt: solid #EAECF0 .5pt; mso-padding-alt: 12.0pt 12.0pt 12.0pt 12.0pt; padding: 0cm; tab-stops: 45.8pt 91.6pt 137.4pt 183.2pt 229.0pt 274.8pt 320.6pt 366.4pt 412.2pt 458.0pt 503.8pt 549.6pt 595.4pt 641.2pt 687.0pt 732.8pt;">
<br /></div>
<div class="MsoNormal" style="background: #F8F9FA; border: none; line-height: 15.6pt; margin-bottom: .0001pt; margin-bottom: 0cm; mso-border-alt: solid #EAECF0 .5pt; mso-padding-alt: 12.0pt 12.0pt 12.0pt 12.0pt; padding: 0cm; tab-stops: 45.8pt 91.6pt 137.4pt 183.2pt 229.0pt 274.8pt 320.6pt 366.4pt 412.2pt 458.0pt 503.8pt 549.6pt 595.4pt 641.2pt 687.0pt 732.8pt;">
<span style="color: black; font-family: "courier new"; font-size: 9.0pt;">public class TestPaddingAndContended {<o:p></o:p></span></div>
<div class="MsoNormal" style="background: #F8F9FA; border: none; line-height: 15.6pt; margin-bottom: .0001pt; margin-bottom: 0cm; mso-border-alt: solid #EAECF0 .5pt; mso-padding-alt: 12.0pt 12.0pt 12.0pt 12.0pt; padding: 0cm; tab-stops: 45.8pt 91.6pt 137.4pt 183.2pt 229.0pt 274.8pt 320.6pt 366.4pt 412.2pt 458.0pt 503.8pt 549.6pt 595.4pt 641.2pt 687.0pt 732.8pt;">
<br /></div>
<div class="MsoNormal" style="background: #F8F9FA; border: none; line-height: 15.6pt; margin-bottom: .0001pt; margin-bottom: 0cm; mso-border-alt: solid #EAECF0 .5pt; mso-padding-alt: 12.0pt 12.0pt 12.0pt 12.0pt; padding: 0cm; tab-stops: 45.8pt 91.6pt 137.4pt 183.2pt 229.0pt 274.8pt 320.6pt 366.4pt 412.2pt 458.0pt 503.8pt 549.6pt 595.4pt 641.2pt 687.0pt 732.8pt;">
<span style="color: black; font-family: "courier new"; font-size: 9.0pt;"><span style="mso-spacerun: yes;"> </span>private
static final long NUM_OF_ITERATION = 100000000L;<o:p></o:p></span></div>
<div class="MsoNormal" style="background: #F8F9FA; border: none; line-height: 15.6pt; margin-bottom: .0001pt; margin-bottom: 0cm; mso-border-alt: solid #EAECF0 .5pt; mso-padding-alt: 12.0pt 12.0pt 12.0pt 12.0pt; padding: 0cm; tab-stops: 45.8pt 91.6pt 137.4pt 183.2pt 229.0pt 274.8pt 320.6pt 366.4pt 412.2pt 458.0pt 503.8pt 549.6pt 595.4pt 641.2pt 687.0pt 732.8pt;">
<br /></div>
<div class="MsoNormal" style="background: #F8F9FA; border: none; line-height: 15.6pt; margin-bottom: .0001pt; margin-bottom: 0cm; mso-border-alt: solid #EAECF0 .5pt; mso-padding-alt: 12.0pt 12.0pt 12.0pt 12.0pt; padding: 0cm; tab-stops: 45.8pt 91.6pt 137.4pt 183.2pt 229.0pt 274.8pt 320.6pt 366.4pt 412.2pt 458.0pt 503.8pt 549.6pt 595.4pt 641.2pt 687.0pt 732.8pt;">
<span style="color: black; font-family: "courier new"; font-size: 9.0pt;"><span style="mso-spacerun: yes;"> </span>public
static final TestPaddingAndContended INSTANCE =<o:p></o:p></span></div>
<div class="MsoNormal" style="background: #F8F9FA; border: none; line-height: 15.6pt; margin-bottom: .0001pt; margin-bottom: 0cm; mso-border-alt: solid #EAECF0 .5pt; mso-padding-alt: 12.0pt 12.0pt 12.0pt 12.0pt; padding: 0cm; tab-stops: 45.8pt 91.6pt 137.4pt 183.2pt 229.0pt 274.8pt 320.6pt 366.4pt 412.2pt 458.0pt 503.8pt 549.6pt 595.4pt 641.2pt 687.0pt 732.8pt;">
<span style="color: black; font-family: "courier new"; font-size: 9.0pt;"><span style="mso-spacerun: yes;"> </span>new
TestPaddingAndContended();<o:p></o:p></span></div>
<div class="MsoNormal" style="background: #F8F9FA; border: none; line-height: 15.6pt; margin-bottom: .0001pt; margin-bottom: 0cm; mso-border-alt: solid #EAECF0 .5pt; mso-padding-alt: 12.0pt 12.0pt 12.0pt 12.0pt; padding: 0cm; tab-stops: 45.8pt 91.6pt 137.4pt 183.2pt 229.0pt 274.8pt 320.6pt 366.4pt 412.2pt 458.0pt 503.8pt 549.6pt 595.4pt 641.2pt 687.0pt 732.8pt;">
<br /></div>
<div class="MsoNormal" style="background: #F8F9FA; border: none; line-height: 15.6pt; margin-bottom: .0001pt; margin-bottom: 0cm; mso-border-alt: solid #EAECF0 .5pt; mso-padding-alt: 12.0pt 12.0pt 12.0pt 12.0pt; padding: 0cm; tab-stops: 45.8pt 91.6pt 137.4pt 183.2pt 229.0pt 274.8pt 320.6pt 366.4pt 412.2pt 458.0pt 503.8pt 549.6pt 595.4pt 641.2pt 687.0pt 732.8pt;">
<span style="color: black; font-family: "courier new"; font-size: 9.0pt;"><span style="mso-spacerun: yes;"> </span>private
TestPaddingAndContended() {<o:p></o:p></span></div>
<div class="MsoNormal" style="background: #F8F9FA; border: none; line-height: 15.6pt; margin-bottom: .0001pt; margin-bottom: 0cm; mso-border-alt: solid #EAECF0 .5pt; mso-padding-alt: 12.0pt 12.0pt 12.0pt 12.0pt; padding: 0cm; tab-stops: 45.8pt 91.6pt 137.4pt 183.2pt 229.0pt 274.8pt 320.6pt 366.4pt 412.2pt 458.0pt 503.8pt 549.6pt 595.4pt 641.2pt 687.0pt 732.8pt;">
<br /></div>
<div class="MsoNormal" style="background: #F8F9FA; border: none; line-height: 15.6pt; margin-bottom: .0001pt; margin-bottom: 0cm; mso-border-alt: solid #EAECF0 .5pt; mso-padding-alt: 12.0pt 12.0pt 12.0pt 12.0pt; padding: 0cm; tab-stops: 45.8pt 91.6pt 137.4pt 183.2pt 229.0pt 274.8pt 320.6pt 366.4pt 412.2pt 458.0pt 503.8pt 549.6pt 595.4pt 641.2pt 687.0pt 732.8pt;">
<span style="color: black; font-family: "courier new"; font-size: 9.0pt;"><span style="mso-spacerun: yes;"> </span>}<o:p></o:p></span></div>
<div class="MsoNormal" style="background: #F8F9FA; border: none; line-height: 15.6pt; margin-bottom: .0001pt; margin-bottom: 0cm; mso-border-alt: solid #EAECF0 .5pt; mso-padding-alt: 12.0pt 12.0pt 12.0pt 12.0pt; padding: 0cm; tab-stops: 45.8pt 91.6pt 137.4pt 183.2pt 229.0pt 274.8pt 320.6pt 366.4pt 412.2pt 458.0pt 503.8pt 549.6pt 595.4pt 641.2pt 687.0pt 732.8pt;">
<br /></div>
<div class="MsoNormal" style="background: #F8F9FA; border: none; line-height: 15.6pt; margin-bottom: .0001pt; margin-bottom: 0cm; mso-border-alt: solid #EAECF0 .5pt; mso-padding-alt: 12.0pt 12.0pt 12.0pt 12.0pt; padding: 0cm; tab-stops: 45.8pt 91.6pt 137.4pt 183.2pt 229.0pt 274.8pt 320.6pt 366.4pt 412.2pt 458.0pt 503.8pt 549.6pt 595.4pt 641.2pt 687.0pt 732.8pt;">
<span style="color: black; font-family: "courier new"; font-size: 9.0pt;"><span style="mso-spacerun: yes;"> </span>@Contended<o:p></o:p></span></div>
<div class="MsoNormal" style="background: #F8F9FA; border: none; line-height: 15.6pt; margin-bottom: .0001pt; margin-bottom: 0cm; mso-border-alt: solid #EAECF0 .5pt; mso-padding-alt: 12.0pt 12.0pt 12.0pt 12.0pt; padding: 0cm; tab-stops: 45.8pt 91.6pt 137.4pt 183.2pt 229.0pt 274.8pt 320.6pt 366.4pt 412.2pt 458.0pt 503.8pt 549.6pt 595.4pt 641.2pt 687.0pt 732.8pt;">
<span style="color: black; font-family: "courier new"; font-size: 9.0pt;"><span style="mso-spacerun: yes;"> </span>private
volatile int myVolatileValue1; // 4 bytes<o:p></o:p></span></div>
<div class="MsoNormal" style="background: #F8F9FA; border: none; line-height: 15.6pt; margin-bottom: .0001pt; margin-bottom: 0cm; mso-border-alt: solid #EAECF0 .5pt; mso-padding-alt: 12.0pt 12.0pt 12.0pt 12.0pt; padding: 0cm; tab-stops: 45.8pt 91.6pt 137.4pt 183.2pt 229.0pt 274.8pt 320.6pt 366.4pt 412.2pt 458.0pt 503.8pt 549.6pt 595.4pt 641.2pt 687.0pt 732.8pt;">
<br /></div>
<div class="MsoNormal" style="background: #F8F9FA; border: none; line-height: 15.6pt; margin-bottom: .0001pt; margin-bottom: 0cm; mso-border-alt: solid #EAECF0 .5pt; mso-padding-alt: 12.0pt 12.0pt 12.0pt 12.0pt; padding: 0cm; tab-stops: 45.8pt 91.6pt 137.4pt 183.2pt 229.0pt 274.8pt 320.6pt 366.4pt 412.2pt 458.0pt 503.8pt 549.6pt 595.4pt 641.2pt 687.0pt 732.8pt;">
<span style="color: black; font-family: "courier new"; font-size: 9.0pt;">// fields used for padding to prevent false sharing<o:p></o:p></span></div>
<div class="MsoNormal" style="background: #F8F9FA; border: none; line-height: 15.6pt; margin-bottom: .0001pt; margin-bottom: 0cm; mso-border-alt: solid #EAECF0 .5pt; mso-padding-alt: 12.0pt 12.0pt 12.0pt 12.0pt; padding: 0cm; tab-stops: 45.8pt 91.6pt 137.4pt 183.2pt 229.0pt 274.8pt 320.6pt 366.4pt 412.2pt 458.0pt 503.8pt 549.6pt 595.4pt 641.2pt 687.0pt 732.8pt;">
<span style="color: black; font-family: "courier new"; font-size: 9.0pt;">// uncomment to test padding after removing @Contented
above<o:p></o:p></span></div>
<div class="MsoNormal" style="background: #F8F9FA; border: none; line-height: 15.6pt; margin-bottom: .0001pt; margin-bottom: 0cm; mso-border-alt: solid #EAECF0 .5pt; mso-padding-alt: 12.0pt 12.0pt 12.0pt 12.0pt; padding: 0cm; tab-stops: 45.8pt 91.6pt 137.4pt 183.2pt 229.0pt 274.8pt 320.6pt 366.4pt 412.2pt 458.0pt 503.8pt 549.6pt 595.4pt 641.2pt 687.0pt 732.8pt;">
<span style="color: black; font-family: "courier new"; font-size: 9.0pt;">// private volatile int dummyInt1;<span style="mso-spacerun: yes;"> </span>// 4 bytes<o:p></o:p></span></div>
<div class="MsoNormal" style="background: #F8F9FA; border: none; line-height: 15.6pt; margin-bottom: .0001pt; margin-bottom: 0cm; mso-border-alt: solid #EAECF0 .5pt; mso-padding-alt: 12.0pt 12.0pt 12.0pt 12.0pt; padding: 0cm; tab-stops: 45.8pt 91.6pt 137.4pt 183.2pt 229.0pt 274.8pt 320.6pt 366.4pt 412.2pt 458.0pt 503.8pt 549.6pt 595.4pt 641.2pt 687.0pt 732.8pt;">
<span style="color: black; font-family: "courier new"; font-size: 9.0pt;">// private volatile long dummyLong1; // 8 bytes<o:p></o:p></span></div>
<div class="MsoNormal" style="background: #F8F9FA; border: none; line-height: 15.6pt; margin-bottom: .0001pt; margin-bottom: 0cm; mso-border-alt: solid #EAECF0 .5pt; mso-padding-alt: 12.0pt 12.0pt 12.0pt 12.0pt; padding: 0cm; tab-stops: 45.8pt 91.6pt 137.4pt 183.2pt 229.0pt 274.8pt 320.6pt 366.4pt 412.2pt 458.0pt 503.8pt 549.6pt 595.4pt 641.2pt 687.0pt 732.8pt;">
<span style="color: black; font-family: "courier new"; font-size: 9.0pt;">// private volatile long dummyLong2;<o:p></o:p></span></div>
<div class="MsoNormal" style="background: #F8F9FA; border: none; line-height: 15.6pt; margin-bottom: .0001pt; margin-bottom: 0cm; mso-border-alt: solid #EAECF0 .5pt; mso-padding-alt: 12.0pt 12.0pt 12.0pt 12.0pt; padding: 0cm; tab-stops: 45.8pt 91.6pt 137.4pt 183.2pt 229.0pt 274.8pt 320.6pt 366.4pt 412.2pt 458.0pt 503.8pt 549.6pt 595.4pt 641.2pt 687.0pt 732.8pt;">
<span style="color: black; font-family: "courier new"; font-size: 9.0pt;">// private volatile long dummyLong3;<o:p></o:p></span></div>
<div class="MsoNormal" style="background: #F8F9FA; border: none; line-height: 15.6pt; margin-bottom: .0001pt; margin-bottom: 0cm; mso-border-alt: solid #EAECF0 .5pt; mso-padding-alt: 12.0pt 12.0pt 12.0pt 12.0pt; padding: 0cm; tab-stops: 45.8pt 91.6pt 137.4pt 183.2pt 229.0pt 274.8pt 320.6pt 366.4pt 412.2pt 458.0pt 503.8pt 549.6pt 595.4pt 641.2pt 687.0pt 732.8pt;">
<span style="color: black; font-family: "courier new"; font-size: 9.0pt;">// private volatile long dummyLong4;<o:p></o:p></span></div>
<div class="MsoNormal" style="background: #F8F9FA; border: none; line-height: 15.6pt; margin-bottom: .0001pt; margin-bottom: 0cm; mso-border-alt: solid #EAECF0 .5pt; mso-padding-alt: 12.0pt 12.0pt 12.0pt 12.0pt; padding: 0cm; tab-stops: 45.8pt 91.6pt 137.4pt 183.2pt 229.0pt 274.8pt 320.6pt 366.4pt 412.2pt 458.0pt 503.8pt 549.6pt 595.4pt 641.2pt 687.0pt 732.8pt;">
<span style="color: black; font-family: "courier new"; font-size: 9.0pt;">// private volatile long dummyLong5;<o:p></o:p></span></div>
<div class="MsoNormal" style="background: #F8F9FA; border: none; line-height: 15.6pt; margin-bottom: .0001pt; margin-bottom: 0cm; mso-border-alt: solid #EAECF0 .5pt; mso-padding-alt: 12.0pt 12.0pt 12.0pt 12.0pt; padding: 0cm; tab-stops: 45.8pt 91.6pt 137.4pt 183.2pt 229.0pt 274.8pt 320.6pt 366.4pt 412.2pt 458.0pt 503.8pt 549.6pt 595.4pt 641.2pt 687.0pt 732.8pt;">
<span style="color: black; font-family: "courier new"; font-size: 9.0pt;">// private volatile long dummyLong6;<o:p></o:p></span></div>
<div class="MsoNormal" style="background: #F8F9FA; border: none; line-height: 15.6pt; margin-bottom: .0001pt; margin-bottom: 0cm; mso-border-alt: solid #EAECF0 .5pt; mso-padding-alt: 12.0pt 12.0pt 12.0pt 12.0pt; padding: 0cm; tab-stops: 45.8pt 91.6pt 137.4pt 183.2pt 229.0pt 274.8pt 320.6pt 366.4pt 412.2pt 458.0pt 503.8pt 549.6pt 595.4pt 641.2pt 687.0pt 732.8pt;">
<span style="color: black; font-family: "courier new"; font-size: 9.0pt;">// private volatile long dummyLong7;<o:p></o:p></span></div>
<div class="MsoNormal" style="background: #F8F9FA; border: none; line-height: 15.6pt; margin-bottom: .0001pt; margin-bottom: 0cm; mso-border-alt: solid #EAECF0 .5pt; mso-padding-alt: 12.0pt 12.0pt 12.0pt 12.0pt; padding: 0cm; tab-stops: 45.8pt 91.6pt 137.4pt 183.2pt 229.0pt 274.8pt 320.6pt 366.4pt 412.2pt 458.0pt 503.8pt 549.6pt 595.4pt 641.2pt 687.0pt 732.8pt;">
<br /></div>
<div class="MsoNormal" style="background: #F8F9FA; border: none; line-height: 15.6pt; margin-bottom: .0001pt; margin-bottom: 0cm; mso-border-alt: solid #EAECF0 .5pt; mso-padding-alt: 12.0pt 12.0pt 12.0pt 12.0pt; padding: 0cm; tab-stops: 45.8pt 91.6pt 137.4pt 183.2pt 229.0pt 274.8pt 320.6pt 366.4pt 412.2pt 458.0pt 503.8pt 549.6pt 595.4pt 641.2pt 687.0pt 732.8pt;">
<span style="color: black; font-family: "courier new"; font-size: 9.0pt;"><span style="mso-spacerun: yes;"> </span>@Contended<o:p></o:p></span></div>
<div class="MsoNormal" style="background: #F8F9FA; border: none; line-height: 15.6pt; margin-bottom: .0001pt; margin-bottom: 0cm; mso-border-alt: solid #EAECF0 .5pt; mso-padding-alt: 12.0pt 12.0pt 12.0pt 12.0pt; padding: 0cm; tab-stops: 45.8pt 91.6pt 137.4pt 183.2pt 229.0pt 274.8pt 320.6pt 366.4pt 412.2pt 458.0pt 503.8pt 549.6pt 595.4pt 641.2pt 687.0pt 732.8pt;">
<span style="color: black; font-family: "courier new"; font-size: 9.0pt;"><span style="mso-spacerun: yes;"> </span>private
volatile int myVolatileValue2; // 4 bytes<o:p></o:p></span></div>
<div class="MsoNormal" style="background: #F8F9FA; border: none; line-height: 15.6pt; margin-bottom: .0001pt; margin-bottom: 0cm; mso-border-alt: solid #EAECF0 .5pt; mso-padding-alt: 12.0pt 12.0pt 12.0pt 12.0pt; padding: 0cm; tab-stops: 45.8pt 91.6pt 137.4pt 183.2pt 229.0pt 274.8pt 320.6pt 366.4pt 412.2pt 458.0pt 503.8pt 549.6pt 595.4pt 641.2pt 687.0pt 732.8pt;">
<br /></div>
<div class="MsoNormal" style="background: #F8F9FA; border: none; line-height: 15.6pt; margin-bottom: .0001pt; margin-bottom: 0cm; mso-border-alt: solid #EAECF0 .5pt; mso-padding-alt: 12.0pt 12.0pt 12.0pt 12.0pt; padding: 0cm; tab-stops: 45.8pt 91.6pt 137.4pt 183.2pt 229.0pt 274.8pt 320.6pt 366.4pt 412.2pt 458.0pt 503.8pt 549.6pt 595.4pt 641.2pt 687.0pt 732.8pt;">
<span style="color: black; font-family: "courier new"; font-size: 9.0pt;"><span style="mso-spacerun: yes;"> </span>public
static void main(String[] args) {<o:p></o:p></span></div>
<div class="MsoNormal" style="background: #F8F9FA; border: none; line-height: 15.6pt; margin-bottom: .0001pt; margin-bottom: 0cm; mso-border-alt: solid #EAECF0 .5pt; mso-padding-alt: 12.0pt 12.0pt 12.0pt 12.0pt; padding: 0cm; tab-stops: 45.8pt 91.6pt 137.4pt 183.2pt 229.0pt 274.8pt 320.6pt 366.4pt 412.2pt 458.0pt 503.8pt 549.6pt 595.4pt 641.2pt 687.0pt 732.8pt;">
<span style="color: black; font-family: "courier new"; font-size: 9.0pt;"><span style="mso-spacerun: yes;"> </span>Thread
thread1 = new Thread(new Thread1Runnable());<o:p></o:p></span></div>
<div class="MsoNormal" style="background: #F8F9FA; border: none; line-height: 15.6pt; margin-bottom: .0001pt; margin-bottom: 0cm; mso-border-alt: solid #EAECF0 .5pt; mso-padding-alt: 12.0pt 12.0pt 12.0pt 12.0pt; padding: 0cm; tab-stops: 45.8pt 91.6pt 137.4pt 183.2pt 229.0pt 274.8pt 320.6pt 366.4pt 412.2pt 458.0pt 503.8pt 549.6pt 595.4pt 641.2pt 687.0pt 732.8pt;">
<span style="color: black; font-family: "courier new"; font-size: 9.0pt;"><span style="mso-spacerun: yes;"> </span>Thread
thread2 = new Thread(new Thread2Runnable());<o:p></o:p></span></div>
<div class="MsoNormal" style="background: #F8F9FA; border: none; line-height: 15.6pt; margin-bottom: .0001pt; margin-bottom: 0cm; mso-border-alt: solid #EAECF0 .5pt; mso-padding-alt: 12.0pt 12.0pt 12.0pt 12.0pt; padding: 0cm; tab-stops: 45.8pt 91.6pt 137.4pt 183.2pt 229.0pt 274.8pt 320.6pt 366.4pt 412.2pt 458.0pt 503.8pt 549.6pt 595.4pt 641.2pt 687.0pt 732.8pt;">
<span style="color: black; font-family: "courier new"; font-size: 9.0pt;"><span style="mso-spacerun: yes;">
</span>thread1.start();<o:p></o:p></span></div>
<div class="MsoNormal" style="background: #F8F9FA; border: none; line-height: 15.6pt; margin-bottom: .0001pt; margin-bottom: 0cm; mso-border-alt: solid #EAECF0 .5pt; mso-padding-alt: 12.0pt 12.0pt 12.0pt 12.0pt; padding: 0cm; tab-stops: 45.8pt 91.6pt 137.4pt 183.2pt 229.0pt 274.8pt 320.6pt 366.4pt 412.2pt 458.0pt 503.8pt 549.6pt 595.4pt 641.2pt 687.0pt 732.8pt;">
<span style="color: black; font-family: "courier new"; font-size: 9.0pt;"><span style="mso-spacerun: yes;"> </span>thread2.start();<o:p></o:p></span></div>
<div class="MsoNormal" style="background: #F8F9FA; border: none; line-height: 15.6pt; margin-bottom: .0001pt; margin-bottom: 0cm; mso-border-alt: solid #EAECF0 .5pt; mso-padding-alt: 12.0pt 12.0pt 12.0pt 12.0pt; padding: 0cm; tab-stops: 45.8pt 91.6pt 137.4pt 183.2pt 229.0pt 274.8pt 320.6pt 366.4pt 412.2pt 458.0pt 503.8pt 549.6pt 595.4pt 641.2pt 687.0pt 732.8pt;">
<span style="color: black; font-family: "courier new"; font-size: 9.0pt;"><span style="mso-spacerun: yes;"> </span>}<o:p></o:p></span></div>
<div class="MsoNormal" style="background: #F8F9FA; border: none; line-height: 15.6pt; margin-bottom: .0001pt; margin-bottom: 0cm; mso-border-alt: solid #EAECF0 .5pt; mso-padding-alt: 12.0pt 12.0pt 12.0pt 12.0pt; padding: 0cm; tab-stops: 45.8pt 91.6pt 137.4pt 183.2pt 229.0pt 274.8pt 320.6pt 366.4pt 412.2pt 458.0pt 503.8pt 549.6pt 595.4pt 641.2pt 687.0pt 732.8pt;">
<br /></div>
<div class="MsoNormal" style="background: #F8F9FA; border: none; line-height: 15.6pt; margin-bottom: .0001pt; margin-bottom: 0cm; mso-border-alt: solid #EAECF0 .5pt; mso-padding-alt: 12.0pt 12.0pt 12.0pt 12.0pt; padding: 0cm; tab-stops: 45.8pt 91.6pt 137.4pt 183.2pt 229.0pt 274.8pt 320.6pt 366.4pt 412.2pt 458.0pt 503.8pt 549.6pt 595.4pt 641.2pt 687.0pt 732.8pt;">
<span style="color: black; font-family: "courier new"; font-size: 9.0pt;"><span style="mso-spacerun: yes;"> </span>public
static class Thread1Runnable implements Runnable {<o:p></o:p></span></div>
<div class="MsoNormal" style="background: #F8F9FA; border: none; line-height: 15.6pt; margin-bottom: .0001pt; margin-bottom: 0cm; mso-border-alt: solid #EAECF0 .5pt; mso-padding-alt: 12.0pt 12.0pt 12.0pt 12.0pt; padding: 0cm; tab-stops: 45.8pt 91.6pt 137.4pt 183.2pt 229.0pt 274.8pt 320.6pt 366.4pt 412.2pt 458.0pt 503.8pt 549.6pt 595.4pt 641.2pt 687.0pt 732.8pt;">
<br /></div>
<div class="MsoNormal" style="background: #F8F9FA; border: none; line-height: 15.6pt; margin-bottom: .0001pt; margin-bottom: 0cm; mso-border-alt: solid #EAECF0 .5pt; mso-padding-alt: 12.0pt 12.0pt 12.0pt 12.0pt; padding: 0cm; tab-stops: 45.8pt 91.6pt 137.4pt 183.2pt 229.0pt 274.8pt 320.6pt 366.4pt 412.2pt 458.0pt 503.8pt 549.6pt 595.4pt 641.2pt 687.0pt 732.8pt;">
<span style="color: black; font-family: "courier new"; font-size: 9.0pt;"><span style="mso-spacerun: yes;"> </span>public
void run() {<o:p></o:p></span></div>
<div class="MsoNormal" style="background: #F8F9FA; border: none; line-height: 15.6pt; margin-bottom: .0001pt; margin-bottom: 0cm; mso-border-alt: solid #EAECF0 .5pt; mso-padding-alt: 12.0pt 12.0pt 12.0pt 12.0pt; padding: 0cm; tab-stops: 45.8pt 91.6pt 137.4pt 183.2pt 229.0pt 274.8pt 320.6pt 366.4pt 412.2pt 458.0pt 503.8pt 549.6pt 595.4pt 641.2pt 687.0pt 732.8pt;">
<span style="color: black; font-family: "courier new"; font-size: 9.0pt;"><span style="mso-spacerun: yes;"> </span>long
start = System.nanoTime();<o:p></o:p></span></div>
<div class="MsoNormal" style="background: #F8F9FA; border: none; line-height: 15.6pt; margin-bottom: .0001pt; margin-bottom: 0cm; mso-border-alt: solid #EAECF0 .5pt; mso-padding-alt: 12.0pt 12.0pt 12.0pt 12.0pt; padding: 0cm; tab-stops: 45.8pt 91.6pt 137.4pt 183.2pt 229.0pt 274.8pt 320.6pt 366.4pt 412.2pt 458.0pt 503.8pt 549.6pt 595.4pt 641.2pt 687.0pt 732.8pt;">
<span style="color: black; font-family: "courier new"; font-size: 9.0pt;"><span style="mso-spacerun: yes;"> </span>long
i = NUM_OF_ITERATION;<o:p></o:p></span></div>
<div class="MsoNormal" style="background: #F8F9FA; border: none; line-height: 15.6pt; margin-bottom: .0001pt; margin-bottom: 0cm; mso-border-alt: solid #EAECF0 .5pt; mso-padding-alt: 12.0pt 12.0pt 12.0pt 12.0pt; padding: 0cm; tab-stops: 45.8pt 91.6pt 137.4pt 183.2pt 229.0pt 274.8pt 320.6pt 366.4pt 412.2pt 458.0pt 503.8pt 549.6pt 595.4pt 641.2pt 687.0pt 732.8pt;">
<span style="color: black; font-family: "courier new"; font-size: 9.0pt;"><span style="mso-spacerun: yes;">
</span>while (--i != 0) {<o:p></o:p></span></div>
<div class="MsoNormal" style="background: #F8F9FA; border: none; line-height: 15.6pt; margin-bottom: .0001pt; margin-bottom: 0cm; mso-border-alt: solid #EAECF0 .5pt; mso-padding-alt: 12.0pt 12.0pt 12.0pt 12.0pt; padding: 0cm; tab-stops: 45.8pt 91.6pt 137.4pt 183.2pt 229.0pt 274.8pt 320.6pt 366.4pt 412.2pt 458.0pt 503.8pt 549.6pt 595.4pt 641.2pt 687.0pt 732.8pt;">
<span style="color: black; font-family: "courier new"; font-size: 9.0pt;"><span style="mso-spacerun: yes;">
</span>INSTANCE.myVolatileValue1 = (int) i;<o:p></o:p></span></div>
<div class="MsoNormal" style="background: #F8F9FA; border: none; line-height: 15.6pt; margin-bottom: .0001pt; margin-bottom: 0cm; mso-border-alt: solid #EAECF0 .5pt; mso-padding-alt: 12.0pt 12.0pt 12.0pt 12.0pt; padding: 0cm; tab-stops: 45.8pt 91.6pt 137.4pt 183.2pt 229.0pt 274.8pt 320.6pt 366.4pt 412.2pt 458.0pt 503.8pt 549.6pt 595.4pt 641.2pt 687.0pt 732.8pt;">
<span style="color: black; font-family: "courier new"; font-size: 9.0pt;"><span style="mso-spacerun: yes;"> </span>}<o:p></o:p></span></div>
<div class="MsoNormal" style="background: #F8F9FA; border: none; line-height: 15.6pt; margin-bottom: .0001pt; margin-bottom: 0cm; mso-border-alt: solid #EAECF0 .5pt; mso-padding-alt: 12.0pt 12.0pt 12.0pt 12.0pt; padding: 0cm; tab-stops: 45.8pt 91.6pt 137.4pt 183.2pt 229.0pt 274.8pt 320.6pt 366.4pt 412.2pt 458.0pt 503.8pt 549.6pt 595.4pt 641.2pt 687.0pt 732.8pt;">
<span style="color: black; font-family: "courier new"; font-size: 9.0pt;">System.out.println("End of thread 1, last value
of" +<o:p></o:p></span></div>
<div class="MsoNormal" style="background: #F8F9FA; border: none; line-height: 15.6pt; margin-bottom: .0001pt; margin-bottom: 0cm; mso-border-alt: solid #EAECF0 .5pt; mso-padding-alt: 12.0pt 12.0pt 12.0pt 12.0pt; padding: 0cm; tab-stops: 45.8pt 91.6pt 137.4pt 183.2pt 229.0pt 274.8pt 320.6pt 366.4pt 412.2pt 458.0pt 503.8pt 549.6pt 595.4pt 641.2pt 687.0pt 732.8pt;">
<span style="color: black; font-family: "courier new"; font-size: 9.0pt;"><span style="mso-spacerun: yes;"> </span>"
myVolatileValue1 is " + INSTANCE.myVolatileValue1<o:p></o:p></span></div>
<div class="MsoNormal" style="background: #F8F9FA; border: none; line-height: 15.6pt; margin-bottom: .0001pt; margin-bottom: 0cm; mso-border-alt: solid #EAECF0 .5pt; mso-padding-alt: 12.0pt 12.0pt 12.0pt 12.0pt; padding: 0cm; tab-stops: 45.8pt 91.6pt 137.4pt 183.2pt 229.0pt 274.8pt 320.6pt 366.4pt 412.2pt 458.0pt 503.8pt 549.6pt 595.4pt 641.2pt 687.0pt 732.8pt;">
<span style="color: black; font-family: "courier new"; font-size: 9.0pt;"><span style="mso-spacerun: yes;"> </span>+ " it
took " +<o:p></o:p></span></div>
<div class="MsoNormal" style="background: #F8F9FA; border: none; line-height: 15.6pt; margin-bottom: .0001pt; margin-bottom: 0cm; mso-border-alt: solid #EAECF0 .5pt; mso-padding-alt: 12.0pt 12.0pt 12.0pt 12.0pt; padding: 0cm; tab-stops: 45.8pt 91.6pt 137.4pt 183.2pt 229.0pt 274.8pt 320.6pt 366.4pt 412.2pt 458.0pt 503.8pt 549.6pt 595.4pt 641.2pt 687.0pt 732.8pt;">
<span style="color: black; font-family: "courier new"; font-size: 9.0pt;"><span style="mso-spacerun: yes;">
</span>(System.nanoTime() - start) + " nanoseconds");<o:p></o:p></span></div>
<div class="MsoNormal" style="background: #F8F9FA; border: none; line-height: 15.6pt; margin-bottom: .0001pt; margin-bottom: 0cm; mso-border-alt: solid #EAECF0 .5pt; mso-padding-alt: 12.0pt 12.0pt 12.0pt 12.0pt; padding: 0cm; tab-stops: 45.8pt 91.6pt 137.4pt 183.2pt 229.0pt 274.8pt 320.6pt 366.4pt 412.2pt 458.0pt 503.8pt 549.6pt 595.4pt 641.2pt 687.0pt 732.8pt;">
<span style="color: black; font-family: "courier new"; font-size: 9.0pt;"><span style="mso-spacerun: yes;"> </span>}<o:p></o:p></span></div>
<div class="MsoNormal" style="background: #F8F9FA; border: none; line-height: 15.6pt; margin-bottom: .0001pt; margin-bottom: 0cm; mso-border-alt: solid #EAECF0 .5pt; mso-padding-alt: 12.0pt 12.0pt 12.0pt 12.0pt; padding: 0cm; tab-stops: 45.8pt 91.6pt 137.4pt 183.2pt 229.0pt 274.8pt 320.6pt 366.4pt 412.2pt 458.0pt 503.8pt 549.6pt 595.4pt 641.2pt 687.0pt 732.8pt;">
<br /></div>
<div class="MsoNormal" style="background: #F8F9FA; border: none; line-height: 15.6pt; margin-bottom: .0001pt; margin-bottom: 0cm; mso-border-alt: solid #EAECF0 .5pt; mso-padding-alt: 12.0pt 12.0pt 12.0pt 12.0pt; padding: 0cm; tab-stops: 45.8pt 91.6pt 137.4pt 183.2pt 229.0pt 274.8pt 320.6pt 366.4pt 412.2pt 458.0pt 503.8pt 549.6pt 595.4pt 641.2pt 687.0pt 732.8pt;">
<span style="color: black; font-family: "courier new"; font-size: 9.0pt;"><span style="mso-spacerun: yes;"> </span>public
static class Thread2Runnable implements Runnable {<o:p></o:p></span></div>
<div class="MsoNormal" style="background: #F8F9FA; border: none; line-height: 15.6pt; margin-bottom: .0001pt; margin-bottom: 0cm; mso-border-alt: solid #EAECF0 .5pt; mso-padding-alt: 12.0pt 12.0pt 12.0pt 12.0pt; padding: 0cm; tab-stops: 45.8pt 91.6pt 137.4pt 183.2pt 229.0pt 274.8pt 320.6pt 366.4pt 412.2pt 458.0pt 503.8pt 549.6pt 595.4pt 641.2pt 687.0pt 732.8pt;">
<br /></div>
<div class="MsoNormal" style="background: #F8F9FA; border: none; line-height: 15.6pt; margin-bottom: .0001pt; margin-bottom: 0cm; mso-border-alt: solid #EAECF0 .5pt; mso-padding-alt: 12.0pt 12.0pt 12.0pt 12.0pt; padding: 0cm; tab-stops: 45.8pt 91.6pt 137.4pt 183.2pt 229.0pt 274.8pt 320.6pt 366.4pt 412.2pt 458.0pt 503.8pt 549.6pt 595.4pt 641.2pt 687.0pt 732.8pt;">
<span style="color: black; font-family: "courier new"; font-size: 9.0pt;"><span style="mso-spacerun: yes;"> </span>public
void run() {<o:p></o:p></span></div>
<div class="MsoNormal" style="background: #F8F9FA; border: none; line-height: 15.6pt; margin-bottom: .0001pt; margin-bottom: 0cm; mso-border-alt: solid #EAECF0 .5pt; mso-padding-alt: 12.0pt 12.0pt 12.0pt 12.0pt; padding: 0cm; tab-stops: 45.8pt 91.6pt 137.4pt 183.2pt 229.0pt 274.8pt 320.6pt 366.4pt 412.2pt 458.0pt 503.8pt 549.6pt 595.4pt 641.2pt 687.0pt 732.8pt;">
<span style="color: black; font-family: "courier new"; font-size: 9.0pt;"><span style="mso-spacerun: yes;"> </span>long
start = System.nanoTime();<o:p></o:p></span></div>
<div class="MsoNormal" style="background: #F8F9FA; border: none; line-height: 15.6pt; margin-bottom: .0001pt; margin-bottom: 0cm; mso-border-alt: solid #EAECF0 .5pt; mso-padding-alt: 12.0pt 12.0pt 12.0pt 12.0pt; padding: 0cm; tab-stops: 45.8pt 91.6pt 137.4pt 183.2pt 229.0pt 274.8pt 320.6pt 366.4pt 412.2pt 458.0pt 503.8pt 549.6pt 595.4pt 641.2pt 687.0pt 732.8pt;">
<span style="color: black; font-family: "courier new"; font-size: 9.0pt;"><span style="mso-spacerun: yes;"> </span>long
i = NUM_OF_ITERATION;<o:p></o:p></span></div>
<div class="MsoNormal" style="background: #F8F9FA; border: none; line-height: 15.6pt; margin-bottom: .0001pt; margin-bottom: 0cm; mso-border-alt: solid #EAECF0 .5pt; mso-padding-alt: 12.0pt 12.0pt 12.0pt 12.0pt; padding: 0cm; tab-stops: 45.8pt 91.6pt 137.4pt 183.2pt 229.0pt 274.8pt 320.6pt 366.4pt 412.2pt 458.0pt 503.8pt 549.6pt 595.4pt 641.2pt 687.0pt 732.8pt;">
<span style="color: black; font-family: "courier new"; font-size: 9.0pt;"><span style="mso-spacerun: yes;">
</span>while (--i != 0) {<o:p></o:p></span></div>
<div class="MsoNormal" style="background: #F8F9FA; border: none; line-height: 15.6pt; margin-bottom: .0001pt; margin-bottom: 0cm; mso-border-alt: solid #EAECF0 .5pt; mso-padding-alt: 12.0pt 12.0pt 12.0pt 12.0pt; padding: 0cm; tab-stops: 45.8pt 91.6pt 137.4pt 183.2pt 229.0pt 274.8pt 320.6pt 366.4pt 412.2pt 458.0pt 503.8pt 549.6pt 595.4pt 641.2pt 687.0pt 732.8pt;">
<span style="color: black; font-family: "courier new"; font-size: 9.0pt;"><span style="mso-spacerun: yes;">
</span>INSTANCE.myVolatileValue2 = (int) i;<o:p></o:p></span></div>
<div class="MsoNormal" style="background: #F8F9FA; border: none; line-height: 15.6pt; margin-bottom: .0001pt; margin-bottom: 0cm; mso-border-alt: solid #EAECF0 .5pt; mso-padding-alt: 12.0pt 12.0pt 12.0pt 12.0pt; padding: 0cm; tab-stops: 45.8pt 91.6pt 137.4pt 183.2pt 229.0pt 274.8pt 320.6pt 366.4pt 412.2pt 458.0pt 503.8pt 549.6pt 595.4pt 641.2pt 687.0pt 732.8pt;">
<span style="color: black; font-family: "courier new"; font-size: 9.0pt;"><span style="mso-spacerun: yes;"> </span><span style="mso-spacerun: yes;"> </span>}<o:p></o:p></span></div>
<div class="MsoNormal" style="background: #F8F9FA; border: none; line-height: 15.6pt; margin-bottom: .0001pt; margin-bottom: 0cm; mso-border-alt: solid #EAECF0 .5pt; mso-padding-alt: 12.0pt 12.0pt 12.0pt 12.0pt; padding: 0cm; tab-stops: 45.8pt 91.6pt 137.4pt 183.2pt 229.0pt 274.8pt 320.6pt 366.4pt 412.2pt 458.0pt 503.8pt 549.6pt 595.4pt 641.2pt 687.0pt 732.8pt;">
<span style="color: black; font-family: "courier new"; font-size: 9.0pt;">System.out.println("End of thread 2, last value
of" +<o:p></o:p></span></div>
<div class="MsoNormal" style="background: #F8F9FA; border: none; line-height: 15.6pt; margin-bottom: .0001pt; margin-bottom: 0cm; mso-border-alt: solid #EAECF0 .5pt; mso-padding-alt: 12.0pt 12.0pt 12.0pt 12.0pt; padding: 0cm; tab-stops: 45.8pt 91.6pt 137.4pt 183.2pt 229.0pt 274.8pt 320.6pt 366.4pt 412.2pt 458.0pt 503.8pt 549.6pt 595.4pt 641.2pt 687.0pt 732.8pt;">
<span style="color: black; font-family: "courier new"; font-size: 9.0pt;"><span style="mso-spacerun: yes;"> </span>"
myVolatileValue2 is " + INSTANCE.myVolatileValue2<o:p></o:p></span></div>
<div class="MsoNormal" style="background: #F8F9FA; border: none; line-height: 15.6pt; margin-bottom: .0001pt; margin-bottom: 0cm; mso-border-alt: solid #EAECF0 .5pt; mso-padding-alt: 12.0pt 12.0pt 12.0pt 12.0pt; padding: 0cm; tab-stops: 45.8pt 91.6pt 137.4pt 183.2pt 229.0pt 274.8pt 320.6pt 366.4pt 412.2pt 458.0pt 503.8pt 549.6pt 595.4pt 641.2pt 687.0pt 732.8pt;">
<span style="color: black; font-family: "courier new"; font-size: 9.0pt;"><span style="mso-spacerun: yes;"> </span>+ " it
took " +<o:p></o:p></span></div>
<div class="MsoNormal" style="background: #F8F9FA; border: none; line-height: 15.6pt; margin-bottom: .0001pt; margin-bottom: 0cm; mso-border-alt: solid #EAECF0 .5pt; mso-padding-alt: 12.0pt 12.0pt 12.0pt 12.0pt; padding: 0cm; tab-stops: 45.8pt 91.6pt 137.4pt 183.2pt 229.0pt 274.8pt 320.6pt 366.4pt 412.2pt 458.0pt 503.8pt 549.6pt 595.4pt 641.2pt 687.0pt 732.8pt;">
<span style="color: black; font-family: "courier new"; font-size: 9.0pt;"><span style="mso-spacerun: yes;">
</span>(System.nanoTime() - start) + " nanoseconds");<o:p></o:p></span></div>
<div class="MsoNormal" style="background: #F8F9FA; border: none; line-height: 15.6pt; margin-bottom: .0001pt; margin-bottom: 0cm; mso-border-alt: solid #EAECF0 .5pt; mso-padding-alt: 12.0pt 12.0pt 12.0pt 12.0pt; padding: 0cm; tab-stops: 45.8pt 91.6pt 137.4pt 183.2pt 229.0pt 274.8pt 320.6pt 366.4pt 412.2pt 458.0pt 503.8pt 549.6pt 595.4pt 641.2pt 687.0pt 732.8pt;">
<span style="color: black; font-family: "courier new"; font-size: 9.0pt;"><span style="mso-spacerun: yes;"> </span>}<o:p></o:p></span></div>
<div class="MsoNormal" style="background: #F8F9FA; border: none; line-height: 15.6pt; margin-bottom: .0001pt; margin-bottom: 0cm; mso-border-alt: solid #EAECF0 .5pt; mso-padding-alt: 12.0pt 12.0pt 12.0pt 12.0pt; padding: 0cm; tab-stops: 45.8pt 91.6pt 137.4pt 183.2pt 229.0pt 274.8pt 320.6pt 366.4pt 412.2pt 458.0pt 503.8pt 549.6pt 595.4pt 641.2pt 687.0pt 732.8pt;">
<span style="color: black; font-family: "courier new"; font-size: 9.0pt;">}<o:p></o:p></span></div>
<div class="MsoNormal" style="background: #F8F9FA; border: none; line-height: 15.6pt; margin-bottom: .0001pt; margin-bottom: 0cm; mso-border-alt: solid #EAECF0 .5pt; mso-padding-alt: 12.0pt 12.0pt 12.0pt 12.0pt; padding: 0cm; tab-stops: 45.8pt 91.6pt 137.4pt 183.2pt 229.0pt 274.8pt 320.6pt 366.4pt 412.2pt 458.0pt 503.8pt 549.6pt 595.4pt 641.2pt 687.0pt 732.8pt;">
<br /></div>
<div class="MsoNormal" style="background: #F8F9FA; border: none; line-height: 15.6pt; margin-bottom: .0001pt; margin-bottom: 0cm; mso-border-alt: solid #EAECF0 .5pt; mso-padding-alt: 12.0pt 12.0pt 12.0pt 12.0pt; padding: 0cm; tab-stops: 45.8pt 91.6pt 137.4pt 183.2pt 229.0pt 274.8pt 320.6pt 366.4pt 412.2pt 458.0pt 503.8pt 549.6pt 595.4pt 641.2pt 687.0pt 732.8pt;">
<br /></div>
<div class="MsoNormal" style="background: #F8F9FA; border: none; line-height: 15.6pt; margin-bottom: .0001pt; margin-bottom: 0cm; mso-border-alt: solid #EAECF0 .5pt; mso-padding-alt: 12.0pt 12.0pt 12.0pt 12.0pt; padding: 0cm; tab-stops: 45.8pt 91.6pt 137.4pt 183.2pt 229.0pt 274.8pt 320.6pt 366.4pt 412.2pt 458.0pt 503.8pt 549.6pt 595.4pt 641.2pt 687.0pt 732.8pt;">
<br /></div>
<div class="MsoNormal" style="background: #F8F9FA; border: none; line-height: 15.6pt; margin-bottom: .0001pt; margin-bottom: 0cm; mso-border-alt: solid #EAECF0 .5pt; mso-padding-alt: 12.0pt 12.0pt 12.0pt 12.0pt; padding: 0cm; tab-stops: 45.8pt 91.6pt 137.4pt 183.2pt 229.0pt 274.8pt 320.6pt 366.4pt 412.2pt 458.0pt 503.8pt 549.6pt 595.4pt 641.2pt 687.0pt 732.8pt;">
<span style="color: black; font-family: "courier new"; font-size: 9.0pt;">/**<o:p></o:p></span></div>
<div class="MsoNormal" style="background: #F8F9FA; border: none; line-height: 15.6pt; margin-bottom: .0001pt; margin-bottom: 0cm; mso-border-alt: solid #EAECF0 .5pt; mso-padding-alt: 12.0pt 12.0pt 12.0pt 12.0pt; padding: 0cm; tab-stops: 45.8pt 91.6pt 137.4pt 183.2pt 229.0pt 274.8pt 320.6pt 366.4pt 412.2pt 458.0pt 503.8pt 549.6pt 595.4pt 641.2pt 687.0pt 732.8pt;">
<span style="color: black; font-family: "courier new"; font-size: 9.0pt;"><span style="mso-spacerun: yes;"> </span>2 non-shared
volatile without padding, suppose to be<o:p></o:p></span></div>
<div class="MsoNormal" style="background: #F8F9FA; border: none; line-height: 15.6pt; margin-bottom: .0001pt; margin-bottom: 0cm; mso-border-alt: solid #EAECF0 .5pt; mso-padding-alt: 12.0pt 12.0pt 12.0pt 12.0pt; padding: 0cm; tab-stops: 45.8pt 91.6pt 137.4pt 183.2pt 229.0pt 274.8pt 320.6pt 366.4pt 412.2pt 458.0pt 503.8pt 549.6pt 595.4pt 641.2pt 687.0pt 732.8pt;">
<span style="color: black; font-family: "courier new"; font-size: 9.0pt;"><span style="mso-spacerun: yes;"> </span>on the same
cache line<o:p></o:p></span></div>
<div class="MsoNormal" style="background: #F8F9FA; border: none; line-height: 15.6pt; margin-bottom: .0001pt; margin-bottom: 0cm; mso-border-alt: solid #EAECF0 .5pt; mso-padding-alt: 12.0pt 12.0pt 12.0pt 12.0pt; padding: 0cm; tab-stops: 45.8pt 91.6pt 137.4pt 183.2pt 229.0pt 274.8pt 320.6pt 366.4pt 412.2pt 458.0pt 503.8pt 549.6pt 595.4pt 641.2pt 687.0pt 732.8pt;">
<span style="color: black; font-family: "courier new"; font-size: 9.0pt;"><span style="mso-spacerun: yes;"> </span>First Attempt:<o:p></o:p></span></div>
<div class="MsoNormal" style="background: #F8F9FA; border: none; line-height: 15.6pt; margin-bottom: .0001pt; margin-bottom: 0cm; mso-border-alt: solid #EAECF0 .5pt; mso-padding-alt: 12.0pt 12.0pt 12.0pt 12.0pt; padding: 0cm; tab-stops: 45.8pt 91.6pt 137.4pt 183.2pt 229.0pt 274.8pt 320.6pt 366.4pt 412.2pt 458.0pt 503.8pt 549.6pt 595.4pt 641.2pt 687.0pt 732.8pt;">
<span style="color: black; font-family: "courier new"; font-size: 9.0pt;"><span style="mso-spacerun: yes;"> </span>End of thread
1, last value of myVolatileValue1 is 1<o:p></o:p></span></div>
<div class="MsoNormal" style="background: #F8F9FA; border: none; line-height: 15.6pt; margin-bottom: .0001pt; margin-bottom: 0cm; mso-border-alt: solid #EAECF0 .5pt; mso-padding-alt: 12.0pt 12.0pt 12.0pt 12.0pt; padding: 0cm; tab-stops: 45.8pt 91.6pt 137.4pt 183.2pt 229.0pt 274.8pt 320.6pt 366.4pt 412.2pt 458.0pt 503.8pt 549.6pt 595.4pt 641.2pt 687.0pt 732.8pt;">
<span style="color: black; font-family: "courier new"; font-size: 9.0pt;"><span style="mso-spacerun: yes;"> </span>it took
3133182407 nanoseconds<o:p></o:p></span></div>
<div class="MsoNormal" style="background: #F8F9FA; border: none; line-height: 15.6pt; margin-bottom: .0001pt; margin-bottom: 0cm; mso-border-alt: solid #EAECF0 .5pt; mso-padding-alt: 12.0pt 12.0pt 12.0pt 12.0pt; padding: 0cm; tab-stops: 45.8pt 91.6pt 137.4pt 183.2pt 229.0pt 274.8pt 320.6pt 366.4pt 412.2pt 458.0pt 503.8pt 549.6pt 595.4pt 641.2pt 687.0pt 732.8pt;">
<span style="color: black; font-family: "courier new"; font-size: 9.0pt;"><span style="mso-spacerun: yes;"> </span>End of thread
2, last value of myVolatileValue2 is 1<o:p></o:p></span></div>
<div class="MsoNormal" style="background: #F8F9FA; border: none; line-height: 15.6pt; margin-bottom: .0001pt; margin-bottom: 0cm; mso-border-alt: solid #EAECF0 .5pt; mso-padding-alt: 12.0pt 12.0pt 12.0pt 12.0pt; padding: 0cm; tab-stops: 45.8pt 91.6pt 137.4pt 183.2pt 229.0pt 274.8pt 320.6pt 366.4pt 412.2pt 458.0pt 503.8pt 549.6pt 595.4pt 641.2pt 687.0pt 732.8pt;">
<span style="color: black; font-family: "courier new"; font-size: 9.0pt;"><span style="mso-spacerun: yes;"> </span>it took
3167983652 nanoseconds<o:p></o:p></span></div>
<div class="MsoNormal" style="background: #F8F9FA; border: none; line-height: 15.6pt; margin-bottom: .0001pt; margin-bottom: 0cm; mso-border-alt: solid #EAECF0 .5pt; mso-padding-alt: 12.0pt 12.0pt 12.0pt 12.0pt; padding: 0cm; tab-stops: 45.8pt 91.6pt 137.4pt 183.2pt 229.0pt 274.8pt 320.6pt 366.4pt 412.2pt 458.0pt 503.8pt 549.6pt 595.4pt 641.2pt 687.0pt 732.8pt;">
<span style="color: black; font-family: "courier new"; font-size: 9.0pt;"><span style="mso-spacerun: yes;"> </span>Second Attempt:<o:p></o:p></span></div>
<div class="MsoNormal" style="background: #F8F9FA; border: none; line-height: 15.6pt; margin-bottom: .0001pt; margin-bottom: 0cm; mso-border-alt: solid #EAECF0 .5pt; mso-padding-alt: 12.0pt 12.0pt 12.0pt 12.0pt; padding: 0cm; tab-stops: 45.8pt 91.6pt 137.4pt 183.2pt 229.0pt 274.8pt 320.6pt 366.4pt 412.2pt 458.0pt 503.8pt 549.6pt 595.4pt 641.2pt 687.0pt 732.8pt;">
<span style="color: black; font-family: "courier new"; font-size: 9.0pt;"><span style="mso-spacerun: yes;"> </span>End of thread
2, last value of myVolatileValue2 is 1<o:p></o:p></span></div>
<div class="MsoNormal" style="background: #F8F9FA; border: none; line-height: 15.6pt; margin-bottom: .0001pt; margin-bottom: 0cm; mso-border-alt: solid #EAECF0 .5pt; mso-padding-alt: 12.0pt 12.0pt 12.0pt 12.0pt; padding: 0cm; tab-stops: 45.8pt 91.6pt 137.4pt 183.2pt 229.0pt 274.8pt 320.6pt 366.4pt 412.2pt 458.0pt 503.8pt 549.6pt 595.4pt 641.2pt 687.0pt 732.8pt;">
<span style="color: black; font-family: "courier new"; font-size: 9.0pt;"><span style="mso-spacerun: yes;"> </span>it took
3383002049 nanoseconds<o:p></o:p></span></div>
<div class="MsoNormal" style="background: #F8F9FA; border: none; line-height: 15.6pt; margin-bottom: .0001pt; margin-bottom: 0cm; mso-border-alt: solid #EAECF0 .5pt; mso-padding-alt: 12.0pt 12.0pt 12.0pt 12.0pt; padding: 0cm; tab-stops: 45.8pt 91.6pt 137.4pt 183.2pt 229.0pt 274.8pt 320.6pt 366.4pt 412.2pt 458.0pt 503.8pt 549.6pt 595.4pt 641.2pt 687.0pt 732.8pt;">
<span style="color: black; font-family: "courier new"; font-size: 9.0pt;"><span style="mso-spacerun: yes;"> </span>End of thread
1, last value of myVolatileValue1 is 1<o:p></o:p></span></div>
<div class="MsoNormal" style="background: #F8F9FA; border: none; line-height: 15.6pt; margin-bottom: .0001pt; margin-bottom: 0cm; mso-border-alt: solid #EAECF0 .5pt; mso-padding-alt: 12.0pt 12.0pt 12.0pt 12.0pt; padding: 0cm; tab-stops: 45.8pt 91.6pt 137.4pt 183.2pt 229.0pt 274.8pt 320.6pt 366.4pt 412.2pt 458.0pt 503.8pt 549.6pt 595.4pt 641.2pt 687.0pt 732.8pt;">
<span style="color: black; font-family: "courier new"; font-size: 9.0pt;"><span style="mso-spacerun: yes;"> </span>it took
3418189666 nanoseconds<o:p></o:p></span></div>
<div class="MsoNormal" style="background: #F8F9FA; border: none; line-height: 15.6pt; margin-bottom: .0001pt; margin-bottom: 0cm; mso-border-alt: solid #EAECF0 .5pt; mso-padding-alt: 12.0pt 12.0pt 12.0pt 12.0pt; padding: 0cm; tab-stops: 45.8pt 91.6pt 137.4pt 183.2pt 229.0pt 274.8pt 320.6pt 366.4pt 412.2pt 458.0pt 503.8pt 549.6pt 595.4pt 641.2pt 687.0pt 732.8pt;">
<span style="color: black; font-family: "courier new"; font-size: 9.0pt;"><span style="mso-spacerun: yes;"> </span>Third Attempt:<o:p></o:p></span></div>
<div class="MsoNormal" style="background: #F8F9FA; border: none; line-height: 15.6pt; margin-bottom: .0001pt; margin-bottom: 0cm; mso-border-alt: solid #EAECF0 .5pt; mso-padding-alt: 12.0pt 12.0pt 12.0pt 12.0pt; padding: 0cm; tab-stops: 45.8pt 91.6pt 137.4pt 183.2pt 229.0pt 274.8pt 320.6pt 366.4pt 412.2pt 458.0pt 503.8pt 549.6pt 595.4pt 641.2pt 687.0pt 732.8pt;">
<span style="color: black; font-family: "courier new"; font-size: 9.0pt;"><span style="mso-spacerun: yes;"> </span>End of thread
2, last value of myVolatileValue2 is 1<o:p></o:p></span></div>
<div class="MsoNormal" style="background: #F8F9FA; border: none; line-height: 15.6pt; margin-bottom: .0001pt; margin-bottom: 0cm; mso-border-alt: solid #EAECF0 .5pt; mso-padding-alt: 12.0pt 12.0pt 12.0pt 12.0pt; padding: 0cm; tab-stops: 45.8pt 91.6pt 137.4pt 183.2pt 229.0pt 274.8pt 320.6pt 366.4pt 412.2pt 458.0pt 503.8pt 549.6pt 595.4pt 641.2pt 687.0pt 732.8pt;">
<span style="color: black; font-family: "courier new"; font-size: 9.0pt;"><span style="mso-spacerun: yes;"> </span>it took
3480275412 nanoseconds<o:p></o:p></span></div>
<div class="MsoNormal" style="background: #F8F9FA; border: none; line-height: 15.6pt; margin-bottom: .0001pt; margin-bottom: 0cm; mso-border-alt: solid #EAECF0 .5pt; mso-padding-alt: 12.0pt 12.0pt 12.0pt 12.0pt; padding: 0cm; tab-stops: 45.8pt 91.6pt 137.4pt 183.2pt 229.0pt 274.8pt 320.6pt 366.4pt 412.2pt 458.0pt 503.8pt 549.6pt 595.4pt 641.2pt 687.0pt 732.8pt;">
<span style="color: black; font-family: "courier new"; font-size: 9.0pt;"><span style="mso-spacerun: yes;"> </span>End of thread
1, last value of myVolatileValue1 is 1<o:p></o:p></span></div>
<div class="MsoNormal" style="background: #F8F9FA; border: none; line-height: 15.6pt; margin-bottom: .0001pt; margin-bottom: 0cm; mso-border-alt: solid #EAECF0 .5pt; mso-padding-alt: 12.0pt 12.0pt 12.0pt 12.0pt; padding: 0cm; tab-stops: 45.8pt 91.6pt 137.4pt 183.2pt 229.0pt 274.8pt 320.6pt 366.4pt 412.2pt 458.0pt 503.8pt 549.6pt 595.4pt 641.2pt 687.0pt 732.8pt;">
<span style="color: black; font-family: "courier new"; font-size: 9.0pt;"><span style="mso-spacerun: yes;"> </span>it took
3492587998 nanoseconds<o:p></o:p></span></div>
<div class="MsoNormal" style="background: #F8F9FA; border: none; line-height: 15.6pt; margin-bottom: .0001pt; margin-bottom: 0cm; mso-border-alt: solid #EAECF0 .5pt; mso-padding-alt: 12.0pt 12.0pt 12.0pt 12.0pt; padding: 0cm; tab-stops: 45.8pt 91.6pt 137.4pt 183.2pt 229.0pt 274.8pt 320.6pt 366.4pt 412.2pt 458.0pt 503.8pt 549.6pt 595.4pt 641.2pt 687.0pt 732.8pt;">
<span style="color: black; font-family: "courier new"; font-size: 9.0pt;"><span style="mso-spacerun: yes;"> </span>Avg. running
time: 3.34 sec<o:p></o:p></span></div>
<div class="MsoNormal" style="background: #F8F9FA; border: none; line-height: 15.6pt; margin-bottom: .0001pt; margin-bottom: 0cm; mso-border-alt: solid #EAECF0 .5pt; mso-padding-alt: 12.0pt 12.0pt 12.0pt 12.0pt; padding: 0cm; tab-stops: 45.8pt 91.6pt 137.4pt 183.2pt 229.0pt 274.8pt 320.6pt 366.4pt 412.2pt 458.0pt 503.8pt 549.6pt 595.4pt 641.2pt 687.0pt 732.8pt;">
<span style="color: black; font-family: "courier new"; font-size: 9.0pt;"><span style="mso-spacerun: yes;"> </span>--------------------------------------------------<o:p></o:p></span></div>
<div class="MsoNormal" style="background: #F8F9FA; border: none; line-height: 15.6pt; margin-bottom: .0001pt; margin-bottom: 0cm; mso-border-alt: solid #EAECF0 .5pt; mso-padding-alt: 12.0pt 12.0pt 12.0pt 12.0pt; padding: 0cm; tab-stops: 45.8pt 91.6pt 137.4pt 183.2pt 229.0pt 274.8pt 320.6pt 366.4pt 412.2pt 458.0pt 503.8pt 549.6pt 595.4pt 641.2pt 687.0pt 732.8pt;">
<span style="color: black; font-family: "courier new"; font-size: 9.0pt;"><span style="mso-spacerun: yes;"> </span>2 non-shared
volatile with padding, suppose to be<o:p></o:p></span></div>
<div class="MsoNormal" style="background: #F8F9FA; border: none; line-height: 15.6pt; margin-bottom: .0001pt; margin-bottom: 0cm; mso-border-alt: solid #EAECF0 .5pt; mso-padding-alt: 12.0pt 12.0pt 12.0pt 12.0pt; padding: 0cm; tab-stops: 45.8pt 91.6pt 137.4pt 183.2pt 229.0pt 274.8pt 320.6pt 366.4pt 412.2pt 458.0pt 503.8pt 549.6pt 595.4pt 641.2pt 687.0pt 732.8pt;">
<span style="color: black; font-family: "courier new"; font-size: 9.0pt;"><span style="mso-spacerun: yes;"> </span>on different
cache line<o:p></o:p></span></div>
<div class="MsoNormal" style="background: #F8F9FA; border: none; line-height: 15.6pt; margin-bottom: .0001pt; margin-bottom: 0cm; mso-border-alt: solid #EAECF0 .5pt; mso-padding-alt: 12.0pt 12.0pt 12.0pt 12.0pt; padding: 0cm; tab-stops: 45.8pt 91.6pt 137.4pt 183.2pt 229.0pt 274.8pt 320.6pt 366.4pt 412.2pt 458.0pt 503.8pt 549.6pt 595.4pt 641.2pt 687.0pt 732.8pt;">
<span style="color: black; font-family: "courier new"; font-size: 9.0pt;"><span style="mso-spacerun: yes;"> </span>First Attempt:<o:p></o:p></span></div>
<div class="MsoNormal" style="background: #F8F9FA; border: none; line-height: 15.6pt; margin-bottom: .0001pt; margin-bottom: 0cm; mso-border-alt: solid #EAECF0 .5pt; mso-padding-alt: 12.0pt 12.0pt 12.0pt 12.0pt; padding: 0cm; tab-stops: 45.8pt 91.6pt 137.4pt 183.2pt 229.0pt 274.8pt 320.6pt 366.4pt 412.2pt 458.0pt 503.8pt 549.6pt 595.4pt 641.2pt 687.0pt 732.8pt;">
<span style="color: black; font-family: "courier new"; font-size: 9.0pt;"><span style="mso-spacerun: yes;"> </span>End of thread
2, last value of myVolatileValue2 is 1<o:p></o:p></span></div>
<div class="MsoNormal" style="background: #F8F9FA; border: none; line-height: 15.6pt; margin-bottom: .0001pt; margin-bottom: 0cm; mso-border-alt: solid #EAECF0 .5pt; mso-padding-alt: 12.0pt 12.0pt 12.0pt 12.0pt; padding: 0cm; tab-stops: 45.8pt 91.6pt 137.4pt 183.2pt 229.0pt 274.8pt 320.6pt 366.4pt 412.2pt 458.0pt 503.8pt 549.6pt 595.4pt 641.2pt 687.0pt 732.8pt;">
<span style="color: black; font-family: "courier new"; font-size: 9.0pt;"><span style="mso-spacerun: yes;"> </span>it took
3000347735 nanoseconds<o:p></o:p></span></div>
<div class="MsoNormal" style="background: #F8F9FA; border: none; line-height: 15.6pt; margin-bottom: .0001pt; margin-bottom: 0cm; mso-border-alt: solid #EAECF0 .5pt; mso-padding-alt: 12.0pt 12.0pt 12.0pt 12.0pt; padding: 0cm; tab-stops: 45.8pt 91.6pt 137.4pt 183.2pt 229.0pt 274.8pt 320.6pt 366.4pt 412.2pt 458.0pt 503.8pt 549.6pt 595.4pt 641.2pt 687.0pt 732.8pt;">
<span style="color: black; font-family: "courier new"; font-size: 9.0pt;"><span style="mso-spacerun: yes;"> </span>End of thread
1, last value of myVolatileValue1 is 1<o:p></o:p></span></div>
<div class="MsoNormal" style="background: #F8F9FA; border: none; line-height: 15.6pt; margin-bottom: .0001pt; margin-bottom: 0cm; mso-border-alt: solid #EAECF0 .5pt; mso-padding-alt: 12.0pt 12.0pt 12.0pt 12.0pt; padding: 0cm; tab-stops: 45.8pt 91.6pt 137.4pt 183.2pt 229.0pt 274.8pt 320.6pt 366.4pt 412.2pt 458.0pt 503.8pt 549.6pt 595.4pt 641.2pt 687.0pt 732.8pt;">
<span style="color: black; font-family: "courier new"; font-size: 9.0pt;"><span style="mso-spacerun: yes;"> </span>it took
3032000048 nanoseconds<o:p></o:p></span></div>
<div class="MsoNormal" style="background: #F8F9FA; border: none; line-height: 15.6pt; margin-bottom: .0001pt; margin-bottom: 0cm; mso-border-alt: solid #EAECF0 .5pt; mso-padding-alt: 12.0pt 12.0pt 12.0pt 12.0pt; padding: 0cm; tab-stops: 45.8pt 91.6pt 137.4pt 183.2pt 229.0pt 274.8pt 320.6pt 366.4pt 412.2pt 458.0pt 503.8pt 549.6pt 595.4pt 641.2pt 687.0pt 732.8pt;">
<span style="color: black; font-family: "courier new"; font-size: 9.0pt;"><span style="mso-spacerun: yes;"> </span>Second Attempt:<o:p></o:p></span></div>
<div class="MsoNormal" style="background: #F8F9FA; border: none; line-height: 15.6pt; margin-bottom: .0001pt; margin-bottom: 0cm; mso-border-alt: solid #EAECF0 .5pt; mso-padding-alt: 12.0pt 12.0pt 12.0pt 12.0pt; padding: 0cm; tab-stops: 45.8pt 91.6pt 137.4pt 183.2pt 229.0pt 274.8pt 320.6pt 366.4pt 412.2pt 458.0pt 503.8pt 549.6pt 595.4pt 641.2pt 687.0pt 732.8pt;">
<span style="color: black; font-family: "courier new"; font-size: 9.0pt;"><span style="mso-spacerun: yes;"> </span>End of thread
1, last value of myVolatileValue1 is 1<o:p></o:p></span></div>
<div class="MsoNormal" style="background: #F8F9FA; border: none; line-height: 15.6pt; margin-bottom: .0001pt; margin-bottom: 0cm; mso-border-alt: solid #EAECF0 .5pt; mso-padding-alt: 12.0pt 12.0pt 12.0pt 12.0pt; padding: 0cm; tab-stops: 45.8pt 91.6pt 137.4pt 183.2pt 229.0pt 274.8pt 320.6pt 366.4pt 412.2pt 458.0pt 503.8pt 549.6pt 595.4pt 641.2pt 687.0pt 732.8pt;">
<span style="color: black; font-family: "courier new"; font-size: 9.0pt;"><span style="mso-spacerun: yes;"> </span>it took
3104793729 nanoseconds<o:p></o:p></span></div>
<div class="MsoNormal" style="background: #F8F9FA; border: none; line-height: 15.6pt; margin-bottom: .0001pt; margin-bottom: 0cm; mso-border-alt: solid #EAECF0 .5pt; mso-padding-alt: 12.0pt 12.0pt 12.0pt 12.0pt; padding: 0cm; tab-stops: 45.8pt 91.6pt 137.4pt 183.2pt 229.0pt 274.8pt 320.6pt 366.4pt 412.2pt 458.0pt 503.8pt 549.6pt 595.4pt 641.2pt 687.0pt 732.8pt;">
<span style="color: black; font-family: "courier new"; font-size: 9.0pt;"><span style="mso-spacerun: yes;"> </span>End of thread
2, last value of myVolatileValue2 is 1<o:p></o:p></span></div>
<div class="MsoNormal" style="background: #F8F9FA; border: none; line-height: 15.6pt; margin-bottom: .0001pt; margin-bottom: 0cm; mso-border-alt: solid #EAECF0 .5pt; mso-padding-alt: 12.0pt 12.0pt 12.0pt 12.0pt; padding: 0cm; tab-stops: 45.8pt 91.6pt 137.4pt 183.2pt 229.0pt 274.8pt 320.6pt 366.4pt 412.2pt 458.0pt 503.8pt 549.6pt 595.4pt 641.2pt 687.0pt 732.8pt;">
<span style="color: black; font-family: "courier new"; font-size: 9.0pt;"><span style="mso-spacerun: yes;"> </span>it took
3143762961 nanoseconds<o:p></o:p></span></div>
<div class="MsoNormal" style="background: #F8F9FA; border: none; line-height: 15.6pt; margin-bottom: .0001pt; margin-bottom: 0cm; mso-border-alt: solid #EAECF0 .5pt; mso-padding-alt: 12.0pt 12.0pt 12.0pt 12.0pt; padding: 0cm; tab-stops: 45.8pt 91.6pt 137.4pt 183.2pt 229.0pt 274.8pt 320.6pt 366.4pt 412.2pt 458.0pt 503.8pt 549.6pt 595.4pt 641.2pt 687.0pt 732.8pt;">
<span style="color: black; font-family: "courier new"; font-size: 9.0pt;"><span style="mso-spacerun: yes;"> </span>Third Attempt:<o:p></o:p></span></div>
<div class="MsoNormal" style="background: #F8F9FA; border: none; line-height: 15.6pt; margin-bottom: .0001pt; margin-bottom: 0cm; mso-border-alt: solid #EAECF0 .5pt; mso-padding-alt: 12.0pt 12.0pt 12.0pt 12.0pt; padding: 0cm; tab-stops: 45.8pt 91.6pt 137.4pt 183.2pt 229.0pt 274.8pt 320.6pt 366.4pt 412.2pt 458.0pt 503.8pt 549.6pt 595.4pt 641.2pt 687.0pt 732.8pt;">
<span style="color: black; font-family: "courier new"; font-size: 9.0pt;"><span style="mso-spacerun: yes;"> </span>End of thread
1, last value of myVolatileValue1 is 1<o:p></o:p></span></div>
<div class="MsoNormal" style="background: #F8F9FA; border: none; line-height: 15.6pt; margin-bottom: .0001pt; margin-bottom: 0cm; mso-border-alt: solid #EAECF0 .5pt; mso-padding-alt: 12.0pt 12.0pt 12.0pt 12.0pt; padding: 0cm; tab-stops: 45.8pt 91.6pt 137.4pt 183.2pt 229.0pt 274.8pt 320.6pt 366.4pt 412.2pt 458.0pt 503.8pt 549.6pt 595.4pt 641.2pt 687.0pt 732.8pt;">
<span style="color: black; font-family: "courier new"; font-size: 9.0pt;"><span style="mso-spacerun: yes;"> </span>it took
3091972217 nanoseconds<o:p></o:p></span></div>
<div class="MsoNormal" style="background: #F8F9FA; border: none; line-height: 15.6pt; margin-bottom: .0001pt; margin-bottom: 0cm; mso-border-alt: solid #EAECF0 .5pt; mso-padding-alt: 12.0pt 12.0pt 12.0pt 12.0pt; padding: 0cm; tab-stops: 45.8pt 91.6pt 137.4pt 183.2pt 229.0pt 274.8pt 320.6pt 366.4pt 412.2pt 458.0pt 503.8pt 549.6pt 595.4pt 641.2pt 687.0pt 732.8pt;">
<span style="color: black; font-family: "courier new"; font-size: 9.0pt;"><span style="mso-spacerun: yes;"> </span>End of thread
2, last value of myVolatileValue2 is 1<o:p></o:p></span></div>
<div class="MsoNormal" style="background: #F8F9FA; border: none; line-height: 15.6pt; margin-bottom: .0001pt; margin-bottom: 0cm; mso-border-alt: solid #EAECF0 .5pt; mso-padding-alt: 12.0pt 12.0pt 12.0pt 12.0pt; padding: 0cm; tab-stops: 45.8pt 91.6pt 137.4pt 183.2pt 229.0pt 274.8pt 320.6pt 366.4pt 412.2pt 458.0pt 503.8pt 549.6pt 595.4pt 641.2pt 687.0pt 732.8pt;">
<span style="color: black; font-family: "courier new"; font-size: 9.0pt;"><span style="mso-spacerun: yes;"> </span>it took
3106549306 nanoseconds<o:p></o:p></span></div>
<div class="MsoNormal" style="background: #F8F9FA; border: none; line-height: 15.6pt; margin-bottom: .0001pt; margin-bottom: 0cm; mso-border-alt: solid #EAECF0 .5pt; mso-padding-alt: 12.0pt 12.0pt 12.0pt 12.0pt; padding: 0cm; tab-stops: 45.8pt 91.6pt 137.4pt 183.2pt 229.0pt 274.8pt 320.6pt 366.4pt 412.2pt 458.0pt 503.8pt 549.6pt 595.4pt 641.2pt 687.0pt 732.8pt;">
<span style="color: black; font-family: "courier new"; font-size: 9.0pt;"><span style="mso-spacerun: yes;"> </span>Avg. running
time: 3.07 sec<o:p></o:p></span></div>
<div class="MsoNormal" style="background: #F8F9FA; border: none; line-height: 15.6pt; margin-bottom: .0001pt; margin-bottom: 0cm; mso-border-alt: solid #EAECF0 .5pt; mso-padding-alt: 12.0pt 12.0pt 12.0pt 12.0pt; padding: 0cm; tab-stops: 45.8pt 91.6pt 137.4pt 183.2pt 229.0pt 274.8pt 320.6pt 366.4pt 412.2pt 458.0pt 503.8pt 549.6pt 595.4pt 641.2pt 687.0pt 732.8pt;">
<span style="color: black; font-family: "courier new"; font-size: 9.0pt;"><span style="mso-spacerun: yes;"> </span>----------------------------------------------------<o:p></o:p></span></div>
<div class="MsoNormal" style="background: #F8F9FA; border: none; line-height: 15.6pt; margin-bottom: .0001pt; margin-bottom: 0cm; mso-border-alt: solid #EAECF0 .5pt; mso-padding-alt: 12.0pt 12.0pt 12.0pt 12.0pt; padding: 0cm; tab-stops: 45.8pt 91.6pt 137.4pt 183.2pt 229.0pt 274.8pt 320.6pt 366.4pt 412.2pt 458.0pt 503.8pt 549.6pt 595.4pt 641.2pt 687.0pt 732.8pt;">
<span style="color: black; font-family: "courier new"; font-size: 9.0pt;"><span style="mso-spacerun: yes;"> </span>2 non-shared
volatile with @Contended, suppose to be<o:p></o:p></span></div>
<div class="MsoNormal" style="background: #F8F9FA; border: none; line-height: 15.6pt; margin-bottom: .0001pt; margin-bottom: 0cm; mso-border-alt: solid #EAECF0 .5pt; mso-padding-alt: 12.0pt 12.0pt 12.0pt 12.0pt; padding: 0cm; tab-stops: 45.8pt 91.6pt 137.4pt 183.2pt 229.0pt 274.8pt 320.6pt 366.4pt 412.2pt 458.0pt 503.8pt 549.6pt 595.4pt 641.2pt 687.0pt 732.8pt;">
<span style="color: black; font-family: "courier new"; font-size: 9.0pt;"><span style="mso-spacerun: yes;"> </span>on different
cache line<o:p></o:p></span></div>
<div class="MsoNormal" style="background: #F8F9FA; border: none; line-height: 15.6pt; margin-bottom: .0001pt; margin-bottom: 0cm; mso-border-alt: solid #EAECF0 .5pt; mso-padding-alt: 12.0pt 12.0pt 12.0pt 12.0pt; padding: 0cm; tab-stops: 45.8pt 91.6pt 137.4pt 183.2pt 229.0pt 274.8pt 320.6pt 366.4pt 412.2pt 458.0pt 503.8pt 549.6pt 595.4pt 641.2pt 687.0pt 732.8pt;">
<span style="color: black; font-family: "courier new"; font-size: 9.0pt;"><span style="mso-spacerun: yes;"> </span>First Attempt:<o:p></o:p></span></div>
<div class="MsoNormal" style="background: #F8F9FA; border: none; line-height: 15.6pt; margin-bottom: .0001pt; margin-bottom: 0cm; mso-border-alt: solid #EAECF0 .5pt; mso-padding-alt: 12.0pt 12.0pt 12.0pt 12.0pt; padding: 0cm; tab-stops: 45.8pt 91.6pt 137.4pt 183.2pt 229.0pt 274.8pt 320.6pt 366.4pt 412.2pt 458.0pt 503.8pt 549.6pt 595.4pt 641.2pt 687.0pt 732.8pt;">
<span style="color: black; font-family: "courier new"; font-size: 9.0pt;"><span style="mso-spacerun: yes;"> </span>End of thread
1, last value of myVolatileValue1 is 1<o:p></o:p></span></div>
<div class="MsoNormal" style="background: #F8F9FA; border: none; line-height: 15.6pt; margin-bottom: .0001pt; margin-bottom: 0cm; mso-border-alt: solid #EAECF0 .5pt; mso-padding-alt: 12.0pt 12.0pt 12.0pt 12.0pt; padding: 0cm; tab-stops: 45.8pt 91.6pt 137.4pt 183.2pt 229.0pt 274.8pt 320.6pt 366.4pt 412.2pt 458.0pt 503.8pt 549.6pt 595.4pt 641.2pt 687.0pt 732.8pt;">
<span style="color: black; font-family: "courier new"; font-size: 9.0pt;"><span style="mso-spacerun: yes;"> </span>it took
1406085998 nanoseconds<o:p></o:p></span></div>
<div class="MsoNormal" style="background: #F8F9FA; border: none; line-height: 15.6pt; margin-bottom: .0001pt; margin-bottom: 0cm; mso-border-alt: solid #EAECF0 .5pt; mso-padding-alt: 12.0pt 12.0pt 12.0pt 12.0pt; padding: 0cm; tab-stops: 45.8pt 91.6pt 137.4pt 183.2pt 229.0pt 274.8pt 320.6pt 366.4pt 412.2pt 458.0pt 503.8pt 549.6pt 595.4pt 641.2pt 687.0pt 732.8pt;">
<span style="color: black; font-family: "courier new"; font-size: 9.0pt;"><span style="mso-spacerun: yes;"> </span>End of thread
2, last value of myVolatileValue2 is 1<o:p></o:p></span></div>
<div class="MsoNormal" style="background: #F8F9FA; border: none; line-height: 15.6pt; margin-bottom: .0001pt; margin-bottom: 0cm; mso-border-alt: solid #EAECF0 .5pt; mso-padding-alt: 12.0pt 12.0pt 12.0pt 12.0pt; padding: 0cm; tab-stops: 45.8pt 91.6pt 137.4pt 183.2pt 229.0pt 274.8pt 320.6pt 366.4pt 412.2pt 458.0pt 503.8pt 549.6pt 595.4pt 641.2pt 687.0pt 732.8pt;">
<span style="color: black; font-family: "courier new"; font-size: 9.0pt;"><span style="mso-spacerun: yes;"> </span>it took
1684038215 nanoseconds<o:p></o:p></span></div>
<div class="MsoNormal" style="background: #F8F9FA; border: none; line-height: 15.6pt; margin-bottom: .0001pt; margin-bottom: 0cm; mso-border-alt: solid #EAECF0 .5pt; mso-padding-alt: 12.0pt 12.0pt 12.0pt 12.0pt; padding: 0cm; tab-stops: 45.8pt 91.6pt 137.4pt 183.2pt 229.0pt 274.8pt 320.6pt 366.4pt 412.2pt 458.0pt 503.8pt 549.6pt 595.4pt 641.2pt 687.0pt 732.8pt;">
<span style="color: black; font-family: "courier new"; font-size: 9.0pt;"><span style="mso-spacerun: yes;"> </span>Second Attempt:<o:p></o:p></span></div>
<div class="MsoNormal" style="background: #F8F9FA; border: none; line-height: 15.6pt; margin-bottom: .0001pt; margin-bottom: 0cm; mso-border-alt: solid #EAECF0 .5pt; mso-padding-alt: 12.0pt 12.0pt 12.0pt 12.0pt; padding: 0cm; tab-stops: 45.8pt 91.6pt 137.4pt 183.2pt 229.0pt 274.8pt 320.6pt 366.4pt 412.2pt 458.0pt 503.8pt 549.6pt 595.4pt 641.2pt 687.0pt 732.8pt;">
<span style="color: black; font-family: "courier new"; font-size: 9.0pt;"><span style="mso-spacerun: yes;"> </span>End of thread
1, last value of myVolatileValue1 is 1<o:p></o:p></span></div>
<div class="MsoNormal" style="background: #F8F9FA; border: none; line-height: 15.6pt; margin-bottom: .0001pt; margin-bottom: 0cm; mso-border-alt: solid #EAECF0 .5pt; mso-padding-alt: 12.0pt 12.0pt 12.0pt 12.0pt; padding: 0cm; tab-stops: 45.8pt 91.6pt 137.4pt 183.2pt 229.0pt 274.8pt 320.6pt 366.4pt 412.2pt 458.0pt 503.8pt 549.6pt 595.4pt 641.2pt 687.0pt 732.8pt;">
<span style="color: black; font-family: "courier new"; font-size: 9.0pt;"><span style="mso-spacerun: yes;"> </span>it took
1329552500 nanoseconds<o:p></o:p></span></div>
<div class="MsoNormal" style="background: #F8F9FA; border: none; line-height: 15.6pt; margin-bottom: .0001pt; margin-bottom: 0cm; mso-border-alt: solid #EAECF0 .5pt; mso-padding-alt: 12.0pt 12.0pt 12.0pt 12.0pt; padding: 0cm; tab-stops: 45.8pt 91.6pt 137.4pt 183.2pt 229.0pt 274.8pt 320.6pt 366.4pt 412.2pt 458.0pt 503.8pt 549.6pt 595.4pt 641.2pt 687.0pt 732.8pt;">
<span style="color: black; font-family: "courier new"; font-size: 9.0pt;"><span style="mso-spacerun: yes;"> </span>End of thread
2, last value of myVolatileValue2 is 1<o:p></o:p></span></div>
<div class="MsoNormal" style="background: #F8F9FA; border: none; line-height: 15.6pt; margin-bottom: .0001pt; margin-bottom: 0cm; mso-border-alt: solid #EAECF0 .5pt; mso-padding-alt: 12.0pt 12.0pt 12.0pt 12.0pt; padding: 0cm; tab-stops: 45.8pt 91.6pt 137.4pt 183.2pt 229.0pt 274.8pt 320.6pt 366.4pt 412.2pt 458.0pt 503.8pt 549.6pt 595.4pt 641.2pt 687.0pt 732.8pt;">
<span style="color: black; font-family: "courier new"; font-size: 9.0pt;"><span style="mso-spacerun: yes;"> </span>it took
1374891105 nanoseconds<o:p></o:p></span></div>
<div class="MsoNormal" style="background: #F8F9FA; border: none; line-height: 15.6pt; margin-bottom: .0001pt; margin-bottom: 0cm; mso-border-alt: solid #EAECF0 .5pt; mso-padding-alt: 12.0pt 12.0pt 12.0pt 12.0pt; padding: 0cm; tab-stops: 45.8pt 91.6pt 137.4pt 183.2pt 229.0pt 274.8pt 320.6pt 366.4pt 412.2pt 458.0pt 503.8pt 549.6pt 595.4pt 641.2pt 687.0pt 732.8pt;">
<span style="color: black; font-family: "courier new"; font-size: 9.0pt;"><span style="mso-spacerun: yes;"> </span>Third Attempt:<o:p></o:p></span></div>
<div class="MsoNormal" style="background: #F8F9FA; border: none; line-height: 15.6pt; margin-bottom: .0001pt; margin-bottom: 0cm; mso-border-alt: solid #EAECF0 .5pt; mso-padding-alt: 12.0pt 12.0pt 12.0pt 12.0pt; padding: 0cm; tab-stops: 45.8pt 91.6pt 137.4pt 183.2pt 229.0pt 274.8pt 320.6pt 366.4pt 412.2pt 458.0pt 503.8pt 549.6pt 595.4pt 641.2pt 687.0pt 732.8pt;">
<span style="color: black; font-family: "courier new"; font-size: 9.0pt;"><span style="mso-spacerun: yes;"> </span>End of thread
2, last value of myVolatileValue2 is 1<o:p></o:p></span></div>
<div class="MsoNormal" style="background: #F8F9FA; border: none; line-height: 15.6pt; margin-bottom: .0001pt; margin-bottom: 0cm; mso-border-alt: solid #EAECF0 .5pt; mso-padding-alt: 12.0pt 12.0pt 12.0pt 12.0pt; padding: 0cm; tab-stops: 45.8pt 91.6pt 137.4pt 183.2pt 229.0pt 274.8pt 320.6pt 366.4pt 412.2pt 458.0pt 503.8pt 549.6pt 595.4pt 641.2pt 687.0pt 732.8pt;">
<span style="color: black; font-family: "courier new"; font-size: 9.0pt;"><span style="mso-spacerun: yes;"> </span>it took
1093849103 nanoseconds<o:p></o:p></span></div>
<div class="MsoNormal" style="background: #F8F9FA; border: none; line-height: 15.6pt; margin-bottom: .0001pt; margin-bottom: 0cm; mso-border-alt: solid #EAECF0 .5pt; mso-padding-alt: 12.0pt 12.0pt 12.0pt 12.0pt; padding: 0cm; tab-stops: 45.8pt 91.6pt 137.4pt 183.2pt 229.0pt 274.8pt 320.6pt 366.4pt 412.2pt 458.0pt 503.8pt 549.6pt 595.4pt 641.2pt 687.0pt 732.8pt;">
<span style="color: black; font-family: "courier new"; font-size: 9.0pt;"><span style="mso-spacerun: yes;"> </span>End of thread
1, last value of myVolatileValue1 is 1<o:p></o:p></span></div>
<div class="MsoNormal" style="background: #F8F9FA; border: none; line-height: 15.6pt; margin-bottom: .0001pt; margin-bottom: 0cm; mso-border-alt: solid #EAECF0 .5pt; mso-padding-alt: 12.0pt 12.0pt 12.0pt 12.0pt; padding: 0cm; tab-stops: 45.8pt 91.6pt 137.4pt 183.2pt 229.0pt 274.8pt 320.6pt 366.4pt 412.2pt 458.0pt 503.8pt 549.6pt 595.4pt 641.2pt 687.0pt 732.8pt;">
<span style="color: black; font-family: "courier new"; font-size: 9.0pt;"><span style="mso-spacerun: yes;"> </span>it took
1489967853 nanoseconds<o:p></o:p></span></div>
<div class="MsoNormal" style="background: #F8F9FA; border: none; line-height: 15.6pt; margin-bottom: .0001pt; margin-bottom: 0cm; mso-border-alt: solid #EAECF0 .5pt; mso-padding-alt: 12.0pt 12.0pt 12.0pt 12.0pt; padding: 0cm; tab-stops: 45.8pt 91.6pt 137.4pt 183.2pt 229.0pt 274.8pt 320.6pt 366.4pt 412.2pt 458.0pt 503.8pt 549.6pt 595.4pt 641.2pt 687.0pt 732.8pt;">
<span style="color: black; font-family: "courier new"; font-size: 9.0pt;"><span style="mso-spacerun: yes;"> </span>Avg. running
time: 1.39 sec<o:p></o:p></span></div>
<div class="MsoNormal" style="background: #F8F9FA; border: none; line-height: 15.6pt; margin-bottom: .0001pt; margin-bottom: 0cm; mso-border-alt: solid #EAECF0 .5pt; mso-padding-alt: 12.0pt 12.0pt 12.0pt 12.0pt; padding: 0cm; tab-stops: 45.8pt 91.6pt 137.4pt 183.2pt 229.0pt 274.8pt 320.6pt 366.4pt 412.2pt 458.0pt 503.8pt 549.6pt 595.4pt 641.2pt 687.0pt 732.8pt;">
<span style="color: black; font-family: "courier new"; font-size: 9.0pt;"><span style="mso-spacerun: yes;"> </span>--------------------------------------------------------<o:p></o:p></span></div>
<div class="MsoNormal" style="background: #F8F9FA; border: none; line-height: 15.6pt; margin-bottom: .0001pt; margin-bottom: 0cm; mso-border-alt: solid #EAECF0 .5pt; mso-padding-alt: 12.0pt 12.0pt 12.0pt 12.0pt; padding: 0cm; tab-stops: 45.8pt 91.6pt 137.4pt 183.2pt 229.0pt 274.8pt 320.6pt 366.4pt 412.2pt 458.0pt 503.8pt 549.6pt 595.4pt 641.2pt 687.0pt 732.8pt;">
<span style="color: black; font-family: "courier new"; font-size: 9.0pt;"><span style="mso-spacerun: yes;"> </span>2 non-shared
non-volatile without padding, suppose to be<o:p></o:p></span></div>
<div class="MsoNormal" style="background: #F8F9FA; border: none; line-height: 15.6pt; margin-bottom: .0001pt; margin-bottom: 0cm; mso-border-alt: solid #EAECF0 .5pt; mso-padding-alt: 12.0pt 12.0pt 12.0pt 12.0pt; padding: 0cm; tab-stops: 45.8pt 91.6pt 137.4pt 183.2pt 229.0pt 274.8pt 320.6pt 366.4pt 412.2pt 458.0pt 503.8pt 549.6pt 595.4pt 641.2pt 687.0pt 732.8pt;">
<span style="color: black; font-family: "courier new"; font-size: 9.0pt;"><span style="mso-spacerun: yes;"> </span>on the same
cache line<o:p></o:p></span></div>
<div class="MsoNormal" style="background: #F8F9FA; border: none; line-height: 15.6pt; margin-bottom: .0001pt; margin-bottom: 0cm; mso-border-alt: solid #EAECF0 .5pt; mso-padding-alt: 12.0pt 12.0pt 12.0pt 12.0pt; padding: 0cm; tab-stops: 45.8pt 91.6pt 137.4pt 183.2pt 229.0pt 274.8pt 320.6pt 366.4pt 412.2pt 458.0pt 503.8pt 549.6pt 595.4pt 641.2pt 687.0pt 732.8pt;">
<span style="color: black; font-family: "courier new"; font-size: 9.0pt;"><span style="mso-spacerun: yes;"> </span>First Attempt:<o:p></o:p></span></div>
<div class="MsoNormal" style="background: #F8F9FA; border: none; line-height: 15.6pt; margin-bottom: .0001pt; margin-bottom: 0cm; mso-border-alt: solid #EAECF0 .5pt; mso-padding-alt: 12.0pt 12.0pt 12.0pt 12.0pt; padding: 0cm; tab-stops: 45.8pt 91.6pt 137.4pt 183.2pt 229.0pt 274.8pt 320.6pt 366.4pt 412.2pt 458.0pt 503.8pt 549.6pt 595.4pt 641.2pt 687.0pt 732.8pt;">
<span style="color: black; font-family: "courier new"; font-size: 9.0pt;"><span style="mso-spacerun: yes;"> </span>End of thread
2, last value of myVolatileValue2 is 1<o:p></o:p></span></div>
<div class="MsoNormal" style="background: #F8F9FA; border: none; line-height: 15.6pt; margin-bottom: .0001pt; margin-bottom: 0cm; mso-border-alt: solid #EAECF0 .5pt; mso-padding-alt: 12.0pt 12.0pt 12.0pt 12.0pt; padding: 0cm; tab-stops: 45.8pt 91.6pt 137.4pt 183.2pt 229.0pt 274.8pt 320.6pt 366.4pt 412.2pt 458.0pt 503.8pt 549.6pt 595.4pt 641.2pt 687.0pt 732.8pt;">
<span style="color: black; font-family: "courier new"; font-size: 9.0pt;"><span style="mso-spacerun: yes;"> </span>it took
112383522 nanoseconds<o:p></o:p></span></div>
<div class="MsoNormal" style="background: #F8F9FA; border: none; line-height: 15.6pt; margin-bottom: .0001pt; margin-bottom: 0cm; mso-border-alt: solid #EAECF0 .5pt; mso-padding-alt: 12.0pt 12.0pt 12.0pt 12.0pt; padding: 0cm; tab-stops: 45.8pt 91.6pt 137.4pt 183.2pt 229.0pt 274.8pt 320.6pt 366.4pt 412.2pt 458.0pt 503.8pt 549.6pt 595.4pt 641.2pt 687.0pt 732.8pt;">
<span style="color: black; font-family: "courier new"; font-size: 9.0pt;"><span style="mso-spacerun: yes;"> </span>End of thread
1, last value of myVolatileValue1 is 1<o:p></o:p></span></div>
<div class="MsoNormal" style="background: #F8F9FA; border: none; line-height: 15.6pt; margin-bottom: .0001pt; margin-bottom: 0cm; mso-border-alt: solid #EAECF0 .5pt; mso-padding-alt: 12.0pt 12.0pt 12.0pt 12.0pt; padding: 0cm; tab-stops: 45.8pt 91.6pt 137.4pt 183.2pt 229.0pt 274.8pt 320.6pt 366.4pt 412.2pt 458.0pt 503.8pt 549.6pt 595.4pt 641.2pt 687.0pt 732.8pt;">
<span style="color: black; font-family: "courier new"; font-size: 9.0pt;"><span style="mso-spacerun: yes;"> </span>it took
114422239 nanoseconds<o:p></o:p></span></div>
<div class="MsoNormal" style="background: #F8F9FA; border: none; line-height: 15.6pt; margin-bottom: .0001pt; margin-bottom: 0cm; mso-border-alt: solid #EAECF0 .5pt; mso-padding-alt: 12.0pt 12.0pt 12.0pt 12.0pt; padding: 0cm; tab-stops: 45.8pt 91.6pt 137.4pt 183.2pt 229.0pt 274.8pt 320.6pt 366.4pt 412.2pt 458.0pt 503.8pt 549.6pt 595.4pt 641.2pt 687.0pt 732.8pt;">
<span style="color: black; font-family: "courier new"; font-size: 9.0pt;"><span style="mso-spacerun: yes;"> </span>Second Attempt:<o:p></o:p></span></div>
<div class="MsoNormal" style="background: #F8F9FA; border: none; line-height: 15.6pt; margin-bottom: .0001pt; margin-bottom: 0cm; mso-border-alt: solid #EAECF0 .5pt; mso-padding-alt: 12.0pt 12.0pt 12.0pt 12.0pt; padding: 0cm; tab-stops: 45.8pt 91.6pt 137.4pt 183.2pt 229.0pt 274.8pt 320.6pt 366.4pt 412.2pt 458.0pt 503.8pt 549.6pt 595.4pt 641.2pt 687.0pt 732.8pt;">
<span style="color: black; font-family: "courier new"; font-size: 9.0pt;"><span style="mso-spacerun: yes;"> </span>End of thread
1, last value of myVolatileValue1 is 1<o:p></o:p></span></div>
<div class="MsoNormal" style="background: #F8F9FA; border: none; line-height: 15.6pt; margin-bottom: .0001pt; margin-bottom: 0cm; mso-border-alt: solid #EAECF0 .5pt; mso-padding-alt: 12.0pt 12.0pt 12.0pt 12.0pt; padding: 0cm; tab-stops: 45.8pt 91.6pt 137.4pt 183.2pt 229.0pt 274.8pt 320.6pt 366.4pt 412.2pt 458.0pt 503.8pt 549.6pt 595.4pt 641.2pt 687.0pt 732.8pt;">
<span style="color: black; font-family: "courier new"; font-size: 9.0pt;"><span style="mso-spacerun: yes;"> </span>it took
115202830 nanoseconds<o:p></o:p></span></div>
<div class="MsoNormal" style="background: #F8F9FA; border: none; line-height: 15.6pt; margin-bottom: .0001pt; margin-bottom: 0cm; mso-border-alt: solid #EAECF0 .5pt; mso-padding-alt: 12.0pt 12.0pt 12.0pt 12.0pt; padding: 0cm; tab-stops: 45.8pt 91.6pt 137.4pt 183.2pt 229.0pt 274.8pt 320.6pt 366.4pt 412.2pt 458.0pt 503.8pt 549.6pt 595.4pt 641.2pt 687.0pt 732.8pt;">
<span style="color: black; font-family: "courier new"; font-size: 9.0pt;"><span style="mso-spacerun: yes;"> </span>End of thread
2, last value of myVolatileValue2 is 1<o:p></o:p></span></div>
<div class="MsoNormal" style="background: #F8F9FA; border: none; line-height: 15.6pt; margin-bottom: .0001pt; margin-bottom: 0cm; mso-border-alt: solid #EAECF0 .5pt; mso-padding-alt: 12.0pt 12.0pt 12.0pt 12.0pt; padding: 0cm; tab-stops: 45.8pt 91.6pt 137.4pt 183.2pt 229.0pt 274.8pt 320.6pt 366.4pt 412.2pt 458.0pt 503.8pt 549.6pt 595.4pt 641.2pt 687.0pt 732.8pt;">
<span style="color: black; font-family: "courier new"; font-size: 9.0pt;"><span style="mso-spacerun: yes;"> </span>it took
115687606 nanoseconds<o:p></o:p></span></div>
<div class="MsoNormal" style="background: #F8F9FA; border: none; line-height: 15.6pt; margin-bottom: .0001pt; margin-bottom: 0cm; mso-border-alt: solid #EAECF0 .5pt; mso-padding-alt: 12.0pt 12.0pt 12.0pt 12.0pt; padding: 0cm; tab-stops: 45.8pt 91.6pt 137.4pt 183.2pt 229.0pt 274.8pt 320.6pt 366.4pt 412.2pt 458.0pt 503.8pt 549.6pt 595.4pt 641.2pt 687.0pt 732.8pt;">
<span style="color: black; font-family: "courier new"; font-size: 9.0pt;"><span style="mso-spacerun: yes;"> </span>Third Attempt:<o:p></o:p></span></div>
<div class="MsoNormal" style="background: #F8F9FA; border: none; line-height: 15.6pt; margin-bottom: .0001pt; margin-bottom: 0cm; mso-border-alt: solid #EAECF0 .5pt; mso-padding-alt: 12.0pt 12.0pt 12.0pt 12.0pt; padding: 0cm; tab-stops: 45.8pt 91.6pt 137.4pt 183.2pt 229.0pt 274.8pt 320.6pt 366.4pt 412.2pt 458.0pt 503.8pt 549.6pt 595.4pt 641.2pt 687.0pt 732.8pt;">
<span style="color: black; font-family: "courier new"; font-size: 9.0pt;"><span style="mso-spacerun: yes;"> </span>End of thread
2, last value of myVolatileValue2 is 1<o:p></o:p></span></div>
<div class="MsoNormal" style="background: #F8F9FA; border: none; line-height: 15.6pt; margin-bottom: .0001pt; margin-bottom: 0cm; mso-border-alt: solid #EAECF0 .5pt; mso-padding-alt: 12.0pt 12.0pt 12.0pt 12.0pt; padding: 0cm; tab-stops: 45.8pt 91.6pt 137.4pt 183.2pt 229.0pt 274.8pt 320.6pt 366.4pt 412.2pt 458.0pt 503.8pt 549.6pt 595.4pt 641.2pt 687.0pt 732.8pt;">
<span style="color: black; font-family: "courier new"; font-size: 9.0pt;"><span style="mso-spacerun: yes;"> </span>it took
105320160 nanoseconds<o:p></o:p></span></div>
<div class="MsoNormal" style="background: #F8F9FA; border: none; line-height: 15.6pt; margin-bottom: .0001pt; margin-bottom: 0cm; mso-border-alt: solid #EAECF0 .5pt; mso-padding-alt: 12.0pt 12.0pt 12.0pt 12.0pt; padding: 0cm; tab-stops: 45.8pt 91.6pt 137.4pt 183.2pt 229.0pt 274.8pt 320.6pt 366.4pt 412.2pt 458.0pt 503.8pt 549.6pt 595.4pt 641.2pt 687.0pt 732.8pt;">
<span style="color: black; font-family: "courier new"; font-size: 9.0pt;"><span style="mso-spacerun: yes;"> </span>End of thread
1, last value of myVolatileValue1 is 1<o:p></o:p></span></div>
<div class="MsoNormal" style="background: #F8F9FA; border: none; line-height: 15.6pt; margin-bottom: .0001pt; margin-bottom: 0cm; mso-border-alt: solid #EAECF0 .5pt; mso-padding-alt: 12.0pt 12.0pt 12.0pt 12.0pt; padding: 0cm; tab-stops: 45.8pt 91.6pt 137.4pt 183.2pt 229.0pt 274.8pt 320.6pt 366.4pt 412.2pt 458.0pt 503.8pt 549.6pt 595.4pt 641.2pt 687.0pt 732.8pt;">
<span style="color: black; font-family: "courier new"; font-size: 9.0pt;"><span style="mso-spacerun: yes;"> </span>it took
106646504 nanoseconds<o:p></o:p></span></div>
<div class="MsoNormal" style="background: #F8F9FA; border: none; line-height: 15.6pt; margin-bottom: .0001pt; margin-bottom: 0cm; mso-border-alt: solid #EAECF0 .5pt; mso-padding-alt: 12.0pt 12.0pt 12.0pt 12.0pt; padding: 0cm; tab-stops: 45.8pt 91.6pt 137.4pt 183.2pt 229.0pt 274.8pt 320.6pt 366.4pt 412.2pt 458.0pt 503.8pt 549.6pt 595.4pt 641.2pt 687.0pt 732.8pt;">
<span style="color: black; font-family: "courier new"; font-size: 9.0pt;"><span style="mso-spacerun: yes;"> </span>Avg. running
time: 1.11 sec<o:p></o:p></span></div>
<div class="MsoNormal" style="background: #F8F9FA; border: none; line-height: 15.6pt; margin-bottom: .0001pt; margin-bottom: 0cm; mso-border-alt: solid #EAECF0 .5pt; mso-padding-alt: 12.0pt 12.0pt 12.0pt 12.0pt; padding: 0cm; tab-stops: 45.8pt 91.6pt 137.4pt 183.2pt 229.0pt 274.8pt 320.6pt 366.4pt 412.2pt 458.0pt 503.8pt 549.6pt 595.4pt 641.2pt 687.0pt 732.8pt;">
<span style="color: black; font-family: "courier new"; font-size: 9.0pt;"><span style="mso-spacerun: yes;"> </span>------------------------------------------------------<o:p></o:p></span></div>
<div class="MsoNormal" style="background: #F8F9FA; border: none; line-height: 15.6pt; margin-bottom: .0001pt; margin-bottom: 0cm; mso-border-alt: solid #EAECF0 .5pt; mso-padding-alt: 12.0pt 12.0pt 12.0pt 12.0pt; padding: 0cm; tab-stops: 45.8pt 91.6pt 137.4pt 183.2pt 229.0pt 274.8pt 320.6pt 366.4pt 412.2pt 458.0pt 503.8pt 549.6pt 595.4pt 641.2pt 687.0pt 732.8pt;">
<span style="color: black; font-family: "courier new"; font-size: 9.0pt;"><span style="mso-spacerun: yes;"> </span>2 non-shared
non-volatile with padding, suppose to be<o:p></o:p></span></div>
<div class="MsoNormal" style="background: #F8F9FA; border: none; line-height: 15.6pt; margin-bottom: .0001pt; margin-bottom: 0cm; mso-border-alt: solid #EAECF0 .5pt; mso-padding-alt: 12.0pt 12.0pt 12.0pt 12.0pt; padding: 0cm; tab-stops: 45.8pt 91.6pt 137.4pt 183.2pt 229.0pt 274.8pt 320.6pt 366.4pt 412.2pt 458.0pt 503.8pt 549.6pt 595.4pt 641.2pt 687.0pt 732.8pt;">
<span style="color: black; font-family: "courier new"; font-size: 9.0pt;"><span style="mso-spacerun: yes;"> </span>on different
cache line<o:p></o:p></span></div>
<div class="MsoNormal" style="background: #F8F9FA; border: none; line-height: 15.6pt; margin-bottom: .0001pt; margin-bottom: 0cm; mso-border-alt: solid #EAECF0 .5pt; mso-padding-alt: 12.0pt 12.0pt 12.0pt 12.0pt; padding: 0cm; tab-stops: 45.8pt 91.6pt 137.4pt 183.2pt 229.0pt 274.8pt 320.6pt 366.4pt 412.2pt 458.0pt 503.8pt 549.6pt 595.4pt 641.2pt 687.0pt 732.8pt;">
<span style="color: black; font-family: "courier new"; font-size: 9.0pt;"><span style="mso-spacerun: yes;"> </span>First Attempt:<o:p></o:p></span></div>
<div class="MsoNormal" style="background: #F8F9FA; border: none; line-height: 15.6pt; margin-bottom: .0001pt; margin-bottom: 0cm; mso-border-alt: solid #EAECF0 .5pt; mso-padding-alt: 12.0pt 12.0pt 12.0pt 12.0pt; padding: 0cm; tab-stops: 45.8pt 91.6pt 137.4pt 183.2pt 229.0pt 274.8pt 320.6pt 366.4pt 412.2pt 458.0pt 503.8pt 549.6pt 595.4pt 641.2pt 687.0pt 732.8pt;">
<span style="color: black; font-family: "courier new"; font-size: 9.0pt;"><span style="mso-spacerun: yes;"> </span>End of thread
1, last value of myVolatileValue1 is 1<o:p></o:p></span></div>
<div class="MsoNormal" style="background: #F8F9FA; border: none; line-height: 15.6pt; margin-bottom: .0001pt; margin-bottom: 0cm; mso-border-alt: solid #EAECF0 .5pt; mso-padding-alt: 12.0pt 12.0pt 12.0pt 12.0pt; padding: 0cm; tab-stops: 45.8pt 91.6pt 137.4pt 183.2pt 229.0pt 274.8pt 320.6pt 366.4pt 412.2pt 458.0pt 503.8pt 549.6pt 595.4pt 641.2pt 687.0pt 732.8pt;">
<span style="color: black; font-family: "courier new"; font-size: 9.0pt;"><span style="mso-spacerun: yes;"> </span>it took
113062087 nanoseconds<o:p></o:p></span></div>
<div class="MsoNormal" style="background: #F8F9FA; border: none; line-height: 15.6pt; margin-bottom: .0001pt; margin-bottom: 0cm; mso-border-alt: solid #EAECF0 .5pt; mso-padding-alt: 12.0pt 12.0pt 12.0pt 12.0pt; padding: 0cm; tab-stops: 45.8pt 91.6pt 137.4pt 183.2pt 229.0pt 274.8pt 320.6pt 366.4pt 412.2pt 458.0pt 503.8pt 549.6pt 595.4pt 641.2pt 687.0pt 732.8pt;">
<span style="color: black; font-family: "courier new"; font-size: 9.0pt;"><span style="mso-spacerun: yes;"> </span>End of thread
2, last value of myVolatileValue2 is 1<o:p></o:p></span></div>
<div class="MsoNormal" style="background: #F8F9FA; border: none; line-height: 15.6pt; margin-bottom: .0001pt; margin-bottom: 0cm; mso-border-alt: solid #EAECF0 .5pt; mso-padding-alt: 12.0pt 12.0pt 12.0pt 12.0pt; padding: 0cm; tab-stops: 45.8pt 91.6pt 137.4pt 183.2pt 229.0pt 274.8pt 320.6pt 366.4pt 412.2pt 458.0pt 503.8pt 549.6pt 595.4pt 641.2pt 687.0pt 732.8pt;">
<span style="color: black; font-family: "courier new"; font-size: 9.0pt;"><span style="mso-spacerun: yes;"> </span>it took
113854150 nanoseconds<o:p></o:p></span></div>
<div class="MsoNormal" style="background: #F8F9FA; border: none; line-height: 15.6pt; margin-bottom: .0001pt; margin-bottom: 0cm; mso-border-alt: solid #EAECF0 .5pt; mso-padding-alt: 12.0pt 12.0pt 12.0pt 12.0pt; padding: 0cm; tab-stops: 45.8pt 91.6pt 137.4pt 183.2pt 229.0pt 274.8pt 320.6pt 366.4pt 412.2pt 458.0pt 503.8pt 549.6pt 595.4pt 641.2pt 687.0pt 732.8pt;">
<span style="color: black; font-family: "courier new"; font-size: 9.0pt;"><span style="mso-spacerun: yes;"> </span>Second Attempt:<o:p></o:p></span></div>
<div class="MsoNormal" style="background: #F8F9FA; border: none; line-height: 15.6pt; margin-bottom: .0001pt; margin-bottom: 0cm; mso-border-alt: solid #EAECF0 .5pt; mso-padding-alt: 12.0pt 12.0pt 12.0pt 12.0pt; padding: 0cm; tab-stops: 45.8pt 91.6pt 137.4pt 183.2pt 229.0pt 274.8pt 320.6pt 366.4pt 412.2pt 458.0pt 503.8pt 549.6pt 595.4pt 641.2pt 687.0pt 732.8pt;">
<span style="color: black; font-family: "courier new"; font-size: 9.0pt;"><span style="mso-spacerun: yes;"> </span>End of thread
2, last value of myVolatileValue2 is 1<o:p></o:p></span></div>
<div class="MsoNormal" style="background: #F8F9FA; border: none; line-height: 15.6pt; margin-bottom: .0001pt; margin-bottom: 0cm; mso-border-alt: solid #EAECF0 .5pt; mso-padding-alt: 12.0pt 12.0pt 12.0pt 12.0pt; padding: 0cm; tab-stops: 45.8pt 91.6pt 137.4pt 183.2pt 229.0pt 274.8pt 320.6pt 366.4pt 412.2pt 458.0pt 503.8pt 549.6pt 595.4pt 641.2pt 687.0pt 732.8pt;">
<span style="color: black; font-family: "courier new"; font-size: 9.0pt;"><span style="mso-spacerun: yes;"> </span>it took
126021245 nanoseconds<o:p></o:p></span></div>
<div class="MsoNormal" style="background: #F8F9FA; border: none; line-height: 15.6pt; margin-bottom: .0001pt; margin-bottom: 0cm; mso-border-alt: solid #EAECF0 .5pt; mso-padding-alt: 12.0pt 12.0pt 12.0pt 12.0pt; padding: 0cm; tab-stops: 45.8pt 91.6pt 137.4pt 183.2pt 229.0pt 274.8pt 320.6pt 366.4pt 412.2pt 458.0pt 503.8pt 549.6pt 595.4pt 641.2pt 687.0pt 732.8pt;">
<span style="color: black; font-family: "courier new"; font-size: 9.0pt;"><span style="mso-spacerun: yes;"> </span>End of thread
1, last value of myVolatileValue1 is 1<o:p></o:p></span></div>
<div class="MsoNormal" style="background: #F8F9FA; border: none; line-height: 15.6pt; margin-bottom: .0001pt; margin-bottom: 0cm; mso-border-alt: solid #EAECF0 .5pt; mso-padding-alt: 12.0pt 12.0pt 12.0pt 12.0pt; padding: 0cm; tab-stops: 45.8pt 91.6pt 137.4pt 183.2pt 229.0pt 274.8pt 320.6pt 366.4pt 412.2pt 458.0pt 503.8pt 549.6pt 595.4pt 641.2pt 687.0pt 732.8pt;">
<span style="color: black; font-family: "courier new"; font-size: 9.0pt;"><span style="mso-spacerun: yes;"> </span>it took
126020036 nanoseconds<o:p></o:p></span></div>
<div class="MsoNormal" style="background: #F8F9FA; border: none; line-height: 15.6pt; margin-bottom: .0001pt; margin-bottom: 0cm; mso-border-alt: solid #EAECF0 .5pt; mso-padding-alt: 12.0pt 12.0pt 12.0pt 12.0pt; padding: 0cm; tab-stops: 45.8pt 91.6pt 137.4pt 183.2pt 229.0pt 274.8pt 320.6pt 366.4pt 412.2pt 458.0pt 503.8pt 549.6pt 595.4pt 641.2pt 687.0pt 732.8pt;">
<span style="color: black; font-family: "courier new"; font-size: 9.0pt;"><span style="mso-spacerun: yes;"> </span>Third Attempt:<o:p></o:p></span></div>
<div class="MsoNormal" style="background: #F8F9FA; border: none; line-height: 15.6pt; margin-bottom: .0001pt; margin-bottom: 0cm; mso-border-alt: solid #EAECF0 .5pt; mso-padding-alt: 12.0pt 12.0pt 12.0pt 12.0pt; padding: 0cm; tab-stops: 45.8pt 91.6pt 137.4pt 183.2pt 229.0pt 274.8pt 320.6pt 366.4pt 412.2pt 458.0pt 503.8pt 549.6pt 595.4pt 641.2pt 687.0pt 732.8pt;">
<span style="color: black; font-family: "courier new"; font-size: 9.0pt;"><span style="mso-spacerun: yes;"> </span>End of thread
2, last value of myVolatileValue2 is 1<o:p></o:p></span></div>
<div class="MsoNormal" style="background: #F8F9FA; border: none; line-height: 15.6pt; margin-bottom: .0001pt; margin-bottom: 0cm; mso-border-alt: solid #EAECF0 .5pt; mso-padding-alt: 12.0pt 12.0pt 12.0pt 12.0pt; padding: 0cm; tab-stops: 45.8pt 91.6pt 137.4pt 183.2pt 229.0pt 274.8pt 320.6pt 366.4pt 412.2pt 458.0pt 503.8pt 549.6pt 595.4pt 641.2pt 687.0pt 732.8pt;">
<span style="color: black; font-family: "courier new"; font-size: 9.0pt;"><span style="mso-spacerun: yes;"> </span>it took
109028728 nanoseconds<o:p></o:p></span></div>
<div class="MsoNormal" style="background: #F8F9FA; border: none; line-height: 15.6pt; margin-bottom: .0001pt; margin-bottom: 0cm; mso-border-alt: solid #EAECF0 .5pt; mso-padding-alt: 12.0pt 12.0pt 12.0pt 12.0pt; padding: 0cm; tab-stops: 45.8pt 91.6pt 137.4pt 183.2pt 229.0pt 274.8pt 320.6pt 366.4pt 412.2pt 458.0pt 503.8pt 549.6pt 595.4pt 641.2pt 687.0pt 732.8pt;">
<span style="color: black; font-family: "courier new"; font-size: 9.0pt;"><span style="mso-spacerun: yes;"> </span>End of thread
1, last value of myVolatileValue1 is 1<o:p></o:p></span></div>
<div class="MsoNormal" style="background: #F8F9FA; border: none; line-height: 15.6pt; margin-bottom: .0001pt; margin-bottom: 0cm; mso-border-alt: solid #EAECF0 .5pt; mso-padding-alt: 12.0pt 12.0pt 12.0pt 12.0pt; padding: 0cm; tab-stops: 45.8pt 91.6pt 137.4pt 183.2pt 229.0pt 274.8pt 320.6pt 366.4pt 412.2pt 458.0pt 503.8pt 549.6pt 595.4pt 641.2pt 687.0pt 732.8pt;">
<span style="color: black; font-family: "courier new"; font-size: 9.0pt;"><span style="mso-spacerun: yes;"> </span>it took
109101776 nanoseconds<o:p></o:p></span></div>
<div class="MsoNormal" style="background: #F8F9FA; border: none; line-height: 15.6pt; margin-bottom: .0001pt; margin-bottom: 0cm; mso-border-alt: solid #EAECF0 .5pt; mso-padding-alt: 12.0pt 12.0pt 12.0pt 12.0pt; padding: 0cm; tab-stops: 45.8pt 91.6pt 137.4pt 183.2pt 229.0pt 274.8pt 320.6pt 366.4pt 412.2pt 458.0pt 503.8pt 549.6pt 595.4pt 641.2pt 687.0pt 732.8pt;">
<span style="color: black; font-family: "courier new"; font-size: 9.0pt;"><span style="mso-spacerun: yes;"> </span>Avg. running
time: 1.16 sec<o:p></o:p></span></div>
<div class="MsoNormal" style="background: #F8F9FA; border: none; line-height: 15.6pt; margin-bottom: .0001pt; margin-bottom: 0cm; mso-border-alt: solid #EAECF0 .5pt; mso-padding-alt: 12.0pt 12.0pt 12.0pt 12.0pt; padding: 0cm; tab-stops: 45.8pt 91.6pt 137.4pt 183.2pt 229.0pt 274.8pt 320.6pt 366.4pt 412.2pt 458.0pt 503.8pt 549.6pt 595.4pt 641.2pt 687.0pt 732.8pt;">
<span style="color: black; font-family: "courier new"; font-size: 9.0pt;"><span style="mso-spacerun: yes;"> </span>*/<o:p></o:p></span></div>
</div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm;">
<br /></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm;">
<span style="color: black; font-family: "times new roman" , "serif"; font-size: 13.5pt;"> </span><b><u><span style="color: black; font-family: "times new roman" , "serif"; font-size: 14.0pt;">Update for Java 9:</span></u></b><span style="color: black; font-family: "times new roman" , "serif"; font-size: 14.0pt;"><o:p></o:p></span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm;">
<b><u><span style="color: black; font-family: "times new roman" , "serif"; font-size: 8.0pt;"><br />
</span></u></b><span style="color: black; font-family: "times new roman" , "serif"; font-size: 12.0pt;">With Java 9 the Contended annotation moved from sun.misc package to jdk.internal.vm.annotation
package. The jdk.internal.** modules are not publicly available for us by
default. So if we try to run our example with java 9 we will get "</span><span style="background: white; color: #222222; font-family: "times new roman" , "serif"; font-size: 12.0pt;">package
jdk.internal.vm.annotation is declared in module java.base, which does not
export it to module java9" </span><span style="color: black; font-family: "times new roman" , "serif"; font-size: 12.0pt;">error on compile time. To overcome this
error we need to add the following command line argument to javac command.<o:p></o:p></span></div>
<div style="background: #F8F9FA; border: solid #EAECF0 1.0pt; mso-border-alt: solid #EAECF0 .5pt; mso-element: para-border-div; padding: 12.0pt 12.0pt 12.0pt 12.0pt;">
<div class="MsoNormal" style="background: #F8F9FA; border: none; line-height: 15.6pt; margin-bottom: .0001pt; margin-bottom: 0cm; mso-border-alt: solid #EAECF0 .5pt; mso-padding-alt: 12.0pt 12.0pt 12.0pt 12.0pt; padding: 0cm; tab-stops: 45.8pt 91.6pt 137.4pt 183.2pt 229.0pt 274.8pt 320.6pt 366.4pt 412.2pt 458.0pt 503.8pt 549.6pt 595.4pt 641.2pt 687.0pt 732.8pt;">
<span style="color: black; font-family: "courier new"; font-size: 9.0pt;">--add-exports
java.base/jdk.internal.vm.annotation=java9<o:p></o:p></span><br />
<span style="color: black; font-family: "courier new"; font-size: 9.0pt;">or for all versions</span><br />
<span style="color: black; font-family: "courier new"; font-size: 9.0pt;">--add-exports java.base/jdk.internal.vm.annotation=ALL-UNNAMED</span></div>
</div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm;">
<span style="color: black; font-family: "times new roman" , "serif"; font-size: 12.0pt;"><br />
Note that here we named my module as java9 by using the module-info.java
in my classpath.<o:p></o:p></span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm;">
<span style="color: black; font-family: "times new roman" , "serif"; font-size: 12.0pt;"><br />
To set the above command in IntelliJ IDEA you can go Settings -> Build,
Execution, Deployment -> Java Compiler and set the command in
"Additional command line parameters" section.<o:p></o:p></span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm;">
<span style="color: black; font-family: "times new roman" , "serif"; font-size: 12.0pt;"><br />
Note that here we used --add-exports instead of --add-opens because we only
want to access to the public Contended class which is not exported by default.
So exporting is enough here since it is public.<o:p></o:p></span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm;">
<span style="color: black; font-family: "times new roman" , "serif"; font-size: 12.0pt;">If we want to use some private fields or methods we would need to use
--add-opens which need to be added on java command not javac command.<o:p></o:p></span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm;">
<br /></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm;">
<span style="color: black; font-family: "" "times new roman" "" , "serif"; font-size: 13.5pt;"> </span><b><u><span style="color: black; font-family: "times new roman" , "serif"; font-size: 14.0pt;">Conclusion:</span></u></b><span style="color: black; font-family: "times new roman" , "serif"; font-size: 14.0pt;"><o:p></o:p></span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm;">
<b><u><span style="color: black; font-family: "times new roman" , "serif"; font-size: 8.0pt;"><br />
</span></u></b><span style="color: black; font-family: "times new roman" , "serif"; font-size: 12.0pt;"> We see that the volatile variable has an important
place in concurrent multithread applications. We should use it carefully to
provide ordering guarantee and visibility. Remember that we cannot use it for
atomicity purposes, for which we need synhronized keyword. We also see the CPU
cache in detail which generally uses cache lines to hold data in L1, L2 or L3
caches to get quick access to data instead of reading it from main memory.<o:p></o:p></span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm;">
<span style="color: black; font-family: "times new roman" , "serif"; font-size: 12.0pt;">Finally we see the false sharing concepts which occur on cache lines
invalidation where we unintentionally hold our variables in the same cache
line. To prevent it we may use manual padding or even better we can try the
@Contended annotation that comes with Java 8 which does the padding for us
directing JVM, JIT and GC respectively. We finally saw how to enable Contended
in java 9.<o:p></o:p></span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm;">
<span style="color: black; font-family: "times new roman" , "serif"; font-size: 12.0pt;"><br />
You can download the source code for the detailed example </span><a href="https://github.com/agelenler/myblog/blob/master/java/src/memory/TestPaddingAndContended.java"><span style="color: blue; font-family: "times new roman" , "serif"; font-size: 12.0pt;">here</span></a><span style="color: black; font-family: "times new roman" , "serif"; font-size: 12.0pt;">.<o:p></o:p></span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm;">
<span style="color: black; font-family: "" "times new roman" "" , "serif"; font-size: 13.5pt;"><br />
</span><b><u><span style="color: black; font-family: "times new roman" , "serif"; font-size: 14.0pt;">References:</span></u></b><span style="color: black; font-family: "times new roman" , "serif"; font-size: 14.0pt;"><o:p></o:p></span></div>
<ul type="disc">
<li class="MsoNormal" style="color: black; line-height: normal; mso-list: l0 level1 lfo1; mso-margin-bottom-alt: auto; mso-margin-top-alt: auto; tab-stops: list 36.0pt;"><b><i><u><span style="color: #333333; font-family: "times new roman" , "serif"; font-size: 10.0pt;">http://openjdk.java.net/jeps/142</span></u></i></b><span style="font-family: "times new roman" , "serif"; font-size: 10.0pt;"><o:p></o:p></span></li>
<li class="MsoNormal" style="color: black; line-height: normal; mso-list: l0 level1 lfo1; mso-margin-bottom-alt: auto; mso-margin-top-alt: auto; tab-stops: list 36.0pt;"><b><i><u><span style="color: #333333; font-family: "times new roman" , "serif"; font-size: 10.0pt;">http://beautynbits.blogspot.com/2012/11/the-end-for-false-sharing-in-java.html</span></u></i></b><span style="font-family: "times new roman" , "serif"; font-size: 10.0pt;"><o:p></o:p></span></li>
<li class="MsoNormal" style="color: black; line-height: normal; mso-list: l0 level1 lfo1; mso-margin-bottom-alt: auto; mso-margin-top-alt: auto; tab-stops: list 36.0pt;"><b><i><u><span style="color: #333333; font-family: "times new roman" , "serif"; font-size: 10.0pt;">http://www.cs.wustl.edu/~schmidt/PDF/DC-Locking.pdf</span></u></i></b><span style="font-family: "times new roman" , "serif"; font-size: 10.0pt;"><o:p></o:p></span></li>
<li class="MsoNormal" style="color: black; line-height: normal; mso-list: l0 level1 lfo1; mso-margin-bottom-alt: auto; mso-margin-top-alt: auto; tab-stops: list 36.0pt;"><b><i><u><span style="color: #333333; font-family: "times new roman" , "serif"; font-size: 10.0pt;">https://en.wikipedia.org/wiki/Double-checked_locking</span></u></i></b><span style="font-family: "times new roman" , "serif"; font-size: 10.0pt;"><o:p></o:p></span></li>
<li class="MsoNormal" style="color: black; line-height: normal; mso-list: l0 level1 lfo1; mso-margin-bottom-alt: auto; mso-margin-top-alt: auto; tab-stops: list 36.0pt;"><b><i><u><span style="color: #333333; font-family: "times new roman" , "serif"; font-size: 10.0pt;">https://docs.oracle.com/cd/E15357_01/coh.360/e15723/cache_intro.htm#COHDG5049</span></u></i></b><span style="font-family: "times new roman" , "serif"; font-size: 10.0pt;"><o:p></o:p></span></li>
<li class="MsoNormal" style="color: black; line-height: normal; mso-list: l0 level1 lfo1; mso-margin-bottom-alt: auto; mso-margin-top-alt: auto; tab-stops: list 36.0pt;"><b><i><u><span style="color: #333333; font-family: "times new roman" , "serif"; font-size: 10.0pt;">http://openjdk.java.net/projects/code-tools/jol/</span></u></i></b><span style="font-family: "times new roman" , "serif"; font-size: 10.0pt;"><o:p></o:p></span></li>
</ul>
<div class="MsoNormal">
<br /></div>
<br /></div>
Ali Gelenlerhttp://www.blogger.com/profile/09439697648573423668noreply@blogger.com0Amsterdam, Hollanda52.3702157 4.895167899999933152.2151142 4.5724443999999327 52.5253172 5.2178913999999335tag:blogger.com,1999:blog-3858181542467916490.post-2175115325437374832015-05-04T10:37:00.002+03:002015-05-04T19:24:41.769+03:00String and String Related Object's Memory Usage in Java <span style="font-family: Times New Roman, serif;"><b><u>Introduction</u></b></span><u style="font-family: 'Times New Roman', serif; font-size: 16px; font-weight: bold;">:</u><br />
<u style="font-family: 'Times New Roman', serif; font-size: 16px; font-weight: bold;"><br /></u>
<span style="font-family: 'Times New Roman', serif; font-size: 16px;"> Strings are everywhere and almost every application heavily use them. For example, for web applications all the data coming from the view are firstly Strings, after taking them into the application they are converted to their real data types. Hence it's crucial to understand the memory consumption of String and related Objects. In this write we'll examine the history of String Object in Java, through Java versions looking into the some String methods like substring, and then we try to figure out StringBuilder Object's memory consumption and finally see how we can canonicalize String objects to reduce memory occupied by String and related Objects.</span><br />
<u style="font-family: 'Times New Roman', serif; font-size: 16px; font-weight: bold;"><br /></u>
<u style="font-family: 'Times New Roman', serif; font-size: 16px; font-weight: bold;">History of the Well Known String Object:</u><br />
<u style="font-family: 'Times New Roman', serif; font-size: 16px; font-weight: bold;"><br /></u>
<span style="font-family: Times New Roman, serif;"> We examine the String class in three part regarding to Java versions as before 1.7.0_06, after 1.7.0_06 before 1.8, and after 1.8.</span><br />
<span style="font-family: Times New Roman, serif;"><br /></span>
<span style="font-family: Times New Roman, serif;"><u><b>Before 1.7.0_06;</b></u></span><br />
<span style="font-family: Times New Roman, serif;"><u><br /></u></span><span style="font-family: Times New Roman, serif;"> String class before 1.7.0_06 has a private char array, and 3 int variables; offset, count and hash respectively. That means a String "A" object will occupy 56 bytes as explained below. For details of memory calculations you can refer to this <a href="http://www.aligelenler.com/2015/01/actual-memory-consumption-of-java.html" target="_blank">post</a>.</span><br />
<span style="font-family: Times New Roman, serif;"><br /></span>
<span style="font-family: Times New Roman, serif;">12 header + 4 ref to char[] + (4*3) for 3 int = 28 rounded to 32 bytes; plus</span><br />
<span style="font-family: Times New Roman, serif;">12 header + 4 len + 1(len of "A") * 2 = 18 rounded to 24 bytes; totally 56 bytes.</span><br />
<span style="font-family: Times New Roman, serif;"><br /></span>
<span style="font-family: Times New Roman, serif;">In this implementation, we had offset and count int variables, and the reason of them is to share the char array inside the String object among the substrings created with the substring method.</span><br />
<span style="font-family: Times New Roman, serif;"><br /></span>
<span style="font-family: Times New Roman, serif;">Let's see it on the following example which run on Java version before 1.7.0_06.</span><br />
<span style="font-family: Times New Roman, serif;"><br /></span>
<span style="font-family: Times New Roman, serif;"><b><u>Example 1:</u></b></span><br />
<span style="font-family: Times New Roman, serif;"><br /></span>
<span style="font-family: Times New Roman, serif;"><span class="Apple-tab-span" style="white-space: pre;"> </span>String s1 = "My String"; </span><br />
<span style="font-family: Times New Roman, serif;"><span class="Apple-tab-span" style="white-space: pre;"> </span>String s2 = s1.substring(3); </span><br />
<span style="font-family: Times New Roman, serif;"><span class="Apple-tab-span" style="white-space: pre;"> </span>System.out.println(s1); // </span><span style="font-family: 'Times New Roman', serif;">My String</span><span style="font-family: Times New Roman, serif;"> </span><br />
<span style="font-family: Times New Roman, serif;"><span class="Apple-tab-span" style="white-space: pre;"> </span>System.out.println(s2); // </span><span style="font-family: 'Times New Roman', serif;">String</span><span style="font-family: Times New Roman, serif;"> </span><br />
<span style="font-family: Times New Roman, serif;"><br /></span>
<span style="font-family: Times New Roman, serif;"><span class="Apple-tab-span" style="white-space: pre;"> </span>Field field = String.class.getDeclaredField("value"); </span><br />
<span style="font-family: Times New Roman, serif;"><span class="Apple-tab-span" style="white-space: pre;"> </span>field.setAccessible(true); </span><br />
<span style="font-family: Times New Roman, serif;"><span class="Apple-tab-span" style="white-space: pre;"> </span>char[] valueInString = (char[])field.get(s1); </span><br />
<span style="font-family: Times New Roman, serif;"><span class="Apple-tab-span" style="white-space: pre;"> </span></span><span style="font-family: 'Times New Roman', serif;">valueInString </span><span style="font-family: Times New Roman, serif;">[3] = 'J'; </span><br />
<span style="font-family: Times New Roman, serif;"><span class="Apple-tab-span" style="white-space: pre;"> </span></span><span style="font-family: 'Times New Roman', serif;">valueInString </span><span style="font-family: Times New Roman, serif;">[4] = 'a'; </span><br />
<span style="font-family: Times New Roman, serif;"><span class="Apple-tab-span" style="white-space: pre;"> </span></span><span style="font-family: 'Times New Roman', serif;">valueInString </span><span style="font-family: Times New Roman, serif;">[5] = 'v'; </span><br />
<span style="font-family: Times New Roman, serif;"><span class="Apple-tab-span" style="white-space: pre;"> </span></span><span style="font-family: 'Times New Roman', serif;">valueInString </span><span style="font-family: Times New Roman, serif;">[6] = 'a';</span><br />
<span style="font-family: 'Times New Roman', serif;"> valueInString </span><span style="font-family: Times New Roman, serif;">[7] = ' '; </span><span style="font-family: 'Times New Roman', serif;"> </span><span style="font-family: Times New Roman, serif;"> </span><br />
<span style="font-family: 'Times New Roman', serif;"> valueInString </span><span style="font-family: Times New Roman, serif;">[8] = ' ';</span><span style="font-family: 'Times New Roman', serif;"> </span><br />
<span style="font-family: Times New Roman, serif;"><br /></span>
<span style="font-family: Times New Roman, serif;"><span class="Apple-tab-span" style="white-space: pre;"> </span>System.out.println(s1); // </span><span style="font-family: 'Times New Roman', serif;">My </span><span style="font-family: Times New Roman, serif;">Java </span><br />
<span style="font-family: Times New Roman, serif;"><span class="Apple-tab-span" style="white-space: pre;"> </span>System.out.println(s2); // </span><span style="font-family: Times New Roman, serif;">Java </span><br />
<span style="font-family: Times New Roman, serif;"><br /></span>
<span style="font-family: Times New Roman, serif;">Here we see that, the String object s2 obtained by the substring method share the underlying char array in the object s1, so that any change to the char array of s1 will directly affect the s2. With this approach we create the substring in constant time by just changing the offset and count values of s2 and referencing to the same char array, however at the same time we possibly get a memory leak if we do not want to use the s1 object anymore, since it will cause the whole object continue to alive not the substring only. To get rid of this memory leak possibility we may use new String(string) constructor around the String obtained with substring.</span><br />
<span style="font-family: Times New Roman, serif;"><br /></span>
<span style="font-family: Times New Roman, serif;">An important change has been made after 1.7.0_06 to the String class, let's examine it now.</span><br />
<span style="font-family: Times New Roman, serif;"><br /></span>
<u style="font-family: 'Times New Roman', serif;"><b>After 1.7.0_06, Before 1.8;</b></u><br />
<u style="font-family: 'Times New Roman', serif;"><b><br /></b></u>
<span style="font-family: 'Times New Roman', serif;"> String class after 1.7.0_06 before 1.8 has a private final char array, and 2 int variables, hash and hash32 respectively. The offset and count variables are removed from the implementation, and the char[] in substrings are not shared anymore. Another change to this version is, the char[] is a final variable indicating it's immutability, although we can change it's value either by reflection or array manipulation.In this version, the String "A" object will occupy 48 bytes as explained below. For details of memory calculations you can refer to this </span><a href="http://www.aligelenler.com/2015/01/actual-memory-consumption-of-java.html" style="font-family: 'Times New Roman', serif;" target="_blank">post</a><span style="font-family: 'Times New Roman', serif;">.</span><br />
<span style="font-family: Times New Roman, serif;"><br /></span>
<span style="font-family: Times New Roman, serif;">12 header + 4 ref to char[] + (4*2) for 2 int = 24 bytes; plus</span><br />
<span style="font-family: Times New Roman, serif;">12 header + 4 len + 1(len of "A") * 2 = 18 rounded to 24 bytes; totally 48 bytes.</span><br />
<span style="font-family: Times New Roman, serif;"><br /></span>
<span style="font-family: Times New Roman, serif;">Let's run the code we saw in Example 1 with this String version.</span><br />
<span style="font-family: Times New Roman, serif;"><br /></span><span style="font-family: Times New Roman, serif;"><b><u>Example 2:</u></b></span><br />
<span style="font-family: Times New Roman, serif;"><br /></span><span style="font-family: Times New Roman, serif;"><span class="Apple-tab-span" style="white-space: pre;"> </span>String s1 = "My String"; </span><br />
<span style="font-family: Times New Roman, serif;"><span class="Apple-tab-span" style="white-space: pre;"> </span>String s2 = s1.substring(3); </span><br />
<span style="font-family: Times New Roman, serif;"><span class="Apple-tab-span" style="white-space: pre;"> </span>System.out.println(s1); // </span><span style="font-family: 'Times New Roman', serif;">My String</span><span style="font-family: Times New Roman, serif;"> </span><br />
<span style="font-family: Times New Roman, serif;"><span class="Apple-tab-span" style="white-space: pre;"> </span>System.out.println(s2); // </span><span style="font-family: 'Times New Roman', serif;">String</span><span style="font-family: Times New Roman, serif;"> </span><br />
<span style="font-family: Times New Roman, serif;"><br /></span><span style="font-family: Times New Roman, serif;"><span class="Apple-tab-span" style="white-space: pre;"> </span>Field field = String.class.getDeclaredField("value"); </span><br />
<span style="font-family: Times New Roman, serif;"><span class="Apple-tab-span" style="white-space: pre;"> </span>field.setAccessible(true); </span><br />
<span style="font-family: Times New Roman, serif;"><span class="Apple-tab-span" style="white-space: pre;"> </span>char[] valueInString = (char[])field.get(s1); </span><br />
<span style="font-family: Times New Roman, serif;"><span class="Apple-tab-span" style="white-space: pre;"> </span></span><span style="font-family: 'Times New Roman', serif;">valueInString </span><span style="font-family: Times New Roman, serif;">[3] = 'J'; </span><br />
<span style="font-family: Times New Roman, serif;"><span class="Apple-tab-span" style="white-space: pre;"> </span></span><span style="font-family: 'Times New Roman', serif;">valueInString </span><span style="font-family: Times New Roman, serif;">[4] = 'a'; </span><br />
<span style="font-family: Times New Roman, serif;"><span class="Apple-tab-span" style="white-space: pre;"> </span></span><span style="font-family: 'Times New Roman', serif;">valueInString </span><span style="font-family: Times New Roman, serif;">[5] = 'v'; </span><br />
<span style="font-family: Times New Roman, serif;"><span class="Apple-tab-span" style="white-space: pre;"> </span></span><span style="font-family: 'Times New Roman', serif;">valueInString </span><span style="font-family: Times New Roman, serif;">[6] = 'a';</span><br />
<span style="font-family: 'Times New Roman', serif;"> valueInString </span><span style="font-family: Times New Roman, serif;">[7] = ' '; </span><span style="font-family: 'Times New Roman', serif;"> </span><span style="font-family: Times New Roman, serif;"> </span><br />
<span style="font-family: 'Times New Roman', serif;"> valueInString </span><span style="font-family: Times New Roman, serif;">[8] = ' ';</span><span style="font-family: 'Times New Roman', serif;"> </span><br />
<span style="font-family: Times New Roman, serif;"><br /></span><span style="font-family: Times New Roman, serif;"><span class="Apple-tab-span" style="white-space: pre;"> </span>System.out.println(s1); // </span><span style="font-family: 'Times New Roman', serif;">My </span><span style="font-family: Times New Roman, serif;">Java </span><br />
<span style="font-family: Times New Roman, serif;"><span class="Apple-tab-span" style="white-space: pre;"> </span>System.out.println(s2); // String</span><span style="font-family: Times New Roman, serif;"> </span><br />
<span style="font-family: Times New Roman, serif;"><br /></span>
<span style="font-family: Times New Roman, serif;">We see the change to the char[] in the first String doesn't affect the second String obtained with the substring method of the first String. As we see, if you use reflection we can't anymore say that String is immutable. Immutability is valid only if you use String object without reflection.</span><br />
<span style="font-family: Times New Roman, serif;"><br /></span>
<u style="font-family: 'Times New Roman', serif;"><b>After 1.8;</b></u><br />
<u style="font-family: 'Times New Roman', serif;"><b><br /></b></u>
<span style="font-family: 'Times New Roman', serif;"> String class after 1.8 has a private final char array, and 1 int variable, hash. The hash32 variable removed from the implementation, which was used as an alternative hash implementation if there are too many collisions with the default hashing algorithm when using with HashMap. However with Java 8 the HashMap implementation has changed and if there are too many collisions in the buckets, HashMap dynamically replaces the way of holding the buckets from linkedlist to </span><span style="font-family: 'Times New Roman', serif;">ad-hoc implementation of TreeMap</span><span style="font-family: 'Times New Roman', serif;">. Using this way we end up with O(logn) complexity instead of O(n) since the bucket's elements are now ordered thanks to the TreeMap implementation. In this new implementation HashMap order the bucket's elements that collison occured in. It requires the keys to be Comparable and uses the compareTo methods to order them. Thanks to this new implementation, hash32 variable removed from the String implementation.</span><br />
<span style="font-family: 'Times New Roman', serif;"><br /></span>
<span style="font-family: 'Times New Roman', serif;">In this version, the String "A" object will occupy 48 bytes as explained below.</span><br />
<span style="font-family: Times New Roman, serif;"><br /></span>
<span style="font-family: Times New Roman, serif;">12 header + 4 ref to char[] + (4*1) for 1 int = 20 bytes rounded to 24 bytes; plus</span><br />
<span style="font-family: Times New Roman, serif;">12 header + 4 len + 1(len of "A") * 2 = 18 rounded to 24 bytes; totally 48 bytes.</span><br />
<span style="font-family: Times New Roman, serif;"><br /></span>
<u style="font-family: 'Times New Roman', serif;"><b>StringBuilder Memory Consumption:</b></u><br />
<u style="font-family: 'Times New Roman', serif;"><b><br /></b></u>
<span style="font-family: 'Times New Roman', serif;"> We now see the StringBuilder in terms of memory usage. We use the last Java version's StringBuilder implementation. The StringBuilder class holds a char[] and an int variable 'count' in the abstract super class AbstractStringBuilder. Since the default capacity of StringBuilder is 16, the total amount of a empty StringBuilder object will occupy 72 bytes as explained below.</span><br />
<span style="font-family: 'Times New Roman', serif;"><br /></span>
<span style="font-family: Times New Roman, serif;">12 header + 4 ref to char[] + (4*1) for count = 20 bytes rounded to 24 bytes; plus</span><br />
<span style="font-family: Times New Roman, serif;">12 header + 4 len + 16 * 2 = 48 bytes; totally 72 bytes.</span><br />
<span style="font-family: Times New Roman, serif;"><br /></span>
<span style="font-family: Times New Roman, serif;">The initial capacity for a non-empty StringBuilder will be 16 + length and we can get this capacity with capacity() method of it. At anytime we can shrink the capacity to the current lenght with the trimToSize() method if we pretty sure the lenght won't be increase, otherwise we lose with the effort of capacity increase. In the last implementation of the StringBuilder when we append content using the append method, StringBuilder check if the required new length (old length + new String's length) is less than the current capacity of the inner char[], and if so increase capacity to "old capacity * 2 + 2". If this value is still less than the required minimum less capacity than set the capacity to the required minimum capacity, that is </span><span style="font-family: 'Times New Roman', serif;">old length + new String's length</span><span style="font-family: 'Times New Roman', serif;">.</span><br />
<span style="font-family: Times New Roman, serif;"><br /></span>
<span style="font-family: Times New Roman, serif;">If we sure we finish appending to a StringBuilder object, we can shrink it's size with trimToSize() method at any time to reduce the amount of memory spanned with StringBuilder object.</span><br />
<span style="font-family: Times New Roman, serif;"><br /></span><u><b><span style="font-family: Times New Roman, serif;">Canonicalization of String:</span></b></u><span style="font-family: Times New Roman, serif;"><br /></span>
<span style="font-family: Times New Roman, serif;"><br /></span><span style="font-family: Times New Roman, serif;">Using Canonicalization we can sure there is only one unique content of an object. The JVM already maintained a canonicalization technique </span><span style="font-family: 'Times New Roman', serif;">for all String objects</span><span style="font-family: 'Times New Roman', serif;">, which is called pooling. If we define the Strings as hardcoded literals such as s= "a", it will be pooled automatically. The pooled String objects are kept in perm gen area until Java 7 and then removed from perm gen to the heap by Java 7 and later versions.</span><br />
<span style="font-family: Times New Roman, serif;"><br /></span>
<span style="font-family: Times New Roman, serif;">At this point , a small information will be helpful about perm gen space and String pooling. As we said String pool is removed from perm gen to the Heap after Java 7. By Java 8 an important change has been made and the permanent generation is completely removed. Class meta-data informations are now hold in native-memory which is called as "MetaSpace" and interned Strings and static variables are hold in Heap. By this way instead of limiting the memory of the class meta-data, interned Strings and static variables by the -XXMaxPerSize, JVM will allocate and free the machine's native memory dynamically for class meta-data and the Heap memory tuned by the -Xms and -Xmx variables will be used for static variables and interned Strings which are subject to garbage collection, as the normal java objects. By this change the difficulty of tuning perm gen space is gone.</span><br />
<span style="font-family: Times New Roman, serif;">So , </span><span style="font-family: 'Times New Roman', serif;">keeping in mind these important changes</span><span style="font-family: 'Times New Roman', serif;"> </span><span style="font-family: 'Times New Roman', serif;">we can say that tuning the JVM again is important when you are moving to Java 8.</span><br />
<span style="font-family: Times New Roman, serif;">You can set the metaspace size by -XX:MaxMetaSpaceSize which has no limit by default and has a 21 MB initial value for 64 bit JVM. To print meta space related statistics we have to set </span><span style="font-family: 'Times New Roman', serif;">-XX:+UnlockDisagnosticVMOptions.</span><br />
<span style="font-family: Times New Roman, serif;"><br /></span><span style="font-family: Times New Roman, serif;"><b>Note: </b>There is also a canonicalization for </span><span style="font-family: 'Times New Roman', serif;"> all </span><span style="font-family: 'Times New Roman', serif;">Wrappers (except Double and Float) implemented as cached array inside the Wrapper classes.</span><br />
<span style="font-family: Times New Roman, serif;"><br /></span>
<span style="font-family: Times New Roman, serif;">If your Strings are coming from different sources such as database or file, the values will not be pooled. In this case you may use native intern method to force the JVM to pool the String objects. But be careful with the intern method with user-generated Strings as </span><span style="font-family: 'Times New Roman', serif;">it may cause a memory leak and an OutOfMemory error if there is an attack by sending large number of different Strings to your application.</span><br />
<span style="font-family: Times New Roman, serif;">Also reconsider using intern methods if you are using Java 6 or earlier, since the pooled Strings are kept in perm gen and the perm gen has a fixed size determined by -XX:MaxPermSize JVM parameter.</span><br />
<span style="font-family: Times New Roman, serif;"><br /></span>
<span style="font-family: Times New Roman, serif;">If we use intern methods heavily, we have to use -XXStringTableSize JVM parameter after Java 7 to set the map size of String pool (Default value is 60013 in Java 8). We have to carefully determine the max number of distinct Strings that the application may hold and set the map size according to this.</span><br />
<span style="font-family: Times New Roman, serif;">We can also use -XXPrintStringTableStatistics JVM parameter to see the usage of String pool.</span><br />
<span style="font-family: Times New Roman, serif;"><br /></span>
<span style="font-family: Times New Roman, serif;">Using intern method is pretty straightforward as shown in the below example;</span><br />
<span style="font-family: Times New Roman, serif;"><br /></span>
<b style="font-family: 'Times New Roman', serif;"><u>Example 3:</u></b><br />
<b style="font-family: 'Times New Roman', serif;"><u><br /></u></b>
<span style="font-family: Times New Roman, serif;">String s1 = readAsStringFromSomeExternalSource();//say it's value is "a"</span><br />
<span style="font-family: Times New Roman, serif;">s1.intern();</span><br />
<span style="font-family: Times New Roman, serif;">String s2 = "a";</span><br />
<span style="font-family: Times New Roman, serif;">if (s1 == s2)</span><br />
<span style="font-family: Times New Roman, serif;"> System.out.println("String is pooled by intern method");</span><br />
<span style="font-family: Times New Roman, serif;"><br /></span>
<span style="font-family: Times New Roman, serif;">When we use intern method we may use == operator instead of equals method which can also get some slight performance advantage. However this is so negligible since the first statement of the equals method also uses the == operator to check the equality, and calling the equals method may be inlined by the JVM. Also be careful that if you forget intern at some point == operator will fail.</span><br />
<span style="font-family: Times New Roman, serif;"><br /></span>
<span style="font-family: Times New Roman, serif;">For String pool we may use our implementation with a ConcurrentHashMap or WeakHashMap.</span><br />
<span style="font-family: 'Times New Roman', serif;">WeakHashMap will be the correct implementation since it will remove the String from the map when there is no other reference, which is the default behaviour of the String pool. Yes, the String pool also subject to Garbage Collection, and if there is no live reference to an Object in the native JVM String pool, it will garbage collected.</span><br />
<span style="font-family: 'Times New Roman', serif;">If you don't use WeakHashMap, we have to manually control the size of the map as it may grow too much after some time.</span><br />
<span style="font-family: 'Times New Roman', serif;">Remember also to use a synchronized version of WeakHashMap if you're in a multithread environment. Y</span><span style="font-family: 'Times New Roman', serif;">ou may also use Google Collections API's <a href="http://google-collections.googlecode.com/svn/trunk/javadoc/index.html?http://google-collections.googlecode.com/svn/trunk/javadoc/com/google/common/collect/package-summary.html" target="_blank">MapMaker </a>to use concurrent WeakHashMap</span><br />
<span style="font-family: Times New Roman, serif;"><br /></span>
<span style="font-family: Times New Roman, serif;">Using Map instead of intern method causes to create one extra String object for every String used in the application as you have to pass the String object to the custom pool method and this parameter will be directly become eligible to the garbage collection. Subsequent parameter passes will be pooled by the JVM. One advantage of using map pool instead of intern method is there is no method to turn back from the intend operation.</span><br />
<span style="font-family: Times New Roman, serif;"><br /></span>
<span style="font-family: Times New Roman, serif;">See in the following example;</span><br />
<span style="font-family: Times New Roman, serif;"><br /></span>
<b style="font-family: 'Times New Roman', serif;"><u>Example 4:</u></b><br />
<b style="font-family: 'Times New Roman', serif;"><u><br /></u></b>
<span style="font-family: Times New Roman, serif;">private ConcurrentMap<String, String> stringPool= new ConcurrentHashMap<String, String>(500</span><span style="font-family: 'Times New Roman', serif;">);</span><br />
<span style="font-family: Times New Roman, serif;"><br /></span>
<span style="font-family: Times New Roman, serif;">public String getCanonicalString(String param) {</span><br />
<span style="font-family: Times New Roman, serif;">//Here the literal param String object created on heap and added to the String pool by JVM</span><br />
<span style="font-family: Times New Roman, serif;">//Thanks to the interned String pool, later calls with the same param String are not created</span><br />
<span style="font-family: Times New Roman, serif;">//on heap and just get from the interned String pool. So we can say that every String added </span><br />
<span style="font-family: Times New Roman, serif;">//to our string pool also added to the interned String pool.</span><br />
<span style="font-family: Times New Roman, serif;">String pooledVersion= </span><span style="font-family: 'Times New Roman', serif;">stringPool</span><span style="font-family: Times New Roman, serif;">.putIfAbsent(</span><span style="font-family: 'Times New Roman', serif;">param</span><span style="font-family: Times New Roman, serif;">, </span><span style="font-family: 'Times New Roman', serif;">param</span><span style="font-family: Times New Roman, serif;">);</span><br />
<span style="font-family: Times New Roman, serif;">return (</span><span style="font-family: 'Times New Roman', serif;">pooledVersion </span><span style="font-family: Times New Roman, serif;">== null) ? </span><span style="font-family: 'Times New Roman', serif;">param </span><span style="font-family: Times New Roman, serif;">: </span><span style="font-family: 'Times New Roman', serif;">pooledVersion </span><span style="font-family: Times New Roman, serif;">;</span><br />
<span style="font-family: Times New Roman, serif;">}</span><br />
<span style="font-family: Times New Roman, serif;"><br /></span>
<span style="font-family: Times New Roman, serif;">Remember to clear the stringPool if it's size grow too much.</span><br />
<span style="font-family: 'Times New Roman', serif;"><br /></span>
<u><b><span style="font-family: Times New Roman, serif;">Using byte[] instead of String:</span></b></u><br />
<span style="font-family: 'Times New Roman', serif;"><br /></span>
<span style="font-family: Times New Roman, serif;">We may use byte[] instead of String class in some situtations to reduce the memory usage, although it has limited usage because you can't use some characters with some charsets as it can hold only 256 ascii characters not full unicode. See in the following example; </span><br />
<span style="font-family: Times New Roman, serif;"><br /></span>
<b style="font-family: 'Times New Roman', serif;"><u>Example 5:</u></b><br />
<b style="font-family: 'Times New Roman', serif;"><u><br /></u></b>
<span style="font-family: Times New Roman, serif;">byte[] arr = new byte[5];</span><br />
<span style="font-family: Times New Roman, serif;">arr[0] = 'a';</span><br />
<span style="font-family: Times New Roman, serif;">arr[1] = 'b';</span><br />
<span style="font-family: Times New Roman, serif;">arr[2] = 'c';</span><br />
<span style="font-family: Times New Roman, serif;">arr[3] = 'd';</span><br />
<span style="font-family: Times New Roman, serif;">arr[4] = 'e';</span><br />
<span style="font-family: Times New Roman, serif;">System.out.println(SizeUtil.fullSizeOf(arr)); // 24 bytes</span><br />
<span style="font-family: Times New Roman, serif;">String s ="abcde";</span><br />
<span style="font-family: Times New Roman, serif;">System.out.println(SizeUtil.fullSizeOf(s)); // 56 bytes</span><br />
<span style="font-family: Times New Roman, serif;"></span><br />
<span style="font-family: Times New Roman, serif;">}</span><br />
<span style="font-family: Times New Roman, serif;"><br />For the implementation of SizeUtil look for this </span><a href="http://www.aligelenler.com/2015/01/actual-memory-consumption-of-java.html" style="font-family: 'Times New Roman', serif;" target="_blank">post</a>. You see that byte array spans significantly smaller memory. Until you need the String representation you can keep the byte array, then can use<br />
String s2 = new String(arr, CHARSET_NAME); to obtain the String object. You can especially use this technique when sending object across network or similar situation.<br />
<br />
<b style="font-family: 'Times New Roman', serif;"><u>Conclusion:</u></b><br />
<span style="font-family: Times New Roman, serif;"><b><u><br /></u></b></span>
<span style="font-family: 'Times New Roman', serif; font-size: 16px;"> Today we see how String and related objects are kept in memory, and how we can reduce memory usage of them and get higher performance. We saw the history of String Object in Java through Java versions and see some methods to reduce memory usage. For example by holding byte[] instead String object we can reduce the memory usage by half or we can use StringBuilder object with trims to the current size and reduce the memory usage by this way.</span>Also we have consider the Java version we're using, and be careful with the implementation changes. Finally we have to consider canonicalization of String objects to reduce their memory usage.<span style="font-family: Times New Roman, serif;"><b><u><br /></u></b></span>
<span style="font-family: Times New Roman, serif;"><br /></span>Ali Gelenlerhttp://www.blogger.com/profile/09439697648573423668noreply@blogger.com0tag:blogger.com,1999:blog-3858181542467916490.post-67497086477426426072015-02-01T23:14:00.000+02:002019-08-11T14:00:58.323+03:00Actual Memory Consumption of Java Objects <span style="font-family: "times new roman" , serif;"><b><u>Introduction</u></b></span><u style="font-family: 'Times New Roman', serif; font-size: 16px; font-weight: bold;">:</u><br />
<u style="font-family: 'Times New Roman', serif; font-size: 16px; font-weight: bold;"><br /></u>
<span style="font-family: "times new roman" , serif; font-size: 16px;"> Today we'll be talking about the general memory consumption of java objects on the Heap, although the normal situation may sometimes change, i.e; the JVM may choose not the put a Thread local object on to the Heap instead put it to the stack. </span><br />
<span style="font-family: "times new roman" , serif; font-size: 16px;"><br /></span>
<span style="font-family: "times new roman" , serif;"><b><u>General Memory Usage of Java Objects</u></b></span><u style="font-family: 'Times New Roman', serif; font-size: 16px; font-weight: bold;">:</u><br />
<u style="font-family: 'Times New Roman', serif; font-size: 16px; font-weight: bold;"><br /></u>
<span style="font-family: "times new roman" , serif; font-size: 16px;"> Although the memory usage may changes depending on the JVM's vendor, JVM's type as 32 bit-64 bit or UseCompressedOops VM argument, the general formula for a Java object is like below.</span><br />
<span style="font-family: "times new roman" , serif; font-size: 16px;"><br /></span>
<span style="font-family: "times new roman" , serif;"> An object header (object class information, status flags about the synhronization locked and the reachability of the object, ID of the class) 8 bytes for 32 bit JVM </span><span style="font-family: "times new roman" , serif;">and 12 bytes for 64 bit </span><span style="font-family: "times new roman" , serif; font-size: 15.5555562973022px;">UseCompressedOops</span><span style="font-family: "times new roman" , serif; font-size: 15.5555562973022px;"> enabled JVM, 16 bytes for 64 bit non compressed JVM</span><span style="font-family: "times new roman" , serif;"> + Memory for primitives according to their size (See below) + Memory for reference to the member pointer (4 bytes for 32 bit JVM and 64 bit </span><span style="font-family: "times new roman" , serif; font-size: 15.5555562973022px;">UseCompressedOops</span><span style="font-family: "times new roman" , serif; font-size: 15.5555562973022px;"> enabled JVM, 8 bytes for 64 bit non compressed JVM</span><span style="font-family: "times new roman" , serif;">) + padding (a wasted space after the object data to make every object start at a standart address space which is a multiple of 8, so rounded to the next multiple of 8)</span><br />
<span style="font-family: "times new roman" , serif;">Be careful, all the middle calculations will be rounded to the next multiple of 8, not the total calculation. That means the outer object is rounded </span><span style="font-family: "times new roman" , serif;">individually </span><span style="font-family: "times new roman" , serif;">while the fields of that objects are rounded individually.</span><br />
<div style="text-align: center;">
<span style="font-family: "times new roman" , serif;"><br /></span></div>
<div style="text-align: center;">
<span style="font-family: "times new roman" , serif;">byte, boolean 1 byte</span></div>
<div style="text-align: center;">
<span style="font-family: "times new roman" , serif;"> short, char 2 bytes</span></div>
<div style="text-align: center;">
<span style="font-family: "times new roman" , serif;"> int, float 4 bytes</span></div>
<div style="text-align: center;">
<span style="font-family: "times new roman" , serif;"> long, double 8 bytes</span></div>
<div style="text-align: center;">
<span style="font-family: "times new roman" , serif;"><br /></span></div>
<div style="text-align: center;">
<span style="font-family: "times new roman" , serif;">Java Primitive Size</span></div>
<div style="text-align: center;">
<span style="font-family: "times new roman" , serif;"><br /></span></div>
<div style="text-align: left;">
<span style="font-family: "times new roman" , serif;">Here we see boolean type is holding 1 byte although it is required just one single bit. This is just for easy access to the class in memory. If we holded 1 bit for the boolean type, we would have been deal with the exact position of the boolean type each time we read or write data, but in this case we use a byte offset and the implementation is easy now.</span></div>
<div style="text-align: left;">
<span style="font-family: "times new roman" , serif;">When you need boolean array, you can use the BitSet implementation of Java language to be able to hold 1 bit for each boolean variable of the array.</span></div>
<div style="text-align: left;">
<span style="font-family: "times new roman" , serif;"><br /></span></div>
<div style="text-align: left;">
<span style="font-family: "times new roman" , serif;"><u style="font-weight: bold;">Note: </u></span><span style="font-family: "times new roman" , serif;">In <a href="http://www.aligelenler.com/2015/01/where-is-java-primitives-stored-in.html" target="_blank">this </a>write you can see the memory space retained for primitives depending on the place where they defined. Here the point is, if we declare the primitive as class variables they will hold the sizes above , however for the local variables they will be defined independently and they may retain larger space then their requirements. That's because the smallest unit of the memory for a JVM is changing between 32 bit and 64 bit versions.For example,some JVM's may hold a 1 byte variable on the 4 byte smallest unit for 32 bit and 8 byte unit for 64 bit.To be really able to hold 1 byte for a byte you should use array of byte , which will be holded on the heap and the array members will be reached by the reference of the array, so can hold really 1 byte.</span></div>
<div style="text-align: left;">
<span style="font-family: "times new roman" , serif;"><br /></span></div>
<div style="text-align: left;">
<span style="font-family: "times new roman" , serif;"><b><u>General Memory Usage of Java Array Objects</u></b></span><u style="font-family: 'Times New Roman', serif; font-size: 16px; font-weight: bold;">:</u></div>
<div style="text-align: left;">
<u style="font-family: 'Times New Roman', serif; font-size: 16px; font-weight: bold;"><br /></u></div>
<div style="text-align: left;">
<span style="font-family: inherit;"><span style="font-size: 16px;"> </span><span style="font-family: inherit;">Arrays are normal java objects so their memory usage include the previous section's steps plus a memory space for the length of the array. This space is 4 bytes for 32 bit JVM's and </span><span style="font-family: inherit;">64 bit UseCompressedOops enabled JVM, 8 bytes for 64 bit non compressed JVM). </span></span></div>
<div style="text-align: left;">
<span style="font-family: "times new roman" , serif; font-size: 15.5555562973022px;"><br /></span></div>
<div style="text-align: left;">
<span style="font-family: "times new roman" , serif;"><u style="font-weight: bold;">Note:</u> </span><span style="font-family: inherit;">For most of the JVM implementations UseCompressedOops is enabled by default, so you don't need to the anything to enable it. You can check whether its enabled or not using the below java code and iterating over the arguments list.</span></div>
<div style="text-align: left;">
<span style="font-family: "times new roman" , serif; font-size: 15.5555562973022px;"><br /></span></div>
<div class="MsoNormal" style="margin-bottom: 0.0001pt;">
<span style="font-family: "consolas"; font-size: 10pt;">RuntimeMXBean </span><span style="color: #6a3e3e; font-family: "consolas"; font-size: 10.0pt;">runtimeMxBean</span><span style="font-family: "consolas"; font-size: 10pt;"> = ManagementFactory.<i>getRuntimeMXBean</i>();</span><span style="font-family: "consolas"; font-size: 10.0pt;"><o:p></o:p></span></div>
<br />
<div class="MsoNormal">
<span style="font-family: "consolas"; font-size: 10pt;">List<String> </span><u><span style="color: #6a3e3e; font-family: "consolas"; font-size: 10.0pt;">arguments</span></u><span style="font-family: "consolas"; font-size: 10pt;"> = </span><span style="color: #6a3e3e; font-family: "consolas"; font-size: 10.0pt;">runtimeMxBean</span><span style="font-family: "consolas"; font-size: 10pt;">.getInputArguments();<o:p></o:p></span></div>
<div class="MsoNormal">
<span style="font-family: inherit;"><br /></span></div>
<div class="MsoNormal">
<span style="font-family: inherit;">Now we'll show you some examples for memory usage of java objects. But, before that we need to find out a way to measure the memory usage. In this post, we use java Instrumentation class to be able to measure the size of objects.</span></div>
<div class="MsoNormal">
<span style="font-family: "consolas"; font-size: 10pt;"><br /></span></div>
<div class="MsoNormal">
<span style="font-family: "times new roman" , serif;"><b><u>How to Find the Memory Usage Programmatically Using Instrumentation:</u></b></span></div>
<div class="MsoNormal">
<span style="font-family: "times new roman" , serif;"><b><u><br /></u></b></span></div>
<div class="MsoNormal">
<span style="font-family: "times new roman" , serif;"> </span><span style="font-family: inherit;">We'll use java.lang.instrument.Instrumentation class to get the size of the java objects. To do that follow the following instructions.</span></div>
<div class="MsoNormal">
<span style="font-family: inherit;"><br /></span></div>
<div class="MsoNormal">
<span style="font-family: inherit;">1.) Create a java project including a class that include the following static field and the following methods named premain and shallowSizeOfObject.</span></div>
<div class="MsoNormal">
<span style="font-family: inherit;"><br /></span></div>
<div class="MsoNormal">
<span style="font-family: inherit;">private static Instrumentation instrumentation = null;</span></div>
<div class="MsoNormal">
<span style="font-family: inherit;"><br /></span></div>
<div class="MsoNormal">
<span style="font-family: inherit;">public static void premain(String args, Instrumentation paramInstrumentation) {</span></div>
<div class="MsoNormal">
<span style="font-family: inherit;"><span class="Apple-tab-span" style="white-space: pre;"> </span>instrumentation = paramInstrumentation;</span></div>
<div class="MsoNormal">
</div>
<div class="MsoNormal">
<span style="font-family: inherit;"><span class="Apple-tab-span" style="white-space: pre;"> </span>}</span></div>
<div class="MsoNormal">
<span style="font-family: inherit;"><br /></span></div>
<div class="MsoNormal">
<span style="font-family: inherit;">public static long shallowSizeOfObject(Object obj) {</span></div>
<div class="MsoNormal">
<span style="font-family: inherit;"><span class="Apple-tab-span" style="white-space: pre;"> </span>return instrumentation.getObjectSize(obj);</span></div>
<div class="MsoNormal">
</div>
<div class="MsoNormal">
<span style="font-family: inherit;"><span class="Apple-tab-span" style="white-space: pre;"> </span>}</span></div>
<div class="MsoNormal">
<span style="font-family: "times new roman" , serif;"><br /></span></div>
<div class="MsoNormal">
<span style="font-family: inherit;">2.) Create a MANIFEST.MF file including the following definition.</span></div>
<div class="MsoNormal">
<span style="font-family: inherit;"><br /></span></div>
<div class="MsoNormal">
<span style="font-family: inherit;">Premain-Class: your_pck_name.Your_Class_Name</span></div>
<div class="MsoNormal">
<span style="font-family: inherit;"><br /></span></div>
<div class="MsoNormal">
<span style="font-family: inherit;">3.) Export the java project as a jar file using the MANIFEST.MF created in step 2.</span></div>
<div class="MsoNormal">
<span style="font-family: inherit;"><br /></span></div>
<div class="MsoNormal">
<span style="font-family: inherit;">4.) Add the jar created in step 3 to your project class path.</span></div>
<div class="MsoNormal">
<span style="font-family: inherit;"><br /></span></div>
<div class="MsoNormal">
<span style="font-family: inherit;">5.) In your project that has reference to the jar created in step 3, run the class that include a main method with the following VM argument.</span></div>
<div class="MsoNormal">
<span style="font-family: inherit;"><br /></span></div>
<div class="MsoNormal">
<span style="font-family: inherit;">-javaagent:your_jar_name.jar</span></div>
<div class="MsoNormal">
<span style="font-family: inherit;"><br /></span></div>
<div class="MsoNormal">
<span style="font-family: inherit;">That's it, when you run your program, since you tell that the jar file including the Instrumentation code is an java agent (using the javaagent VM argument) the JVM will automatically run the premain method and set the Instrumentation object to your static variable.Then you can use the getObjectSize(obj) method to get the shallow size of a java object which will include header + primitive variables total size + member pointers like we mentioned in the previous part of this post.</span></div>
<div class="MsoNormal">
<span style="font-family: inherit;">However if you have inner arrays or objects in your object, the getObjectSize(obj) will not give you memory usage of this arrays or objects. That's why we call our method as shallowSizeOfObject.Now ,let's see how can we get the deep memory size of a java object.</span></div>
<div class="MsoNormal">
<span style="font-family: "times new roman" , serif;"><br /></span></div>
<div class="MsoNormal">
<span style="font-family: "times new roman" , serif;"><b><u>Deep Memory Usage of Java Objects:</u></b></span></div>
<div class="MsoNormal">
<span style="font-family: "times new roman" , serif;"><b><u><br /></u></b></span></div>
<div class="MsoNormal">
<span style="font-family: "times new roman" , serif;"> </span><span style="font-family: inherit;">To get the real retained memory space of a java object, we'll use reflection api to access the inner arrays and objects. Also we should use some techniques to skip the pooled objects, like String, Integer etc and to skip primitive and static variables.We then recursively call our deepSizeOfObject method until we finished all the fields of our object and the fields of the all super classes of our object.</span></div>
<div class="MsoNormal">
<span style="font-family: inherit;">Below is the last version of our SizeUtil class including the methods added to get those functionalities.</span></div>
<div class="MsoNormal">
<span style="font-family: "times new roman" , serif;"><br /></span></div>
<div class="MsoNormal">
<span style="font-family: "times new roman" , serif;">package sizeutil;</span></div>
<div class="MsoNormal">
<span style="font-family: "times new roman" , serif;"><br /></span></div>
<div class="MsoNormal">
<span style="font-family: "times new roman" , serif;">import java.lang.instrument.Instrumentation;</span></div>
<div class="MsoNormal">
<span style="font-family: "times new roman" , serif;">import java.lang.reflect.Array;</span></div>
<div class="MsoNormal">
<span style="font-family: "times new roman" , serif;">import java.lang.reflect.Field;</span></div>
<div class="MsoNormal">
<span style="font-family: "times new roman" , serif;">import java.lang.reflect.Modifier;</span></div>
<div class="MsoNormal">
<span style="font-family: "times new roman" , serif;">import java.util.IdentityHashMap;</span></div>
<div class="MsoNormal">
<span style="font-family: "times new roman" , serif;">import java.util.Map;</span></div>
<div class="MsoNormal">
<span style="font-family: "times new roman" , serif;"><br /></span></div>
<div class="MsoNormal">
<span style="font-family: "times new roman" , serif;">public class SizeUtil {</span></div>
<div class="MsoNormal">
<span style="font-family: "times new roman" , serif;"><br /></span></div>
<div class="MsoNormal">
<span style="font-family: "times new roman" , serif;"><span class="Apple-tab-span" style="white-space: pre;"> </span>private static boolean SKIP_POOLED_OBJECTS = false;</span></div>
<div class="MsoNormal">
<span style="font-family: "times new roman" , serif;"><br /></span></div>
<div class="MsoNormal">
<span style="font-family: "times new roman" , serif;"><span class="Apple-tab-span" style="white-space: pre;"> </span>private static Instrumentation instrumentation = null;</span></div>
<div class="MsoNormal">
<span style="font-family: "times new roman" , serif;"><br /></span></div>
<div class="MsoNormal">
<span style="font-family: "times new roman" , serif;"><span class="Apple-tab-span" style="white-space: pre;"> </span>public static void premain(String args, Instrumentation paramInstrumentation) {</span></div>
<div class="MsoNormal">
<span style="font-family: "times new roman" , serif;"><span class="Apple-tab-span" style="white-space: pre;"> </span>instrumentation = paramInstrumentation;</span></div>
<div class="MsoNormal">
<span style="font-family: "times new roman" , serif;"><span class="Apple-tab-span" style="white-space: pre;"> </span>}</span></div>
<div class="MsoNormal">
<span style="font-family: "times new roman" , serif;"><br /></span></div>
<div class="MsoNormal">
<span style="font-family: "times new roman" , serif;"><span class="Apple-tab-span" style="white-space: pre;"> </span>/**</span></div>
<div class="MsoNormal">
<span style="font-family: "times new roman" , serif;"><span class="Apple-tab-span" style="white-space: pre;"> </span> * Calculates size</span></div>
<div class="MsoNormal">
<span style="font-family: "times new roman" , serif;"><span class="Apple-tab-span" style="white-space: pre;"> </span> * </span></div>
<div class="MsoNormal">
<span style="font-family: "times new roman" , serif;"><span class="Apple-tab-span" style="white-space: pre;"> </span> * @param obj</span></div>
<div class="MsoNormal">
<span style="font-family: "times new roman" , serif;"><span class="Apple-tab-span" style="white-space: pre;"> </span> * object to calculate size of</span></div>
<div class="MsoNormal">
<span style="font-family: "times new roman" , serif;"><span class="Apple-tab-span" style="white-space: pre;"> </span> * @return object size</span></div>
<div class="MsoNormal">
<span style="font-family: "times new roman" , serif;"><span class="Apple-tab-span" style="white-space: pre;"> </span> */</span></div>
<div class="MsoNormal">
<span style="font-family: "times new roman" , serif;"><span class="Apple-tab-span" style="white-space: pre;"> </span>public static long shallowSizeOfObject(Object obj) {</span></div>
<div class="MsoNormal">
<span style="font-family: "times new roman" , serif;"><span class="Apple-tab-span" style="white-space: pre;"> </span>if (SKIP_POOLED_OBJECTS && isPooled(obj))</span></div>
<div class="MsoNormal">
<span style="font-family: "times new roman" , serif;"><span class="Apple-tab-span" style="white-space: pre;"> </span>return 0;</span></div>
<div class="MsoNormal">
<span style="font-family: "times new roman" , serif;"><span class="Apple-tab-span" style="white-space: pre;"> </span>return instrumentation.getObjectSize(obj);</span></div>
<div class="MsoNormal">
<span style="font-family: "times new roman" , serif;"><span class="Apple-tab-span" style="white-space: pre;"> </span>}</span></div>
<div class="MsoNormal">
<span style="font-family: "times new roman" , serif;"><br /></span></div>
<div class="MsoNormal">
<span style="font-family: "times new roman" , serif;"><span class="Apple-tab-span" style="white-space: pre;"> </span>private static boolean isPooled(Object paramObject) {</span></div>
<div class="MsoNormal">
<span style="font-family: "times new roman" , serif;"><span class="Apple-tab-span" style="white-space: pre;"> </span>if ((paramObject instanceof Comparable)) {</span></div>
<div class="MsoNormal">
<span style="font-family: "times new roman" , serif;"><span class="Apple-tab-span" style="white-space: pre;"> </span>if ((paramObject instanceof Enum)) {</span></div>
<div class="MsoNormal">
<span style="font-family: "times new roman" , serif;"><span class="Apple-tab-span" style="white-space: pre;"> </span>return true;</span></div>
<div class="MsoNormal">
<span style="font-family: "times new roman" , serif;"><span class="Apple-tab-span" style="white-space: pre;"> </span>}</span></div>
<div class="MsoNormal">
<span style="font-family: "times new roman" , serif;"><span class="Apple-tab-span" style="white-space: pre;"> </span>if ((paramObject instanceof String)) {</span></div>
<div class="MsoNormal">
<span style="font-family: "times new roman" , serif;"><span class="Apple-tab-span" style="white-space: pre;"> </span>return paramObject == ((String) paramObject).intern();</span></div>
<div class="MsoNormal">
<span style="font-family: "times new roman" , serif;"><span class="Apple-tab-span" style="white-space: pre;"> </span>}</span></div>
<div class="MsoNormal">
<span style="font-family: "times new roman" , serif;"><span class="Apple-tab-span" style="white-space: pre;"> </span>if ((paramObject instanceof Boolean)) {</span></div>
<div class="MsoNormal">
<span style="font-family: "times new roman" , serif;"><span class="Apple-tab-span" style="white-space: pre;"> </span>return (paramObject == Boolean.TRUE) || (paramObject == Boolean.FALSE);</span></div>
<div class="MsoNormal">
<span style="font-family: "times new roman" , serif;"><span class="Apple-tab-span" style="white-space: pre;"> </span>}</span></div>
<div class="MsoNormal">
<span style="font-family: "times new roman" , serif;"><span class="Apple-tab-span" style="white-space: pre;"> </span>if ((paramObject instanceof Integer)) {</span></div>
<div class="MsoNormal">
<span style="font-family: "times new roman" , serif;"><span class="Apple-tab-span" style="white-space: pre;"> </span>return paramObject == Integer.valueOf(((Integer) paramObject).intValue());</span></div>
<div class="MsoNormal">
<span style="font-family: "times new roman" , serif;"><span class="Apple-tab-span" style="white-space: pre;"> </span>}</span></div>
<div class="MsoNormal">
<span style="font-family: "times new roman" , serif;"><span class="Apple-tab-span" style="white-space: pre;"> </span>if ((paramObject instanceof Short)) {</span></div>
<div class="MsoNormal">
<span style="font-family: "times new roman" , serif;"><span class="Apple-tab-span" style="white-space: pre;"> </span>return paramObject == Short.valueOf(((Short) paramObject).shortValue());</span></div>
<div class="MsoNormal">
<span style="font-family: "times new roman" , serif;"><span class="Apple-tab-span" style="white-space: pre;"> </span>}</span></div>
<div class="MsoNormal">
<span style="font-family: "times new roman" , serif;"><span class="Apple-tab-span" style="white-space: pre;"> </span>if ((paramObject instanceof Byte)) {</span></div>
<div class="MsoNormal">
<span style="font-family: "times new roman" , serif;"><span class="Apple-tab-span" style="white-space: pre;"> </span>return paramObject == Byte.valueOf(((Byte) paramObject).byteValue());</span></div>
<div class="MsoNormal">
<span style="font-family: "times new roman" , serif;"><span class="Apple-tab-span" style="white-space: pre;"> </span>}</span></div>
<div class="MsoNormal">
<span style="font-family: "times new roman" , serif;"><span class="Apple-tab-span" style="white-space: pre;"> </span>if ((paramObject instanceof Long)) {</span></div>
<div class="MsoNormal">
<span style="font-family: "times new roman" , serif;"><span class="Apple-tab-span" style="white-space: pre;"> </span>return paramObject == Long.valueOf(((Long) paramObject).longValue());</span></div>
<div class="MsoNormal">
<span style="font-family: "times new roman" , serif;"><span class="Apple-tab-span" style="white-space: pre;"> </span>}</span></div>
<div class="MsoNormal">
<span style="font-family: "times new roman" , serif;"><span class="Apple-tab-span" style="white-space: pre;"> </span>if ((paramObject instanceof Character)) {</span></div>
<div class="MsoNormal">
<span style="font-family: "times new roman" , serif;"><span class="Apple-tab-span" style="white-space: pre;"> </span>return paramObject == Character.valueOf(((Character) paramObject).charValue());</span></div>
<div class="MsoNormal">
<span style="font-family: "times new roman" , serif;"><span class="Apple-tab-span" style="white-space: pre;"> </span>}</span></div>
<div class="MsoNormal">
<span style="font-family: "times new roman" , serif;"><span class="Apple-tab-span" style="white-space: pre;"> </span>}</span></div>
<div class="MsoNormal">
<span style="font-family: "times new roman" , serif;"><span class="Apple-tab-span" style="white-space: pre;"> </span>return false;</span></div>
<div class="MsoNormal">
<span style="font-family: "times new roman" , serif;"><span class="Apple-tab-span" style="white-space: pre;"> </span>}</span></div>
<div class="MsoNormal">
<span style="font-family: "times new roman" , serif;"><br /></span></div>
<div class="MsoNormal">
<span style="font-family: "times new roman" , serif;"><span class="Apple-tab-span" style="white-space: pre;"> </span>/**</span></div>
<div class="MsoNormal">
<span style="font-family: "times new roman" , serif;"><span class="Apple-tab-span" style="white-space: pre;"> </span> * Calculates deep size</span></div>
<div class="MsoNormal">
<span style="font-family: "times new roman" , serif;"><span class="Apple-tab-span" style="white-space: pre;"> </span> * </span></div>
<div class="MsoNormal">
<span style="font-family: "times new roman" , serif;"><span class="Apple-tab-span" style="white-space: pre;"> </span> * @param obj</span></div>
<div class="MsoNormal">
<span style="font-family: "times new roman" , serif;"><span class="Apple-tab-span" style="white-space: pre;"> </span> * object to calculate size of</span></div>
<div class="MsoNormal">
<span style="font-family: "times new roman" , serif;"><span class="Apple-tab-span" style="white-space: pre;"> </span> * @return object deep size</span></div>
<div class="MsoNormal">
<span style="font-family: "times new roman" , serif;"><span class="Apple-tab-span" style="white-space: pre;"> </span> */</span></div>
<div class="MsoNormal">
<span style="font-family: "times new roman" , serif;"><span class="Apple-tab-span" style="white-space: pre;"> </span>public static long deepSizeOfObject(Object obj) {</span></div>
<div class="MsoNormal">
<span style="font-family: "times new roman" , serif;"><br /></span></div>
<div class="MsoNormal">
<span style="font-family: "times new roman" , serif;"><span class="Apple-tab-span" style="white-space: pre;"> </span>Map<Object, Object> previouslyVisited = new IdentityHashMap<Object, Object>();</span></div>
<div class="MsoNormal">
<span style="font-family: "times new roman" , serif;"><span class="Apple-tab-span" style="white-space: pre;"> </span>long result = deepSizeOf(obj, previouslyVisited);</span></div>
<div class="MsoNormal">
<span style="font-family: "times new roman" , serif;"><span class="Apple-tab-span" style="white-space: pre;"> </span>previouslyVisited.clear();</span></div>
<div class="MsoNormal">
<span style="font-family: "times new roman" , serif;"><span class="Apple-tab-span" style="white-space: pre;"> </span>return result;</span></div>
<div class="MsoNormal">
<span style="font-family: "times new roman" , serif;"><span class="Apple-tab-span" style="white-space: pre;"> </span>}</span></div>
<div class="MsoNormal">
<span style="font-family: "times new roman" , serif;"><br /></span></div>
<div class="MsoNormal">
<span style="font-family: "times new roman" , serif;"><span class="Apple-tab-span" style="white-space: pre;"> </span>private static boolean skipObject(Object obj, Map<Object, Object> previouslyVisited) {</span></div>
<div class="MsoNormal">
<span style="font-family: "times new roman" , serif;"><span class="Apple-tab-span" style="white-space: pre;"> </span>if (SKIP_POOLED_OBJECTS && isPooled(obj))</span></div>
<div class="MsoNormal">
<span style="font-family: "times new roman" , serif;"><span class="Apple-tab-span" style="white-space: pre;"> </span>return true;</span></div>
<div class="MsoNormal">
<span style="font-family: "times new roman" , serif;"><span class="Apple-tab-span" style="white-space: pre;"> </span>return (obj == null) || previouslyVisited == null || previouslyVisited.containsKey(obj);</span></div>
<div class="MsoNormal">
<span style="font-family: "times new roman" , serif;"><span class="Apple-tab-span" style="white-space: pre;"> </span>}</span></div>
<div class="MsoNormal">
<span style="font-family: "times new roman" , serif;"><br /></span></div>
<div class="MsoNormal">
<span style="font-family: "times new roman" , serif;"><span class="Apple-tab-span" style="white-space: pre;"> </span>@SuppressWarnings("rawtypes")</span></div>
<div class="MsoNormal">
<span style="font-family: "times new roman" , serif;"><span class="Apple-tab-span" style="white-space: pre;"> </span>private static long deepSizeOf(Object obj, Map<Object, Object> previouslyVisited) {</span></div>
<div class="MsoNormal">
<span style="font-family: "times new roman" , serif;"><span class="Apple-tab-span" style="white-space: pre;"> </span>if (skipObject(obj, previouslyVisited)) {</span></div>
<div class="MsoNormal">
<span style="font-family: "times new roman" , serif;"><span class="Apple-tab-span" style="white-space: pre;"> </span>return 0;</span></div>
<div class="MsoNormal">
<span style="font-family: "times new roman" , serif;"><span class="Apple-tab-span" style="white-space: pre;"> </span>}</span></div>
<div class="MsoNormal">
<span style="font-family: "times new roman" , serif;"><span class="Apple-tab-span" style="white-space: pre;"> </span>previouslyVisited.put(obj, null);</span></div>
<div class="MsoNormal">
<span style="font-family: "times new roman" , serif;"><br /></span></div>
<div class="MsoNormal">
<span style="font-family: "times new roman" , serif;"><span class="Apple-tab-span" style="white-space: pre;"> </span>long returnVal = 0;</span></div>
<div class="MsoNormal">
<span style="font-family: "times new roman" , serif;"><span class="Apple-tab-span" style="white-space: pre;"> </span>// get size of object + primitive variables + member pointers</span></div>
<div class="MsoNormal">
<span style="font-family: "times new roman" , serif;"><span class="Apple-tab-span" style="white-space: pre;"> </span>// for array header + len + if primitive total value for primitives</span></div>
<div class="MsoNormal">
<span style="font-family: "times new roman" , serif;"><span class="Apple-tab-span" style="white-space: pre;"> </span>returnVal += SizeUtil.shallowSizeOfObject(obj);</span></div>
<div class="MsoNormal">
<span style="font-family: "times new roman" , serif;"><br /></span></div>
<div class="MsoNormal">
<span style="font-family: "times new roman" , serif;"><span class="Apple-tab-span" style="white-space: pre;"> </span>// recursively call all array elements</span></div>
<div class="MsoNormal">
<span style="font-family: "times new roman" , serif;"><span class="Apple-tab-span" style="white-space: pre;"> </span>Class objClass = obj.getClass();</span></div>
<div class="MsoNormal">
<span style="font-family: "times new roman" , serif;"><span class="Apple-tab-span" style="white-space: pre;"> </span>if (objClass == null)</span></div>
<div class="MsoNormal">
<span style="font-family: "times new roman" , serif;"><span class="Apple-tab-span" style="white-space: pre;"> </span>return 0;</span></div>
<div class="MsoNormal">
<span class="Apple-tab-span" style="white-space: pre;"><span style="font-family: "times new roman" , serif;"> </span></span></div>
<div class="MsoNormal">
<span style="font-family: "times new roman" , serif;"><span class="Apple-tab-span" style="white-space: pre;"> </span>if (objClass.isArray()) {</span></div>
<div class="MsoNormal">
<span style="font-family: "times new roman" , serif;"><span class="Apple-tab-span" style="white-space: pre;"> </span>if (objClass.getName().length() != 2) {// primitive type arrays has length two, skip them (they included in the shallow size)</span></div>
<div class="MsoNormal">
<span style="font-family: "times new roman" , serif;"><span class="Apple-tab-span" style="white-space: pre;"> </span>int lengthOfArray = Array.getLength(obj);</span></div>
<div class="MsoNormal">
<span style="font-family: "times new roman" , serif;"><span class="Apple-tab-span" style="white-space: pre;"> </span>for (int i = 0; i < lengthOfArray; i++) {</span></div>
<div class="MsoNormal">
<span style="font-family: "times new roman" , serif;"><span class="Apple-tab-span" style="white-space: pre;"> </span>returnVal += deepSizeOf(Array.get(obj, i), previouslyVisited);</span></div>
<div class="MsoNormal">
<span style="font-family: "times new roman" , serif;"><span class="Apple-tab-span" style="white-space: pre;"> </span>}</span></div>
<div class="MsoNormal">
<span style="font-family: "times new roman" , serif;"><span class="Apple-tab-span" style="white-space: pre;"> </span>}</span></div>
<div class="MsoNormal">
<span style="font-family: "times new roman" , serif;"><span class="Apple-tab-span" style="white-space: pre;"> </span>} else {</span></div>
<div class="MsoNormal">
<span style="font-family: "times new roman" , serif;"><span class="Apple-tab-span" style="white-space: pre;"> </span>// recursively call all fields of the object including the superclass fields</span></div>
<div class="MsoNormal">
<span style="font-family: "times new roman" , serif;"><span class="Apple-tab-span" style="white-space: pre;"> </span>do {</span></div>
<div class="MsoNormal">
<span style="font-family: "times new roman" , serif;"><span class="Apple-tab-span" style="white-space: pre;"> </span>Field[] objFields = objClass.getDeclaredFields();</span></div>
<div class="MsoNormal">
<span style="font-family: "times new roman" , serif;"><span class="Apple-tab-span" style="white-space: pre;"> </span>for (int i = 0; i < objFields.length; i++) {</span></div>
<div class="MsoNormal">
<span style="font-family: "times new roman" , serif;"><span class="Apple-tab-span" style="white-space: pre;"> </span>if (!Modifier.isStatic(objFields[i].getModifiers())) {// skip statics</span></div>
<div class="MsoNormal">
<span style="font-family: "times new roman" , serif;"><span class="Apple-tab-span" style="white-space: pre;"> </span>if (!objFields[i].getType().isPrimitive()) { // skip primitives</span></div>
<div class="MsoNormal">
<span style="font-family: "times new roman" , serif;"><span class="Apple-tab-span" style="white-space: pre;"> </span>objFields[i].setAccessible(true);</span></div>
<div class="MsoNormal">
<span style="font-family: "times new roman" , serif;"><span class="Apple-tab-span" style="white-space: pre;"> </span>Object tempObject = null;</span></div>
<div class="MsoNormal">
<span style="font-family: "times new roman" , serif;"><span class="Apple-tab-span" style="white-space: pre;"> </span>try {</span></div>
<div class="MsoNormal">
<span style="font-family: "times new roman" , serif;"><span class="Apple-tab-span" style="white-space: pre;"> </span>tempObject = objFields[i].get(obj);</span></div>
<div class="MsoNormal">
<span style="font-family: "times new roman" , serif;"><span class="Apple-tab-span" style="white-space: pre;"> </span>} catch (IllegalArgumentException e) {</span></div>
<div class="MsoNormal">
<span style="font-family: "times new roman" , serif;"><span class="Apple-tab-span" style="white-space: pre;"> </span>// TODO Auto-generated catch block</span></div>
<div class="MsoNormal">
<span style="font-family: "times new roman" , serif;"><br /></span></div>
<div class="MsoNormal">
<span style="font-family: "times new roman" , serif;"><span class="Apple-tab-span" style="white-space: pre;"> </span>} catch (IllegalAccessException e) {</span></div>
<div class="MsoNormal">
<span style="font-family: "times new roman" , serif;"><span class="Apple-tab-span" style="white-space: pre;"> </span>// TODO Auto-generated catch block</span></div>
<div class="MsoNormal">
<span style="font-family: "times new roman" , serif;"><br /></span></div>
<div class="MsoNormal">
<span style="font-family: "times new roman" , serif;"><span class="Apple-tab-span" style="white-space: pre;"> </span>}</span></div>
<div class="MsoNormal">
<span style="font-family: "times new roman" , serif;"><span class="Apple-tab-span" style="white-space: pre;"> </span>if (tempObject != null) {</span></div>
<div class="MsoNormal">
<span style="font-family: "times new roman" , serif;"><span class="Apple-tab-span" style="white-space: pre;"> </span>returnVal += deepSizeOf(tempObject, previouslyVisited);</span></div>
<div class="MsoNormal">
<span style="font-family: "times new roman" , serif;"><span class="Apple-tab-span" style="white-space: pre;"> </span>}</span></div>
<div class="MsoNormal">
<span style="font-family: "times new roman" , serif;"><span class="Apple-tab-span" style="white-space: pre;"> </span>}</span></div>
<div class="MsoNormal">
<span style="font-family: "times new roman" , serif;"><span class="Apple-tab-span" style="white-space: pre;"> </span>}</span></div>
<div class="MsoNormal">
<span style="font-family: "times new roman" , serif;"><span class="Apple-tab-span" style="white-space: pre;"> </span>}</span></div>
<div class="MsoNormal">
<span style="font-family: "times new roman" , serif;"><span class="Apple-tab-span" style="white-space: pre;"> </span>objClass = objClass.getSuperclass();</span></div>
<div class="MsoNormal">
<span style="font-family: "times new roman" , serif;"><span class="Apple-tab-span" style="white-space: pre;"> </span>} while (objClass != null);</span></div>
<div class="MsoNormal">
<span style="font-family: "times new roman" , serif;"><span class="Apple-tab-span" style="white-space: pre;"> </span>}</span></div>
<div class="MsoNormal">
<span style="font-family: "times new roman" , serif;"><span class="Apple-tab-span" style="white-space: pre;"> </span>return returnVal;</span></div>
<div class="MsoNormal">
<span style="font-family: "times new roman" , serif;"><span class="Apple-tab-span" style="white-space: pre;"> </span>}</span></div>
<div class="MsoNormal">
</div>
<div class="MsoNormal">
<span style="font-family: "times new roman" , serif;">}</span></div>
<div class="MsoNormal">
<span style="font-family: "consolas"; font-size: 10pt;"><br /></span></div>
<div class="MsoNormal">
<span style="font-family: "times new roman" , serif;"><b><u>Examples of Memory Usage:</u></b></span></div>
<div class="MsoNormal">
<span style="font-family: "times new roman" , serif;"><b><u><br /></u></b></span></div>
<div class="MsoNormal">
<span style="font-family: "times new roman" , serif;"> </span><span style="font-family: inherit;">Here are some examples in a single TestSizeOf class about java object's memory usage. We use the SizeUtil class mentioned in the previous section in our examples. The examples are run on 64 bit Java version 1.8.0.25 where as I mentinoned UseCompressedOops enabled automatically. So our objects have 12 bytes header, 4 bytes ref to member pointers, 4 bytes ref to array elements, and extra 4 bytes for array objects to hold the length. Remember to add the -javaagent:sizeOfObjects.jar as VM argument before run your main program.</span></div>
<div class="MsoNormal">
<span style="font-family: "times new roman" , serif;"><br /></span></div>
<div class="MsoNormal">
<span style="font-family: "times new roman" , serif;">package test;</span></div>
<div class="MsoNormal">
<span style="font-family: "times new roman" , serif;"><br /></span></div>
<div class="MsoNormal">
<span style="font-family: "times new roman" , serif;">import sizeutil.SizeUtil;</span></div>
<div class="MsoNormal">
<span style="font-family: "times new roman" , serif;"><br /></span></div>
<div class="MsoNormal">
<span style="font-family: "times new roman" , serif;">public class TestSizeOf {</span></div>
<div class="MsoNormal">
<span class="Apple-tab-span" style="white-space: pre;"><span style="font-family: "times new roman" , serif;"> </span></span></div>
<div class="MsoNormal">
<span style="font-family: "times new roman" , serif;"><span class="Apple-tab-span" style="white-space: pre;"> </span>private String innerStr;</span></div>
<div class="MsoNormal">
<span style="font-family: "times new roman" , serif;"><span class="Apple-tab-span" style="white-space: pre;"> </span>private int innerInt;</span></div>
<div class="MsoNormal">
<span style="font-family: "times new roman" , serif;"><br /></span></div>
<div class="MsoNormal">
<span style="font-family: "times new roman" , serif;"><span class="Apple-tab-span" style="white-space: pre;"> </span>public TestSizeOf(String innerStr, int innerInt) {</span></div>
<div class="MsoNormal">
<span style="font-family: "times new roman" , serif;"><span class="Apple-tab-span" style="white-space: pre;"> </span>this.innerInt = innerInt;</span></div>
<div class="MsoNormal">
<span style="font-family: "times new roman" , serif;"><span class="Apple-tab-span" style="white-space: pre;"> </span>this.innerStr = innerStr;</span></div>
<div class="MsoNormal">
<span style="font-family: "times new roman" , serif;"><span class="Apple-tab-span" style="white-space: pre;"> </span>}</span></div>
<div class="MsoNormal">
<span style="font-family: "times new roman" , serif;"><br /></span></div>
<div class="MsoNormal">
<span style="font-family: "times new roman" , serif;"><span class="Apple-tab-span" style="white-space: pre;"> </span>public static void main(String[] args) {</span></div>
<div class="MsoNormal">
<span class="Apple-tab-span" style="white-space: pre;"><span style="font-family: "times new roman" , serif;"> </span></span></div>
<div class="MsoNormal">
<span style="font-family: "times new roman" , serif;"><span class="Apple-tab-span" style="white-space: pre;"> </span>boolean bo1 = true;</span></div>
<div class="MsoNormal">
<span style="font-family: "times new roman" , serif;"><span class="Apple-tab-span" style="white-space: pre;"> </span>System.out.println("Retained space for boolean bo1 = true --> " + SizeUtil.deepSizeOfObject(bo1));</span></div>
<div class="MsoNormal">
<span class="Apple-tab-span" style="white-space: pre;"><span style="font-family: "times new roman" , serif;"> </span></span></div>
<div class="MsoNormal">
<span style="font-family: "times new roman" , serif;"><span class="Apple-tab-span" style="white-space: pre;"> </span>byte b1 = 3;</span></div>
<div class="MsoNormal">
<span style="font-family: "times new roman" , serif;"><span class="Apple-tab-span" style="white-space: pre;"> </span>System.out.println("Retained space for byte b1 = 3 --> " + SizeUtil.deepSizeOfObject(b1));</span></div>
<div class="MsoNormal">
<span class="Apple-tab-span" style="white-space: pre;"><span style="font-family: "times new roman" , serif;"> </span></span></div>
<div class="MsoNormal">
<span style="font-family: "times new roman" , serif;"><span class="Apple-tab-span" style="white-space: pre;"> </span>short sh1 = 3;</span></div>
<div class="MsoNormal">
<span style="font-family: "times new roman" , serif;"><span class="Apple-tab-span" style="white-space: pre;"> </span>System.out.println("Retained space for short sh1 = 3 --> " + SizeUtil.deepSizeOfObject(sh1));</span></div>
<div class="MsoNormal">
<span style="font-family: "times new roman" , serif;"><br /></span></div>
<div class="MsoNormal">
<span style="font-family: "times new roman" , serif;"><span class="Apple-tab-span" style="white-space: pre;"> </span>int i1 = 3;</span></div>
<div class="MsoNormal">
<span style="font-family: "times new roman" , serif;"><span class="Apple-tab-span" style="white-space: pre;"> </span>System.out.println("Retained space for int i1 = 3 --> " + SizeUtil.deepSizeOfObject(i1));</span></div>
<div class="MsoNormal">
<span style="font-family: "times new roman" , serif;"><br /></span></div>
<div class="MsoNormal">
<span style="font-family: "times new roman" , serif;"><span class="Apple-tab-span" style="white-space: pre;"> </span>long l1 = 3L;</span></div>
<div class="MsoNormal">
<span style="font-family: "times new roman" , serif;"><span class="Apple-tab-span" style="white-space: pre;"> </span>System.out.println("Retained space for long l1 = 3L --> " + SizeUtil.deepSizeOfObject(l1));</span></div>
<div class="MsoNormal">
<span style="font-family: "times new roman" , serif;"><br /></span></div>
<div class="MsoNormal">
<span style="font-family: "times new roman" , serif;"><span class="Apple-tab-span" style="white-space: pre;"> </span>char c1 = 'A';</span></div>
<div class="MsoNormal">
<span style="font-family: "times new roman" , serif;"><span class="Apple-tab-span" style="white-space: pre;"> </span>System.out.println("Retained space for char c1 = 'A' --> " + SizeUtil.deepSizeOfObject(c1));</span></div>
<div class="MsoNormal">
<span style="font-family: "times new roman" , serif;"><br /></span></div>
<div class="MsoNormal">
<span style="font-family: "times new roman" , serif;"><span class="Apple-tab-span" style="white-space: pre;"> </span>float f1 = 3f;</span></div>
<div class="MsoNormal">
<span style="font-family: "times new roman" , serif;"><span class="Apple-tab-span" style="white-space: pre;"> </span>System.out.println("Retained space for float f1 = 3f --> " + SizeUtil.deepSizeOfObject(f1));</span></div>
<div class="MsoNormal">
<span class="Apple-tab-span" style="white-space: pre;"><span style="font-family: "times new roman" , serif;"> </span></span></div>
<div class="MsoNormal">
<span style="font-family: "times new roman" , serif;"><span class="Apple-tab-span" style="white-space: pre;"> </span>double d1 = 3;</span></div>
<div class="MsoNormal">
<span style="font-family: "times new roman" , serif;"><span class="Apple-tab-span" style="white-space: pre;"> </span>System.out.println("Retained space for double d1 = 3 --> " + SizeUtil.deepSizeOfObject(d1));</span></div>
<div class="MsoNormal">
<span style="font-family: "times new roman" , serif;"><br /></span></div>
<div class="MsoNormal">
<span style="font-family: "times new roman" , serif;"><span class="Apple-tab-span" style="white-space: pre;"> </span>Object o = new Object();</span></div>
<div class="MsoNormal">
<span style="font-family: "times new roman" , serif;"><span class="Apple-tab-span" style="white-space: pre;"> </span>System.out.println("Retained space for Object o = new Object() --> "+ </span><br />
<span style="font-family: "times new roman" , serif;">SizeUtil.deepSizeOfObject(o));</span></div>
<div class="MsoNormal">
<span style="font-family: "times new roman" , serif;"><br /></span></div>
<div class="MsoNormal">
<span style="font-family: "times new roman" , serif;"><span class="Apple-tab-span" style="white-space: pre;"> </span>String st1 = "A";</span></div>
<div class="MsoNormal">
<span style="font-family: "times new roman" , serif;"><span class="Apple-tab-span" style="white-space: pre;"> </span>System.out.println("Retained space for String st1 = \"A\" --> " + SizeUtil.deepSizeOfObject(st1));</span></div>
<div class="MsoNormal">
<span style="font-family: "times new roman" , serif;"><br /></span></div>
<div class="MsoNormal">
<span style="font-family: "times new roman" , serif;"><span class="Apple-tab-span" style="white-space: pre;"> </span>byte[] arrByte = new byte[20];</span></div>
<div class="MsoNormal">
<span style="font-family: "times new roman" , serif;"><span class="Apple-tab-span" style="white-space: pre;"> </span>System.out.println("Retained shallow space for byte[] arrByte = new byte[20] --> " + SizeUtil.shallowSizeOfObject(arrByte));</span></div>
<div class="MsoNormal">
<span style="font-family: "times new roman" , serif;"><span class="Apple-tab-span" style="white-space: pre;"> </span>System.out.println("Retained deep space for byte[] arrByte = new byte[20] --> " + SizeUtil.deepSizeOfObject(arrByte));</span></div>
<div class="MsoNormal">
<span style="font-family: "times new roman" , serif;"><br /></span></div>
<div class="MsoNormal">
<span style="font-family: "times new roman" , serif;"><span class="Apple-tab-span" style="white-space: pre;"> </span>Byte[] arrByteObj = new Byte[] { 3, 4, 5 };</span></div>
<div class="MsoNormal">
<span style="font-family: "times new roman" , serif;"><span class="Apple-tab-span" style="white-space: pre;"> </span>System.out.println("Retained shallow space for Byte[] arrByteObj = new Byte[] { 3, 4, 5 } --> " + SizeUtil.shallowSizeOfObject(arrByteObj));</span></div>
<div class="MsoNormal">
<span style="font-family: "times new roman" , serif;"><span class="Apple-tab-span" style="white-space: pre;"> </span>System.out.println("Retained deep space for Byte[] arrByteObj = new Byte[] { 3, 4, 5 } --> " + SizeUtil.deepSizeOfObject(arrByteObj));</span></div>
<div class="MsoNormal">
<span style="font-family: "times new roman" , serif;"><br /></span></div>
<div class="MsoNormal">
<span style="font-family: "times new roman" , serif;"><span class="Apple-tab-span" style="white-space: pre;"> </span>int[] arrInt = new int[] { 0 };</span></div>
<div class="MsoNormal">
<span style="font-family: "times new roman" , serif;"><span class="Apple-tab-span" style="white-space: pre;"> </span>System.out.println("Retained shallow space for int[] arrInt = new int[] { 0 } --> " + SizeUtil.shallowSizeOfObject(arrInt));</span></div>
<div class="MsoNormal">
<span style="font-family: "times new roman" , serif;"><span class="Apple-tab-span" style="white-space: pre;"> </span>System.out.println("Retained deep space for int[] arrInt = new int[] { 0 } --> " + SizeUtil.deepSizeOfObject(arrInt));</span></div>
<div class="MsoNormal">
<span style="font-family: "times new roman" , serif;"><br /></span></div>
<div class="MsoNormal">
<span style="font-family: "times new roman" , serif;"><span class="Apple-tab-span" style="white-space: pre;"> </span>long[] arrLong = new long[] { 0 };</span></div>
<div class="MsoNormal">
<span style="font-family: "times new roman" , serif;"><span class="Apple-tab-span" style="white-space: pre;"> </span>System.out.println("Retained shallow space for long[] arrLong = new long[] { 0 } --> " + SizeUtil.shallowSizeOfObject(arrLong));</span></div>
<div class="MsoNormal">
<span style="font-family: "times new roman" , serif;"><span class="Apple-tab-span" style="white-space: pre;"> </span>System.out.println("Retained deep space for long[] arrLong = new long[] { 0 } --> " + SizeUtil.deepSizeOfObject(arrLong));</span></div>
<div class="MsoNormal">
<span style="font-family: "times new roman" , serif;"><br /></span></div>
<div class="MsoNormal">
<span style="font-family: "times new roman" , serif;"><span class="Apple-tab-span" style="white-space: pre;"> </span>int[][] arrIntTwoDim = new int[5][5]; </span></div>
<div class="MsoNormal">
<span style="font-family: "times new roman" , serif;"><br /></span></div>
<div class="MsoNormal">
<span style="font-family: "times new roman" , serif;"><span class="Apple-tab-span" style="white-space: pre;"> </span>for (int i = 0; i < 5; i++) {</span></div>
<div class="MsoNormal">
<span style="font-family: "times new roman" , serif;"><span class="Apple-tab-span" style="white-space: pre;"> </span>for (int j = 0; j < 5; j++) {</span></div>
<div class="MsoNormal">
<span style="font-family: "times new roman" , serif;"><span class="Apple-tab-span" style="white-space: pre;"> </span>arrIntTwoDim[i][j] = i * j;</span></div>
<div class="MsoNormal">
<span style="font-family: "times new roman" , serif;"><span class="Apple-tab-span" style="white-space: pre;"> </span>}</span></div>
<div class="MsoNormal">
<span style="font-family: "times new roman" , serif;"><span class="Apple-tab-span" style="white-space: pre;"> </span>}</span></div>
<div class="MsoNormal">
<span style="font-family: "times new roman" , serif;"><span class="Apple-tab-span" style="white-space: pre;"> </span>System.out.println("Retained shallow space for int[][] arrIntTwoDim = new int[5][5] --> " + SizeUtil.shallowSizeOfObject(arrIntTwoDim));</span></div>
<div class="MsoNormal">
<span style="font-family: "times new roman" , serif;"><span class="Apple-tab-span" style="white-space: pre;"> </span>System.out.println("Retained deep space for int[][] arrIntTwoDim = new int[5][5] --> " + SizeUtil.deepSizeOfObject(arrIntTwoDim));</span></div>
<div class="MsoNormal">
<span style="font-family: "times new roman" , serif;"><br /></span></div>
<div class="MsoNormal">
<span style="font-family: "times new roman" , serif;"><span class="Apple-tab-span" style="white-space: pre;"> </span>String[] arrStr = new String[4];</span></div>
<div class="MsoNormal">
<span style="font-family: "times new roman" , serif;"><span class="Apple-tab-span" style="white-space: pre;"> </span>arrStr[0] = "1";</span></div>
<div class="MsoNormal">
<span style="font-family: "times new roman" , serif;"><span class="Apple-tab-span" style="white-space: pre;"> </span>arrStr[1] = "2";</span></div>
<div class="MsoNormal">
<span style="font-family: "times new roman" , serif;"><span class="Apple-tab-span" style="white-space: pre;"> </span>arrStr[2] = "3";</span></div>
<div class="MsoNormal">
<span style="font-family: "times new roman" , serif;"><span class="Apple-tab-span" style="white-space: pre;"> </span>arrStr[3] = null;</span></div>
<div class="MsoNormal">
<span style="font-family: "times new roman" , serif;"><span class="Apple-tab-span" style="white-space: pre;"> </span>System.out.println("Retained shallow space for String[] arrStr = new String[4] --> " + SizeUtil.shallowSizeOfObject(arrStr));</span></div>
<div class="MsoNormal">
<span style="font-family: "times new roman" , serif;"><span class="Apple-tab-span" style="white-space: pre;"> </span>System.out.println("Retained deep space for String[] arrStr = new String[4] --> " + SizeUtil.deepSizeOfObject(arrStr));</span></div>
<div class="MsoNormal">
<span style="font-family: "times new roman" , serif;"><br /></span></div>
<div class="MsoNormal">
<span style="font-family: "times new roman" , serif;"><span class="Apple-tab-span" style="white-space: pre;"> </span>TestSizeOf myTest = new TestSizeOf("test", 11111111);</span></div>
<div class="MsoNormal">
<span style="font-family: "times new roman" , serif;"><span class="Apple-tab-span" style="white-space: pre;"> </span>System.out.println("Retained shallow space for TestSizeOf myTest = new TestSizeOf(\"test\", 11111111) --> " + SizeUtil.shallowSizeOfObject(myTest));</span></div>
<div class="MsoNormal">
<span style="font-family: "times new roman" , serif;"><span class="Apple-tab-span" style="white-space: pre;"> </span>System.out.println("Retained deep space for TestSizeOf myTest = new TestSizeOf(\"test\", 11111111) --> " + SizeUtil.deepSizeOfObject(myTest));</span></div>
<div class="MsoNormal">
<span style="font-family: "times new roman" , serif;"><br /></span></div>
<div class="MsoNormal">
<span style="font-family: "times new roman" , serif;"><span class="Apple-tab-span" style="white-space: pre;"> </span>Object obj = new String("test");</span></div>
<div class="MsoNormal">
<span style="font-family: "times new roman" , serif;"><span class="Apple-tab-span" style="white-space: pre;"> </span>System.out.println("Retained shallow space for Object obj = new String(\"test\") --> " + SizeUtil.shallowSizeOfObject(obj));</span></div>
<div class="MsoNormal">
<span style="font-family: "times new roman" , serif;"><span class="Apple-tab-span" style="white-space: pre;"> </span>System.out.println("Retained deep space for Object obj = new String(\"test\") --> " + SizeUtil.deepSizeOfObject(obj));</span></div>
<div class="MsoNormal">
<span class="Apple-tab-span" style="white-space: pre;"><span style="font-family: "times new roman" , serif;"> </span></span></div>
<div class="MsoNormal">
<span style="font-family: "times new roman" , serif;"><span class="Apple-tab-span" style="white-space: pre;"> </span>}</span></div>
<div class="MsoNormal">
<span style="font-family: "times new roman" , serif;"><br /></span></div>
<div class="MsoNormal">
</div>
<div class="MsoNormal">
<span style="font-family: "times new roman" , serif;">}</span></div>
<div>
<br /></div>
<div>
Here is the output of the program; </div>
<div>
<br /></div>
<div>
<div>
Retained space for boolean bo1 = true --> 16</div>
<div>
<span style="color: red;">Explanation: 12 bytes header + 1 byte for boolean = 13 rounded to 16 bytes</span></div>
<div>
Retained space for byte b1 = 3 --> 16</div>
<div>
<span style="color: red;">Explanation: 12 bytes header + 1 byte for byte= 13 rounded to 16 bytes</span></div>
<div>
Retained space for short sh1 = 3 --> 16</div>
<div>
<span style="color: red;">Explanation: 12 bytes header + 2 bytes for short = 14 rounded to 16 bytes</span></div>
<div>
Retained space for int i1 = 3 --> 16</div>
<div>
<span style="color: red;">Explanation: 12 bytes header + 4 bytes for int = 16 no need to round</span></div>
<div>
Retained space for long l1 = 3L --> 24</div>
<div>
<span style="color: red;">Explanation: 12 bytes header + 8 bytes for long = 20 rounded to 24 bytes</span></div>
<div>
Retained space for char c1 = 'A' --> 16</div>
<div>
<span style="color: red;">Explanation: 12 bytes header + 2 bytes for 1 char = 14 rounded to 16 bytes</span></div>
<div>
Retained space for float f1 = 3f --> 16</div>
<div>
<span style="color: red;">Explanation: 12 bytes header + 4 bytes for float= 16</span><span style="color: red;"> </span><span style="color: red;">no need to round</span></div>
<div>
Retained space for double d1 = 3 --> 24</div>
<div>
<span style="color: red;">Explanation: 12 bytes header + 8 bytes for double= 20 rounded to 24 bytes</span></div>
<div>
Retained space for Object o = new Object() --> 16</div>
<div>
<span style="color: red;">Explanation: 12 bytes header = 12 rounded to 16 bytes</span></div>
<div>
Retained space for String st1 = "A" --> 48</div>
<div>
<span style="color: red;">Explanation: (for String)12 bytes header + 4 bytes ref to char[] + 4 bytes hash int value = 20 rounded to <b>24 bytes</b> </span><br />
<span style="color: red;">+ </span><br />
<span style="color: red;">(</span><span style="color: red;">for char[]) 12 bytes header + 4 bytes for length of char[] + 1(1 character String)*2 bytes =18 bytes rounded to <b>24 bytes</b></span><br />
<span style="color: red;">-> so 24 + 24 =<b> 48 bytes</b></span></div>
<div>
Retained shallow space for byte[] arrByte = new byte[20] --> 40</div>
<div>
<span style="color: red;">Explanation: 12 bytes header + 4 bytes for length of byte[] + 20 (20 bytes in array) * 1 bytes = 36 rounded to 40 bytes</span></div>
<div>
Retained deep space for byte[] arrByte = new byte[20] --> 40</div>
<div>
<span style="color: red;">Explanation</span><span style="color: red;">: 12 bytes header + 4 bytes for length of byte[] </span><span style="color: red;">+ 20 (20 bytes in array) * 1 bytes = 36 rounded to 40 bytes</span></div>
<div>
Retained shallow space for Byte[] arrByteObj = new Byte[] { 3, 4, 5 } --> 32</div>
<div>
<span style="color: red;">Explanation</span><span style="color: red;">: 12 bytes header + 4 bytes for length of byte[] </span><span style="color: red;">+ 3 (ref to each array element) * 4 bytes = 28 rounded to 32 bytes</span></div>
<div>
Retained deep space for Byte[] arrByteObj = new Byte[] { 3, 4, 5 } --> 80</div>
<div>
<span style="color: red;">Explanation</span><span style="color: red;">: 12 bytes header + 4 bytes for length of byte[] </span><span style="color: red;">+ 3 (ref to each array element) * 4 bytes = 28 rounded to<b> 32 bytes</b></span><br />
<span style="color: red;"><b>+</b></span><br />
<span style="color: red;">3 (for 3 array elements) * 16 bytes = <b>48 bytes</b></span><br />
<span style="color: red;">-> so 32 + 48 = <b>80 bytes</b></span></div>
<div>
Retained shallow space for int[] arrInt = new int[] { 0 } --> 24</div>
<div>
<span style="color: red;">Explanation: 12 bytes header + </span><span style="color: red;">4 bytes for length of int [] + 1(1 int in array) * 4 bytes </span><span style="color: red;">= 20 rounded to 24 bytes</span></div>
<div>
Retained deep space for int[] arrInt = new int[] { 0 } --> 24</div>
<div>
<span style="color: red;">Explanation: 12 bytes header + </span><span style="color: red;">4 bytes for length of int [] + 1(1 int in array) * 4 bytes </span><span style="color: red;">= 20 rounded to 24 bytes</span></div>
<div>
Retained shallow space for long[] arrLong = new long[] { 0 } --> 24</div>
<div>
<span style="color: red;">Explanation: 12 bytes header + </span><span style="color: red;">4 bytes for length of int [] + 1(1 long in array) * 8 bytes </span><span style="color: red;">= 24 rounded to 24 bytes</span></div>
<div>
Retained deep space for long[] arrLong = new long[] { 0 } --> 24</div>
<div>
<span style="color: red;">Explanation: 12 bytes header + </span><span style="color: red;">4 bytes for length of int [] + 1(1 long in array) * 8 bytes </span><span style="color: red;">= 24 rounded to 24 bytes</span></div>
<div>
Retained shallow space for int[][] arrIntTwoDim = new int[5][5] --> 40</div>
<div>
<span style="color: red;">Explanation: (for outer array)12 bytes header + 4 bytes for </span><span style="color: red;"> length of int [][] + 5(ref to 5 inner array) * 4 bytes </span><span style="color: red;">= 36 rounded to 40 bytes</span></div>
<div>
Retained deep space for int[][] arrIntTwoDim = new int[5][5] --> 240</div>
<div>
<span style="color: red;">Explanation: (for outer array)12 bytes header + 4 bytes for </span><span style="color: red;"> length of int [][] + 5(ref to 5 inner array) * 4 bytes </span><span style="color: red;">= 36 rounded to <b>40 bytes</b></span><br />
<span style="color: red;">+</span><br />
<span style="color: red;">(for inner arrays) 5(5 inner array) * (12 bytes header + </span><span style="color: red;"> 4 bytes for </span><span style="color: red;"> length of int [] + 5 * 4 bytes = 36 rounded to 40 bytes</span><span style="color: red;">) = <b>200 bytes</b> no need to round</span><br />
<span style="color: red;">-> so 40 + 200 = <b>240 bytes</b></span></div>
<div>
Retained shallow space for String[] arrStr = new String[4] --> 32</div>
<div>
<span style="color: red;">Explanation: 12 bytes header + </span><span style="color: red;">4 bytes for </span><span style="color: red;"> length of String + 4 (4 String in array) * 4 bytes</span><span style="color: red;"> = 32 bytes no need to round</span></div>
<div>
Retained deep space for String[] arrStr = new String[4] --> 176</div>
<div>
<span style="color: red;">Explanation: 12 bytes header + </span><span style="color: red;">4 bytes for </span><span style="color: red;"> length of String + 4 (4 String in array) * 4 bytes</span><span style="color: red;"> = <b>32 bytes</b> no need to round</span><br />
<span style="color: red;">+</span><br />
<span style="color: red;">3 (4 th value is null so has no memory space) * 48 bytes (1 String with 1 character is 48 bytes as explained before) = <b>144 bytes</b></span><br />
<span style="color: red;">so -> 32 + 144 = <b>176 bytes</b></span></div>
<div>
Retained shallow space for TestSizeOf myTest = new TestSizeOf("test", 11111111) --> 24</div>
<div>
<span style="color: red;">Explanation: 12 bytes header + 1 (ref to String field of the class) * 4 bytes + 4 bytes for int field = 20 bytes rounded to </span><b style="color: red;">24 bytes</b></div>
<div>
Retained deep space for TestSizeOf myTest = new TestSizeOf("test", 11111111) --> 72</div>
<div>
<span style="color: red;">Explanation: 12 bytes header + 1 (ref to String field of the class) * 4 bytes </span><span style="color: red;">+ 4 bytes for int field</span><span style="color: red;"> = 2</span><span style="color: red;">0 bytes rounded to </span><b style="color: red;">24 bytes</b><br />
<span style="color: red;"><b>+</b></span><br />
<span style="color: red;">(for String field) 12 bytes header + 4 bytes for ref of char[] + 4 bytes for hash int value = 20 rounded to 24 bytes </span><br />
<span style="color: red;"><b>+</b></span><br />
<span style="color: red;">(for char[] of String) 12 bytes header + 4 bytes length + 4 * 2 bytes = 24 bytes no need to round</span><br />
<span style="color: red;">so-> 24 + 24 = <b>48 bytes</b></span><br />
<span style="color: red;">so the final result-> 24 + 48 </span><span style="color: red;">= 72</span><b style="color: red;"> bytes</b></div>
<div>
Retained shallow space for Object obj = new String("test") --> 24</div>
<div>
<span style="color: red;">Explanation: </span><span style="color: red;">12 bytes header + 4 bytes for ref of char[] + 4 bytes for hash int value = 20 rounded to 24 bytes </span></div>
<div>
Retained deep space for Object obj = new String("test") --> 48</div>
</div>
<div>
<span style="color: red;">Explanation: </span><span style="color: red;">12 bytes header + 4 bytes for ref of char[] + 4 bytes for hash int value = 20 rounded to <b>24 bytes </b></span><br />
<span style="color: red;">+</span><br />
<span style="color: red;">(for char[] of String) 12 bytes header + 4 bytes length + 4 * 2 bytes = <b>24 bytes</b> no need to round</span></div>
<div>
<span style="color: red;">so-> 24 + 24 = </span><b style="color: red;">48 bytes </b><br />
<b style="color: red;"><span style="font-family: inherit;"><br /></span></b></div>
<div class="MsoNormal">
<span style="font-family: inherit;">You can see the explanations in the below of each output.</span><br />
<span style="font-family: inherit;"><br /></span></div>
<div class="MsoNormal">
<span style="font-family: inherit;">Although we use primitive types in the first few examples, they are boxed to their wrapper classes when we call the deepSizeOfObject method. Normally we don't boxed them, we just use them like that just for explanation.</span><br />
<span style="font-family: inherit;"><br /></span></div>
<div class="MsoNormal">
<span style="font-family: inherit;">All the objects has 12 bytes header in the example. The wrapper objects has 12 bytes header + primitive size memory usage. Arrays has extra 4 bytes for their length.</span><br />
<span style="font-family: inherit;"><br /></span></div>
<div class="MsoNormal">
<span style="font-family: inherit;">The two dimensional arrays are just array of arrays.So the outer array has separate header and all the inner arrays has separate headers also.</span><br />
<span style="font-family: inherit;"><br /></span></div>
<div class="MsoNormal">
<span style="font-family: inherit;">The TestSizeOf class has two fields as String and int. They are calculated separately in the deepSizeOfObject method.</span></div>
<div class="MsoNormal">
<span style="font-family: "times new roman" , serif;"><br /></span></div>
<div style="text-align: left;">
<span style="font-family: "times new roman" , serif;"><b><u>Conclusion:</u></b></span><br />
<span style="font-family: "times new roman" , serif;"><b><u><br /></u></b></span>
<span style="font-family: "times new roman" , serif;"> </span><span style="font-family: inherit;">We see the real retained memory space of java objects. Although </span><span style="font-family: "times new roman" , serif; font-size: 15.5555562973022px;">the current state of the object like whether it is garbage collected or it's synchronization locked is contended may affect the size of the object on the heap, i</span><span style="font-family: inherit;">f we get a general understanding of how much our objects will occupy, we can reconsider our java code to get less space and more performance. We'll be talking about memory consumption of String and StringBuilder objects and some suggestions on using String related objects in the next post.</span></div>
<div style="text-align: left;">
<span style="font-family: "times new roman" , serif;"><br /></span></div>
<div style="text-align: left;">
<span style="font-family: "times new roman" , serif;">You can download the source code from <a href="https://github.com/agelenler/myblog/tree/master/java/src/memory" target="_blank">here</a>.</span></div>
<div style="text-align: center;">
<span style="font-family: "times new roman" , serif;"><br /></span></div>
Ali Gelenlerhttp://www.blogger.com/profile/09439697648573423668noreply@blogger.com0tag:blogger.com,1999:blog-3858181542467916490.post-29148939940129345152015-01-12T23:13:00.000+02:002015-01-12T23:27:24.947+02:00Where Is The Java Primitives Stored In Memory ? <span style="font-family: Times New Roman, serif;"><b><u>Introduction</u></b></span><u style="font-family: 'Times New Roman', serif; font-size: 16px; font-weight: bold;">:</u><br />
<u style="font-family: 'Times New Roman', serif; font-size: 16px; font-weight: bold;"><br /></u>
<span style="font-family: 'Times New Roman', serif; font-size: 16px; font-weight: bold;"> </span><span style="font-family: 'Times New Roman', serif; font-size: 16px;">Today we'll mention about the memory usage of primitives. There is two different usage of primitive types in java in terms of memory usage. One is using the primitives as local variables in an instance or static method, the other is using them as class variables defining directly at the class level.</span><br />
<span style="font-family: 'Times New Roman', serif; font-size: 16px;"><br /></span>
<span style="font-family: Times New Roman, serif;"><b><u>Primitives as Local Variables</u></b></span><u style="font-family: 'Times New Roman', serif; font-size: 16px; font-weight: bold;">:</u><br />
<u style="font-family: 'Times New Roman', serif; font-size: 16px; font-weight: bold;"><br /></u>
<span style="font-family: 'Times New Roman', serif; font-size: 16px;"> As we know a</span><span style="font-family: 'Times New Roman', serif; font-size: 15.5555562973022px;">ll Threads in java has their own stack and when we call a </span><span style="font-family: 'Times New Roman', serif; font-size: 16px;">java method (not a native method) a new frame is added to the current thread's frame by the JVM. All the local variables including the method parameters and local variables defined in the method are added to this new frame on to the stack. For an instance method there will also be an objectref as local variable at position 0 which is an implicit this pointer pointing to the current instance of the class. </span><br />
<span style="font-family: 'Times New Roman', serif; font-size: 16px;">Note: We may later talk about the method call architecture in detail including invokevirtual (for instance method call), invokestatic (for static method call), invokespecial (for constructor call (to be able to call the super's constructor first)) and invokeinterface (to call an instance method given a reference to the interface- to see difference of invokeinterface look for this <a href="http://stackoverflow.com/questions/1504633/what-is-the-point-of-invokeinterface" target="_blank">link</a>.). The fastest ones of course invokestatic and invokespecial since they use static binding instead of dynamc binding.</span><br />
Anyway since we use thread's stack frame for all the local variables all the pritimives defined here will be holded in the stack and will be discarded at the end of the method call directly.<br />
<br />
<span style="font-family: Times New Roman, serif;"><b><u>Primitives as Class Variables</u></b></span><u style="font-family: 'Times New Roman', serif; font-size: 16px; font-weight: bold;">:</u><br />
<u style="font-family: 'Times New Roman', serif; font-size: 16px; font-weight: bold;"><br /></u>
<span style="font-family: 'Times New Roman', serif; font-size: 16px;"> Since the objects do not have their own stack, the primitives defined as class variables will not be on any stack, instead they will be on the heap under the reference of the class that includes the variable whenever a new instance created on that class.</span><br />
<span style="font-family: 'Times New Roman', serif; font-size: 16px;"><br /></span>
<span style="font-family: Times New Roman, serif;"><b><u>Example</u></b></span><u style="font-family: 'Times New Roman', serif; font-size: 16px; font-weight: bold;">:</u><br />
<u style="font-family: 'Times New Roman', serif; font-size: 16px; font-weight: bold;"><br /></u>
<span style="font-family: 'Times New Roman', serif; font-size: 16px;">public class TestPrimitiveMemory {</span><br />
<span style="font-family: 'Times New Roman', serif; font-size: 16px;"> </span><br />
<span style="font-family: 'Times New Roman', serif; font-size: 16px;"> private int i; // no need to initialize since its automatically done</span><br />
<span style="font-family: 'Times New Roman', serif; font-size: 16px;"><br /></span>
<span style="font-family: Times New Roman, serif;"> public void m1() {</span><br />
<span style="font-family: Times New Roman, serif;"> int y = 0; // need to initialize</span><br />
<span style="font-family: Times New Roman, serif;"> }</span><br />
<span style="font-family: 'Times New Roman', serif; font-size: 16px;">}</span><br />
<span style="font-family: 'Times New Roman', serif; font-size: 16px;"><br /></span>
<span style="font-family: 'Times New Roman', serif; font-size: 15.5555562973022px;">TestPrimitiveMemory tpm = new </span><span style="font-family: 'Times New Roman', serif; font-size: 15.5555562973022px;">TestPrimitiveMemory</span><span style="font-family: 'Times New Roman', serif; font-size: 15.5555562973022px;"> ();// at this line int i with a value of 0 will be added on the heap.</span><br />
<span style="font-family: 'Times New Roman', serif; font-size: 15.5555562973022px;">tpm.m1();// m1 is put on to the current thread's stack frame and int y primitive variable is created on the stack.</span><br />
<span style="font-family: 'Times New Roman', serif; font-size: 15.5555562973022px;"><br /></span>
<span style="font-family: Times New Roman, serif;"><b><u>Conclusion</u></b></span><u style="font-family: 'Times New Roman', serif; font-size: 16px; font-weight: bold;">:</u><br />
<u style="font-family: 'Times New Roman', serif; font-size: 16px; font-weight: bold;"><br /></u>
<span style="font-family: Times New Roman, serif;"> We pointed out where the primitive variables are holded on the memory depending on the place it is defined. Primitives created as local variables are created on stack while primitives created as class variables are created on heap.</span><br />
<u style="font-family: 'Times New Roman', serif; font-size: 16px; font-weight: bold;"><br /></u>
<span style="font-family: 'Times New Roman', serif; font-size: 15.5555562973022px;"><br /></span>
Ali Gelenlerhttp://www.blogger.com/profile/09439697648573423668noreply@blogger.com0tag:blogger.com,1999:blog-3858181542467916490.post-4560673484747625362015-01-01T20:59:00.000+02:002015-02-24T23:24:05.230+02:00Radio Button Changing Check Property in JQuery<span style="font-family: Times New Roman, serif;"><b><u>Radio Button .prop("checked") Property</u></b></span><u style="font-family: 'Times New Roman', serif; font-size: 16px; font-weight: bold;">:</u><br />
<u style="font-family: 'Times New Roman', serif; font-size: 16px; font-weight: bold;"><br /></u>
<span style="font-family: Times New Roman, serif;"> You can use .prop("checked") property of a JQuery object to change check property of radio button. Here is an example.</span><br />
<span style="font-family: Times New Roman, serif;"><br /></span>
<b style="font-family: 'Times New Roman', serif;"><u>Example:</u></b><br />
<b style="font-family: 'Times New Roman', serif;"><u><br /></u></b>
<span style="font-family: Times New Roman, serif;"><html></span><br />
<span style="font-family: Times New Roman, serif;"> <head></span><br />
<span style="font-family: Times New Roman, serif;"> <script src="http://ajax.googleapis.com/ajax/libs/jquery/1.11.1/jquery.min.js"></script></span><br />
<span style="font-family: Times New Roman, serif;"> <script></span><br />
<span style="font-family: Times New Roman, serif;"> $(document).ready(function() {</span><br />
<span style="font-family: Times New Roman, serif;"> $('#myButton').click(function () { </span><br />
<span style="font-family: Times New Roman, serif;"> if ($('#A').prop("checked")) {</span><br />
<span style="font-family: Times New Roman, serif;"><span class="Apple-tab-span" style="white-space: pre;"> </span> $('#A').prop("checked", false); </span><br />
<span style="font-family: Times New Roman, serif;"><span class="Apple-tab-span" style="white-space: pre;"> </span> $('#B').prop("checked", true); </span><br />
<span style="font-family: Times New Roman, serif;"><span class="Apple-tab-span" style="white-space: pre;"> </span>} </span><br />
<span style="font-family: Times New Roman, serif;"><span class="Apple-tab-span" style="white-space: pre;"> </span>else if ($('#B').prop("checked")) {</span><br />
<span style="font-family: Times New Roman, serif;"><span class="Apple-tab-span" style="white-space: pre;"> </span> $('#A').prop("checked", true); </span><br />
<span style="font-family: Times New Roman, serif;"><span class="Apple-tab-span" style="white-space: pre;"> </span> $('#B').prop("checked", false);</span><br />
<span style="font-family: Times New Roman, serif;"><span class="Apple-tab-span" style="white-space: pre;"> </span>}</span><br />
<span style="font-family: Times New Roman, serif;"> return true;</span><br />
<span style="font-family: Times New Roman, serif;"> }); </span><br />
<span style="font-family: Times New Roman, serif;"> });</span><br />
<span style="font-family: Times New Roman, serif;"> </script></span><br />
<span style="font-family: Times New Roman, serif;"> </head></span><br />
<span style="font-family: Times New Roman, serif;"> <body></span><br />
<span style="font-family: Times New Roman, serif;"> <input type="radio" name="rd" id="A" value="A_value" checked="true">A<br/></span><br />
<span style="font-family: Times New Roman, serif;"> <input type="radio" name="rd" id="B" value="B_value">B</span><br />
<span style="font-family: Times New Roman, serif;"> <br/></span><br />
<span style="font-family: Times New Roman, serif;"> <input type="button" id="myButton" value="change selection"></span><br />
<span style="font-family: Times New Roman, serif;"> </body></span><br />
<span style="font-family: Times New Roman, serif;"></html> </span><br />
<span style="font-family: Times New Roman, serif;"><br /></span>
<span style="font-family: 'Times New Roman', serif;">The screen will look like the following.</span><br />
<span style="font-family: 'Times New Roman', serif;"><br /></span>
<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEj53YHlTUJL_CLpjkoFltSykymBzGzp-XgG2KNe4nAD_D3P7xeAlY7JtCUi6mzH4q57e7u0KRby0q25ZqjGEPzRwXqP6Xn_2Iwz-pan4mf79qeGkdE457YlHTh4RdNUtaiCRENYhyphenhyphenUep1Fr/s1600/9.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img alt="Radio Button Changing Check Property in JQuery" border="0" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEj53YHlTUJL_CLpjkoFltSykymBzGzp-XgG2KNe4nAD_D3P7xeAlY7JtCUi6mzH4q57e7u0KRby0q25ZqjGEPzRwXqP6Xn_2Iwz-pan4mf79qeGkdE457YlHTh4RdNUtaiCRENYhyphenhyphenUep1Fr/s1600/9.png" height="173" title="Radio Button Changing Check Property in JQuery" width="320" /></a></div>
<div class="separator" style="clear: both; text-align: center;">
Figure 1</div>
<div style="text-align: center;">
<span style="font-family: 'Times New Roman', serif;"><br /></span>
<br />
<div style="text-align: left;">
<span style="font-family: 'Times New Roman', serif;">You can download the source code from <a href="https://github.com/agelenler/myblog/tree/master/js_jQuery/radio" target="_blank">here</a>.</span></div>
</div>
Ali Gelenlerhttp://www.blogger.com/profile/09439697648573423668noreply@blogger.com0tag:blogger.com,1999:blog-3858181542467916490.post-10920966011199169102014-11-27T15:10:00.000+02:002014-11-28T08:34:00.715+02:00Using hashCode(), equals() and toString() Methods in Java<span style="font-family: Times New Roman, serif;"><b><u>Introduction</u></b></span><u style="font-family: 'Times New Roman', serif; font-size: 16px; font-weight: bold;">:</u><br />
<u style="font-family: 'Times New Roman', serif; font-size: 16px; font-weight: bold;"><br /></u>
<span style="font-family: 'Times New Roman', serif; font-size: 16px;"> The Object class being the super class of all the classes in Java has the methods hashCode(), </span><span style="font-family: 'Times New Roman', serif; font-size: 16px;">equals(Object) and </span><span style="font-family: 'Times New Roman', serif; font-size: 16px;">toString()</span><span style="font-family: 'Times New Roman', serif; font-size: 16px;"> addition to some other methods like </span><span style="font-family: 'Times New Roman', serif; font-size: 16px;">clone(), getClass() and so on. I'll try to illustrate the important points of the use of hashCode(), equals() and toString() methods today.</span><br />
<span style="font-family: 'Times New Roman', serif; font-size: 16px;"><br /></span>
<span style="font-family: Times New Roman, serif;"><b><u>Default Implementation</u></b></span><u style="font-family: 'Times New Roman', serif; font-size: 16px; font-weight: bold;">:</u><br />
<span style="font-family: 'Times New Roman', serif; font-size: 16px;"><br /></span>
<span style="font-family: 'Times New Roman', serif; font-size: 16px;"> By default hashCode() is a native method with a signature "public native int hashCode()". The Java doc. says that </span><br />
<span style="font-family: 'Times New Roman', serif; font-size: 16px;">* It is used to return a hash code value of an object to be used in hash tables like HashMap and HashSet which we introduce in later writes. </span><br />
<span style="font-family: 'Times New Roman', serif; font-size: 16px;">* The hashCode() must return the same integer value if it's invoked more than once, however it's not required to be the same value with another execution. </span><br />
<span style="font-family: 'Times New Roman', serif; font-size: 16px;">* You have to obey the contract of "equal objects must have equal hash codes", however two unequal objects also can have the same hash code which decrease the performance of hash tables.</span><br />
<span style="font-family: 'Times New Roman', serif; font-size: 16px;">* It is not a must that the hashcode method of Object class return distinct integers for different objects so don't rely on that.</span><br />
<span style="font-family: 'Times New Roman', serif; font-size: 16px;">* It is typically implemented to return the internal address of the object converting to an integer, but it's not a requirement of Java programming language and it's JVM dependent.</span><br />
<span style="font-family: 'Times New Roman', serif; font-size: 16px;"><br /></span>
<span style="font-family: Times New Roman, serif;"><b><u>Overriding Default Implementation</u></b></span><u style="font-family: 'Times New Roman', serif; font-size: 16px; font-weight: bold;">:</u><br />
<u style="font-family: 'Times New Roman', serif; font-size: 16px; font-weight: bold;"><br /></u>
<span style="font-family: 'Times New Roman', serif; font-size: 16px;"> If you override the hashCode() method you have to rely on the contract of "</span><span style="font-family: 'Times New Roman', serif; font-size: 16px;">equal objects must have equal hash codes" and define the fields that you want to be included in the hashCode and equals implementations.Then you should use a prime number as a multiplier and use the primitive fields adding to the result, and use the hashCode() methods of Object fields like String's hashCode() implementation used in the Example 1. Many of the IDE's have the ability of creating a reasonable hashCode() and equals() implementations as well as the toString() method. For example in eclipse you can use Source -> Generate hashCode() and equals(). Below is an example of hashCode(), equals() and toString() implementations created for a String (named innerStr) and an int(innerInt) using the eclipse.</span><br />
<span style="font-family: 'Times New Roman', serif; font-size: 16px;">For the equals() method, you should consider the null conditions, direct equality of references, runtime classes of the object instance (if you want the same runtime class for both instance), and the the equality of the required fields using == for primitives and using the correspending equals() methods for the Objects. The default equals method just compare the references not the values as can be shown below.</span><br />
<span style="font-family: 'Times New Roman', serif; font-size: 16px;"><br /></span>
<span style="font-family: Times New Roman, serif;"> public boolean equals(Object obj) {</span><br />
<span style="font-family: Times New Roman, serif;"> return (this == obj);</span><br />
<br />
<span style="font-family: Times New Roman, serif;"> }</span><br />
<span style="font-family: 'Times New Roman', serif; font-size: 16px;"><br /></span>
<b style="font-family: 'Times New Roman', serif;"><u>Example 1:</u></b><br />
<b style="font-family: 'Times New Roman', serif;"><u><br /></u></b>
<span style="font-family: 'Times New Roman', serif;"> </span><span style="font-family: Times New Roman, serif;"><span class="Apple-tab-span" style="white-space: pre;"> </span>@Override</span><br />
<span style="font-family: Times New Roman, serif;"><span class="Apple-tab-span" style="white-space: pre;"> </span>public int hashCode() {</span><br />
<span style="font-family: Times New Roman, serif;"><span class="Apple-tab-span" style="white-space: pre;"> </span>final int prime = 31;</span><br />
<span style="font-family: Times New Roman, serif;"><span class="Apple-tab-span" style="white-space: pre;"> </span>int result = 1;</span><br />
<span style="font-family: Times New Roman, serif;"><span class="Apple-tab-span" style="white-space: pre;"> </span>result = prime * result + innerInt;</span><br />
<span style="font-family: Times New Roman, serif;"><span class="Apple-tab-span" style="white-space: pre;"> </span>result = prime * result + ((innerStr == null) ? 0 : innerStr.hashCode());</span><br />
<span style="font-family: Times New Roman, serif;"><span class="Apple-tab-span" style="white-space: pre;"> </span>return result;</span><br />
<span style="font-family: Times New Roman, serif;"><span class="Apple-tab-span" style="white-space: pre;"> </span>}</span><br />
<span style="font-family: Times New Roman, serif;"><br /></span>
<span style="font-family: Times New Roman, serif;"><span class="Apple-tab-span" style="white-space: pre;"> </span>@Override</span><br />
<span style="font-family: Times New Roman, serif;"><span class="Apple-tab-span" style="white-space: pre;"> </span>public boolean equals(Object obj) {</span><br />
<span style="font-family: Times New Roman, serif;"><span class="Apple-tab-span" style="white-space: pre;"> </span>if (this == obj)</span><br />
<span style="font-family: Times New Roman, serif;"><span class="Apple-tab-span" style="white-space: pre;"> </span>return true;</span><br />
<span style="font-family: Times New Roman, serif;"><span class="Apple-tab-span" style="white-space: pre;"> </span>if (obj == null)</span><br />
<span style="font-family: Times New Roman, serif;"><span class="Apple-tab-span" style="white-space: pre;"> </span>return false;</span><br />
<span style="font-family: Times New Roman, serif;"><span class="Apple-tab-span" style="white-space: pre;"> </span>if (getClass() != obj.getClass())</span><br />
<span style="font-family: Times New Roman, serif;"><span class="Apple-tab-span" style="white-space: pre;"> </span>return false;</span><br />
<span style="font-family: Times New Roman, serif;"><span class="Apple-tab-span" style="white-space: pre;"> </span>HashSetEx other = (HashSetEx) obj;</span><br />
<span style="font-family: Times New Roman, serif;"><span class="Apple-tab-span" style="white-space: pre;"> </span>if (innerInt != other.innerInt)</span><br />
<span style="font-family: Times New Roman, serif;"><span class="Apple-tab-span" style="white-space: pre;"> </span>return false;</span><br />
<span style="font-family: Times New Roman, serif;"><span class="Apple-tab-span" style="white-space: pre;"> </span>if (innerStr == null) {</span><br />
<span style="font-family: Times New Roman, serif;"><span class="Apple-tab-span" style="white-space: pre;"> </span>if (other.innerStr != null)</span><br />
<span style="font-family: Times New Roman, serif;"><span class="Apple-tab-span" style="white-space: pre;"> </span>return false;</span><br />
<span style="font-family: Times New Roman, serif;"><span class="Apple-tab-span" style="white-space: pre;"> </span>} else if (!innerStr.equals(other.innerStr))</span><br />
<span style="font-family: Times New Roman, serif;"><span class="Apple-tab-span" style="white-space: pre;"> </span>return false;</span><br />
<span style="font-family: Times New Roman, serif;"><span class="Apple-tab-span" style="white-space: pre;"> </span>return true;</span><br />
<span style="font-family: Times New Roman, serif;"><span class="Apple-tab-span" style="white-space: pre;"> </span>}</span><br />
<span style="font-family: Times New Roman, serif;"><br /></span>
<span style="font-family: Times New Roman, serif;"><span class="Apple-tab-span" style="white-space: pre;"> </span>@Override</span><br />
<span style="font-family: Times New Roman, serif;"><span class="Apple-tab-span" style="white-space: pre;"> </span>public String toString() {</span><br />
<span style="font-family: Times New Roman, serif;"><span class="Apple-tab-span" style="white-space: pre;"> </span>return "Test [innerStr=" + innerStr + ", innerInt=" + innerInt + "]";</span><br />
<span style="font-family: Times New Roman, serif;"></span><br />
<span style="font-family: Times New Roman, serif;"><span class="Apple-tab-span" style="white-space: pre;"> </span>}</span><br />
<span style="font-family: Times New Roman, serif;"><br /></span>
<b style="font-family: 'Times New Roman', serif;"><u>Using System.</u></b><span style="font-family: Times New Roman, serif;"><b><u>identityHashCode(Object o) Method:</u></b></span><br />
<span style="font-family: Times New Roman, serif;"><b><u><br /></u></b></span>
<span style="font-family: Times New Roman, serif;"> Even if you override the hashCode() method, you can still get the default behaviour's result using the System.identityHashCode method. It returns as if you don't override the hashCode() method. Remember again that, the default behaviour need not to be a distinct integer for all different objects and also need not to be an integer indicating the internal address of the object.</span><br />
<span style="font-family: Times New Roman, serif;"><br /></span>
<b style="font-family: 'Times New Roman', serif;"><u>Example 2:</u></b><br />
<b style="font-family: 'Times New Roman', serif;"><u><br /></u></b>
<span style="font-family: 'Times New Roman', serif;"> Assuming we use the default toString() implementation as below;</span><br />
<span style="font-family: 'Times New Roman', serif;"><br /></span>
<span style="font-family: Times New Roman, serif;"> public String toString() {</span><br />
<span style="font-family: Times New Roman, serif;"> return getClass().getName() + "@" + Integer.toHexString(hashCode());</span><br />
<span style="font-family: 'Times New Roman', serif;"> }</span><br />
<div>
<br /></div>
<div>
<div>
public class Test {</div>
<div>
<br /></div>
<div>
<span class="Apple-tab-span" style="white-space: pre;"> </span>private String innerStr;</div>
<div>
<span class="Apple-tab-span" style="white-space: pre;"> </span>private Integer innerInt;</div>
<div>
<br /></div>
<div>
<span class="Apple-tab-span" style="white-space: pre;"> </span>public Test(String innerStr, int innerInt) {</div>
<div>
<span class="Apple-tab-span" style="white-space: pre;"> </span>this.innerInt = innerInt;</div>
<div>
<span class="Apple-tab-span" style="white-space: pre;"> </span>this.innerStr = innerStr;</div>
<div>
<span class="Apple-tab-span" style="white-space: pre;"> </span>}</div>
<div>
<span class="Apple-tab-span" style="white-space: pre;"> </span></div>
<div>
<span class="Apple-tab-span" style="white-space: pre;"> </span>public static void main(String[] args) {</div>
<div>
<span class="Apple-tab-span" style="white-space: pre;"> </span>Test test = new Test("a", 1);</div>
<div>
<span class="Apple-tab-span" style="white-space: pre;"> </span>System.out.println(test);</div>
<div>
<span class="Apple-tab-span" style="white-space: pre;"> </span>System.out.println(Integer.toHexString(System.identityHashCode(test)));</div>
<div>
<span class="Apple-tab-span" style="white-space: pre;"> </span>}</div>
<div>
<span class="Apple-tab-span" style="white-space: pre;"> </span></div>
<div>
}</div>
</div>
<div>
<br /></div>
<div>
The output will be as below. </div>
<div>
<br /></div>
<div>
<div>
hash.Test@38da9246</div>
<div>
38da9246</div>
</div>
<div>
<br /></div>
<div>
Now, if you override hashCode() as below;</div>
<div>
<br /></div>
<div>
<div>
<span class="Apple-tab-span" style="white-space: pre;"> </span>@Override</div>
<div>
<span class="Apple-tab-span" style="white-space: pre;"> </span>public int hashCode() {</div>
<div>
<span class="Apple-tab-span" style="white-space: pre;"> </span>final int prime = 31;</div>
<div>
<span class="Apple-tab-span" style="white-space: pre;"> </span>int result = 1;</div>
<div>
<span class="Apple-tab-span" style="white-space: pre;"> </span>result = prime * result + ((innerInt == null) ? 0 : innerInt.hashCode());</div>
<div>
<span class="Apple-tab-span" style="white-space: pre;"> </span>result = prime * result + ((innerStr == null) ? 0 : innerStr.hashCode());</div>
<div>
<span class="Apple-tab-span" style="white-space: pre;"> </span>return result;</div>
<div>
<span class="Apple-tab-span" style="white-space: pre;"> </span>}</div>
<div>
<br /></div>
<div>
<span class="Apple-tab-span" style="white-space: pre;"> </span>@Override</div>
<div>
<span class="Apple-tab-span" style="white-space: pre;"> </span>public boolean equals(Object obj) {</div>
<div>
<span class="Apple-tab-span" style="white-space: pre;"> </span>if (this == obj)</div>
<div>
<span class="Apple-tab-span" style="white-space: pre;"> </span>return true;</div>
<div>
<span class="Apple-tab-span" style="white-space: pre;"> </span>if (obj == null)</div>
<div>
<span class="Apple-tab-span" style="white-space: pre;"> </span>return false;</div>
<div>
<span class="Apple-tab-span" style="white-space: pre;"> </span>if (getClass() != obj.getClass())</div>
<div>
<span class="Apple-tab-span" style="white-space: pre;"> </span>return false;</div>
<div>
<span class="Apple-tab-span" style="white-space: pre;"> </span>Test other = (Test) obj;</div>
<div>
<span class="Apple-tab-span" style="white-space: pre;"> </span>if (innerInt == null) {</div>
<div>
<span class="Apple-tab-span" style="white-space: pre;"> </span>if (other.innerInt != null)</div>
<div>
<span class="Apple-tab-span" style="white-space: pre;"> </span>return false;</div>
<div>
<span class="Apple-tab-span" style="white-space: pre;"> </span>} else if (!innerInt.equals(other.innerInt))</div>
<div>
<span class="Apple-tab-span" style="white-space: pre;"> </span>return false;</div>
<div>
<span class="Apple-tab-span" style="white-space: pre;"> </span>if (innerStr == null) {</div>
<div>
<span class="Apple-tab-span" style="white-space: pre;"> </span>if (other.innerStr != null)</div>
<div>
<span class="Apple-tab-span" style="white-space: pre;"> </span>return false;</div>
<div>
<span class="Apple-tab-span" style="white-space: pre;"> </span>} else if (!innerStr.equals(other.innerStr))</div>
<div>
<span class="Apple-tab-span" style="white-space: pre;"> </span>return false;</div>
<div>
<span class="Apple-tab-span" style="white-space: pre;"> </span>return true;</div>
<div>
<span class="Apple-tab-span" style="white-space: pre;"> </span>}</div>
</div>
<div>
<br /></div>
<div>
And run again, you will get the following result;</div>
<div>
<br /></div>
<div>
<div>
hash.Test@441</div>
<div>
7448bc3d</div>
</div>
<div>
<br /></div>
<div>
As you see we get the default behaviour with the System.identityHashCode method. If we run again we get the same hashCode with the overrided hashCode() method, but get different hashCode with the System.identityHashCode method as you see below.</div>
<div>
<br /></div>
<div>
<div>
hash.Test@441</div>
<div>
68c884e</div>
</div>
<div>
<br /></div>
<div>
See, we use the hex representation of the returned integer of hashCode() method as it's used in the default toString() implementation.</div>
<div>
</div>
<span style="font-family: Times New Roman, serif;"><b><u>Conclusion</u></b></span><u style="font-family: 'Times New Roman', serif; font-size: 16px; font-weight: bold;">:</u><br />
<u style="font-family: 'Times New Roman', serif; font-size: 16px; font-weight: bold;"><br /></u>
<span style="font-family: Times New Roman, serif;"> We see some important points of using hashCode(), equals() and toString() methods. You should now what the Java doc. says and now where you can rely on or not to the behaviour of that methods.</span>Ali Gelenlerhttp://www.blogger.com/profile/09439697648573423668noreply@blogger.com0tag:blogger.com,1999:blog-3858181542467916490.post-90106545559254141182014-11-22T13:47:00.000+02:002018-03-10T13:27:01.542+03:00Using Ajax in JQuery<div style="margin-bottom: .0001pt; margin: 0cm;">
<b><u><span style="font-size: 14pt;">$.ajax call in JQuery:</span></u></b><span style="font-size: 14pt;"><o:p></o:p></span></div>
<div style="margin: 0cm 0cm 0.0001pt;">
<b><u style="font-family: 'Times New Roman', serif; font-size: 16px; font-weight: bold;"><span style="font-size: 8pt;"><br />
</span></u></b> You can use $.ajax
method to make ajax requests in JQuery. Below is an example that call a jsp
file served on a tomcat server. For simplicity test.jsp only include
<%="successfully called"%>.<o:p></o:p></div>
<div style="margin: 0cm 0cm 0.0001pt;">
You also have to serve your html file that call
the test.jsp in the same tomcat server since making an ajax request to another
domain is forbidden by default. You can use cross domain call for calling a
file in another domain as explained <a href="http://jquery-howto.blogspot.com.tr/2013/09/jquery-cross-domain-ajax-request.html" target="_blank">here</a> or you can use the technique
mentioned in the Example 2 below. You could also call another type of
file like test.txt as long as it is served on the same server. For security
reasons, you can neither call a file on the file system by ajax nor use
html file on the file system that include ajax code. <o:p></o:p></div>
<div style="margin: 0cm 0cm 0.0001pt;">
<br />
If you try to call an external domain resource by ajax or try to call a domain
resource from a file in the file system of your computer say in your desktop
you would get the following error indicating that cross domain call is
forbidden with a response code 404. This error can be overcomed with
CORS(Cross-Origin Resource Sharing) as I mentioned above.<o:p></o:p></div>
<br />
<div style="margin: 0cm 0cm 0.0001pt;">
Also for the case of calling external
domain resource from another domain we can use the tehnique explained in
Exemple 2 with the help of a server resource.<o:p></o:p></div>
<span style="font-family: "times new roman" , serif;"><br /></span>
<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjTgOgUCHOY2iISJa4AM2bkSNKZORU5F70WppzjVe_Q9ll2pZQyI88aYrfUkwoNCAak-xPvfx7lpKNdRSNl8fRF-amj1qgSACMQJm1h1_T4EzmW4dbQnn9R_06fA1WiSKXEnB5R_B2qr9M7/s1600/1.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img alt="Using Ajax in JQuery" border="0" height="173" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjTgOgUCHOY2iISJa4AM2bkSNKZORU5F70WppzjVe_Q9ll2pZQyI88aYrfUkwoNCAak-xPvfx7lpKNdRSNl8fRF-amj1qgSACMQJm1h1_T4EzmW4dbQnn9R_06fA1WiSKXEnB5R_B2qr9M7/s1600/1.png" title="Using Ajax in JQuery" width="320" /></a></div>
<div align="center" class="separator" style="margin-bottom: .0001pt; margin: 0cm; text-align: center;">
Figure 1<o:p></o:p></div>
<div align="center" class="separator" style="margin: 0cm 0cm 0.0001pt; text-align: center;">
<br /></div>
<div class="separator" style="clear: both; text-align: center;">
</div>
<div class="separator" style="margin: 0cm 0cm 0.0001pt;">
If you try to call a file in the file system in your
computer say in desktop from a domain hosted resource like test.jsp with ajax,
you would get the following error. This error can also be overcomed with a
technique like in Example 2 with the help of a server resource. Without a
server resource we cannot call a external file on the file system. It should be
like that for security reasons, otherwise one can inject a javascript to a web
site to call the external files on the server that hosts web site.<o:p></o:p></div>
<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhRGp8ieMnpSi-ZcU-bNZvJzsLOHY1WsNYq3riTbA94tayYvXmdrN0LQwU4UwcmAu_mgu1unfaQTGP4NBrfHGeFoPqM2vTOApB-njJuVSd7vJe5djfrW9pmWSmxJTH5v-r0ZtKSxY2XBeuD/s1600/2.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img alt="Using Ajax in JQuery" border="0" height="173" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhRGp8ieMnpSi-ZcU-bNZvJzsLOHY1WsNYq3riTbA94tayYvXmdrN0LQwU4UwcmAu_mgu1unfaQTGP4NBrfHGeFoPqM2vTOApB-njJuVSd7vJe5djfrW9pmWSmxJTH5v-r0ZtKSxY2XBeuD/s1600/2.png" title="Using Ajax in JQuery" width="320" /></a></div>
<div align="center" class="separator" style="margin-bottom: .0001pt; margin: 0cm; text-align: center;">
Figure 2<o:p></o:p></div>
<div align="center" style="margin-bottom: .0001pt; margin: 0cm; text-align: center;">
<br /></div>
<div class="separator" style="clear: both; text-align: center;">
</div>
<div style="margin: 0cm 0cm 0.0001pt;">
<br />
Below there are 2 examples explaining the ajax call in JQuery.<o:p></o:p></div>
<span style="font-family: "times new roman" , serif;"><br /></span>
<span style="font-family: "times new roman" , serif;"><b><u><span style="font-family: Calibri, sans-serif; font-size: 14pt; line-height: 115%;">Example 1:</span></u></b></span><br />
<span style="font-family: "times new roman" , serif;"><b><u><span style="font-family: Calibri, sans-serif; font-size: 14pt; line-height: 115%;"><br /></span></u></b></span>
<div style="margin-bottom: .0001pt; margin: 0cm;">
Create a
file jQuery.html under a web project named ajax with the following html code
and create a test.jsp with the code <%="successfully
called"%> under the same place.<o:p></o:p></div>
<div style="margin: 0cm 0cm 0.0001pt;">
<br /></div>
<div style="background: #F8F9FA; border: solid #EAECF0 1.0pt; mso-border-alt: solid #EAECF0 .5pt; mso-element: para-border-div; padding: 12.0pt 12.0pt 12.0pt 12.0pt;">
<div class="MsoNormal" style="background-attachment: initial; background-clip: initial; background-image: initial; background-origin: initial; background-position: initial; background-repeat: initial; background-size: initial; border: none; line-height: 15.6pt; margin-bottom: 0.0001pt; padding: 0cm;">
<span style="font-family: "Courier New"; font-size: 9pt;"><html><o:p></o:p></span></div>
<div class="MsoNormal" style="background-attachment: initial; background-clip: initial; background-image: initial; background-origin: initial; background-position: initial; background-repeat: initial; background-size: initial; border: none; line-height: 15.6pt; margin-bottom: 0.0001pt; padding: 0cm;">
<span style="font-family: "Courier New"; font-size: 9pt;"> <head><o:p></o:p></span></div>
<div class="MsoNormal" style="background-attachment: initial; background-clip: initial; background-image: initial; background-origin: initial; background-position: initial; background-repeat: initial; background-size: initial; border: none; line-height: 15.6pt; margin-bottom: 0.0001pt; padding: 0cm;">
<span style="font-family: "Courier New"; font-size: 9pt;"> <script
src="http://code.jquery.com/jquery-1.11.1.min.js"></script><o:p></o:p></span></div>
<div class="MsoNormal" style="background-attachment: initial; background-clip: initial; background-image: initial; background-origin: initial; background-position: initial; background-repeat: initial; background-size: initial; border: none; line-height: 15.6pt; margin-bottom: 0.0001pt; padding: 0cm;">
<span style="font-family: "Courier New"; font-size: 9pt;"> <script><o:p></o:p></span></div>
<div class="MsoNormal" style="background-attachment: initial; background-clip: initial; background-image: initial; background-origin: initial; background-position: initial; background-repeat: initial; background-size: initial; border: none; line-height: 15.6pt; margin-bottom: 0.0001pt; padding: 0cm;">
<span style="font-family: "Courier New"; font-size: 9pt;">
$(document).ready(function() {<o:p></o:p></span></div>
<div class="MsoNormal" style="background-attachment: initial; background-clip: initial; background-image: initial; background-origin: initial; background-position: initial; background-repeat: initial; background-size: initial; border: none; line-height: 15.6pt; margin-bottom: 0.0001pt; padding: 0cm;">
<span style="font-family: "Courier New"; font-size: 9pt;">
$('#myButton').click(function () { <o:p></o:p></span></div>
<div class="MsoNormal" style="background-attachment: initial; background-clip: initial; background-image: initial; background-origin: initial; background-position: initial; background-repeat: initial; background-size: initial; border: none; line-height: 15.6pt; margin-bottom: 0.0001pt; padding: 0cm;">
<span style="font-family: "Courier New"; font-size: 9pt;"> $.ajax({<o:p></o:p></span></div>
<div class="MsoNormal" style="background-attachment: initial; background-clip: initial; background-image: initial; background-origin: initial; background-position: initial; background-repeat: initial; background-size: initial; border: none; line-height: 15.6pt; margin-bottom: 0.0001pt; padding: 0cm;">
<span style="font-family: "Courier New"; font-size: 9pt;"> url:
"http://localhost:8080/ajax/test.jsp",// you can call directly test.jsp<o:p></o:p></span></div>
<div class="MsoNormal" style="background-attachment: initial; background-clip: initial; background-image: initial; background-origin: initial; background-position: initial; background-repeat: initial; background-size: initial; border: none; line-height: 15.6pt; margin-bottom: 0.0001pt; padding: 0cm;">
<span style="font-family: "Courier New"; font-size: 9pt;"> //
test.jsp just include <%="successfully called"%><o:p></o:p></span></div>
<div class="MsoNormal" style="background-attachment: initial; background-clip: initial; background-image: initial; background-origin: initial; background-position: initial; background-repeat: initial; background-size: initial; border: none; line-height: 15.6pt; margin-bottom: 0.0001pt; padding: 0cm;">
<span style="font-family: "Courier New"; font-size: 9pt;"> //
url: "http://localhost:8080/documenter/test.txt", you can also call a
txt file here<o:p></o:p></span></div>
<div class="MsoNormal" style="background-attachment: initial; background-clip: initial; background-image: initial; background-origin: initial; background-position: initial; background-repeat: initial; background-size: initial; border: none; line-height: 15.6pt; margin-bottom: 0.0001pt; padding: 0cm;">
<span style="font-family: "Courier New"; font-size: 9pt;">
success: function( data ) {<o:p></o:p></span></div>
<div class="MsoNormal" style="background-attachment: initial; background-clip: initial; background-image: initial; background-origin: initial; background-position: initial; background-repeat: initial; background-size: initial; border: none; line-height: 15.6pt; margin-bottom: 0.0001pt; padding: 0cm;">
<span style="font-family: "Courier New"; font-size: 9pt;"> $(
"#myDiv" ).html( data );<o:p></o:p></span></div>
<div class="MsoNormal" style="background-attachment: initial; background-clip: initial; background-image: initial; background-origin: initial; background-position: initial; background-repeat: initial; background-size: initial; border: none; line-height: 15.6pt; margin-bottom: 0.0001pt; padding: 0cm;">
<span style="font-family: "Courier New"; font-size: 9pt;"> }<o:p></o:p></span></div>
<div class="MsoNormal" style="background-attachment: initial; background-clip: initial; background-image: initial; background-origin: initial; background-position: initial; background-repeat: initial; background-size: initial; border: none; line-height: 15.6pt; margin-bottom: 0.0001pt; padding: 0cm;">
<span style="font-family: "Courier New"; font-size: 9pt;"> });<o:p></o:p></span></div>
<div class="MsoNormal" style="background-attachment: initial; background-clip: initial; background-image: initial; background-origin: initial; background-position: initial; background-repeat: initial; background-size: initial; border: none; line-height: 15.6pt; margin-bottom: 0.0001pt; padding: 0cm;">
<span style="font-family: "Courier New"; font-size: 9pt;"> }); <o:p></o:p></span></div>
<div class="MsoNormal" style="background-attachment: initial; background-clip: initial; background-image: initial; background-origin: initial; background-position: initial; background-repeat: initial; background-size: initial; border: none; line-height: 15.6pt; margin-bottom: 0.0001pt; padding: 0cm;">
<span style="font-family: "Courier New"; font-size: 9pt;"> });<o:p></o:p></span></div>
<div class="MsoNormal" style="background-attachment: initial; background-clip: initial; background-image: initial; background-origin: initial; background-position: initial; background-repeat: initial; background-size: initial; border: none; line-height: 15.6pt; margin-bottom: 0.0001pt; padding: 0cm;">
<span style="font-family: "Courier New"; font-size: 9pt;">
</script><o:p></o:p></span></div>
<div class="MsoNormal" style="background-attachment: initial; background-clip: initial; background-image: initial; background-origin: initial; background-position: initial; background-repeat: initial; background-size: initial; border: none; line-height: 15.6pt; margin-bottom: 0.0001pt; padding: 0cm;">
<span style="font-family: "Courier New"; font-size: 9pt;"> </head><o:p></o:p></span></div>
<div class="MsoNormal" style="background-attachment: initial; background-clip: initial; background-image: initial; background-origin: initial; background-position: initial; background-repeat: initial; background-size: initial; border: none; line-height: 15.6pt; margin-bottom: 0.0001pt; padding: 0cm;">
<span style="font-family: "Courier New"; font-size: 9pt;"> <body><o:p></o:p></span></div>
<div class="MsoNormal" style="background-attachment: initial; background-clip: initial; background-image: initial; background-origin: initial; background-position: initial; background-repeat: initial; background-size: initial; border: none; line-height: 15.6pt; margin-bottom: 0.0001pt; padding: 0cm;">
<span style="font-family: "Courier New"; font-size: 9pt;"> <input
type="button" id="myButton" value="fill the div with
ajax"><o:p></o:p></span></div>
<div class="MsoNormal" style="background-attachment: initial; background-clip: initial; background-image: initial; background-origin: initial; background-position: initial; background-repeat: initial; background-size: initial; border: none; line-height: 15.6pt; margin-bottom: 0.0001pt; padding: 0cm;">
<span style="font-family: "Courier New"; font-size: 9pt;"> <br/><o:p></o:p></span></div>
<div class="MsoNormal" style="background-attachment: initial; background-clip: initial; background-image: initial; background-origin: initial; background-position: initial; background-repeat: initial; background-size: initial; border: none; line-height: 15.6pt; margin-bottom: 0.0001pt; padding: 0cm;">
<span style="font-family: "Courier New"; font-size: 9pt;"> <div
id="myDiv"></div><o:p></o:p></span></div>
<div class="MsoNormal" style="background-attachment: initial; background-clip: initial; background-image: initial; background-origin: initial; background-position: initial; background-repeat: initial; background-size: initial; border: none; line-height: 15.6pt; margin-bottom: 0.0001pt; padding: 0cm;">
<span style="font-family: "Courier New"; font-size: 9pt;"> </body><o:p></o:p></span></div>
<div class="MsoNormal" style="background-attachment: initial; background-clip: initial; background-image: initial; background-origin: initial; background-position: initial; background-repeat: initial; background-size: initial; border: none; line-height: 15.6pt; margin-bottom: 0.0001pt; padding: 0cm;">
<span style="font-family: "Courier New"; font-size: 9pt;"></html></span><span style="font-size: 13.5pt;"><br />
<!--[if !supportLineBreakNewLine]--><br />
<!--[endif]--></span><span style="font-family: "Courier New"; font-size: 9pt;"><o:p></o:p></span></div>
</div>
<div align="center" style="margin-bottom: .0001pt; margin: 0cm; text-align: center;">
JQuery.html<o:p></o:p></div>
<div align="center" style="margin-bottom: .0001pt; margin: 0cm; text-align: center;">
<br /></div>
<div style="margin-bottom: .0001pt; margin: 0cm;">
</div>
<div style="margin-bottom: .0001pt; margin: 0cm;">
You see
the following result when you run this code.<o:p></o:p></div>
<div style="text-align: left;">
<span style="font-family: "times new roman" , serif;"><br /></span></div>
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgmHFK7NTGOYF0nZwcnmbs4SiKuhyBZh7jXQX_lEPf_ZgKrwexnydQ60VDipwievpk3uuh33mRK05fnlQC59dSgF4RQY8YmlWR0YVRmXvb6CxcO2LsdxvKi_up7aHkm9ga4x4k3PYXHyGEe/s1600/3.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img alt="Using Ajax in JQuery" border="0" height="173" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgmHFK7NTGOYF0nZwcnmbs4SiKuhyBZh7jXQX_lEPf_ZgKrwexnydQ60VDipwievpk3uuh33mRK05fnlQC59dSgF4RQY8YmlWR0YVRmXvb6CxcO2LsdxvKi_up7aHkm9ga4x4k3PYXHyGEe/s1600/3.png" title="Using Ajax in JQuery" width="320" /></a></div>
<div class="separator" style="clear: both; text-align: center;">
<br /></div>
<div style="text-align: center;">
<div align="center" style="margin: 0cm 0cm 0.0001pt;">
Figure 3<o:p></o:p></div>
<div align="center" style="margin: 0cm 0cm 0.0001pt;">
<br /></div>
<div style="margin: 0cm 0cm 0.0001pt; text-align: start;">
<span style="font-size: 13.5pt;"><br />
</span><b style="font-family: 'Times New Roman', serif;"><u><span style="font-size: 14pt;">Example 2:</span></u></b><span style="font-size: 14pt;"><o:p></o:p></span></div>
<div style="margin: 0cm 0cm 0.0001pt; text-align: start;">
<b style="font-family: 'Times New Roman', serif;"><u><span style="font-size: 13.5pt;"><br />
</span></u></b><span style="font-size: 13.5pt;"> </span>Create a file
named jQuery2.html under a web project named ajax with the following html code
and create a servlet named CallExternalDomain as shown below. We'll call
the servlet with ajax, and do the call of external domain job in the servlet to
overcome the cross domain call problem. We send the external domain address
with the data property of ajax call and get that address as request parameter
in the servlet. We can use a similar approach to call a file using ajax served
on the file system.<o:p></o:p></div>
<div style="margin: 0cm 0cm 0.0001pt; text-align: start;">
<br /></div>
<div style="background: #F8F9FA; border: solid #EAECF0 1.0pt; mso-border-alt: solid #EAECF0 .5pt; mso-element: para-border-div; padding: 12.0pt 12.0pt 12.0pt 12.0pt;">
<div class="MsoNormal" style="background-attachment: initial; background-clip: initial; background-image: initial; background-origin: initial; background-position: initial; background-repeat: initial; background-size: initial; border: none; line-height: 15.6pt; margin-bottom: 0.0001pt; padding: 0cm; text-align: left;">
<span style="font-family: "Courier New"; font-size: 9pt;"><html><o:p></o:p></span></div>
<div class="MsoNormal" style="background-attachment: initial; background-clip: initial; background-image: initial; background-origin: initial; background-position: initial; background-repeat: initial; background-size: initial; border: none; line-height: 15.6pt; margin-bottom: 0.0001pt; padding: 0cm; text-align: left;">
<span style="font-family: "Courier New"; font-size: 9pt;"> <head><o:p></o:p></span></div>
<div class="MsoNormal" style="background-attachment: initial; background-clip: initial; background-image: initial; background-origin: initial; background-position: initial; background-repeat: initial; background-size: initial; border: none; line-height: 15.6pt; margin-bottom: 0.0001pt; padding: 0cm; text-align: left;">
<span style="font-family: "Courier New"; font-size: 9pt;"> <script
src="http://code.jquery.com/jquery-1.11.1.min.js"></script><o:p></o:p></span></div>
<div class="MsoNormal" style="background-attachment: initial; background-clip: initial; background-image: initial; background-origin: initial; background-position: initial; background-repeat: initial; background-size: initial; border: none; line-height: 15.6pt; margin-bottom: 0.0001pt; padding: 0cm; text-align: left;">
<span style="font-family: "Courier New"; font-size: 9pt;"> <script><o:p></o:p></span></div>
<div class="MsoNormal" style="background-attachment: initial; background-clip: initial; background-image: initial; background-origin: initial; background-position: initial; background-repeat: initial; background-size: initial; border: none; line-height: 15.6pt; margin-bottom: 0.0001pt; padding: 0cm; text-align: left;">
<span style="font-family: "Courier New"; font-size: 9pt;">
$(document).ready(function() {<o:p></o:p></span></div>
<div class="MsoNormal" style="background-attachment: initial; background-clip: initial; background-image: initial; background-origin: initial; background-position: initial; background-repeat: initial; background-size: initial; border: none; line-height: 15.6pt; margin-bottom: 0.0001pt; padding: 0cm; text-align: left;">
<span style="font-family: "Courier New"; font-size: 9pt;">
$('#myButton').click(function () { <o:p></o:p></span></div>
<div class="MsoNormal" style="background-attachment: initial; background-clip: initial; background-image: initial; background-origin: initial; background-position: initial; background-repeat: initial; background-size: initial; border: none; line-height: 15.6pt; margin-bottom: 0.0001pt; padding: 0cm; text-align: left;">
<span style="font-family: "Courier New"; font-size: 9pt;"> $.ajax({<o:p></o:p></span></div>
<div class="MsoNormal" style="background-attachment: initial; background-clip: initial; background-image: initial; background-origin: initial; background-position: initial; background-repeat: initial; background-size: initial; border: none; line-height: 15.6pt; margin-bottom: 0.0001pt; padding: 0cm; text-align: left;">
<span style="font-family: "Courier New"; font-size: 9pt;"> url:
'/ajax/CallExternalDomain',<o:p></o:p></span></div>
<div class="MsoNormal" style="background-attachment: initial; background-clip: initial; background-image: initial; background-origin: initial; background-position: initial; background-repeat: initial; background-size: initial; border: none; line-height: 15.6pt; margin-bottom: 0.0001pt; padding: 0cm; text-align: left;">
<span style="font-family: "Courier New"; font-size: 9pt;"> data: {<o:p></o:p></span></div>
<div class="MsoNormal" style="background-attachment: initial; background-clip: initial; background-image: initial; background-origin: initial; background-position: initial; background-repeat: initial; background-size: initial; border: none; line-height: 15.6pt; margin-bottom: 0.0001pt; padding: 0cm; text-align: left;">
<span style="font-family: "Courier New"; font-size: 9pt;"> address:
'http://www.aligelenler.com/2014/11/using-ajax-in-jquery.html'<o:p></o:p></span></div>
<div class="MsoNormal" style="background-attachment: initial; background-clip: initial; background-image: initial; background-origin: initial; background-position: initial; background-repeat: initial; background-size: initial; border: none; line-height: 15.6pt; margin-bottom: 0.0001pt; padding: 0cm; text-align: left;">
<span style="font-family: "Courier New"; font-size: 9pt;"> },<o:p></o:p></span></div>
<div class="MsoNormal" style="background-attachment: initial; background-clip: initial; background-image: initial; background-origin: initial; background-position: initial; background-repeat: initial; background-size: initial; border: none; line-height: 15.6pt; margin-bottom: 0.0001pt; padding: 0cm; text-align: left;">
<span style="font-family: "Courier New"; font-size: 9pt;">
success: function(response) {<o:p></o:p></span></div>
<div class="MsoNormal" style="background-attachment: initial; background-clip: initial; background-image: initial; background-origin: initial; background-position: initial; background-repeat: initial; background-size: initial; border: none; line-height: 15.6pt; margin-bottom: 0.0001pt; padding: 0cm; text-align: left;">
<span style="font-family: "Courier New"; font-size: 9pt;"> $(
"#myDiv" ).html( response ); <o:p></o:p></span></div>
<div class="MsoNormal" style="background-attachment: initial; background-clip: initial; background-image: initial; background-origin: initial; background-position: initial; background-repeat: initial; background-size: initial; border: none; line-height: 15.6pt; margin-bottom: 0.0001pt; padding: 0cm; text-align: left;">
<span style="font-family: "Courier New"; font-size: 9pt;"> }<o:p></o:p></span></div>
<div class="MsoNormal" style="background-attachment: initial; background-clip: initial; background-image: initial; background-origin: initial; background-position: initial; background-repeat: initial; background-size: initial; border: none; line-height: 15.6pt; margin-bottom: 0.0001pt; padding: 0cm; text-align: left;">
<span style="font-family: "Courier New"; font-size: 9pt;"> });<o:p></o:p></span></div>
<div class="MsoNormal" style="background-attachment: initial; background-clip: initial; background-image: initial; background-origin: initial; background-position: initial; background-repeat: initial; background-size: initial; border: none; line-height: 15.6pt; margin-bottom: 0.0001pt; padding: 0cm; text-align: left;">
<span style="font-family: "Courier New"; font-size: 9pt;"> }); <o:p></o:p></span></div>
<div class="MsoNormal" style="background-attachment: initial; background-clip: initial; background-image: initial; background-origin: initial; background-position: initial; background-repeat: initial; background-size: initial; border: none; line-height: 15.6pt; margin-bottom: 0.0001pt; padding: 0cm; text-align: left;">
<span style="font-family: "Courier New"; font-size: 9pt;"> });<o:p></o:p></span></div>
<div class="MsoNormal" style="background-attachment: initial; background-clip: initial; background-image: initial; background-origin: initial; background-position: initial; background-repeat: initial; background-size: initial; border: none; line-height: 15.6pt; margin-bottom: 0.0001pt; padding: 0cm; text-align: left;">
<span style="font-family: "Courier New"; font-size: 9pt;">
</script><o:p></o:p></span></div>
<div class="MsoNormal" style="background-attachment: initial; background-clip: initial; background-image: initial; background-origin: initial; background-position: initial; background-repeat: initial; background-size: initial; border: none; line-height: 15.6pt; margin-bottom: 0.0001pt; padding: 0cm; text-align: left;">
<span style="font-family: "Courier New"; font-size: 9pt;"> </head><o:p></o:p></span></div>
<div class="MsoNormal" style="background-attachment: initial; background-clip: initial; background-image: initial; background-origin: initial; background-position: initial; background-repeat: initial; background-size: initial; border: none; line-height: 15.6pt; margin-bottom: 0.0001pt; padding: 0cm; text-align: left;">
<span style="font-family: "Courier New"; font-size: 9pt;"> <body><o:p></o:p></span></div>
<div class="MsoNormal" style="background-attachment: initial; background-clip: initial; background-image: initial; background-origin: initial; background-position: initial; background-repeat: initial; background-size: initial; border: none; line-height: 15.6pt; margin-bottom: 0.0001pt; padding: 0cm; text-align: left;">
<span style="font-family: "Courier New"; font-size: 9pt;"> <input
type="button" id="myButton" value="fill the div with
ajax"><o:p></o:p></span></div>
<div class="MsoNormal" style="background-attachment: initial; background-clip: initial; background-image: initial; background-origin: initial; background-position: initial; background-repeat: initial; background-size: initial; border: none; line-height: 15.6pt; margin-bottom: 0.0001pt; padding: 0cm; text-align: left;">
<span style="font-family: "Courier New"; font-size: 9pt;"> <br/><o:p></o:p></span></div>
<div class="MsoNormal" style="background-attachment: initial; background-clip: initial; background-image: initial; background-origin: initial; background-position: initial; background-repeat: initial; background-size: initial; border: none; line-height: 15.6pt; margin-bottom: 0.0001pt; padding: 0cm; text-align: left;">
<span style="font-family: "Courier New"; font-size: 9pt;"> <div
id="myDiv"></div><o:p></o:p></span></div>
<div class="MsoNormal" style="background-attachment: initial; background-clip: initial; background-image: initial; background-origin: initial; background-position: initial; background-repeat: initial; background-size: initial; border: none; line-height: 15.6pt; margin-bottom: 0.0001pt; padding: 0cm; text-align: left;">
<span style="font-family: "Courier New"; font-size: 9pt;"> </body><o:p></o:p></span></div>
<div class="MsoNormal" style="background-attachment: initial; background-clip: initial; background-image: initial; background-origin: initial; background-position: initial; background-repeat: initial; background-size: initial; border: none; line-height: 15.6pt; margin-bottom: 0.0001pt; padding: 0cm; text-align: left;">
<span style="font-family: "Courier New"; font-size: 9pt;"></html><o:p></o:p></span></div>
</div>
<div style="margin-bottom: .0001pt; margin: 0cm;">
<br /></div>
<div style="margin-bottom: .0001pt; margin: 0cm;">
<br /></div>
<div align="center" style="margin: 0cm 0cm 0.0001pt;">
JQuery2.html<o:p></o:p></div>
<div align="center" style="margin: 0cm 0cm 0.0001pt;">
<br /></div>
<div style="background: #F8F9FA; border: solid #EAECF0 1.0pt; mso-border-alt: solid #EAECF0 .5pt; mso-element: para-border-div; padding: 12.0pt 12.0pt 12.0pt 12.0pt;">
<div class="MsoNormal" style="background-attachment: initial; background-clip: initial; background-image: initial; background-origin: initial; background-position: initial; background-repeat: initial; background-size: initial; border: none; line-height: 15.6pt; margin-bottom: 0.0001pt; padding: 0cm; text-align: left;">
<span style="font-family: "Courier New"; font-size: 9pt;">package ajax;<o:p></o:p></span></div>
<div class="MsoNormal" style="background-attachment: initial; background-clip: initial; background-image: initial; background-origin: initial; background-position: initial; background-repeat: initial; background-size: initial; border: none; line-height: 15.6pt; margin-bottom: 0.0001pt; padding: 0cm; text-align: left;">
<br /></div>
<div class="MsoNormal" style="background-attachment: initial; background-clip: initial; background-image: initial; background-origin: initial; background-position: initial; background-repeat: initial; background-size: initial; border: none; line-height: 15.6pt; margin-bottom: 0.0001pt; padding: 0cm; text-align: left;">
<span style="font-family: "Courier New"; font-size: 9pt;"> import
java.io.BufferedReader;<o:p></o:p></span></div>
<div class="MsoNormal" style="background-attachment: initial; background-clip: initial; background-image: initial; background-origin: initial; background-position: initial; background-repeat: initial; background-size: initial; border: none; line-height: 15.6pt; margin-bottom: 0.0001pt; padding: 0cm; text-align: left;">
<br /></div>
<div class="MsoNormal" style="background-attachment: initial; background-clip: initial; background-image: initial; background-origin: initial; background-position: initial; background-repeat: initial; background-size: initial; border: none; line-height: 15.6pt; margin-bottom: 0.0001pt; padding: 0cm; text-align: left;">
<span style="font-family: "Courier New"; font-size: 9pt;"> import
java.io.IOException;<o:p></o:p></span></div>
<div class="MsoNormal" style="background-attachment: initial; background-clip: initial; background-image: initial; background-origin: initial; background-position: initial; background-repeat: initial; background-size: initial; border: none; line-height: 15.6pt; margin-bottom: 0.0001pt; padding: 0cm; text-align: left;">
<span style="font-family: "Courier New"; font-size: 9pt;"> import
java.io.InputStreamReader;<o:p></o:p></span></div>
<div class="MsoNormal" style="background-attachment: initial; background-clip: initial; background-image: initial; background-origin: initial; background-position: initial; background-repeat: initial; background-size: initial; border: none; line-height: 15.6pt; margin-bottom: 0.0001pt; padding: 0cm; text-align: left;">
<span style="font-family: "Courier New"; font-size: 9pt;"> import
java.net.HttpURLConnection;<o:p></o:p></span></div>
<div class="MsoNormal" style="background-attachment: initial; background-clip: initial; background-image: initial; background-origin: initial; background-position: initial; background-repeat: initial; background-size: initial; border: none; line-height: 15.6pt; margin-bottom: 0.0001pt; padding: 0cm; text-align: left;">
<span style="font-family: "Courier New"; font-size: 9pt;"> import
java.net.URL;<o:p></o:p></span></div>
<div class="MsoNormal" style="background-attachment: initial; background-clip: initial; background-image: initial; background-origin: initial; background-position: initial; background-repeat: initial; background-size: initial; border: none; line-height: 15.6pt; margin-bottom: 0.0001pt; padding: 0cm; text-align: left;">
<br /></div>
<div class="MsoNormal" style="background-attachment: initial; background-clip: initial; background-image: initial; background-origin: initial; background-position: initial; background-repeat: initial; background-size: initial; border: none; line-height: 15.6pt; margin-bottom: 0.0001pt; padding: 0cm; text-align: left;">
<span style="font-family: "Courier New"; font-size: 9pt;"> import
javax.servlet.ServletException;<o:p></o:p></span></div>
<div class="MsoNormal" style="background-attachment: initial; background-clip: initial; background-image: initial; background-origin: initial; background-position: initial; background-repeat: initial; background-size: initial; border: none; line-height: 15.6pt; margin-bottom: 0.0001pt; padding: 0cm; text-align: left;">
<span style="font-family: "Courier New"; font-size: 9pt;"> import
javax.servlet.annotation.WebServlet;<o:p></o:p></span></div>
<div class="MsoNormal" style="background-attachment: initial; background-clip: initial; background-image: initial; background-origin: initial; background-position: initial; background-repeat: initial; background-size: initial; border: none; line-height: 15.6pt; margin-bottom: 0.0001pt; padding: 0cm; text-align: left;">
<span style="font-family: "Courier New"; font-size: 9pt;"> import
javax.servlet.http.HttpServlet;<o:p></o:p></span></div>
<div class="MsoNormal" style="background-attachment: initial; background-clip: initial; background-image: initial; background-origin: initial; background-position: initial; background-repeat: initial; background-size: initial; border: none; line-height: 15.6pt; margin-bottom: 0.0001pt; padding: 0cm; text-align: left;">
<span style="font-family: "Courier New"; font-size: 9pt;"> import
javax.servlet.http.HttpServletRequest;<o:p></o:p></span></div>
<div class="MsoNormal" style="background-attachment: initial; background-clip: initial; background-image: initial; background-origin: initial; background-position: initial; background-repeat: initial; background-size: initial; border: none; line-height: 15.6pt; margin-bottom: 0.0001pt; padding: 0cm; text-align: left;">
<span style="font-family: "Courier New"; font-size: 9pt;"> import
javax.servlet.http.HttpServletResponse;<o:p></o:p></span></div>
<div class="MsoNormal" style="background-attachment: initial; background-clip: initial; background-image: initial; background-origin: initial; background-position: initial; background-repeat: initial; background-size: initial; border: none; line-height: 15.6pt; margin-bottom: 0.0001pt; padding: 0cm; text-align: left;">
<br /></div>
<div class="MsoNormal" style="background-attachment: initial; background-clip: initial; background-image: initial; background-origin: initial; background-position: initial; background-repeat: initial; background-size: initial; border: none; line-height: 15.6pt; margin-bottom: 0.0001pt; padding: 0cm; text-align: left;">
<span style="font-family: "Courier New"; font-size: 9pt;">/**<o:p></o:p></span></div>
<div class="MsoNormal" style="background-attachment: initial; background-clip: initial; background-image: initial; background-origin: initial; background-position: initial; background-repeat: initial; background-size: initial; border: none; line-height: 15.6pt; margin-bottom: 0.0001pt; padding: 0cm; text-align: left;">
<span style="font-family: "Courier New"; font-size: 9pt;"> * Servlet
implementation class CallExternalDomain<o:p></o:p></span></div>
<div class="MsoNormal" style="background-attachment: initial; background-clip: initial; background-image: initial; background-origin: initial; background-position: initial; background-repeat: initial; background-size: initial; border: none; line-height: 15.6pt; margin-bottom: 0.0001pt; padding: 0cm; text-align: left;">
<span style="font-family: "Courier New"; font-size: 9pt;"> */<o:p></o:p></span></div>
<div class="MsoNormal" style="background-attachment: initial; background-clip: initial; background-image: initial; background-origin: initial; background-position: initial; background-repeat: initial; background-size: initial; border: none; line-height: 15.6pt; margin-bottom: 0.0001pt; padding: 0cm; text-align: left;">
<span style="font-family: "Courier New"; font-size: 9pt;">@WebServlet("/CallExternalDomain")<o:p></o:p></span></div>
<div class="MsoNormal" style="background-attachment: initial; background-clip: initial; background-image: initial; background-origin: initial; background-position: initial; background-repeat: initial; background-size: initial; border: none; line-height: 15.6pt; margin-bottom: 0.0001pt; padding: 0cm; text-align: left;">
<span style="font-family: "Courier New"; font-size: 9pt;">public class CallExternalDomain extends HttpServlet {<o:p></o:p></span></div>
<div class="MsoNormal" style="background-attachment: initial; background-clip: initial; background-image: initial; background-origin: initial; background-position: initial; background-repeat: initial; background-size: initial; border: none; line-height: 15.6pt; margin-bottom: 0.0001pt; padding: 0cm; text-align: left;">
<span style="font-family: "Courier New"; font-size: 9pt;"> private
static final long serialVersionUID = 1L;<o:p></o:p></span></div>
<div class="MsoNormal" style="background-attachment: initial; background-clip: initial; background-image: initial; background-origin: initial; background-position: initial; background-repeat: initial; background-size: initial; border: none; line-height: 15.6pt; margin-bottom: 0.0001pt; padding: 0cm; text-align: left;">
<br /></div>
<div class="MsoNormal" style="background-attachment: initial; background-clip: initial; background-image: initial; background-origin: initial; background-position: initial; background-repeat: initial; background-size: initial; border: none; line-height: 15.6pt; margin-bottom: 0.0001pt; padding: 0cm; text-align: left;">
<span style="font-family: "Courier New"; font-size: 9pt;"> /**<o:p></o:p></span></div>
<div class="MsoNormal" style="background-attachment: initial; background-clip: initial; background-image: initial; background-origin: initial; background-position: initial; background-repeat: initial; background-size: initial; border: none; line-height: 15.6pt; margin-bottom: 0.0001pt; padding: 0cm; text-align: left;">
<span style="font-family: "Courier New"; font-size: 9pt;"> * @see
HttpServlet#HttpServlet()<o:p></o:p></span></div>
<div class="MsoNormal" style="background-attachment: initial; background-clip: initial; background-image: initial; background-origin: initial; background-position: initial; background-repeat: initial; background-size: initial; border: none; line-height: 15.6pt; margin-bottom: 0.0001pt; padding: 0cm; text-align: left;">
<span style="font-family: "Courier New"; font-size: 9pt;"> */<o:p></o:p></span></div>
<div class="MsoNormal" style="background-attachment: initial; background-clip: initial; background-image: initial; background-origin: initial; background-position: initial; background-repeat: initial; background-size: initial; border: none; line-height: 15.6pt; margin-bottom: 0.0001pt; padding: 0cm; text-align: left;">
<span style="font-family: "Courier New"; font-size: 9pt;"> public
CallExternalDomain() {<o:p></o:p></span></div>
<div class="MsoNormal" style="background-attachment: initial; background-clip: initial; background-image: initial; background-origin: initial; background-position: initial; background-repeat: initial; background-size: initial; border: none; line-height: 15.6pt; margin-bottom: 0.0001pt; padding: 0cm; text-align: left;">
<span style="font-family: "Courier New"; font-size: 9pt;"> super();<o:p></o:p></span></div>
<div class="MsoNormal" style="background-attachment: initial; background-clip: initial; background-image: initial; background-origin: initial; background-position: initial; background-repeat: initial; background-size: initial; border: none; line-height: 15.6pt; margin-bottom: 0.0001pt; padding: 0cm; text-align: left;">
<span style="font-family: "Courier New"; font-size: 9pt;"> // TODO
Auto-generated constructor stub<o:p></o:p></span></div>
<div class="MsoNormal" style="background-attachment: initial; background-clip: initial; background-image: initial; background-origin: initial; background-position: initial; background-repeat: initial; background-size: initial; border: none; line-height: 15.6pt; margin-bottom: 0.0001pt; padding: 0cm; text-align: left;">
<span style="font-family: "Courier New"; font-size: 9pt;"> }<o:p></o:p></span></div>
<div class="MsoNormal" style="background-attachment: initial; background-clip: initial; background-image: initial; background-origin: initial; background-position: initial; background-repeat: initial; background-size: initial; border: none; line-height: 15.6pt; margin-bottom: 0.0001pt; padding: 0cm; text-align: left;">
<br /></div>
<div class="MsoNormal" style="background-attachment: initial; background-clip: initial; background-image: initial; background-origin: initial; background-position: initial; background-repeat: initial; background-size: initial; border: none; line-height: 15.6pt; margin-bottom: 0.0001pt; padding: 0cm; text-align: left;">
<span style="font-family: "Courier New"; font-size: 9pt;"> /**<o:p></o:p></span></div>
<div class="MsoNormal" style="background-attachment: initial; background-clip: initial; background-image: initial; background-origin: initial; background-position: initial; background-repeat: initial; background-size: initial; border: none; line-height: 15.6pt; margin-bottom: 0.0001pt; padding: 0cm; text-align: left;">
<span style="font-family: "Courier New"; font-size: 9pt;"> * @see
HttpServlet#doGet(HttpServletRequest request, HttpServletResponse response)<o:p></o:p></span></div>
<div class="MsoNormal" style="background-attachment: initial; background-clip: initial; background-image: initial; background-origin: initial; background-position: initial; background-repeat: initial; background-size: initial; border: none; line-height: 15.6pt; margin-bottom: 0.0001pt; padding: 0cm; text-align: left;">
<span style="font-family: "Courier New"; font-size: 9pt;"> */<o:p></o:p></span></div>
<div class="MsoNormal" style="background-attachment: initial; background-clip: initial; background-image: initial; background-origin: initial; background-position: initial; background-repeat: initial; background-size: initial; border: none; line-height: 15.6pt; margin-bottom: 0.0001pt; padding: 0cm; text-align: left;">
<span style="font-family: "Courier New"; font-size: 9pt;"> protected
void doGet(HttpServletRequest request, HttpServletResponse response) throws
ServletException, IOException {<o:p></o:p></span></div>
<div class="MsoNormal" style="background-attachment: initial; background-clip: initial; background-image: initial; background-origin: initial; background-position: initial; background-repeat: initial; background-size: initial; border: none; line-height: 15.6pt; margin-bottom: 0.0001pt; padding: 0cm; text-align: left;">
<span style="font-family: "Courier New"; font-size: 9pt;">
HttpURLConnection conn = null;<o:p></o:p></span></div>
<div class="MsoNormal" style="background-attachment: initial; background-clip: initial; background-image: initial; background-origin: initial; background-position: initial; background-repeat: initial; background-size: initial; border: none; line-height: 15.6pt; margin-bottom: 0.0001pt; padding: 0cm; text-align: left;">
<span style="font-family: "Courier New"; font-size: 9pt;">
BufferedReader reader = null;<o:p></o:p></span></div>
<div class="MsoNormal" style="background-attachment: initial; background-clip: initial; background-image: initial; background-origin: initial; background-position: initial; background-repeat: initial; background-size: initial; border: none; line-height: 15.6pt; margin-bottom: 0.0001pt; padding: 0cm; text-align: left;">
<span style="font-family: "Courier New"; font-size: 9pt;"> try {<o:p></o:p></span></div>
<div class="MsoNormal" style="background-attachment: initial; background-clip: initial; background-image: initial; background-origin: initial; background-position: initial; background-repeat: initial; background-size: initial; border: none; line-height: 15.6pt; margin-bottom: 0.0001pt; padding: 0cm; text-align: left;">
<span style="font-family: "Courier New"; font-size: 9pt;"> URL
url = new java.net.URL(request.getParameter("address"));<o:p></o:p></span></div>
<div class="MsoNormal" style="background-attachment: initial; background-clip: initial; background-image: initial; background-origin: initial; background-position: initial; background-repeat: initial; background-size: initial; border: none; line-height: 15.6pt; margin-bottom: 0.0001pt; padding: 0cm; text-align: left;">
<span style="font-family: "Courier New"; font-size: 9pt;"> conn
= (HttpURLConnection) url.openConnection();<o:p></o:p></span></div>
<div class="MsoNormal" style="background-attachment: initial; background-clip: initial; background-image: initial; background-origin: initial; background-position: initial; background-repeat: initial; background-size: initial; border: none; line-height: 15.6pt; margin-bottom: 0.0001pt; padding: 0cm; text-align: left;">
<span style="font-family: "Courier New"; font-size: 9pt;">
conn.setRequestMethod("GET");<o:p></o:p></span></div>
<div class="MsoNormal" style="background-attachment: initial; background-clip: initial; background-image: initial; background-origin: initial; background-position: initial; background-repeat: initial; background-size: initial; border: none; line-height: 15.6pt; margin-bottom: 0.0001pt; padding: 0cm; text-align: left;">
<span style="font-family: "Courier New"; font-size: 9pt;">
reader = new BufferedReader(new
InputStreamReader(conn.getInputStream()));<o:p></o:p></span></div>
<div class="MsoNormal" style="background-attachment: initial; background-clip: initial; background-image: initial; background-origin: initial; background-position: initial; background-repeat: initial; background-size: initial; border: none; line-height: 15.6pt; margin-bottom: 0.0001pt; padding: 0cm; text-align: left;">
<span style="font-family: "Courier New"; font-size: 9pt;">
String next = null;<o:p></o:p></span></div>
<div class="MsoNormal" style="background-attachment: initial; background-clip: initial; background-image: initial; background-origin: initial; background-position: initial; background-repeat: initial; background-size: initial; border: none; line-height: 15.6pt; margin-bottom: 0.0001pt; padding: 0cm; text-align: left;">
<span style="font-family: "Courier New"; font-size: 9pt;">
StringBuilder responseStr = new StringBuilder();<o:p></o:p></span></div>
<div class="MsoNormal" style="background-attachment: initial; background-clip: initial; background-image: initial; background-origin: initial; background-position: initial; background-repeat: initial; background-size: initial; border: none; line-height: 15.6pt; margin-bottom: 0.0001pt; padding: 0cm; text-align: left;">
<span style="font-family: "Courier New"; font-size: 9pt;">
while ((next = reader.readLine()) != null)<o:p></o:p></span></div>
<div class="MsoNormal" style="background-attachment: initial; background-clip: initial; background-image: initial; background-origin: initial; background-position: initial; background-repeat: initial; background-size: initial; border: none; line-height: 15.6pt; margin-bottom: 0.0001pt; padding: 0cm; text-align: left;">
<span style="font-family: "Courier New"; font-size: 9pt;">
responseStr.append(next);<o:p></o:p></span></div>
<div class="MsoNormal" style="background-attachment: initial; background-clip: initial; background-image: initial; background-origin: initial; background-position: initial; background-repeat: initial; background-size: initial; border: none; line-height: 15.6pt; margin-bottom: 0.0001pt; padding: 0cm; text-align: left;">
<span style="font-family: "Courier New"; font-size: 9pt;">
response.getWriter().write(responseStr.toString());<o:p></o:p></span></div>
<div class="MsoNormal" style="background-attachment: initial; background-clip: initial; background-image: initial; background-origin: initial; background-position: initial; background-repeat: initial; background-size: initial; border: none; line-height: 15.6pt; margin-bottom: 0.0001pt; padding: 0cm; text-align: left;">
<span style="font-family: "Courier New"; font-size: 9pt;"> } catch
(Exception e) {<o:p></o:p></span></div>
<div class="MsoNormal" style="background-attachment: initial; background-clip: initial; background-image: initial; background-origin: initial; background-position: initial; background-repeat: initial; background-size: initial; border: none; line-height: 15.6pt; margin-bottom: 0.0001pt; padding: 0cm; text-align: left;">
<span style="font-family: "Courier New"; font-size: 9pt;">
System.out.println("An error occurred connecting to external
resource" + e.getMessage());<o:p></o:p></span></div>
<div class="MsoNormal" style="background-attachment: initial; background-clip: initial; background-image: initial; background-origin: initial; background-position: initial; background-repeat: initial; background-size: initial; border: none; line-height: 15.6pt; margin-bottom: 0.0001pt; padding: 0cm; text-align: left;">
<span style="font-family: "Courier New"; font-size: 9pt;"> }
finally {<o:p></o:p></span></div>
<div class="MsoNormal" style="background-attachment: initial; background-clip: initial; background-image: initial; background-origin: initial; background-position: initial; background-repeat: initial; background-size: initial; border: none; line-height: 15.6pt; margin-bottom: 0.0001pt; padding: 0cm; text-align: left;">
<span style="font-family: "Courier New"; font-size: 9pt;"> try
{<o:p></o:p></span></div>
<div class="MsoNormal" style="background-attachment: initial; background-clip: initial; background-image: initial; background-origin: initial; background-position: initial; background-repeat: initial; background-size: initial; border: none; line-height: 15.6pt; margin-bottom: 0.0001pt; padding: 0cm; text-align: left;">
<span style="font-family: "Courier New"; font-size: 9pt;">
if (conn != null)<o:p></o:p></span></div>
<div class="MsoNormal" style="background-attachment: initial; background-clip: initial; background-image: initial; background-origin: initial; background-position: initial; background-repeat: initial; background-size: initial; border: none; line-height: 15.6pt; margin-bottom: 0.0001pt; padding: 0cm; text-align: left;">
<span style="font-family: "Courier New"; font-size: 9pt;">
conn.disconnect();<o:p></o:p></span></div>
<div class="MsoNormal" style="background-attachment: initial; background-clip: initial; background-image: initial; background-origin: initial; background-position: initial; background-repeat: initial; background-size: initial; border: none; line-height: 15.6pt; margin-bottom: 0.0001pt; padding: 0cm; text-align: left;">
<span style="font-family: "Courier New"; font-size: 9pt;">
if (reader != null)<o:p></o:p></span></div>
<div class="MsoNormal" style="background-attachment: initial; background-clip: initial; background-image: initial; background-origin: initial; background-position: initial; background-repeat: initial; background-size: initial; border: none; line-height: 15.6pt; margin-bottom: 0.0001pt; padding: 0cm; text-align: left;">
<span style="font-family: "Courier New"; font-size: 9pt;">
reader.close();<o:p></o:p></span></div>
<div class="MsoNormal" style="background-attachment: initial; background-clip: initial; background-image: initial; background-origin: initial; background-position: initial; background-repeat: initial; background-size: initial; border: none; line-height: 15.6pt; margin-bottom: 0.0001pt; padding: 0cm; text-align: left;">
<span style="font-family: "Courier New"; font-size: 9pt;"> }
catch (Exception e) {<o:p></o:p></span></div>
<div class="MsoNormal" style="background-attachment: initial; background-clip: initial; background-image: initial; background-origin: initial; background-position: initial; background-repeat: initial; background-size: initial; border: none; line-height: 15.6pt; margin-bottom: 0.0001pt; padding: 0cm; text-align: left;">
<span style="font-family: "Courier New"; font-size: 9pt;">
System.out.println("An error occurred releasing resources " +
e.getMessage());<o:p></o:p></span></div>
<div class="MsoNormal" style="background-attachment: initial; background-clip: initial; background-image: initial; background-origin: initial; background-position: initial; background-repeat: initial; background-size: initial; border: none; line-height: 15.6pt; margin-bottom: 0.0001pt; padding: 0cm; text-align: left;">
<span style="font-family: "Courier New"; font-size: 9pt;"> }<o:p></o:p></span></div>
<div class="MsoNormal" style="background-attachment: initial; background-clip: initial; background-image: initial; background-origin: initial; background-position: initial; background-repeat: initial; background-size: initial; border: none; line-height: 15.6pt; margin-bottom: 0.0001pt; padding: 0cm; text-align: left;">
<span style="font-family: "Courier New"; font-size: 9pt;"> }<o:p></o:p></span></div>
<div class="MsoNormal" style="background-attachment: initial; background-clip: initial; background-image: initial; background-origin: initial; background-position: initial; background-repeat: initial; background-size: initial; border: none; line-height: 15.6pt; margin-bottom: 0.0001pt; padding: 0cm; text-align: left;">
<span style="font-family: "Courier New"; font-size: 9pt;"> }<o:p></o:p></span></div>
<div class="MsoNormal" style="background-attachment: initial; background-clip: initial; background-image: initial; background-origin: initial; background-position: initial; background-repeat: initial; background-size: initial; border: none; line-height: 15.6pt; margin-bottom: 0.0001pt; padding: 0cm; text-align: left;">
<br /></div>
<div class="MsoNormal" style="background-attachment: initial; background-clip: initial; background-image: initial; background-origin: initial; background-position: initial; background-repeat: initial; background-size: initial; border: none; line-height: 15.6pt; margin-bottom: 0.0001pt; padding: 0cm; text-align: left;">
<span style="font-family: "Courier New"; font-size: 9pt;"> /**<o:p></o:p></span></div>
<div class="MsoNormal" style="background-attachment: initial; background-clip: initial; background-image: initial; background-origin: initial; background-position: initial; background-repeat: initial; background-size: initial; border: none; line-height: 15.6pt; margin-bottom: 0.0001pt; padding: 0cm; text-align: left;">
<span style="font-family: "Courier New"; font-size: 9pt;"> * @see
HttpServlet#doPost(HttpServletRequest request, HttpServletResponse response)<o:p></o:p></span></div>
<div class="MsoNormal" style="background-attachment: initial; background-clip: initial; background-image: initial; background-origin: initial; background-position: initial; background-repeat: initial; background-size: initial; border: none; line-height: 15.6pt; margin-bottom: 0.0001pt; padding: 0cm; text-align: left;">
<span style="font-family: "Courier New"; font-size: 9pt;"> */<o:p></o:p></span></div>
<div class="MsoNormal" style="background-attachment: initial; background-clip: initial; background-image: initial; background-origin: initial; background-position: initial; background-repeat: initial; background-size: initial; border: none; line-height: 15.6pt; margin-bottom: 0.0001pt; padding: 0cm; text-align: left;">
<span style="font-family: "Courier New"; font-size: 9pt;"> protected
void doPost(HttpServletRequest request, HttpServletResponse response) throws
ServletException, IOException {<o:p></o:p></span></div>
<div class="MsoNormal" style="background-attachment: initial; background-clip: initial; background-image: initial; background-origin: initial; background-position: initial; background-repeat: initial; background-size: initial; border: none; line-height: 15.6pt; margin-bottom: 0.0001pt; padding: 0cm; text-align: left;">
<span style="font-family: "Courier New"; font-size: 9pt;"> // TODO
Auto-generated method stub<o:p></o:p></span></div>
<div class="MsoNormal" style="background-attachment: initial; background-clip: initial; background-image: initial; background-origin: initial; background-position: initial; background-repeat: initial; background-size: initial; border: none; line-height: 15.6pt; margin-bottom: 0.0001pt; padding: 0cm; text-align: left;">
<span style="font-family: "Courier New"; font-size: 9pt;"> }<o:p></o:p></span></div>
<div class="MsoNormal" style="background-attachment: initial; background-clip: initial; background-image: initial; background-origin: initial; background-position: initial; background-repeat: initial; background-size: initial; border: none; line-height: 15.6pt; margin-bottom: 0.0001pt; padding: 0cm; text-align: left;">
<br /></div>
<div class="MsoNormal" style="background-attachment: initial; background-clip: initial; background-image: initial; background-origin: initial; background-position: initial; background-repeat: initial; background-size: initial; border: none; line-height: 15.6pt; margin-bottom: 0.0001pt; padding: 0cm; text-align: left;">
<span style="font-family: "Courier New"; font-size: 9pt;">}<o:p></o:p></span></div>
</div>
<div align="center" style="margin: 0cm 0cm 0.0001pt;">
<br /></div>
<div align="center" style="margin: 0cm 0cm 0.0001pt;">
<br /></div>
<div style="margin: 0cm 0cm 0.0001pt; text-align: center;">
CallExternalDomain.java<o:p></o:p></div>
<div align="center" style="margin: 0cm 0cm 0.0001pt;">
<br /></div>
<div style="text-align: left;">
<span style="font-family: "Times New Roman", serif; font-size: 12pt; line-height: 115%;">You
see the following result when you run this code.</span></div>
</div>
<div style="text-align: left;">
<span style="font-family: "times new roman" , serif;"><br /></span></div>
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiZj_O9lJ07fZyisQZZlql7FVRfRe9znPTmLY-f5ostwpyGrRWwtZ5rZtOxoJrDK7Ulh63M3R8V66hbRl0DlJxW9T4OgSpu3OS-DWBlYmsCWyNskOD0UB5w5A9lVmy7U5pp23ui1sgHvwbm/s1600/4.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img alt="Using Ajax in JQuery" border="0" height="173" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiZj_O9lJ07fZyisQZZlql7FVRfRe9znPTmLY-f5ostwpyGrRWwtZ5rZtOxoJrDK7Ulh63M3R8V66hbRl0DlJxW9T4OgSpu3OS-DWBlYmsCWyNskOD0UB5w5A9lVmy7U5pp23ui1sgHvwbm/s1600/4.png" title="Using Ajax in JQuery" width="320" /></a></div>
<div class="separator" style="clear: both; text-align: center;">
</div>
<div align="center" class="separator" style="margin-bottom: .0001pt; margin: 0cm; text-align: center;">
<span style="color: black;">Figure 4<o:p></o:p></span></div>
<div align="center" style="margin-bottom: .0001pt; margin: 0cm; text-align: center;">
<br /></div>
<div style="margin-bottom: .0001pt; margin: 0cm;">
<br /></div>
<div style="margin: 0cm 0cm 0.0001pt; text-align: left;">
You can
download the source code from <a href="https://github.com/agelenler/myblog/tree/master/js_jQuery/ajax" target="_blank">here</a>.<o:p></o:p></div>
<br />Ali Gelenlerhttp://www.blogger.com/profile/09439697648573423668noreply@blogger.com0tag:blogger.com,1999:blog-3858181542467916490.post-22849811965011427132014-11-21T16:11:00.000+02:002015-02-24T20:59:43.254+02:00Using Show() and Hide() methods in JQuery<span style="font-family: Times New Roman, serif;"><b><u>show() and hide() methods</u></b></span><u style="font-family: 'Times New Roman', serif; font-size: 16px; font-weight: bold;">:</u><br />
<u style="font-family: 'Times New Roman', serif; font-size: 16px; font-weight: bold;"><br /></u>
<span style="font-family: Times New Roman, serif;"> You can use show and hide methods of a JQuery object to change the visibility of it like in the following example. You can check the visibility with is(':visible') method of JQuery.</span><br />
<span style="font-family: Times New Roman, serif;"><br /></span>
<b style="font-family: 'Times New Roman', serif;"><u>Example:</u></b><br />
<span style="font-family: 'Times New Roman', serif;"><br /></span>
<span style="font-family: 'Times New Roman', serif;"><html></span><br />
<span style="font-family: Times New Roman, serif;"> <head></span><br />
<span style="font-family: Times New Roman, serif;"> <script src="http://ajax.googleapis.com/ajax/libs/jquery/1.11.1/jquery.min.js"></script></span><br />
<span style="font-family: Times New Roman, serif;"> <script></span><br />
<span style="font-family: Times New Roman, serif;"> $(document).ready(function() {</span><br />
<span style="font-family: Times New Roman, serif;"> $('#myButton').click(function () { </span><br />
<span style="font-family: Times New Roman, serif;"><span class="Apple-tab-span" style="white-space: pre;"> </span>if($('#myLink').is(':visible'))</span><br />
<span style="font-family: Times New Roman, serif;"><span class="Apple-tab-span" style="white-space: pre;"> </span> $('#myLink').hide();</span><br />
<span style="font-family: Times New Roman, serif;"><span class="Apple-tab-span" style="white-space: pre;"> </span>else </span><br />
<span style="font-family: Times New Roman, serif;"><span class="Apple-tab-span" style="white-space: pre;"> </span> $('#myLink').show();</span><br />
<span style="font-family: Times New Roman, serif;"> return true;</span><br />
<span style="font-family: Times New Roman, serif;"> }); </span><br />
<span style="font-family: Times New Roman, serif;"> });</span><br />
<span style="font-family: Times New Roman, serif;"> </script></span><br />
<span style="font-family: Times New Roman, serif;"> </head></span><br />
<span style="font-family: Times New Roman, serif;"> <body></span><br />
<span style="font-family: Times New Roman, serif;"> <input type="button" id="myButton" value=" show/hide link"></span><br />
<span style="font-family: Times New Roman, serif;"> <br/></span><br />
<span style="font-family: Times New Roman, serif;"> <a id='myLink' href='#' onClick="myLink_onClick()">my link</a></span><br />
<span style="font-family: Times New Roman, serif;"> </body></span><br />
<span style="font-family: Times New Roman, serif;"></html> </span><br />
<span style="font-family: Times New Roman, serif;"><br /></span>
<span style="font-family: Times New Roman, serif;">The screen will look like the following.</span><br />
<span style="font-family: Times New Roman, serif;"><br /></span>
<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEipwvZfzxXw58fzdr7DcdKeE7eEwMwCBXkNqxWtbW2b11d5QKTtKSEoLezG9IH-gZi63iTlv291UgIclkhcdy-WMMplPfc587li45LualrTS7tZd-vN3DKNmXKD4ZVfFlWjJHIdXpWZvFDl/s1600/10.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img alt="Using Show() and Hide() methods in JQuery" border="0" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEipwvZfzxXw58fzdr7DcdKeE7eEwMwCBXkNqxWtbW2b11d5QKTtKSEoLezG9IH-gZi63iTlv291UgIclkhcdy-WMMplPfc587li45LualrTS7tZd-vN3DKNmXKD4ZVfFlWjJHIdXpWZvFDl/s1600/10.png" height="173" title="Using Show() and Hide() methods in JQuery" width="320" /></a></div>
<div class="separator" style="clear: both; text-align: center;">
Figure 1</div>
<div style="text-align: center;">
<span style="font-family: Times New Roman, serif;"><br /></span>
<div style="text-align: left;">
<span style="font-family: Times New Roman, serif;">You can download the source code from <a href="https://github.com/agelenler/myblog/tree/master/js_jQuery/show_hide" target="_blank">here</a>. </span></div>
</div>
Ali Gelenlerhttp://www.blogger.com/profile/09439697648573423668noreply@blogger.com0tag:blogger.com,1999:blog-3858181542467916490.post-33105944442599948382014-11-21T08:48:00.001+02:002015-02-24T20:58:22.484+02:00Using html() and innerHTML in JQuery<span style="font-family: Times New Roman, serif;"><b><u>html() vs innerHTML</u></b></span><u style="font-family: 'Times New Roman', serif; font-size: 16px; font-weight: bold;">:</u><br />
<u style="font-family: 'Times New Roman', serif; font-size: 16px; font-weight: bold;"><br /></u>
<span style="font-family: 'Times New Roman', serif; font-size: 16px;"> You can either use html() function to set or get value of a div using JQuery objects like $("#myDiv").html() or use innerHTML property of the html dom object like </span><br />
<span style="font-family: 'Times New Roman', serif; font-size: 16px;">$("#myDiv")[0].innerHTML. You see that a JQuery object is hold an array of html dom objects of the same name. Below is an example of using these syntax.</span><br />
<span style="font-family: 'Times New Roman', serif; font-size: 16px;"><br /></span>
<b style="font-family: 'Times New Roman', serif;"><u>Example:</u></b><br />
<span style="font-family: 'Times New Roman', serif;"><br /></span>
<span style="font-family: 'Times New Roman', serif;"><html></span><br />
<span style="font-family: Times New Roman, serif;"> <head></span><br />
<span style="font-family: Times New Roman, serif;"> <script src="http://code.jquery.com/jquery-1.11.1.min.js"></script></span><br />
<span style="font-family: Times New Roman, serif;"> <script></span><br />
<span style="font-family: Times New Roman, serif;"> $(document).ready(function() {</span><br />
<span style="font-family: Times New Roman, serif;"> $('#myButton').click(function () { </span><br />
<span style="font-family: Times New Roman, serif;"><span class="Apple-tab-span" style="white-space: pre;"> </span> $('#myDiv').html('test');</span><br />
<span style="font-family: Times New Roman, serif;"><span class="Apple-tab-span" style="white-space: pre;"> </span> alert("Jquery object value " + $('#myDiv').html());</span><br />
<span style="font-family: Times New Roman, serif;"><span class="Apple-tab-span" style="white-space: pre;"> </span> alert("HTML Dom object value " + $('#myDiv')[0].innerHTML);<span class="Apple-tab-span" style="white-space: pre;"> </span></span><br />
<span style="font-family: Times New Roman, serif;"> return true;</span><br />
<span style="font-family: Times New Roman, serif;"> }); </span><br />
<span style="font-family: Times New Roman, serif;"> });</span><br />
<span style="font-family: Times New Roman, serif;"> </script></span><br />
<span style="font-family: Times New Roman, serif;"> </head></span><br />
<span style="font-family: Times New Roman, serif;"> <body></span><br />
<span style="font-family: Times New Roman, serif;"> <input type="button" id="myButton" value="fill the div"></span><br />
<span style="font-family: Times New Roman, serif;"> <br/></span><br />
<span style="font-family: Times New Roman, serif;"> <div id="myDiv"></div></span><br />
<span style="font-family: Times New Roman, serif;"> </body></span><br />
<span style="font-family: Times New Roman, serif;"></html> </span><span style="font-family: 'Times New Roman', serif; font-size: 16px;"> </span><br />
<span style="font-family: 'Times New Roman', serif; font-size: 16px;"><br /></span>
<span style="font-family: 'Times New Roman', serif;">The screen will look like the following.</span><br />
<span style="font-family: 'Times New Roman', serif;"><br /></span>
<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEi53Q5MddHXIDwXFA-ZIApIcE4JpZl2Rx2dYYTHH9E-kEq923yvJcnruJ08z6-D6yE-lc1SCZVm149PFubfYtIO5tpeAcQz-_ujmptgz3pF2WQOsX5NajQ7B7Y6rPUqxJT_eM15dkwlqSfu/s1600/8.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img alt="Using html() and innerHTML in JQuery" border="0" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEi53Q5MddHXIDwXFA-ZIApIcE4JpZl2Rx2dYYTHH9E-kEq923yvJcnruJ08z6-D6yE-lc1SCZVm149PFubfYtIO5tpeAcQz-_ujmptgz3pF2WQOsX5NajQ7B7Y6rPUqxJT_eM15dkwlqSfu/s1600/8.png" height="173" title="Using html() and innerHTML in JQuery" width="320" /></a></div>
<div class="separator" style="clear: both; text-align: center;">
Figure 1</div>
<div style="text-align: center;">
<span style="font-family: 'Times New Roman', serif;"><br /></span>
<div style="text-align: left;">
<span style="font-family: 'Times New Roman', serif;">You can download the source code from <a href="https://github.com/agelenler/myblog/tree/master/js_jQuery/html_innerHtml" target="_blank">here</a>.</span></div>
</div>
Ali Gelenlerhttp://www.blogger.com/profile/09439697648573423668noreply@blogger.com1tag:blogger.com,1999:blog-3858181542467916490.post-59507224184269559542014-11-20T14:14:00.001+02:002015-02-24T20:58:47.255+02:00Introduction to JQuery<span style="font-family: Times New Roman, serif;"><b><u>Introduction</u></b></span><u style="font-family: 'Times New Roman', serif; font-size: 16px; font-weight: bold;">:</u><br />
<u style="font-family: 'Times New Roman', serif; font-size: 16px; font-weight: bold;"><br /></u>
<span style="font-family: 'Times New Roman', serif; font-size: 16px;"> JQuery is a well known JavaScript library that helps to develop rapid applications with the help of the large library involves in it. You can download the </span><span style="font-family: 'Times New Roman', serif; font-size: 16px;">JavaScript </span><span style="font-family: 'Times New Roman', serif; font-size: 16px;">file of JQuery or can use it with a <a href="http://en.wikipedia.org/wiki/Content_delivery_network" target="_blank">CDN</a> that means you just use the </span><span style="font-family: 'Times New Roman', serif; font-size: 16px;">JavaScript file hosted on the network. We'll use JQuery with CDN at our examples.</span><span style="font-family: 'Times New Roman', serif; font-size: 16px;"> Just go to the </span><span style="font-family: Times New Roman, serif;">http://jquery.com/download/ page and use the latest release's CND which is "</span><span class="tag" style="background-color: #eeeeee; box-sizing: border-box; color: navy; font-family: source-code-pro, Consolas, monospace; font-size: 15px; line-height: 16.5px; white-space: pre;"><<span class="title" style="box-sizing: border-box;">script</span> <span class="attribute" style="box-sizing: border-box; color: teal;">src</span>=<span class="value" style="box-sizing: border-box; color: #dd1144;">"//code.jquery.com/jquery-1.11.1.min.js"</span>></span><span class="javascript" style="background-color: #eeeeee; box-sizing: border-box; color: #333333; font-family: source-code-pro, Consolas, monospace; font-size: 15px; line-height: 16.5px; white-space: pre;"></span><span class="tag" style="background-color: #eeeeee; box-sizing: border-box; color: navy; font-family: source-code-pro, Consolas, monospace; font-size: 15px; line-height: 16.5px; white-space: pre;"></<span class="title" style="box-sizing: border-box;">script</span>></span><span style="background-color: #eeeeee; color: #dd1144; font-family: source-code-pro, Consolas, monospace; font-size: 15px; line-height: 16.5px; white-space: pre;">" </span><span style="font-family: 'Times New Roman', serif;">at the time of this writing. When you use CDN your visitors previously downloaded a copy of the same CDN can reuse it without downloading it again. You can also use other CDN providers like google and microsoft. We see using google CDN in our example.</span><br />
<span style="font-family: 'Times New Roman', serif; font-size: 16px;"><br /></span>
<span style="font-family: Times New Roman, serif;"><b><u>Example:</u></b></span><br />
<span style="font-family: Times New Roman, serif;"><b><u><br /></u></b></span>
<span style="font-family: Times New Roman, serif;"> In the below example, I show both the standart JavaScript syntax and the syntax of JQuery with which you define a function on a html element in the $(document).ready(function() { ... }; without calling the onClick of that element. Here we define a </span><span style="font-family: 'Times New Roman', serif;">myLink_onClick() function for the myLink html element and call that function with onClick property of the element. On the other hand, with the JQuery we just define $('#myLink').click(function() { ... }); in the ready function and no need to call onClick anymore. We have a text, a button and a link in the example, when you click on link the text set with the "val("")" syntax of the JQuery. Also when you click on button </span><span style="font-family: 'Times New Roman', serif;">both</span><span style="font-family: 'Times New Roman', serif;"> </span><span style="font-family: 'Times New Roman', serif;">link click methods are fired. The run order of the methods is first the old JavaScript method and then the new JQuery method if you click on the link. However if you fire the click of link with the button's click, the order is reversed.</span><br />
<span style="font-family: 'Times New Roman', serif;"><br /></span>
<span style="font-family: 'Times New Roman', serif;"><html></span><br />
<span style="font-family: Times New Roman, serif;"> <head></span><br />
<span style="font-family: Times New Roman, serif;"> <script src="http://code.jquery.com/jquery-1.11.1.min.js"></script></span><br />
<span style="font-family: Times New Roman, serif;"><!-- for google CDN use</span><br />
<span style="font-family: Times New Roman, serif;"> <script src="http://ajax.googleapis.com/ajax/libs/jquery/1.11.1/jquery.min.js"></script> </span><br />
<span style="font-family: Times New Roman, serif;">--></span><br />
<span style="font-family: Times New Roman, serif;"> <script></span><br />
<span style="font-family: Times New Roman, serif;"> $(document).ready(function() {</span><br />
<span style="font-family: Times New Roman, serif;"> $('#myLink').click(function () { </span><br />
<span style="font-family: Times New Roman, serif;"> alert('myLink_click');</span><br />
<span style="font-family: Times New Roman, serif;"><span class="Apple-tab-span" style="white-space: pre;"> </span> var myText = $('#myText');</span><br />
<span style="font-family: Times New Roman, serif;"><span class="Apple-tab-span" style="white-space: pre;"> </span> myText.val('test');</span><br />
<span style="font-family: Times New Roman, serif;"> return true;</span><br />
<span style="font-family: Times New Roman, serif;"> }); </span><br />
<span style="font-family: Times New Roman, serif;"> $('#myLinkReset').click(function () { </span><br />
<span style="font-family: Times New Roman, serif;"><span class="Apple-tab-span" style="white-space: pre;"> </span> var myText = $('#myText');</span><br />
<span style="font-family: Times New Roman, serif;"><span class="Apple-tab-span" style="white-space: pre;"> </span> myText.val('');</span><br />
<span style="font-family: Times New Roman, serif;"> return true;</span><br />
<span style="font-family: Times New Roman, serif;"> }); </span><br />
<span style="font-family: Times New Roman, serif;"> });</span><br />
<span style="font-family: Times New Roman, serif;"> function myButton_onClick() {</span><br />
<span style="font-family: Times New Roman, serif;"> alert('myButton_onClick');</span><br />
<span style="font-family: Times New Roman, serif;"> $('#myLink').click();<span class="Apple-tab-span" style="white-space: pre;"> </span></span><br />
<span style="font-family: Times New Roman, serif;"> }</span><br />
<span style="font-family: Times New Roman, serif;"> function myLink_onClick() {</span><br />
<span style="font-family: Times New Roman, serif;"> alert('myLink_onClick');</span><br />
<span style="font-family: Times New Roman, serif;"> }</span><br />
<span style="font-family: Times New Roman, serif;"> </script></span><br />
<span style="font-family: 'Times New Roman', serif;"> </head></span><br />
<span style="font-family: Times New Roman, serif;"> <body></span><br />
<span style="font-family: Times New Roman, serif;"> <input type="text" id="myText"></span><br />
<span style="font-family: Times New Roman, serif;"> <br/></span><br />
<span style="font-family: Times New Roman, serif;"> <input type="button" id="myButton" onClick="myButton_onClick()" value="click me"></span><br />
<span style="font-family: Times New Roman, serif;"> <br/></span><br />
<span style="font-family: Times New Roman, serif;"> <a id='myLink' href='#' onClick="myLink_onClick()"> click me </a></span><br />
<span style="font-family: 'Times New Roman', serif;"> <br/></span><br />
<span style="font-family: 'Times New Roman', serif;"> <a id='myLinkReset' href='#' > reset </a></span><br />
<span style="font-family: Times New Roman, serif;"> </body></span><br />
<span style="font-family: Times New Roman, serif;"></html> </span><br />
<span style="font-family: Times New Roman, serif;"><br /></span>
<span style="font-family: 'Times New Roman', serif;">The screen will look like the following.</span><br />
<span style="font-family: 'Times New Roman', serif;"><br /></span>
<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEj1xg4JmnUCMwJbz028ZJ0-y1tQ6AP37gPBWJFHlj-nXj9ju1zDchm-EYR6UJ8DptXeh2QNFDQK_Qx1iIvfzk-r9ScvBQwjiLO_qo5tGq84lRBMwUbQII97FgmrgfxfngmZR1-ABk7__Aam/s1600/6.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img alt="Introduction to JQuery" border="0" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEj1xg4JmnUCMwJbz028ZJ0-y1tQ6AP37gPBWJFHlj-nXj9ju1zDchm-EYR6UJ8DptXeh2QNFDQK_Qx1iIvfzk-r9ScvBQwjiLO_qo5tGq84lRBMwUbQII97FgmrgfxfngmZR1-ABk7__Aam/s1600/6.png" height="173" title="Introduction to JQuery" width="320" /></a></div>
<div class="separator" style="clear: both; text-align: center;">
Figure 1</div>
<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEh3o7wqLddM5dCHH8bOoRPqADbcph04TDorW_vXNekTVMMaGprpu0oQQ4_DQ3W00WRxC7tEgoSH-0HK7AV-_yGzH4BxRQi2fea36bu4vZgzTZf-pQmBAdr2KZ2ka11cFu_mLAPAFaKgKota/s1600/7.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img alt="Introduction to JQuery" border="0" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEh3o7wqLddM5dCHH8bOoRPqADbcph04TDorW_vXNekTVMMaGprpu0oQQ4_DQ3W00WRxC7tEgoSH-0HK7AV-_yGzH4BxRQi2fea36bu4vZgzTZf-pQmBAdr2KZ2ka11cFu_mLAPAFaKgKota/s1600/7.png" height="173" title="Introduction to JQuery" width="320" /></a></div>
<div class="separator" style="clear: both; text-align: center;">
Figure 2</div>
<div style="text-align: center;">
<span style="font-family: Times New Roman, serif;"><b><u><br /></u></b></span></div>
<div style="text-align: left;">
<span style="font-family: Times New Roman, serif;"><b><u>Conclusion</u></b></span><u style="font-family: 'Times New Roman', serif; font-size: 16px; font-weight: bold;">:</u></div>
<u style="font-family: 'Times New Roman', serif; font-size: 16px; font-weight: bold;"><br /></u>
<span style="font-family: Times New Roman, serif;"> With the help of JQuery you can develop faster applications. It is easier to develop applications since it has a large library. JQuery also has ajax support.</span><br />
<br />
You can download the source code from <a href="https://github.com/agelenler/myblog/tree/master/js_jQuery/intro" target="_blank">here</a>.Ali Gelenlerhttp://www.blogger.com/profile/09439697648573423668noreply@blogger.com0tag:blogger.com,1999:blog-3858181542467916490.post-42055512250310182772014-11-20T09:18:00.000+02:002014-11-20T09:20:19.017+02:00Using Java NIO to Get File Attributes<span style="font-family: Times New Roman, serif;"><b><u>Introduction</u></b></span><u style="font-family: 'Times New Roman', serif; font-size: 16px; font-weight: bold;">:</u><br />
<u style="font-family: 'Times New Roman', serif; font-size: 16px; font-weight: bold;"><br /></u>
<span style="font-family: 'Times New Roman', serif; font-size: 16px;"> Today, I'll talk about how to get the attributes of a file like creation time, last access time and modify time using Java NIO library which comes with Java 7.</span><br />
<span style="font-family: 'Times New Roman', serif; font-size: 16px;"><br /></span>
<b style="font-family: 'Times New Roman', serif;"><u>Enable Access Time Tracking In Win 7:</u></b><br />
<b style="font-family: 'Times New Roman', serif;"><u><br /></u></b>
<span style="font-family: 'Times New Roman', serif;"> If you're a Win 7 user, you will see that access time tracking is not enabled by default. You need to enable it by following command in cmd. If you need to disable again just change 0 to 1 in the command.</span><br />
<span style="font-family: 'Times New Roman', serif;"><br /></span>
<span style="font-family: Times New Roman, serif;">* sutil behavior set disablelastaccess 0 </span><br />
<span style="font-family: Times New Roman, serif;"><br /></span>
<b style="font-family: 'Times New Roman', serif;"><u>Example 1:</u></b><br />
<b style="font-family: 'Times New Roman', serif;"><u><br /></u></b>
Here is the java code sample to get the creation, last access and modify time of a file. You need to create a text file named test.txt under your java project. We'll read this file using the System.getProperty("user.dir") which gives us the current working directory which is the directory of the project. We also use Calendar and SimpleDateFormat classes to set time and to print the result.<br />
<br />
package file.attributes;<br />
<br />
import java.io.File;<br />
<br />
import java.io.IOException;<br />
import java.nio.file.FileSystem;<br />
import java.nio.file.FileSystems;<br />
import java.nio.file.Files;<br />
import java.nio.file.Path;<br />
import java.nio.file.attribute.BasicFileAttributes;<br />
import java.nio.file.attribute.FileTime;<br />
import java.text.SimpleDateFormat;<br />
import java.util.Calendar;<br />
<br />
public class FileAttributes {<br />
<br />
public static final String FILE_NAME = "test.txt";<br />
public static final SimpleDateFormat FORMATTER = new SimpleDateFormat("dd.MM.yyyy hh.mm.ss");<br />
<br />
public static void main(String[] args) {<br />
try {<br />
<span class="Apple-tab-span" style="white-space: pre;"> </span>File file = new File(System.getProperty("user.dir") + "/" + FILE_NAME);<br />
<span class="Apple-tab-span" style="white-space: pre;"> </span>FileSystem fileSystem = FileSystems.getDefault();<br />
<span class="Apple-tab-span" style="white-space: pre;"> </span>Path absolutePath = fileSystem.getPath(file.getAbsolutePath());<br />
<span class="Apple-tab-span" style="white-space: pre;"> </span>BasicFileAttributes fileAttrs = Files.readAttributes(absolutePath, BasicFileAttributes.class);<br />
<span class="Apple-tab-span" style="white-space: pre;"> </span>//Find and print creation time<span class="Apple-tab-span" style="white-space: pre;"> </span><br />
<span class="Apple-tab-span" style="white-space: pre;"> </span>FileTime creationTime = fileAttrs.creationTime();<br />
<span class="Apple-tab-span" style="white-space: pre;"> </span>Calendar cal = Calendar.getInstance();<br />
<span class="Apple-tab-span" style="white-space: pre;"> </span>cal.setTimeInMillis(creationTime.toMillis());<br />
<span class="Apple-tab-span" style="white-space: pre;"> </span>System.out.println("Creation time : " + FORMATTER.format(cal.getTime()));<br />
<span class="Apple-tab-span" style="white-space: pre;"> </span>//Find and print last access time<br />
<span class="Apple-tab-span" style="white-space: pre;"> </span>FileTime lastAccessTime = fileAttrs.lastAccessTime();<span class="Apple-tab-span" style="white-space: pre;"> </span><br />
<span class="Apple-tab-span" style="white-space: pre;"> </span>cal.setTimeInMillis(lastAccessTime.toMillis());<br />
<span class="Apple-tab-span" style="white-space: pre;"> </span>System.out.println("Last access time : " + FORMATTER.format(cal.getTime()));<span class="Apple-tab-span" style="white-space: pre;"> </span><br />
<span class="Apple-tab-span" style="white-space: pre;"> </span>//Find and print last modify time<br />
FileTime lastModifiedTime = fileAttrs.lastModifiedTime();<span class="Apple-tab-span" style="white-space: pre;"> </span><br />
<span class="Apple-tab-span" style="white-space: pre;"> </span>cal.setTimeInMillis(lastModifiedTime.toMillis());<br />
<span class="Apple-tab-span" style="white-space: pre;"> </span>System.out.println("Last modified time : " + FORMATTER.format(cal.getTime()));<span class="Apple-tab-span" style="white-space: pre;"> </span><br />
} catch (IOException e) {<br />
<span class="Apple-tab-span" style="white-space: pre;"> </span>System.out.println("An error occurred: " + e.getMessage());<br />
<span class="Apple-tab-span" style="white-space: pre;"> </span> }<br />
}<br />
}<br />
<br />
<div>
You will see the following results.</div>
<div>
<br /></div>
<div>
* Creation time : 18.11.2014 04.09.21</div>
<div>
* Last access time : 20.11.2014 08.43.20</div>
<div>
* Last modified time : 20.11.2014 08.36.37 </div>
<div>
<br /></div>
<div>
If you access or modify the file you will see the correspending properties changed.</div>
<div>
<br /></div>
<div>
<div>
* Creation time : 18.11.2014 04.09.21</div>
<div>
* Last access time : 20.11.2014 08.50.50</div>
<div>
* Last modified time : 20.11.2014 08.50.50</div>
</div>
<div>
<br /></div>
<div>
If you modify the file both access and modify times will change, on the other hand accessing a file will only change the access time.</div>
<div>
<br /></div>
<div>
<b style="font-family: 'Times New Roman', serif;"><u>Example 2:</u></b></div>
<div>
<b style="font-family: 'Times New Roman', serif;"><u><br /></u></b></div>
<div>
<span style="font-family: 'Times New Roman', serif;"> </span>Here<span style="font-family: 'Times New Roman', serif;"> is another example that get the absolute path with a different way (using Paths.get(...) method) and change the last access time programmatically</span></div>
<div>
<span style="font-family: 'Times New Roman', serif;"><br /></span></div>
<div>
<div>
<span style="font-family: Times New Roman, serif;">package file.attributes;</span></div>
<div>
<span style="font-family: Times New Roman, serif;"><br /></span></div>
<div>
<span style="font-family: Times New Roman, serif;">import java.io.IOException;</span></div>
<div>
<span style="font-family: Times New Roman, serif;">import java.nio.file.Files;</span></div>
<div>
<span style="font-family: Times New Roman, serif;">import java.nio.file.Path;</span></div>
<div>
<span style="font-family: Times New Roman, serif;">import java.nio.file.Paths;</span></div>
<div>
<span style="font-family: Times New Roman, serif;">import java.nio.file.attribute.BasicFileAttributes;</span></div>
<div>
<span style="font-family: Times New Roman, serif;">import java.nio.file.attribute.FileTime;</span></div>
<div>
<span style="font-family: Times New Roman, serif;">import java.text.SimpleDateFormat;</span></div>
<div>
<span style="font-family: Times New Roman, serif;">import java.util.Calendar;</span></div>
<div>
<span style="font-family: Times New Roman, serif;"><br /></span></div>
<div>
<span style="font-family: Times New Roman, serif;">public class FileAttributes2 {</span></div>
<div>
<span style="font-family: Times New Roman, serif;"><br /></span></div>
<div>
<span style="font-family: Times New Roman, serif;"> public static final String FILE_NAME = "test.txt";</span></div>
<div>
<span style="font-family: Times New Roman, serif;"> public static final SimpleDateFormat FORMATTER = new SimpleDateFormat("dd.MM.yyyy hh.mm.ss");</span></div>
<div>
<span style="font-family: Times New Roman, serif;"><br /></span></div>
<div>
<span style="font-family: Times New Roman, serif;"> public static void main(String[] args) {</span></div>
<div>
<span style="font-family: Times New Roman, serif;"> try {</span></div>
<div>
<span style="font-family: Times New Roman, serif;"> // Set the last access time</span></div>
<div>
<span style="font-family: Times New Roman, serif;"><span class="Apple-tab-span" style="white-space: pre;"> </span>Path absolutePath = Paths.get(System.getProperty("user.dir"), FILE_NAME);</span></div>
<div>
<span style="font-family: Times New Roman, serif;"><span class="Apple-tab-span" style="white-space: pre;"> </span>long currTime = System.currentTimeMillis();</span></div>
<div>
<span style="font-family: Times New Roman, serif;"><span class="Apple-tab-span" style="white-space: pre;"> </span>FileTime fileTime = FileTime.fromMillis(currTime);</span></div>
<div>
<span style="font-family: Times New Roman, serif;"><span class="Apple-tab-span" style="white-space: pre;"> </span>Files.setAttribute(absolutePath, "basic:lastAccessTime", fileTime, java.nio.file.LinkOption.NOFOLLOW_LINKS);</span></div>
<div>
<span style="font-family: Times New Roman, serif;"> </span>//Find and print last access time</div>
<div>
<span style="font-family: Times New Roman, serif;"><span class="Apple-tab-span" style="white-space: pre;"> </span>BasicFileAttributes fileAttrs = Files.readAttributes(absolutePath, BasicFileAttributes.class);</span></div>
<div>
<span style="font-family: Times New Roman, serif;"><span class="Apple-tab-span" style="white-space: pre;"> </span>FileTime lastAccessTime = fileAttrs.lastAccessTime();</span></div>
<div>
<span style="font-family: Times New Roman, serif;"><span class="Apple-tab-span" style="white-space: pre;"> </span>Calendar cal = Calendar.getInstance();</span></div>
<div>
<span style="font-family: Times New Roman, serif;"><span class="Apple-tab-span" style="white-space: pre;"> </span>cal.setTimeInMillis(lastAccessTime.toMillis());</span></div>
<div>
<span style="font-family: Times New Roman, serif;"><span class="Apple-tab-span" style="white-space: pre;"> </span>System.out.println("Last access time : " + FORMATTER.format(cal.getTime()));</span></div>
<div>
<span style="font-family: Times New Roman, serif;"><span class="Apple-tab-span" style="white-space: pre;"> </span> } catch (IOException e) {</span></div>
<div>
<span style="font-family: Times New Roman, serif;"><span class="Apple-tab-span" style="white-space: pre;"> </span>System.out.println("An error occurred: " + e.getMessage());</span></div>
<div>
<span style="font-family: Times New Roman, serif;"><span class="Apple-tab-span" style="white-space: pre;"> </span> }</span></div>
<div>
<span style="font-family: 'Times New Roman', serif;">}</span></div>
<div>
<span style="font-family: Times New Roman, serif;">}</span></div>
</div>
<div>
<span style="font-family: 'Times New Roman', serif;"><br /></span></div>
<div>
<b style="font-family: 'Times New Roman', serif;"><u>Conclusion:</u></b></div>
<div>
<b style="font-family: 'Times New Roman', serif;"><u><br /></u></b></div>
<div>
<span style="font-family: 'Times New Roman', serif;"> We saw how to use Java nio library to get the file attributes. You can get creation, last access and modify time of a file using nio. Although we enable tracking of last access time as explained in the first part of this paper, there is still a problem with the last access time. If you modify the file in the windows folder system it changes our program result, however accessing a file in the file system has no effect, while accessing it in the eclipse environment changes the last access time.</span></div>
<div>
<br /></div>
<span style="font-family: 'Times New Roman', serif; font-size: 16px;"><br /></span>Ali Gelenlerhttp://www.blogger.com/profile/09439697648573423668noreply@blogger.com1tag:blogger.com,1999:blog-3858181542467916490.post-27961706234367280032014-11-19T15:59:00.000+02:002015-02-24T21:00:20.863+02:00Getting Selected Text of TextArea Using JavaScript<span style="font-family: Times New Roman, serif;"><b><u>Getting Selected Text of TextArea Using JavaScript</u></b></span><u style="font-family: 'Times New Roman', serif; font-size: 16px; font-weight: bold;">:</u><br />
<u style="font-family: 'Times New Roman', serif; font-size: 16px; font-weight: bold;"><br /></u>
<span style="font-family: 'Times New Roman', serif; font-size: 16px;"> You can get the selected text of a textarea using pure javascript. The below example shows how to achieve it. The example below tested with chrome, mozilla and ie with the following specified versions.C</span><span style="font-family: 'Times New Roman', serif;">hrome version 38.0.2125.111, ie version 11.0.9600, mozilla version 32.0.3</span><br />
<span style="font-family: 'Times New Roman', serif; font-size: 16px;"><br /></span>
<b style="font-family: 'Times New Roman', serif;"><u>Example:</u></b><br />
<b style="font-family: 'Times New Roman', serif;"><u><br /></u></b>
<span style="font-family: 'Times New Roman', serif;"> </span><span style="font-family: Times New Roman, serif;"><html></span><br />
<span style="font-family: 'Times New Roman', serif;"> <head></span><br />
<span style="font-family: Times New Roman, serif;"><span class="Apple-tab-span" style="white-space: pre;"> </span><script type="text/javascript"></span><br />
<span style="font-family: Times New Roman, serif;"><span class="Apple-tab-span" style="white-space: pre;"> </span>function getSelectedText() </span><br />
<span style="font-family: Times New Roman, serif;"><span class="Apple-tab-span" style="white-space: pre;"> </span>{</span><br />
<span style="font-family: Times New Roman, serif;"><span class="Apple-tab-span" style="white-space: pre;"> </span>var txtArea = document.getElementById("textarea1");</span><br />
<span style="font-family: Times New Roman, serif;"><span class="Apple-tab-span" style="white-space: pre;"> </span>var selectedText; </span><br />
<span style="font-family: Times New Roman, serif;"><span class="Apple-tab-span" style="white-space: pre;"> </span>if (txtArea.selectionStart != undefined)</span><br />
<span style="font-family: Times New Roman, serif;"><span class="Apple-tab-span" style="white-space: pre;"> </span>{ </span><br />
<span style="font-family: Times New Roman, serif;"><span class="Apple-tab-span" style="white-space: pre;"> </span> var startPosition = txtArea.selectionStart;</span><br />
<span style="font-family: Times New Roman, serif;"><span class="Apple-tab-span" style="white-space: pre;"> </span> var endPosition = txtArea.selectionEnd;</span><br />
<span style="font-family: Times New Roman, serif;"><span class="Apple-tab-span" style="white-space: pre;"> </span> selectedText = txtArea.value.substring(startPosition, endPosition);</span><br />
<span style="font-family: Times New Roman, serif;"><span class="Apple-tab-span" style="white-space: pre;"> </span>}</span><br />
<span style="font-family: Times New Roman, serif;"><span class="Apple-tab-span" style="white-space: pre;"> </span>alert("You selected :" + selectedText);</span><br />
<span style="font-family: Times New Roman, serif;"><span class="Apple-tab-span" style="white-space: pre;"> </span>}</span><br />
<span style="font-family: Times New Roman, serif;"><span class="Apple-tab-span" style="white-space: pre;"> </span></script></span><br />
<span style="font-family: Times New Roman, serif;"><span class="Apple-tab-span" style="white-space: pre;"> </span></head></span><br />
<span style="font-family: Times New Roman, serif;"><span class="Apple-tab-span" style="white-space: pre;"> </span><body></span><br />
<span style="font-family: Times New Roman, serif;"><span class="Apple-tab-span" style="white-space: pre;"> </span><textarea id="textarea1" onselect="getSelectedText()" cols="75" rows="30"></span><br />
<span style="font-family: Times New Roman, serif;"><span class="Apple-tab-span" style="white-space: pre;"> </span></textarea></span><br />
<span style="font-family: Times New Roman, serif;"><span class="Apple-tab-span" style="white-space: pre;"> </span></body></span><br />
<span style="font-family: Times New Roman, serif;"> </html></span><br />
<span style="font-family: Times New Roman, serif;"><br /></span>
<span style="font-family: 'Times New Roman', serif;">The screen will look like the following.</span><br />
<span style="font-family: 'Times New Roman', serif;"><br /></span>
<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEh1V9uaIQi3J6UWg6AWQ5ENrN-LySnipDKTNbtEUNbltJkixMrlfmL9TWK7elR1lhkHdF_cEDtB1rE0OM0xkYRn2-SBtMeHpzasLj6aUum2HzB9h6oqsWVySHIiffyX5pMTBQK01CgMX8tL/s1600/5.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img alt="Getting Selected Text of TextArea Using JavaScript" border="0" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEh1V9uaIQi3J6UWg6AWQ5ENrN-LySnipDKTNbtEUNbltJkixMrlfmL9TWK7elR1lhkHdF_cEDtB1rE0OM0xkYRn2-SBtMeHpzasLj6aUum2HzB9h6oqsWVySHIiffyX5pMTBQK01CgMX8tL/s1600/5.png" height="173" title="Getting Selected Text of TextArea Using JavaScript" width="320" /></a></div>
<div class="separator" style="clear: both; text-align: center;">
Figure 1</div>
<div style="text-align: center;">
<span style="font-family: 'Times New Roman', serif;"><br /></span>
<div style="text-align: left;">
<span style="font-family: 'Times New Roman', serif;">You can download the source code from <a href="https://github.com/agelenler/myblog/tree/master/js_jQuery/textarea" target="_blank">here</a>. </span></div>
</div>
Ali Gelenlerhttp://www.blogger.com/profile/09439697648573423668noreply@blogger.com8tag:blogger.com,1999:blog-3858181542467916490.post-3967651299665825322014-11-17T15:30:00.000+02:002014-11-17T16:03:12.809+02:00Improving Database Performance in a Multithreading Environment-1<u style="font-family: 'Times New Roman', serif; font-size: 16px; font-weight: bold;">Introduction:</u><br />
<u style="font-family: 'Times New Roman', serif; font-size: 16px; font-weight: bold;"><br /></u>
<span style="font-family: Times New Roman, serif;"> Today many database systems run in multithread environments.In a multithread environment the most important and critical issue is to obtain and maintain a good performance as well as with a success of concurrent access to the resources. In this write we'll talk about two points related to database performance "Concept of Denormalization" and "Join Methods and Techniques". In the future writes we'll be talking about the other aspects that effect the database performance.</span><br />
<span style="font-family: Times New Roman, serif;"><br /></span>
<u style="font-family: 'Times New Roman', serif; font-size: 16px; font-weight: bold;">Concept of Denormalization:</u><br />
<u style="font-family: 'Times New Roman', serif; font-size: 16px; font-weight: bold;"><br /></u>
<span style="font-family: 'Times New Roman', serif; font-size: 16px;"> Normalization is the process of reorganizing the tables and fields to minimize redundancy and tight dependency. This optimize update cost since the value is stored in only one place and you only need to update that place. However, retrieving many different but related values usually requires going to many different places. This cause to slower retrieval process. Conceptual diagrams, either entity-relationship or object oriented, are a precursor to designing relational table structures.Many database systems are designed such that the tables are at least in third normal form (3NF) base on conceptual models, but the more you normalize the more level you will need to reach the data you want. As </span><span style="font-family: 'Times New Roman', serif; font-size: 16px;">client-server platforms</span><span style="font-family: 'Times New Roman', serif; font-size: 16px;"> are going to be cheaper rather than strong mainframes, the performance will decrease because of the normalization. One critical fact is the need to continue to provide a satisfactorty level of system performance, usually reflected by the systems response time, for online transactional systems. A fully normalized database schema can fail to provide adequate system response time due to excessive table join operations.</span><br />
<span style="font-family: 'Times New Roman', serif; font-size: 16px;"><br /></span>
<u style="font-family: 'Times New Roman', serif; font-size: 16px; font-weight: bold;">How to Perform Denormalization:</u><br />
<u style="font-family: 'Times New Roman', serif; font-size: 16px; font-weight: bold;"><br /></u>
<span style="font-family: 'Times New Roman', serif; font-size: 16px;"> When denormalization takes into place you must consider both good system response time and avoiding various anomalies and problems associated with denormalized table structures. Before denormalization you have to analyze critical transactions in detail. This analyse should include the specification of primary and secondary access paths for tables that comprise the end-user view of the database. Furthermore, denormalization should only be considered under conditions that allow designers to collect detail performance mesasurements for comparison with system performance requirements. Relational performance theory provides guidelines for achieving an idealized representaion of data and data relationships. On the contrary, client-server systems require physical database design that optimize performance for specific target systems under less than ideal conditions. The final database schema should be adjusted for characteristics of the environment such as harware, software and other constraints.</span><br />
<span style="font-family: 'Times New Roman', serif; font-size: 16px;"><br /></span>
<span style="font-family: 'Times New Roman', serif; font-size: 16px;">The general steps of denormalization could be the following:</span><br />
<span style="font-family: 'Times New Roman', serif; font-size: 16px;"><br /></span>
<span style="font-family: Times New Roman, serif;"><u style="font-weight: bold;">1.)</u> Analyze the queries that required a lot of join operations to get the related data. We may say that any queries that requires more than three joins should be considered as a candidate for denormalization. Also you need to measure system performance by simulating the production environment to prove the need for denormalization.</span><br />
<span style="font-family: Times New Roman, serif;"><b><u><br /></u></b></span>
<span style="font-family: Times New Roman, serif;"><u style="font-weight: bold;">2.)</u> You should try to reduce the number of foreign keys in order to reduce the index maintenance during insert, update and delete operations. Reducing foreing keys means to reduce number of relational tables.</span><br />
<span style="font-family: Times New Roman, serif;"><b><u><br /></u></b></span>
<span style="font-family: Times New Roman, serif;"><u style="font-weight: bold;">3.)</u> Data maintenance which is the main purpose of normalization should also be provided by the denormalized schema. Therefore, the denormalized approach should'nt require excessive programming effort like triggers to maintain data integrity and consistency.</span><br />
<span style="font-family: Times New Roman, serif;"><br /></span>
<u style="font-family: 'Times New Roman', serif; font-size: 16px; font-weight: bold;">A Denormalization Example:</u><br />
<u style="font-family: 'Times New Roman', serif; font-size: 16px; font-weight: bold;"><br /></u>
<span style="font-family: 'Times New Roman', serif; font-size: 16px;"> We can examine denormalization from 3NF to 2NF by the following example. The relationship between the Customer and Order entities is one-to-many (many orders can be processed by a single customer, but an order is normally associated with one and only one customer). The 3NF solution for the Customer and Order tables is given below, along with a denormalized 2NF solution.</span><br />
<span style="font-family: 'Times New Roman', serif; font-size: 16px;"><br /></span>
<span style="font-family: Times New Roman, serif;"><b>3NF:</b></span><br />
<span style="font-family: Times New Roman, serif;"><b>CUSTOMER (CustomerId, CustomerName,...)</b></span><br />
<span style="font-family: Times New Roman, serif;"><b>ORDER (OrderId, OrderDate, DeliveryDate, Amount, CustomerId)</b></span><br />
<span style="font-family: Times New Roman, serif;"><b><br /></b></span>
<span style="font-family: Times New Roman, serif;"><b>Denormalized 2NF:</b></span><br />
<b style="font-family: 'Times New Roman', serif;">CUSTOMER (CustomerId, CustomerName,...)</b><br />
<b style="font-family: 'Times New Roman', serif;">ORDER (OrderId, OrderDate, DeliveryDate, Amount, CustomerId, CustomerName)</b><br />
<b style="font-family: 'Times New Roman', serif;"><br /></b>
<span style="font-family: 'Times New Roman', serif;">Here we see that CustomerId in the Order table is a foreign key relating the Order and Customer tables. Denormalizing the table structures by duplicating the CustomerName in the Order table results in a solution that is 2NF because the non-key CustomerName is determined by the non-key CustomerId field. If we analyse the denormalized situation we may discover that most end-user requests require getting customer name, not the customer identification number. However the 3NF solution requires joining the Customer and Order tables. </span><br />
<span style="font-family: 'Times New Roman', serif;">When we compare the 3NF solution with the denormalized 2NF solution, we see that customer name could easily be recorded to the denormalized Order table at the time that the order transaction takes place. In the denormalized form we may question the need to maintain the consistency of the data between the Order and Customer tables. In this situation, the requirement to support name changes for customer is very small, and only occurs when a customer changes her name due to marriage. Furthermore, the necessity to update the Order table in such a situation is a decision for management to make and such data maintenance may be ignored, since the important issues for customers usually revolves around whether or not they get paid their charge, and the denormalized 2NF solution supports payroll activities as well as the production of standart end-user views of the database.</span><br />
<span style="font-family: 'Times New Roman', serif;">It's crucial to remember that denormalization was initially implemented for performance reasons. If the environment changes the denormalization process should be reconsidered. Also its possible that, given a changing hardware and software environment, denormalized tables may be causing performance degredation instead of performance gains.</span><br />
<span style="font-family: 'Times New Roman', serif;"><br /></span>
<u style="font-family: 'Times New Roman', serif; font-size: 16px; font-weight: bold;">Join Methods and Techniques:</u><br />
<u style="font-family: 'Times New Roman', serif; font-size: 16px; font-weight: bold;"><br /></u>
<span style="font-family: 'Times New Roman', serif; font-size: 16px;"> In a query based application the need to join two or more tables is one of the most performance degredation operation. Generally when joining tables the Database Management System first chooses one of the tables which is called "outer table", and get that table to memory for quick access. Then this outer table is prepared for the join operation and finally combined with the second choosen table which is called "inner table". If there are more than two tables to join, the same operation is done using the result of first join and the choosen third table.</span><br />
<span style="font-family: 'Times New Roman', serif; font-size: 16px;">When designing and programming a database application one should take into account the following techniques.</span><br />
<br />
<ul>
<li><span style="font-family: Times New Roman, serif;"><u>Choose smaller table as the outer table:</u> Since the outer table will get to the memory, a smaller table will get with less cost. Also the bigger one that is the inner table will be accessed less, since it will be accessed only by the qualifying rows of the outer table.</span></li>
<li><span style="font-family: Times New Roman, serif;"><u>Choose the outer table as if it can use the selective predicate in the where clause:</u> By that way, the inner table will be called only for the satisfying rows of the outer table.</span></li>
<li><span style="font-family: Times New Roman, serif;"><u>Choose the outer table as if it has less duplicate rows:</u></span></li>
<li><span style="font-family: Times New Roman, serif;"><u>Choose the inner table as if it can be access using index lookup:</u> Index lookup means we don't need to go to table to get the information and get all the information from the index. Today many Database Management Systems keeps indexed in memory. As we mentioned, we get also the outer table into the memory during the initial phase of joining. Hence in that case both outer and inner table are in memory , and it greatly improves the performance.</span></li>
</ul>
<div>
<span style="font-family: Times New Roman, serif;">We can now look up to the join methods. Today's database systems are usually using three main join methods.</span></div>
<div>
<span style="font-family: Times New Roman, serif;"> </span></div>
<br />
<span style="font-family: 'Times New Roman', serif; font-size: 16px; font-weight: bold;">1.) Nested Loop Join (NLJ):</span><br />
<span style="font-family: 'Times New Roman', serif; font-size: 16px; font-weight: bold;"><br /></span>
<span style="font-family: 'Times New Roman', serif; font-size: 16px;"> With the NLJ, a qualifying row is identified in the outer table, and then the inner table is scanned searching for a match. A qualifying row is one in which the predicated for colums in the table match. When the inner table's scan is complete, another qualifying row in the outer table is identified. The inner table is scanned for a match again, and so on. The repeating scanning of the inner table is usually accomplished with an index to minimize I/O cost.</span><br />
<span style="font-family: 'Times New Roman', serif; font-size: 16px;"><br /></span>
<span style="font-family: 'Times New Roman', serif; font-size: 16px; font-weight: bold;">2.) Merge Join (MJ):</span><br />
<br />
With the MJ, the tables of the join operation need to be ordered by the join predicates. That means that each table must be accessed in order by the columns that specify the join criteria. This ordering can be result of either a sort or indexed access. After ensuring both the outer and the inner table are properly sequenced, each table is read sequentially and the join columns are matched up. Neither table is read more than once during a merge join.<br />
<br />
<span style="font-family: 'Times New Roman', serif; font-size: 16px; font-weight: bold;">3.) Hash Join (HJ):</span><br />
<span style="font-family: 'Times New Roman', serif; font-size: 16px; font-weight: bold;"><br /></span>
<span style="font-family: 'Times New Roman', serif; font-size: 16px;"> Hash join requires one or more predicated of the form table1.ColX = table2.ColY where the column types are same. The inner table is scanned and the rows are copied into the memory buffers drawn from the sort heap allocation.The memory buffers are divided into partitions based on a "hash code" computed from column(s) of the join predicate(s). If the size of the first table exceeds the available sort heap space, buffers from the selected partitions are written to temporary tables. After processing the inner table, the outer table is scanned and it's rows are matched to the inner table rows by comparing the "hash code". Hash joins can require a significant amount of memory. Therefore, for the hash join to produce realistic performance benefits, you many need to change the value of the database configuration parameters that are related with the memory management.</span><br />
<span style="font-family: 'Times New Roman', serif; font-size: 16px;"><br /></span>
<span style="font-family: 'Times New Roman', serif; font-size: 16px;"> When do we know, which of these join methods should be used ? In general, the nested loop join is preferred in terms of execution cost when a small number of rows qualified for the join.As the number of qualifying rows increases, the merge join becomes a better choose. Finally, in the case of a hash join, the inner table is kept in memory buffers. If there are too few memory buffers, then the hash join possibly will fail. The optimizer attempts to avoid this and so pick the smaller of the two tables as the inner table, and the larger one as the outer table.</span><br />
<span style="font-family: 'Times New Roman', serif; font-size: 16px;"> Results of performance generalizations will depend on the exact number of qualifying rows as well as other factors such as your database design, database organization, accuracy of statictics, type of hardware and the setup of your environment.Today's database systems chooses the join technique automatically with the help of an optimizer. However, looking to the situation, one can change the join method by changing the query and table definition to obtain a better performance. </span><br />
<span style="font-family: 'Times New Roman', serif; font-size: 16px;"><br /></span>
<span style="font-family: 'Times New Roman', serif; font-size: 16px; font-weight: bold;"><u>Conclusion:</u></span><br />
<span style="font-family: 'Times New Roman', serif; font-size: 16px; font-weight: bold;"><u><br /></u></span>
<span style="font-family: 'Times New Roman', serif; font-size: 16px;"> In this write, we examine a database application performance in a multithread environment in terms of two points. There are many aspects that affect the performance of such an application. The normalization is one of the most critical issues in a database design. However, too much normalization will cause many join operation and negatively affect the performance, so we have to try to denormalize the tables without breaking the data maintenance. Even if we denormalize some tables, there may be still some normalized tables that we have to join them in some requirements. When we join the tables not only the expected results but also at least on of the tables will get to the memory.Specifying that table is crucial. As we join tables, there are some rules to consider, like first get the smaller table into the memory in NLJ. If we rewrite out sql by considering those facts, the DBMS will get the results quickly by using the appropriate join method. In the <a href="http://www.aligelenler.com/2014/11/improving-database-performance-2.html" target="_blank">next</a> paper we'll be talking about "Minimizing Contention" in multithreading environment.</span><br />
<span style="font-family: 'Times New Roman', serif; font-size: 16px;"><br /></span>
<u style="font-family: 'Times New Roman', serif; font-size: 16px; font-weight: bold;">References and Resources:</u><br />
<span style="background-color: #fff9ee; color: #222222; font-family: inherit; font-size: 15px; line-height: 21.5599994659424px;"><br /></span>
<span style="background-color: #fff9ee; color: #222222; font-family: inherit; font-size: 15px; line-height: 21.5599994659424px;">- John Goodson and Robert A. Steward, The Data Access Handbook Achieving </span><span style="background-color: #fff9ee; color: #222222; font-family: inherit; font-size: 15px; line-height: 21.5599994659424px;">Optimal Database Application Performance and Scalability, Prentice Hall, Chapter 1-2 </span><span style="background-color: #fff9ee; color: #222222; font-family: inherit; font-size: 15px; line-height: 21.5599994659424px;">(2009)</span><br />
<span style="background-color: #fff9ee; color: #222222; font-family: inherit; font-size: 15px; line-height: 21.5599994659424px;"><br /></span>
<span style="font-family: inherit;"><span style="background-color: #fff9ee; color: #222222; font-size: 15px; line-height: 21.5599994659424px;">- Douglas B. Bock and John F. Schrage, Department of Computer Management and </span><span style="background-color: #fff9ee; color: #222222; font-size: 15px; line-height: 21.5599994659424px;">Information Systems, Southern Illinois University Edwardsville, published in the 1996 </span><span style="background-color: #fff9ee; color: #222222; font-size: 15px; line-height: 21.5599994659424px;">Proceedings of the Decision Sciences Institute, BENEFITS OF DENORMALIZED </span><span style="background-color: #fff9ee; color: #222222; font-size: 15px; line-height: 21.5599994659424px;">RELATIONAL DATABASE TABLES , Orlando, Florida, November, 1996</span></span><br />
<div>
<span style="font-family: inherit;"><br style="background-color: #fff9ee; color: #222222; font-size: 15px; line-height: 21.5599994659424px;" /><span style="background-color: #fff9ee; color: #222222; font-size: 15px; line-height: 21.5599994659424px;">- Craig Mullins, Tuning DB2 SQL Access Paths, </span><span style="background-color: #fff9ee; color: #222222; font-size: 15px; line-height: 21.5599994659424px;">http://www.ibm.com/developerworks/data/library/techarticle/0301mullins/0301mullin</span><span style="background-color: #fff9ee; color: #222222; font-size: 15px; line-height: 21.5599994659424px;">s.html</span></span></div>
Ali Gelenlerhttp://www.blogger.com/profile/09439697648573423668noreply@blogger.com1tag:blogger.com,1999:blog-3858181542467916490.post-42499509169030597472014-11-17T15:02:00.000+02:002014-11-17T15:50:02.507+02:00Improving Database Performance in a Multithreading Environment-2<u style="font-family: 'Times New Roman', serif; font-size: 16px; font-weight: bold;">Introduction:</u><br />
<u style="font-family: 'Times New Roman', serif; font-size: 16px; font-weight: bold;"><br /></u>
<span style="font-family: 'Times New Roman', serif; font-size: 16px;"> We mentioned about some concepts on improving database performance in the first part of this paper<a href="http://www.aligelenler.com/2014/11/improving-database-performance-1.html" target="_blank">[1]</a>. Now we continue with another concept "Minimizing Contention" that one should consider when try to improve database performance.</span><br />
<span style="font-family: 'Times New Roman', serif; font-size: 16px;"><br /></span>
<u style="font-family: 'Times New Roman', serif; font-size: 16px; font-weight: bold;">Minimizing Contention:</u><br />
<u style="font-family: 'Times New Roman', serif; font-size: 16px; font-weight: bold;"><br /></u>
<span style="font-family: 'Times New Roman', serif; font-size: 16px;"> In a multithread environment, we can call every thread as a transaction. A transaction usually means a sequence of information exchange and related work (such as database update) that is treated as a unit for the purposes of satisfying a request and for ensuring database integrity. There are four important properties of a transaction, Atomicity, Consistency, Isolation and Durability. We call them by capital letters as <b>ACID </b>properties.</span><br />
<span style="font-family: 'Times New Roman', serif; font-size: 16px;"><br /></span>
<u style="font-family: 'Times New Roman', serif; font-size: 16px; font-weight: bold;">1.) Atomicity:</u><br />
<u style="font-family: 'Times New Roman', serif; font-size: 16px; font-weight: bold;"><br /></u>
<span style="font-family: 'Times New Roman', serif; font-size: 16px;"> All changes to data are performed as if they are a single operation. That is, all the changes are performed or none of them are. For example, in an application that transfers funds from one account to another, the Atomicity property ensures that, if a debit is made successfully from one account to another, the correspending credit is made to the other account.</span><br />
<span style="font-family: 'Times New Roman', serif; font-size: 16px;"><br /></span>
<u style="font-family: 'Times New Roman', serif; font-size: 16px; font-weight: bold;">2.) Consistency:</u><br />
<u style="font-family: 'Times New Roman', serif; font-size: 16px; font-weight: bold;"><br /></u>
<span style="font-family: 'Times New Roman', serif; font-size: 16px;"> Data is in a consistent state when a transaction starts and ends.For example, </span><span style="font-family: 'Times New Roman', serif; font-size: 16px;">in an application that transfers funds from one account to another, the Consistency property ensures that the total value of funds in both accounts is same, both at the start and end of the transaction.</span><br />
<u style="font-family: 'Times New Roman', serif; font-size: 16px; font-weight: bold;"><br /></u>
<u style="font-family: 'Times New Roman', serif; font-size: 16px; font-weight: bold;">3.) Isolation:</u><br />
<u style="font-family: 'Times New Roman', serif; font-size: 16px; font-weight: bold;"><br /></u>
<span style="font-family: 'Times New Roman', serif; font-size: 16px;"> The intermediate state of a transaction is invisible to other transactions.As a result, transactions that run concurrently should be serialized.For example, </span><span style="font-family: 'Times New Roman', serif; font-size: 16px;">in an application that transfers funds from one account to another, the Isolation property ensures that other transactions see the transferred fund in one account or the other, but not in both nor in neither.</span><br />
<span style="font-family: 'Times New Roman', serif; font-size: 16px;"><br /></span>
<u style="font-family: 'Times New Roman', serif; font-size: 16px; font-weight: bold;">4.) Durability:</u><br />
<u style="font-family: 'Times New Roman', serif; font-size: 16px; font-weight: bold;"><br /></u>
<span style="font-family: 'Times New Roman', serif; font-size: 16px;"> After a transaction successfully completes, changes to the data persists and are not undone, even in the event of a system failure.</span><span style="font-family: 'Times New Roman', serif; font-size: 16px;">For example, </span><span style="font-family: 'Times New Roman', serif; font-size: 16px;">in an application that transfers funds from one account to another, the Durability property ensures that the changes made to the each account will not be reversed.</span><br />
<span style="font-family: 'Times New Roman', serif; font-size: 16px;"><br /></span>
<span style="font-family: Times New Roman, serif;">We now describe the <b>Anomalies </b>that can be encountered in a multithread environment.</span><br />
<span style="font-family: Times New Roman, serif;"><br /></span>
<u style="font-family: 'Times New Roman', serif; font-size: 16px; font-weight: bold;">1.) Dirty Reads:</u><br />
<u style="font-family: 'Times New Roman', serif; font-size: 16px; font-weight: bold;"><br /></u>
<span style="font-family: 'Times New Roman', serif; font-size: 16px;"> A dirty read happens when a transaction reads data that is being modified or reads data that recently inserted by another transaction that has not yet been committed. As an example;</span><br />
<ul>
<li><span style="font-family: Times New Roman, serif;">Transaction A begins,</span></li>
<li><span style="font-family: Times New Roman, serif;">Update Employee Set salary = 30450 Where empno = '000070', (by transaction A)</span></li>
<li><span style="font-family: Times New Roman, serif;">Transaction B begins,</span></li>
<li><span style="font-family: Times New Roman, serif;">Select * From Employee Where empno = '000070' (by transaction B),</span></li>
<li><span style="font-family: Times New Roman, serif;">Transaction A rollback.</span></li>
</ul>
<div>
<span style="font-family: Times New Roman, serif;">Transaction B sees data updated by transaction A. This update has not yet been committed.</span></div>
<br />
<u style="font-family: 'Times New Roman', serif; font-size: 16px; font-weight: bold;">2.) Non-Repeatable Reads:</u><br />
<u style="font-family: 'Times New Roman', serif; font-size: 16px; font-weight: bold;"><br /></u>
<span style="font-family: 'Times New Roman', serif; font-size: 16px;"> Non-Repeatable reads happen when a query returns data that would be different if the same query were repeated in the same transaction. Non-Repeatable reads can occur when other transactions are modifying data that a transaction is reading. As an example;</span><br />
<ul>
<li><span style="font-family: Times New Roman, serif;">Transaction A begins,</span></li>
<li><span style="font-family: Times New Roman, serif;">Select * From Employee Where empno = '000070', (by transaction A)</span></li>
<li><span style="font-family: Times New Roman, serif;">Transaction B begins,</span></li>
<li><span style="font-family: Times New Roman, serif;">Update Employee Set salary = 30000 Where empno = '000070' (by transaction B)</span></li>
<li><span style="font-family: Times New Roman, serif;">Select * From Employee Where empno = '000070', (by transaction A)</span></li>
</ul>
<div>
<span style="font-family: Times New Roman, serif;">Transaction B updates row viewed by transaction A before transaction A commits. If transaction A issues the same Select statement the result will be different.</span></div>
<br />
<u style="font-family: 'Times New Roman', serif; font-size: 16px; font-weight: bold;">3.) Phantom Reads:</u><br />
<u style="font-family: 'Times New Roman', serif; font-size: 16px; font-weight: bold;"><br /></u>
<span style="font-family: 'Times New Roman', serif; font-size: 16px;"> Records that appear in a set being read by another transaction. Phantom reads can occur when other transactions insert rows that would satisfy the Where clause of another transaction. As an example;</span><br />
<ul>
<li><span style="font-family: Times New Roman, serif;">Transaction A begins,</span></li>
<li><span style="font-family: Times New Roman, serif;">Select * From Employee Where salary > 30000, (by transaction A)</span></li>
<li><span style="font-family: Times New Roman, serif;">Transaction B begins,</span></li>
<li><span style="font-family: Times New Roman, serif;">Insert Into Employee (empno, firstname, midinit, lastname, job, salary) Values ('000350', 'TEST', 'TEST', 'TEST', 'TEST', 75000), (by transaction B)</span></li>
<li><span style="font-family: Times New Roman, serif;">Select * From Employee Where salary > 30000, (by transaction A)</span></li>
</ul>
<div>
<span style="font-family: Times New Roman, serif;">Transaction B inserts a row that would satisfy the query in Transaction A if it were issued again.</span></div>
<u style="font-family: 'Times New Roman', serif; font-size: 16px; font-weight: bold;"><br /></u>
All these anomalies can be prevented by using the third property of ACID which is Isolation. There are four possible <b>Isolation Levels</b>;<br />
<br />
<u style="font-family: 'Times New Roman', serif; font-size: 16px; font-weight: bold;">1.) TRANSACTION_READ_UNCOMMITTED:</u><span style="font-family: 'Times New Roman', serif; font-size: 16px;"> Allows dirty read, non-repeatable read and phantom read.</span><br />
<u style="font-family: 'Times New Roman', serif; font-size: 16px; font-weight: bold;"><br /></u>
<u style="font-family: 'Times New Roman', serif; font-size: 16px; font-weight: bold;">2.) </u><u style="font-family: 'Times New Roman', serif; font-size: 16px; font-weight: bold;">TRANSACTION_READ_COMMITTED</u><u style="font-family: 'Times New Roman', serif; font-size: 16px; font-weight: bold;">:</u><span style="font-family: 'Times New Roman', serif; font-size: 16px;"> Prevents dirty read, allows non-repeatable read and phantom read.</span><br />
<u style="font-family: 'Times New Roman', serif; font-size: 16px; font-weight: bold;"><br /></u>
<u style="font-family: 'Times New Roman', serif; font-size: 16px; font-weight: bold;">3.) </u><u style="font-family: 'Times New Roman', serif; font-size: 16px; font-weight: bold;">TRANSACTION_REPEATABLE_READ</u><u style="font-family: 'Times New Roman', serif; font-size: 16px; font-weight: bold;">:</u><span style="font-family: 'Times New Roman', serif; font-size: 16px;"> Prevents dirty read and non-repeatable read, allows phantom read.</span><br />
<u style="font-family: 'Times New Roman', serif; font-size: 16px; font-weight: bold;"><br /></u>
<u style="font-family: 'Times New Roman', serif; font-size: 16px; font-weight: bold;">4.) </u><u style="font-family: 'Times New Roman', serif; font-size: 16px; font-weight: bold;">TRANSACTION_SERIALIZABLE</u><u style="font-family: 'Times New Roman', serif; font-size: 16px; font-weight: bold;">:</u><span style="font-family: 'Times New Roman', serif; font-size: 16px;"> Prevents dirty read, non-repeatable read an phantom read. </span><br />
<span style="font-family: 'Times New Roman', serif; font-size: 16px;"><br /></span>
<span style="font-family: 'Times New Roman', serif; font-size: 16px;">As we see, if we use TRANSACTION_SERIALIZABLE isolation level, we can get rid of all the anomalies that we may encounter. However, when we consider in terms of performance, using such a high level isolation would break down our system and we would get very high response time in our </span><span style="font-family: 'Times New Roman', serif; font-size: 16px;">applications. What we have to do is to design the system as it will allow concurrent access to the database resources. To do this we can apply several steps;</span><br />
<ul>
<li><span style="font-family: Times New Roman, serif;">Divide the physical database into partititons as they don't interrupt with each other. Using partitions may allow us to read committed data since no thread will wait others that deal with data that in different partitions.(Consider a case where all your clients data are in different partitions so they can work individually without waiting others, so no need to read uncommitted data, every client can read their committed data.) To be another example suppose you have partitioned table on a column, but you need to run parallel jobs on that table that select data on a different column's range. In that case the parallel jobs most likely lock each others jobs since the table is not partitioned on the column that used in the parallel jobs.Therefore, you need to carefully desing and choose the partition columns.</span></li>
<li><span style="font-family: Times New Roman, serif;">Redesign the application in a way that it won't allow to long transactions and increase commit frequency.</span></li>
<li><span style="font-family: Times New Roman, serif;">Put the data manipulation operations at the end of the transaction.</span></li>
</ul>
<div>
<span style="font-family: Times New Roman, serif;">Even we apply all these steps, we may still get locks, deadlocks and livelocks if our application does some Update and Delete operations. Even if we select uncommitted data , the nature of Update, Delete and Insert operations still cause some locks on the system. There are basically three types of locks. These locks can be on row, page, table, partition or tablespace. Before going into the lock modes let's explain the <b>Lock Scopes</b>.</span></div>
<div>
<span style="font-family: Times New Roman, serif;"><br /></span></div>
<div>
<u style="font-family: 'Times New Roman', serif; font-size: 16px; font-weight: bold;">1.) Row Lock:</u><br />
<br />
You can lock one row of a table. A program can lock one row or selection of rows while other programs continue to work on others rows of the same table. This type of lock uses more CPU resource than other locks, so it has a drawback in usage.</div>
<div>
<u style="font-family: 'Times New Roman', serif; font-size: 16px; font-weight: bold;"><br /></u></div>
<div>
<u style="font-family: 'Times New Roman', serif; font-size: 16px; font-weight: bold;">2.) Page Lock:</u></div>
<div>
<u style="font-family: 'Times New Roman', serif; font-size: 16px; font-weight: bold;"><br /></u>
<span style="font-family: 'Times New Roman', serif; font-size: 16px;"> The database server stores data in units called disk pages. A disk page contains one or more rows. In some cases it is better to lock a disk page than to lock individual rows on it. For example, with operations that requires changing large number of rows, you might choose page-level locking because row level locking (lock per row) might not be cost effective.</span><br />
<span style="font-family: 'Times New Roman', serif; font-size: 16px;"><br /></span></div>
<div>
<u style="font-family: 'Times New Roman', serif; font-size: 16px; font-weight: bold;">3.) Table Lock:</u><br />
<u style="font-family: 'Times New Roman', serif; font-size: 16px; font-weight: bold;"><br /></u>
<span style="font-family: 'Times New Roman', serif; font-size: 16px;"> Table locks lock the entire table, as if one process continues on the table the other processes must wait. This lock is not suitable for online transactional processing applications, and usually used by online analytical processing applications.</span><br />
<br />
Now we can look for <b>Lock Modes.</b><br />
<b><br /></b>
<u style="font-family: 'Times New Roman', serif; font-size: 16px; font-weight: bold;">1.) Shared Locks (S-Locks):</u><br />
<u style="font-family: 'Times New Roman', serif; font-size: 16px; font-weight: bold;"><br /></u>
<span style="font-family: 'Times New Roman', serif; font-size: 16px;"> The lock owner and any concurrent process can read, but not change the locked page or row. Concurrent processes can acqiure S or U lock on the page or row or might read data without acquiring page or row lock. For example, simple Select statement cause S-lock.</span><br />
<u style="font-family: 'Times New Roman', serif; font-size: 16px; font-weight: bold;"><br /></u>
<u style="font-family: 'Times New Roman', serif; font-size: 16px; font-weight: bold;">2.) Update Locks (U-Locks):</u><br />
<u style="font-family: 'Times New Roman', serif; font-size: 16px; font-weight: bold;"><br /></u>
<span style="font-family: 'Times New Roman', serif; font-size: 16px;"> The lock owner can read but not change the locked page or row. Concurrent processes can acqiure S lock or might read data without acquiring page or row lock. But no concurrent process can acquire U lock. For example, Select For Update statement cause U-lock.</span><br />
<u style="font-family: 'Times New Roman', serif; font-size: 16px; font-weight: bold;"><br /></u>
<u style="font-family: 'Times New Roman', serif; font-size: 16px; font-weight: bold;">3.) Exclusive Locks (X-Locks):</u><br />
<u style="font-family: 'Times New Roman', serif; font-size: 16px; font-weight: bold;"><br /></u>
<span style="font-family: 'Times New Roman', serif; font-size: 16px;"> The lock owner can read or change the locked page or row. A concurrent process cannot acqiure S, U or X lock on page or row. However, a concurrent process might read data without acquiring page or row lock. For example, Update, Delete or Insert statement cause X-lock.</span><br />
<span style="font-family: 'Times New Roman', serif; font-size: 16px;"><br /></span>
<span style="font-family: 'Times New Roman', serif; font-size: 16px;">Below is a summary table of allowed locks.</span><br />
<span style="font-family: 'Times New Roman', serif; font-size: 16px;"><br /></span>
<br />
<table border="1" cellpadding="0" cellspacing="0" class="MsoTableGrid" style="background-color: #fff9ee; border-collapse: collapse; border: none; color: #333333; font-family: 'Helvetica Neue Light', HelveticaNeue-Light, 'Helvetica Neue', Helvetica, Arial, sans-serif; font-size: 14px; line-height: 19.6000003814697px;"><tbody>
<tr><td style="border: 1pt solid windowtext; padding: 0cm 5.4pt; width: 115.15pt;" valign="top" width="154"><div class="MsoNormal" style="margin: 0px 0px 0.0001pt; outline: none; padding: 0px;">
<b><span lang="EN-US" style="font-family: 'Times New Roman', serif; font-size: 12pt;">Locking<o:p></o:p></span></b></div>
</td><td style="border: 1pt solid windowtext; padding: 0cm 5.4pt; width: 115.15pt;" valign="top" width="154"><div class="MsoNormal" style="margin: 0px 0px 0.0001pt; outline: none; padding: 0px;">
<b><span lang="EN-US" style="font-family: 'Times New Roman', serif; font-size: 12pt;">S<o:p></o:p></span></b></div>
</td><td style="border: 1pt solid windowtext; padding: 0cm 5.4pt; width: 115.15pt;" valign="top" width="154"><div class="MsoNormal" style="margin: 0px 0px 0.0001pt; outline: none; padding: 0px;">
<b><span lang="EN-US" style="font-family: 'Times New Roman', serif; font-size: 12pt;">U<o:p></o:p></span></b></div>
</td><td style="border: 1pt solid windowtext; padding: 0cm 5.4pt; width: 115.15pt;" valign="top" width="154"><div class="MsoNormal" style="margin: 0px 0px 0.0001pt; outline: none; padding: 0px;">
<b><span lang="EN-US" style="font-family: 'Times New Roman', serif; font-size: 12pt;">X<o:p></o:p></span></b></div>
</td></tr>
<tr><td style="border: 1pt solid windowtext; padding: 0cm 5.4pt; width: 115.15pt;" valign="top" width="154"><div class="MsoNormal" style="margin: 0px 0px 0.0001pt; outline: none; padding: 0px;">
<b><span lang="EN-US" style="font-family: 'Times New Roman', serif; font-size: 12pt;">S<o:p></o:p></span></b></div>
</td><td style="border-bottom-color: windowtext; border-bottom-width: 1pt; border-right-color: windowtext; border-right-width: 1pt; border-style: none solid solid none; padding: 0cm 5.4pt; width: 115.15pt;" valign="top" width="154"><div class="MsoNormal" style="margin: 0px 0px 0.0001pt; outline: none; padding: 0px;">
<span lang="EN-US" style="font-family: 'Times New Roman', serif; font-size: 12pt;">Y<o:p></o:p></span></div>
</td><td style="border-bottom-color: windowtext; border-bottom-width: 1pt; border-right-color: windowtext; border-right-width: 1pt; border-style: none solid solid none; padding: 0cm 5.4pt; width: 115.15pt;" valign="top" width="154"><div class="MsoNormal" style="margin: 0px 0px 0.0001pt; outline: none; padding: 0px;">
<span lang="EN-US" style="font-family: 'Times New Roman', serif; font-size: 12pt;">Y<o:p></o:p></span></div>
</td><td style="border-bottom-color: windowtext; border-bottom-width: 1pt; border-right-color: windowtext; border-right-width: 1pt; border-style: none solid solid none; padding: 0cm 5.4pt; width: 115.15pt;" valign="top" width="154"><div class="MsoNormal" style="margin: 0px 0px 0.0001pt; outline: none; padding: 0px;">
<span lang="EN-US" style="font-family: 'Times New Roman', serif; font-size: 12pt;">N<o:p></o:p></span></div>
</td></tr>
<tr><td style="border: 1pt solid windowtext; padding: 0cm 5.4pt; width: 115.15pt;" valign="top" width="154"><div class="MsoNormal" style="margin: 0px 0px 0.0001pt; outline: none; padding: 0px;">
<b><span lang="EN-US" style="font-family: 'Times New Roman', serif; font-size: 12pt;">U<o:p></o:p></span></b></div>
</td><td style="border-bottom-color: windowtext; border-bottom-width: 1pt; border-right-color: windowtext; border-right-width: 1pt; border-style: none solid solid none; padding: 0cm 5.4pt; width: 115.15pt;" valign="top" width="154"><div class="MsoNormal" style="margin: 0px 0px 0.0001pt; outline: none; padding: 0px;">
<span lang="EN-US" style="font-family: 'Times New Roman', serif; font-size: 12pt;">Y<o:p></o:p></span></div>
</td><td style="border-bottom-color: windowtext; border-bottom-width: 1pt; border-right-color: windowtext; border-right-width: 1pt; border-style: none solid solid none; padding: 0cm 5.4pt; width: 115.15pt;" valign="top" width="154"><div class="MsoNormal" style="margin: 0px 0px 0.0001pt; outline: none; padding: 0px;">
<span lang="EN-US" style="font-family: 'Times New Roman', serif; font-size: 12pt;">N<o:p></o:p></span></div>
</td><td style="border-bottom-color: windowtext; border-bottom-width: 1pt; border-right-color: windowtext; border-right-width: 1pt; border-style: none solid solid none; padding: 0cm 5.4pt; width: 115.15pt;" valign="top" width="154"><div class="MsoNormal" style="margin: 0px 0px 0.0001pt; outline: none; padding: 0px;">
<span lang="EN-US" style="font-family: 'Times New Roman', serif; font-size: 12pt;">N<o:p></o:p></span></div>
</td></tr>
<tr><td style="border: 1pt solid windowtext; padding: 0cm 5.4pt; width: 115.15pt;" valign="top" width="154"><div class="MsoNormal" style="margin: 0px 0px 0.0001pt; outline: none; padding: 0px;">
<b><span lang="EN-US" style="font-family: 'Times New Roman', serif; font-size: 12pt;">X<o:p></o:p></span></b></div>
</td><td style="border-bottom-color: windowtext; border-bottom-width: 1pt; border-right-color: windowtext; border-right-width: 1pt; border-style: none solid solid none; padding: 0cm 5.4pt; width: 115.15pt;" valign="top" width="154"><div class="MsoNormal" style="margin: 0px 0px 0.0001pt; outline: none; padding: 0px;">
<span lang="EN-US" style="font-family: 'Times New Roman', serif; font-size: 12pt;">N<o:p></o:p></span></div>
</td><td style="border-bottom-color: windowtext; border-bottom-width: 1pt; border-right-color: windowtext; border-right-width: 1pt; border-style: none solid solid none; padding: 0cm 5.4pt; width: 115.15pt;" valign="top" width="154"><div class="MsoNormal" style="margin: 0px 0px 0.0001pt; outline: none; padding: 0px;">
<span lang="EN-US" style="font-family: 'Times New Roman', serif; font-size: 12pt;">N<o:p></o:p></span></div>
</td><td style="border-bottom-color: windowtext; border-bottom-width: 1pt; border-right-color: windowtext; border-right-width: 1pt; border-style: none solid solid none; padding: 0cm 5.4pt; width: 115.15pt;" valign="top" width="154"><div class="MsoNormal" style="margin: 0px 0px 0.0001pt; outline: none; padding: 0px;">
<span lang="EN-US" style="font-family: 'Times New Roman', serif; font-size: 12pt;">N</span></div>
</td></tr>
</tbody></table>
</div>
<div>
<span style="font-family: 'Times New Roman', serif; font-size: 16px;"><b> Figure 1</b></span><br />
<span style="font-family: 'Times New Roman', serif; font-size: 16px;"><b><br /></b></span>
<span style="font-family: 'Times New Roman', serif; font-size: 16px;">If we examine these locks, we see that an Exclusive lock caused by an Update operation with a non-unique predicate may lock whole table (in the case of a table lock and with no Transaction_Read_Uncommitted isolation level).</span><br />
<span style="font-family: 'Times New Roman', serif; font-size: 16px;"><br /></span>
<span style="font-family: 'Times New Roman', serif; font-size: 16px;">You have to be careful with the default isolation level of your database system. For example if your database's default isolation level is read_committed, your select statements have to wait the release of lock if there is an update or delete on the region that you selected</span><span style="font-family: 'Times New Roman', serif; font-size: 16px;">. If the default isolation level is repeatable_read then all the update and delete oparations </span><span style="font-family: 'Times New Roman', serif; font-size: 16px;">have to wait the release of lock</span><span style="font-family: 'Times New Roman', serif; font-size: 16px;"> if there is a select on the region that you update or delete. Finally if the dafault level is serializable then all the insert operations that satifsy any select statement's range have to wait the release of lock of the select statement even if the insert of data will be on a different space than the locked space. If you want to select uncommitted data you should change the isolation level to read_uncommitted or do some database specific select statements. For example, t</span><span style="font-family: 'Times New Roman', serif; font-size: 16px;">he default isolation level of DB2 is read_committed and if you want uncommitted data to be selected then use </span><span style="font-family: 'Times New Roman', serif; font-size: 16px;">select statement </span><span style="font-family: 'Times New Roman', serif; font-size: 16px;">ending with UR(Uncommitted read) in DB2. </span><br />
<span style="font-family: 'Times New Roman', serif; font-size: 16px;">As an important point for MYSQL users, the default isolation level of MYSQL is repeatable_read, so if you encounter some performance problems because of lock wait time in database, this may be the cause.</span><br />
<span style="font-family: 'Times New Roman', serif; font-size: 16px;"><br /></span>
<span style="font-family: Times New Roman, serif;"><u>Example 1:</u> As an example consider the following scenario that run on a DB2 database instance. We have table T1 using page lock with the following columns and values.</span><br />
<span style="font-family: Times New Roman, serif;"><br /></span>
<span style="font-family: Times New Roman, serif;">T1 --> There is a unique index on (Col1, Col2)</span><br />
<span style="font-family: Times New Roman, serif;"><br /></span>
<br />
<table border="1" cellpadding="0" cellspacing="0" class="MsoTableGrid" style="background-color: #fff9ee; border-collapse: collapse; border: none; color: #333333; font-family: 'Helvetica Neue Light', HelveticaNeue-Light, 'Helvetica Neue', Helvetica, Arial, sans-serif; font-size: 14px; line-height: 19.6000003814697px;"><tbody>
<tr style="height: 14.35pt;"><td style="border: 1pt solid windowtext; height: 14.35pt; padding: 0cm 5.4pt; width: 49.35pt;" valign="top" width="66"><div class="MsoNormal" style="margin: 0px 0px 0.0001pt; outline: none; padding: 0px;">
<span lang="EN-US" style="font-family: 'Times New Roman', serif; font-size: 12pt;">Col1<o:p></o:p></span></div>
</td><td style="border: 1pt solid windowtext; height: 14.35pt; padding: 0cm 5.4pt; width: 49.35pt;" valign="top" width="66"><div class="MsoNormal" style="margin: 0px 0px 0.0001pt; outline: none; padding: 0px;">
<span lang="EN-US" style="font-family: 'Times New Roman', serif; font-size: 12pt;">Col2<o:p></o:p></span></div>
</td></tr>
<tr style="height: 14.35pt;"><td style="border: 1pt solid windowtext; height: 14.35pt; padding: 0cm 5.4pt; width: 49.35pt;" valign="top" width="66"><div class="MsoNormal" style="margin: 0px 0px 0.0001pt; outline: none; padding: 0px;">
<span lang="EN-US" style="font-family: 'Times New Roman', serif; font-size: 12pt;">1<o:p></o:p></span></div>
</td><td style="border-bottom-color: windowtext; border-bottom-width: 1pt; border-right-color: windowtext; border-right-width: 1pt; border-style: none solid solid none; height: 14.35pt; padding: 0cm 5.4pt; width: 49.35pt;" valign="top" width="66"><div class="MsoNormal" style="margin: 0px 0px 0.0001pt; outline: none; padding: 0px;">
<span lang="EN-US" style="font-family: 'Times New Roman', serif; font-size: 12pt;">1000<o:p></o:p></span></div>
</td></tr>
<tr style="height: 14.35pt;"><td style="border: 1pt solid windowtext; height: 14.35pt; padding: 0cm 5.4pt; width: 49.35pt;" valign="top" width="66"><div class="MsoNormal" style="margin: 0px 0px 0.0001pt; outline: none; padding: 0px;">
<span lang="EN-US" style="font-family: 'Times New Roman', serif; font-size: 12pt;">2<o:p></o:p></span></div>
</td><td style="border-bottom-color: windowtext; border-bottom-width: 1pt; border-right-color: windowtext; border-right-width: 1pt; border-style: none solid solid none; height: 14.35pt; padding: 0cm 5.4pt; width: 49.35pt;" valign="top" width="66"><div class="MsoNormal" style="margin: 0px 0px 0.0001pt; outline: none; padding: 0px;">
<span lang="EN-US" style="font-family: 'Times New Roman', serif; font-size: 12pt;">2000<o:p></o:p></span></div>
</td></tr>
<tr style="height: 14.35pt;"><td style="border: 1pt solid windowtext; height: 14.35pt; padding: 0cm 5.4pt; width: 49.35pt;" valign="top" width="66"><div class="MsoNormal" style="margin: 0px 0px 0.0001pt; outline: none; padding: 0px;">
<span lang="EN-US" style="font-family: 'Times New Roman', serif; font-size: 12pt;">3<o:p></o:p></span></div>
</td><td style="border-bottom-color: windowtext; border-bottom-width: 1pt; border-right-color: windowtext; border-right-width: 1pt; border-style: none solid solid none; height: 14.35pt; padding: 0cm 5.4pt; width: 49.35pt;" valign="top" width="66"><div class="MsoNormal" style="margin: 0px 0px 0.0001pt; outline: none; padding: 0px;">
<span lang="EN-US" style="font-family: 'Times New Roman', serif; font-size: 12pt;">3000<o:p></o:p></span></div>
</td></tr>
<tr style="height: 15.05pt;"><td style="border: 1pt solid windowtext; height: 15.05pt; padding: 0cm 5.4pt; width: 49.35pt;" valign="top" width="66"><div class="MsoNormal" style="margin: 0px 0px 0.0001pt; outline: none; padding: 0px;">
<span lang="EN-US" style="font-family: 'Times New Roman', serif; font-size: 12pt;">4<o:p></o:p></span></div>
</td><td style="border-bottom-color: windowtext; border-bottom-width: 1pt; border-right-color: windowtext; border-right-width: 1pt; border-style: none solid solid none; height: 15.05pt; padding: 0cm 5.4pt; width: 49.35pt;" valign="top" width="66"><div class="MsoNormal" style="margin: 0px 0px 0.0001pt; outline: none; padding: 0px;">
<span lang="EN-US" style="font-family: 'Times New Roman', serif; font-size: 12pt;">4000</span></div>
</td></tr>
</tbody></table>
</div>
<div>
<br /></div>
<span style="font-family: Times New Roman, serif;">Let's say there are two pages, the first 3 rows are on page one, and 4th row is on page two.Now consider the following steps.</span><br />
<ul>
<li><span style="font-family: Times New Roman, serif;">Transaction A starts and execute Update T1.. Where Col1 = 1 (not committed yet)</span></li>
<li><span style="font-family: Times New Roman, serif;">Transaction B starts and try to execute Update T1.. Where Col1 = 4</span></li>
</ul>
<div>
<span style="font-family: Times New Roman, serif;">Here we have two update statements, so no need to care about the isolation level of the system. An update will always lock the target row or page and concurrent transactions must wait the release of that lock.</span></div>
<div>
<span style="font-family: Times New Roman, serif;"><br /></span></div>
<div>
<span style="font-family: Times New Roman, serif;">Even the transaction B not affect the transaction A being on different system pages, transaction B may still have to wait the transaction A, since the first or second sql statement has not have a unique predicate in the where clause and in our example the DBMS run the queries without using an index instead use a table scan (this happens especially when there is a small amount of data). That means transaction A locks the whole table until it commits and so the transaction B have to wait the commit of transaction A.</span></div>
<div>
<span style="font-family: Times New Roman, serif;">If we run transaction B with Delete operation, we might not get a lock. This is because usually delete lock is considered to be a lighter lock than update lock, since most of the DBMS systems doesn't delete the row physically instead it puts a flag indicating the row deleted and the row will physically removed at a later time choosed by the optimizer.</span><br />
<span style="font-family: Times New Roman, serif;"><br /></span>
<span style="font-family: Times New Roman, serif;">Here another point is using a unique predicate in the where clause. If we use unique predicate in one of the update statements above, depending on the implementation of the DBMS we possibly get no lock since it is enough having an unique predicate to maintain the concurrency.</span></div>
<div>
<span style="font-family: Times New Roman, serif;"><br /></span></div>
<div>
<u style="font-family: 'Times New Roman', serif;">Example 2:</u><span style="font-family: 'Times New Roman', serif;"> Consider a scenario again on a DB2 database instance. We have a table T1 using page lock and TRANSACTION_SERIALIZABLE isolation level with the following columns and values.</span></div>
<div>
<span style="font-family: 'Times New Roman', serif;"><br /></span></div>
<div>
<span style="font-family: 'Times New Roman', serif;">T1 --> There is a unique index on (Col1, Col2)</span><br />
<span style="font-family: 'Times New Roman', serif;"><br /></span></div>
<div>
<table border="1" cellpadding="0" cellspacing="0" class="MsoTableGrid" style="background-color: #fff9ee; border-collapse: collapse; border: none; color: #333333; font-family: 'Helvetica Neue Light', HelveticaNeue-Light, 'Helvetica Neue', Helvetica, Arial, sans-serif; font-size: 14px; line-height: 19.6000003814697px;"><tbody>
<tr style="height: 14.35pt;"><td style="border: 1pt solid windowtext; height: 14.35pt; padding: 0cm 5.4pt; width: 49.35pt;" valign="top" width="66"><div class="MsoNormal" style="margin: 0px 0px 0.0001pt; outline: none; padding: 0px;">
<span lang="EN-US" style="font-family: 'Times New Roman', serif; font-size: 12pt;">Col1<o:p></o:p></span></div>
</td><td style="border: 1pt solid windowtext; height: 14.35pt; padding: 0cm 5.4pt; width: 49.35pt;" valign="top" width="66"><div class="MsoNormal" style="margin: 0px 0px 0.0001pt; outline: none; padding: 0px;">
<span lang="EN-US" style="font-family: 'Times New Roman', serif; font-size: 12pt;">Col2<o:p></o:p></span></div>
</td></tr>
<tr style="height: 14.35pt;"><td style="border: 1pt solid windowtext; height: 14.35pt; padding: 0cm 5.4pt; width: 49.35pt;" valign="top" width="66"><div class="MsoNormal" style="margin: 0px 0px 0.0001pt; outline: none; padding: 0px;">
<span lang="EN-US" style="font-family: 'Times New Roman', serif; font-size: 12pt;">1<o:p></o:p></span></div>
</td><td style="border-bottom-color: windowtext; border-bottom-width: 1pt; border-right-color: windowtext; border-right-width: 1pt; border-style: none solid solid none; height: 14.35pt; padding: 0cm 5.4pt; width: 49.35pt;" valign="top" width="66"><div class="MsoNormal" style="margin: 0px 0px 0.0001pt; outline: none; padding: 0px;">
<span lang="EN-US" style="font-family: 'Times New Roman', serif; font-size: 12pt;">1000<o:p></o:p></span></div>
</td></tr>
<tr style="height: 14.35pt;"><td style="border: 1pt solid windowtext; height: 14.35pt; padding: 0cm 5.4pt; width: 49.35pt;" valign="top" width="66"><div class="MsoNormal" style="margin: 0px 0px 0.0001pt; outline: none; padding: 0px;">
<span lang="EN-US" style="font-family: 'Times New Roman', serif; font-size: 12pt;">2<o:p></o:p></span></div>
</td><td style="border-bottom-color: windowtext; border-bottom-width: 1pt; border-right-color: windowtext; border-right-width: 1pt; border-style: none solid solid none; height: 14.35pt; padding: 0cm 5.4pt; width: 49.35pt;" valign="top" width="66"><div class="MsoNormal" style="margin: 0px 0px 0.0001pt; outline: none; padding: 0px;">
<span lang="EN-US" style="font-family: 'Times New Roman', serif; font-size: 12pt;">2000<o:p></o:p></span></div>
</td></tr>
<tr style="height: 14.35pt;"><td style="border: 1pt solid windowtext; height: 14.35pt; padding: 0cm 5.4pt; width: 49.35pt;" valign="top" width="66"><div class="MsoNormal" style="margin: 0px 0px 0.0001pt; outline: none; padding: 0px;">
<span lang="EN-US" style="font-family: 'Times New Roman', serif; font-size: 12pt;">3<o:p></o:p></span></div>
</td><td style="border-bottom-color: windowtext; border-bottom-width: 1pt; border-right-color: windowtext; border-right-width: 1pt; border-style: none solid solid none; height: 14.35pt; padding: 0cm 5.4pt; width: 49.35pt;" valign="top" width="66"><div class="MsoNormal" style="margin: 0px 0px 0.0001pt; outline: none; padding: 0px;">
<span lang="EN-US" style="font-family: 'Times New Roman', serif; font-size: 12pt;">3001</span></div>
</td></tr>
</tbody></table>
</div>
<div>
<span style="font-family: 'Times New Roman', serif;"><br /></span></div>
<div>
<span style="font-family: 'Times New Roman', serif;">Now consider the following steps.</span></div>
<div>
<ul>
<li><span style="font-family: Times New Roman, serif;">Transaction A starts and executes Select * From T1 Where Col1 > 1(not committed yet)</span></li>
<li><span style="font-family: Times New Roman, serif;">Transaction B starts and executes Insert Into T1 (3, 3000) </span></li>
</ul>
<div>
<span style="font-family: Times New Roman, serif;">Here transaction B will have to wait the transaction A, since the Select statement does a range scan, and the Insert statement touches the result of the Select statement. Notice that insert statement will insert new data in some place that is not locked at that moment, that means Serializable isolation level check a logical lock in addition to the physical lock by comparing the where clause of the select statement and the new data that will come with the insert statement.</span><br />
<span style="font-family: Times New Roman, serif;"><br /></span></div>
</div>
<div>
<span style="font-family: Times New Roman, serif;">As you see if we use TRANSACTION_SERIALIZABLE isolation level, all transactions are serialized and this really slow down our application performance. So we should try to avoid using this high level isolation by changing the application logic.</span></div>
<div>
<span style="font-family: Times New Roman, serif;"><br /></span></div>
<div>
<u style="font-family: 'Times New Roman', serif; font-size: 16px; font-weight: bold;">Conclusion:</u></div>
<div>
<u style="font-family: 'Times New Roman', serif; font-size: 16px; font-weight: bold;"><br /></u></div>
<div>
<span style="font-family: 'Times New Roman', serif; font-size: 16px;"> In this write, we examine the database application performance in a multithread environment in terms of contention problems. There are many aspects that affect the performance of such an application. Contention is one of the most critical point in database performance since it can cause lock, deadlock or livelock problems. To be able to solve the contention problems one must understand and apply correctly, transaction anomalies, transaction levels, lock scopes and lock modes. In the <a href="http://www.aligelenler.com/2014/11/improving-database-performance-3.html" target="_blank">next </a>paper we'll be talking about another important concept in database performance "Optimizing Memory".</span></div>
<div>
<span style="font-family: 'Times New Roman', serif; font-size: 16px;"><br /></span></div>
<div>
<u style="font-family: 'Times New Roman', serif; font-size: 16px; font-weight: bold;">References and Resources:</u></div>
<div>
<u style="font-family: 'Times New Roman', serif; font-size: 16px; font-weight: bold;"><br /></u></div>
<div>
<span style="font-family: inherit;"><span style="background-color: #fff9ee; color: #333333; line-height: 19.6000003814697px; text-align: justify;">- </span><span lang="EN-US" style="background-color: #fff9ee; color: #333333; line-height: 18.3999996185303px; text-indent: -18pt;">IBM documents, http://publib.boulder.ibm.com/infocenter/cicsts/v3r2/index.jsp?topic=%2Fcom.ibm.cics.ts.productoverview.doc%2Fconcepts%2Facid.html</span></span></div>
<div>
<div style="text-indent: -24px;">
<span style="color: #333333; font-family: inherit;"><span style="line-height: 18.3999996185303px;"><br /></span></span></div>
<span style="font-family: inherit;"><span lang="EN-US" style="background-color: #fff9ee; color: #333333; text-indent: -18pt;"> </span><span style="background-color: #fff9ee; color: #333333; line-height: 19.6000003814697px; text-align: justify;">- </span><i style="background-color: #fff9ee; color: #333333; text-indent: -18pt;"><span lang="EN-US">Guy Harrison, </span></i><span lang="EN-US" style="background-color: #fff9ee; color: #333333; text-indent: -18pt;">Oracle® Performance Survival Guide A Systematic Approach to </span><span style="background-color: #fff9ee; color: #333333; text-indent: -18pt;">Database Optimization, Prentice Hall, Part IV- V (2009)</span></span></div>
Ali Gelenlerhttp://www.blogger.com/profile/09439697648573423668noreply@blogger.com0tag:blogger.com,1999:blog-3858181542467916490.post-81442630272211405382014-11-17T14:43:00.000+02:002014-11-17T15:50:21.573+02:00Improving Database Performance in a Multithreading Environment-3<u style="font-family: 'Times New Roman', serif; font-size: 16px; font-weight: bold;">Introduction:</u><br />
<u style="font-family: 'Times New Roman', serif; font-size: 16px; font-weight: bold;"><br /></u>
<span style="font-family: 'Times New Roman', serif; font-size: 16px;"> We mentioned about "Minimizing Contention" on improving database performance in the second part of this paper<a href="http://www.aligelenler.com/2014/11/improving-database-performance-2.html" target="_blank">[2]</a>. Now we continue with another concept , "Insert Only Systems and Optimizing Insert Performance" that one may consider when try to improve database performance. Update and Delete operations are very likely to cause locks. If we plan an insert only system and don't choose "Serializable" isolation level and choose to select uncommitted data we'll get no lock in our system and have the highest concurrency. However, insert only systems may cause some other problems. One of them is - since every operation like update and delete is done using an insert - the amount of data in the database will increase rapidly. If we don't consider that, because of huge amount of data, we can get performance degredation. To solve that issue we have to archive our data properly and rapidly. Also we can use partitioning to behave our data as partitioned causing a decrease in the amount of data being operated. Another problem with insert only systems appears when an application has too hight insert rate. The reason for that is, almost all tables </span><span style="font-family: 'Times New Roman', serif; font-size: 16px;">generally</span><span style="font-family: 'Times New Roman', serif; font-size: 16px;"> </span><span style="font-family: 'Times New Roman', serif; font-size: 16px;">have a clustered index in which the order of the data is same with the table. When an insert request comes to the DBMS it tries to find a good place to the new data to obey the clustered rule. It causes a search operation to find out the correct place to insert. If there is too big data to search, it will slow down our application. </span><br />
<span style="font-family: 'Times New Roman', serif; font-size: 16px;"><br /></span>
<span style="font-family: 'Times New Roman', serif; font-size: 16px;">Now we'll mention about some methods to optimize insert performance.</span><br />
<span style="font-family: 'Times New Roman', serif; font-size: 16px;"><br /></span>
<u style="font-family: 'Times New Roman', serif; font-size: 16px; font-weight: bold;">Insert Performance Issues:</u><br />
<u style="font-family: 'Times New Roman', serif; font-size: 16px; font-weight: bold;"><br /></u>
<span style="font-family: Times New Roman, serif;"><b>1.)</b> Indexes on tables are usually created for performance reasons to decrease the search time when selecting data. However every new index added to the table also has a negative impact which appears when an insert, update or delete operation is done. With these DML operations every index must be rearranged. Thus, one could try to decrease the number of indexes on the tables. </span><br />
<span style="font-family: Times New Roman, serif;">Also most of the indexes on today DMBS systems are B tree indexes and if the levels of the index tree or number of pages at levels are high we possibly get performance degradation. To solve these issues many DBMS systems have capability to keep indexes in memory so we have to try to keep affected indexes, at least non-leaf pages which are %1 of total index pages, in memory by changing the cached memory size. </span><br />
<span style="font-family: Times New Roman, serif;"><br /></span>
<b style="font-family: 'Times New Roman', serif;">2.) </b><span style="font-family: 'Times New Roman', serif;">If there are sequential inserts on our insert only system, we can apply some methods to insert at the end of the table without searching for a place to obey the clustered colums rule. By this way, one can eliminate read I/O since no search will be done, and reduce write I/O since whole data will be written to the same place.</span><br />
<b style="font-family: 'Times New Roman', serif;"><br /></b>
<b style="font-family: 'Times New Roman', serif;">3.) </b><span style="font-family: 'Times New Roman', serif;">By inserting rows to empty buffers that is to the memory and scheduling disk write to a later time is a good option. By this way, disk I/O eliminated and DBMS will do the I/O when the system is not heavy loaded.</span><br />
<span style="font-family: 'Times New Roman', serif;"><br /></span>
<b style="font-family: 'Times New Roman', serif;">4.)</b><span style="font-family: 'Times New Roman', serif;"> A DBMS system always keeps some logs for recovery reasons. We have to minimize that log records since it will get another I/O cost to our system. To do this, we may have to do different preventions, for example for DB2 database, we can put frequently changed and variable columns to the end of the table, because a variable lenght row is logged from the first changed byte to the end of the row when an update operation is done on that row (This issue is solved by the DB2 release 9 by automatically placing variable columns to the end of the table). We can also decrease log size by changing some parameters on DBMS system, for example in DB2 "LOAD Log No" parameter means there will be no log created when data is loaded. </span><br />
<span style="font-family: 'Times New Roman', serif;"><br /></span>
<b style="font-family: 'Times New Roman', serif;">5.) </b><span style="font-family: 'Times New Roman', serif;">Another issue is batch inserts. That means there will be no need to go the database system for every DML operation in a transaction like Update, Delete or Insert. Instead every operation will be finished in one step. As an example, this can be done with java prepared statement batch option. See in <a href="http://www.aligelenler.com/2014/10/using-prepared-statement-in-java.html" target="_blank">this </a>post.</span><br />
<span style="font-family: 'Times New Roman', serif;"><br /></span>
<b style="font-family: 'Times New Roman', serif;">6.)</b><span style="font-family: 'Times New Roman', serif;"> Usually increasing the commit frequency is the preferred way to minimize the lock wait time.</span><br />
<span style="font-family: 'Times New Roman', serif;"><br /></span>
<span style="font-family: Times New Roman, serif;"><b><u>Conclusion:</u></b></span><br />
<span style="font-family: Times New Roman, serif;"><b><u><br /></u></b></span>
<span style="font-family: Times New Roman, serif;"> In this write we examine database application performance in a multithread environment in terms of insert only systems to prevent lock issues. If we can design our system with a good archive mechanism we may use insert only systems preventing locks and increasing concurrent access.</span><br />
<span style="font-family: Times New Roman, serif;"><br /></span>
<b style="font-family: 'Times New Roman', serif;"><u>References and Resources:</u></b><br />
<b style="font-family: 'Times New Roman', serif;"><u><br /></u></b>
<span style="background-color: #fff9ee; color: #333333; line-height: 19.6000003814697px; text-align: justify;">- </span><i style="background-color: #fff9ee; color: #333333; text-indent: -18pt;"><span lang="EN-US">Guy Harrison, </span></i><span lang="EN-US" style="background-color: #fff9ee; color: #333333; text-indent: -18pt;">Oracle® Performance Survival Guide A Systematic Approach to </span><span style="background-color: #fff9ee; color: #333333; text-indent: -18pt;">Database Optimization, Prentice Hall, Part IV- V (2009)</span>Ali Gelenlerhttp://www.blogger.com/profile/09439697648573423668noreply@blogger.com0tag:blogger.com,1999:blog-3858181542467916490.post-74722193892935064402014-11-13T16:02:00.000+02:002015-02-24T21:04:08.580+02:00RESTful Services In SOA<u style="font-family: 'Times New Roman', serif; font-size: 16px; font-weight: bold;">Introduction:</u><br />
<u style="font-family: 'Times New Roman', serif; font-size: 16px; font-weight: bold;"><br /></u>
<span style="font-family: 'Times New Roman', serif; font-size: 16px;"> At this write I'll try to show you how to create and test a simple Rest service in Oracle SOA Suite environment, with a small validate data example.Using Restful approach we can use raw xml or even no xml data instead of using Soap messages in Soap based services.It is sometimes painful to deal with the overengineered Soap services.At that time the Restful based services come to rescue to develop faster web services and to decrease response time of the services.Of course this will bring some extra effort at some points, since Rest doesn't have some builtin capabilities of Soap.For example, although there is an attempt to define Restful services with wadl(web application description language), it is not yet well understood and widely used like wsdl(web services description language).However its more eaiser to develop Restful services in Oracle SOA Suite environment.</span><br />
<span style="font-family: 'Times New Roman', serif; font-size: 16px;">Let's start with creating the bpel process. There will be some differences on creating and testing the Restful service because of the reasons we mentioned above.</span><br />
<span style="font-family: 'Times New Roman', serif; font-size: 16px;"><br /></span>
<u style="font-family: 'Times New Roman', serif; font-size: 16px; font-weight: bold;">Create the Bpel Process:</u><br />
<u style="font-family: 'Times New Roman', serif; font-size: 16px; font-weight: bold;"><br /></u>
<span style="font-family: 'Times New Roman', serif; font-size: 16px;"> Create a Bpel process with "Define Service Later" template in a Soa project in the composite page.</span><br />
<span style="font-family: 'Times New Roman', serif; font-size: 16px;"><br /></span>
<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjhYjbzYlL9zYZJY9iUydhK7WaYNJeMamf1RN-AyZ3ByWMgv_QQ_bW5cImP5MlNAtgpxuPFuTXiEU_4ZtKMidqlhKDq7JSypfUzHpcYDqYF5xAuQmDMHQ8_9739GsC8tVGFy5Jrs5CmYiFw/s1600/1.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img alt="RESTful Services In SOA" border="0" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjhYjbzYlL9zYZJY9iUydhK7WaYNJeMamf1RN-AyZ3ByWMgv_QQ_bW5cImP5MlNAtgpxuPFuTXiEU_4ZtKMidqlhKDq7JSypfUzHpcYDqYF5xAuQmDMHQ8_9739GsC8tVGFy5Jrs5CmYiFw/s1600/1.png" height="256" title="RESTful Services In SOA" width="320" /></a></div>
<div style="text-align: center;">
<span style="font-family: 'Times New Roman', serif; font-size: 16px;">Figure 1</span></div>
<div style="text-align: center;">
<br /></div>
<div style="text-align: left;">
Create a xsd file to use in our example.We'll use Xml data as input and output of the Restful service.</div>
<div style="text-align: left;">
<br /></div>
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiu9FXqOW0apwPJ1YeGtCwA1r7tT7mqqz_C0AbsCYry5dDsK3SwcqR_xebaeKn_MwqX-DVkd6MaH4jvzI4ZBgoH4Apwez4i32iHD0_yeGwby9j-be6fc5Nzi4Voup8Sok8vdBPGSgmFd4Or/s1600/2.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img alt="RESTful Services In SOA" border="0" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiu9FXqOW0apwPJ1YeGtCwA1r7tT7mqqz_C0AbsCYry5dDsK3SwcqR_xebaeKn_MwqX-DVkd6MaH4jvzI4ZBgoH4Apwez4i32iHD0_yeGwby9j-be6fc5Nzi4Voup8Sok8vdBPGSgmFd4Or/s1600/2.png" height="173" title="RESTful Services In SOA" width="320" /></a></div>
<div style="text-align: center;">
Figure 2</div>
<div style="text-align: center;">
<br /></div>
<div style="text-align: left;">
In Figure 2, you can see we have two input variables to validate, one string and one date.Now, open the composite page and create a REST service in the exposed services part as in Figure 3.</div>
<div style="text-align: left;">
<br /></div>
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiuPvA_FAH_IQvFMLji9ijIBvyhPF8jSm1nwLhNNn7CaOwwwD0hfYL4tmqcswAOmtmuFkPl1nv9N8Kru7OioEKEeRNX0MThZJe2WILo1u3Vq8VhpWE2Ur3w9MHtr3xvnVw4p9AM1ocGDGdS/s1600/3.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img alt="RESTful Services In SOA" border="0" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiuPvA_FAH_IQvFMLji9ijIBvyhPF8jSm1nwLhNNn7CaOwwwD0hfYL4tmqcswAOmtmuFkPl1nv9N8Kru7OioEKEeRNX0MThZJe2WILo1u3Vq8VhpWE2Ur3w9MHtr3xvnVw4p9AM1ocGDGdS/s1600/3.png" height="173" title="RESTful Services In SOA" width="320" /></a></div>
<div style="text-align: center;">
Figure 3</div>
<div style="text-align: center;">
<br /></div>
<div style="text-align: left;">
On the "Create Rest binding" page, rename the service, enter a resource path and click on the plus sign on the Operation bindings part.</div>
<div style="text-align: left;">
<br /></div>
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEi0s9b6iRTHdIpqvioOvf59Nh6Nb4g2TWA6iMFyy7w89muasgujRSYDuYBw2RXBSRST5XyQ5WySeHq7NZz3LTPxcBQWsdSc0VEN_W0wCD81PEo7zuz3YysCOosCjh46SfP1FMqHHxz5wOTP/s1600/4.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img alt="RESTful Services In SOA" border="0" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEi0s9b6iRTHdIpqvioOvf59Nh6Nb4g2TWA6iMFyy7w89muasgujRSYDuYBw2RXBSRST5XyQ5WySeHq7NZz3LTPxcBQWsdSc0VEN_W0wCD81PEo7zuz3YysCOosCjh46SfP1FMqHHxz5wOTP/s1600/4.png" height="320" title="RESTful Services In SOA" width="320" /></a></div>
<div style="text-align: center;">
Figure 4</div>
<div style="text-align: center;">
<br /></div>
<div style="text-align: left;">
On the next page, enter the operation name, choose the Http Verb as POST (Since we'll use xml input) and for the request and response choose the process and processResponse elements of our xsd we just created above.See in Figure 5 and 6.</div>
<div style="text-align: left;">
<br /></div>
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEg7IkAVrdiqsNPTWtJLWyPVXXDyVydI-JCKtVKZG76yCs-6reJNPjGUfSNjH63ljqKTR8PhCG1_wAOvkizmQvU1I6w9Wr-ulO_0SQsDDdzaZ9JtEMx9H8tKBbaxF5hz_MPk9WJM3CK3lKXx/s1600/5.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img alt="RESTful Services In SOA" border="0" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEg7IkAVrdiqsNPTWtJLWyPVXXDyVydI-JCKtVKZG76yCs-6reJNPjGUfSNjH63ljqKTR8PhCG1_wAOvkizmQvU1I6w9Wr-ulO_0SQsDDdzaZ9JtEMx9H8tKBbaxF5hz_MPk9WJM3CK3lKXx/s1600/5.png" height="320" title="RESTful Services In SOA" width="320" /></a></div>
<div class="separator" style="clear: both; text-align: center;">
Figure 5</div>
<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEimkmSto2BmQDVI0eIhP6NxehNp9asyq7XD-nYQfWez0pxhM-Ja_qoEiwdp5PYF0CQaMH3zGxFww3t72jYlqRCh182gJlCOU8RWNp4ofku3wprsxyxs_jGJDT39mAfL65TBI4azS8AQ2V5D/s1600/6.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img alt="RESTful Services In SOA" border="0" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEimkmSto2BmQDVI0eIhP6NxehNp9asyq7XD-nYQfWez0pxhM-Ja_qoEiwdp5PYF0CQaMH3zGxFww3t72jYlqRCh182gJlCOU8RWNp4ofku3wprsxyxs_jGJDT39mAfL65TBI4azS8AQ2V5D/s1600/6.png" height="320" title="RESTful Services In SOA" width="320" /></a></div>
<div style="text-align: center;">
Figure 6</div>
<div style="text-align: center;">
<br /></div>
<div style="text-align: left;">
The final screen should look like the following, just press OK.</div>
<div style="text-align: left;">
<br /></div>
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjAIiOJsNUKSEAI7wmQBlgpoFe0dRXBSZwhDabHwpcVJqiAnfNQfxxUFavX1lPfojqr3Oh7ba6ij2dKaisTKqcVY3rE8j5FQXkwkorwTRHv_muEGXZeQyyplEqLIOZfBqx6yvAJdV-vGrH-/s1600/7.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img alt="RESTful Services In SOA" border="0" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjAIiOJsNUKSEAI7wmQBlgpoFe0dRXBSZwhDabHwpcVJqiAnfNQfxxUFavX1lPfojqr3Oh7ba6ij2dKaisTKqcVY3rE8j5FQXkwkorwTRHv_muEGXZeQyyplEqLIOZfBqx6yvAJdV-vGrH-/s1600/7.png" height="320" title="RESTful Services In SOA" width="320" /></a></div>
<div style="text-align: center;">
Figure 7</div>
<div style="text-align: center;">
<br /></div>
<div style="text-align: left;">
Now, go to the composite page and link the REST service with the Bpel process, choosing the transaction as "required" like in Figure 8.</div>
<div style="text-align: left;">
<br /></div>
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEh0XDvD16iHRRGVxQrM-oez9oUuGCdB7lNJnetsQ1FwW5EaZlfwxsGs3d5vHySDiZIHc7ttZB2TIofTUfLBDWney4SWsAEzfIcJVYEhoRTytlC46YoAMTbRNrVQzwxUC1zhoeuKL3BsP57Z/s1600/8.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img alt="RESTful Services In SOA" border="0" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEh0XDvD16iHRRGVxQrM-oez9oUuGCdB7lNJnetsQ1FwW5EaZlfwxsGs3d5vHySDiZIHc7ttZB2TIofTUfLBDWney4SWsAEzfIcJVYEhoRTytlC46YoAMTbRNrVQzwxUC1zhoeuKL3BsP57Z/s1600/8.png" height="96" title="RESTful Services In SOA" width="320" /></a></div>
<div style="text-align: center;">
Figure 8</div>
<div style="text-align: center;">
<br /></div>
<div style="text-align: left;">
<u style="font-family: 'Times New Roman', serif; font-size: 16px; font-weight: bold;">Built the Details of Bpel Process:</u></div>
<div style="text-align: left;">
<u style="font-family: 'Times New Roman', serif; font-size: 16px; font-weight: bold;"><br /></u></div>
<div style="text-align: left;">
<span style="font-family: 'Times New Roman', serif; font-size: 16px;"> Go to the Bpel editor, and drag and drop a Reveice component.</span></div>
<div style="text-align: left;">
<span style="font-family: 'Times New Roman', serif; font-size: 16px;"><br /></span></div>
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEg9hNvnfB9CGq1iDt3GaOaX1l-29mva-FfXC-EayxwD2NmvdLhu-FnFMZBycvOQseS3mEBRtozCgGff6mRKpkA1kOyOG7m9Z3OH0Ztk3DcuJ5krBgUDE3n8vgJSqYDC9zOKYqZIURc8ivR4/s1600/9.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img alt="RESTful Services In SOA" border="0" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEg9hNvnfB9CGq1iDt3GaOaX1l-29mva-FfXC-EayxwD2NmvdLhu-FnFMZBycvOQseS3mEBRtozCgGff6mRKpkA1kOyOG7m9Z3OH0Ztk3DcuJ5krBgUDE3n8vgJSqYDC9zOKYqZIURc8ivR4/s1600/9.png" height="173" title="RESTful Services In SOA" width="320" /></a></div>
<div style="text-align: center;">
<span style="font-family: 'Times New Roman', serif; font-size: 16px;">Figure 9</span></div>
<div style="text-align: center;">
<span style="font-family: 'Times New Roman', serif; font-size: 16px;"><br /></span></div>
<div style="text-align: left;">
<span style="font-family: 'Times New Roman', serif; font-size: 16px;">On the "Edit receive" page, check "Create Instance" and create an input variable by clicking the green plus sign.See in Figure 10.</span></div>
<div style="text-align: left;">
<span style="font-family: 'Times New Roman', serif; font-size: 16px;"><br /></span></div>
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiFexoukd7BYH3vi5h3nbGmUDEG7wpRRAhmTE6TZe7kj9enOkYpolzeJH1pSDNvrNwBRgdANRIiFN4Do8GXHlv6YCO2w-S-h4x3KT_ywVx5tgdH1ewep8jIeosYaaPrH_ZUJLVx7iBDauMe/s1600/10.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img alt="RESTful Services In SOA" border="0" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiFexoukd7BYH3vi5h3nbGmUDEG7wpRRAhmTE6TZe7kj9enOkYpolzeJH1pSDNvrNwBRgdANRIiFN4Do8GXHlv6YCO2w-S-h4x3KT_ywVx5tgdH1ewep8jIeosYaaPrH_ZUJLVx7iBDauMe/s1600/10.png" height="320" title="RESTful Services In SOA" width="281" /></a></div>
<div style="text-align: center;">
<span style="font-family: 'Times New Roman', serif; font-size: 16px;">Figure 10</span></div>
<div style="text-align: center;">
<span style="font-family: 'Times New Roman', serif; font-size: 16px;"><br /></span></div>
<div style="text-align: left;">
<span style="font-family: 'Times New Roman', serif; font-size: 16px;">Similarly create the output variable like in Figure 11.</span></div>
<div style="text-align: left;">
<span style="font-family: 'Times New Roman', serif; font-size: 16px;"><br /></span></div>
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjFe8dpPzXtV8qRnNxeXj4f52SW8HP_vjSHJV_sWuDTdmj9AH-7JVlvQUen5QT1C7vZWi4kcd5XW444N4bH2Z4Q_aLW2cdCOOCFfV7HHxA07ygg7CYw-yc1vUTzEi_sjBTAXTdUhOZHqPs2/s1600/11.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img alt="RESTful Services In SOA" border="0" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjFe8dpPzXtV8qRnNxeXj4f52SW8HP_vjSHJV_sWuDTdmj9AH-7JVlvQUen5QT1C7vZWi4kcd5XW444N4bH2Z4Q_aLW2cdCOOCFfV7HHxA07ygg7CYw-yc1vUTzEi_sjBTAXTdUhOZHqPs2/s1600/11.png" height="320" title="RESTful Services In SOA" width="276" /></a></div>
<div style="text-align: center;">
<span style="font-family: 'Times New Roman', serif; font-size: 16px;">Figure 11</span></div>
<div style="text-align: center;">
<span style="font-family: 'Times New Roman', serif; font-size: 16px;"><br /></span></div>
<div style="text-align: left;">
<span style="font-family: 'Times New Roman', serif; font-size: 16px;">You can now drag and drop a "Validate" activity after the receiveInput component and the final Figure will be like below.</span></div>
<div style="text-align: left;">
<span style="font-family: 'Times New Roman', serif; font-size: 16px;"><br /></span></div>
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiDs35Bbs_wZrVtKgtn2UOWW7YvUU7E0khW9SxindkD8yMuSKZCwj1N3sdaT9a9McUaYDIh3iBhG0COkMRgKh0f7vLlvlNEqbl4Nrih8G-7eecwjR00U1HqGRLail85DmaNzWz8jAZBT_0z/s1600/12.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img alt="RESTful Services In SOA" border="0" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiDs35Bbs_wZrVtKgtn2UOWW7YvUU7E0khW9SxindkD8yMuSKZCwj1N3sdaT9a9McUaYDIh3iBhG0COkMRgKh0f7vLlvlNEqbl4Nrih8G-7eecwjR00U1HqGRLail85DmaNzWz8jAZBT_0z/s1600/12.png" height="173" title="RESTful Services In SOA" width="320" /></a></div>
<div style="text-align: center;">
<span style="font-family: 'Times New Roman', serif; font-size: 16px;">Figure 12</span></div>
<div style="text-align: center;">
<span style="font-family: 'Times New Roman', serif; font-size: 16px;"><br /></span></div>
<div style="text-align: left;">
<span style="font-family: 'Times New Roman', serif; font-size: 16px;">Open the "Edit validate" page by double clicking the validate activity and choose the input to validate.</span></div>
<div style="text-align: left;">
<span style="font-family: 'Times New Roman', serif; font-size: 16px;"><br /></span></div>
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiWM9mOXi_IQkOxRg8OpUOmDcfpGsZgHtALIaRKCWEgdbG_E8YEbjpXqmsvfSjVOmEYZnCGj0M4pCyyy_TIQABSluvTKLtY7smOTTAfquXHtxZMYPzKRBTgf9AOXK-BWDqvHuy1ngjScrJE/s1600/13.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img alt="RESTful Services In SOA" border="0" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiWM9mOXi_IQkOxRg8OpUOmDcfpGsZgHtALIaRKCWEgdbG_E8YEbjpXqmsvfSjVOmEYZnCGj0M4pCyyy_TIQABSluvTKLtY7smOTTAfquXHtxZMYPzKRBTgf9AOXK-BWDqvHuy1ngjScrJE/s1600/13.png" height="297" title="RESTful Services In SOA" width="320" /></a></div>
<div style="text-align: center;">
<span style="font-family: 'Times New Roman', serif; font-size: 16px;">Figure 13</span></div>
<div style="text-align: center;">
<span style="font-family: 'Times New Roman', serif; font-size: 16px;"><br /></span></div>
<div style="text-align: left;">
<span style="font-family: 'Times New Roman', serif; font-size: 16px;">Our aim is to get a fault if there is an error while validating variables.So we'll use catchAll activity with the help of a scope activity that wraps the validate component.If there is an error in the variables validation we'll catch the Rest fault.See in Figure 14.</span></div>
<div style="text-align: left;">
<span style="font-family: 'Times New Roman', serif; font-size: 16px;"><br /></span></div>
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjARo3azdjh2kq16NTbUN1lKt3wO7GdNdHwZqtiu5Rvov2-QPQIjkYxdbfPaX682OCuw4sm1KDZnMLGeky-Hp_HmQbKGWgBTmbWoRFD4w9FTy7DRVpmlUMb7OBr73vY8_ER1Vd8k8JRKzJn/s1600/14.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img alt="RESTful Services In SOA" border="0" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjARo3azdjh2kq16NTbUN1lKt3wO7GdNdHwZqtiu5Rvov2-QPQIjkYxdbfPaX682OCuw4sm1KDZnMLGeky-Hp_HmQbKGWgBTmbWoRFD4w9FTy7DRVpmlUMb7OBr73vY8_ER1Vd8k8JRKzJn/s1600/14.png" height="173" title="RESTful Services In SOA" width="320" /></a></div>
<div style="text-align: center;">
<span style="font-family: 'Times New Roman', serif; font-size: 16px;">Figure 14</span></div>
<div style="text-align: center;">
<span style="font-family: 'Times New Roman', serif; font-size: 16px;"><br /></span></div>
<div style="text-align: left;">
<span style="font-family: Times New Roman, serif;">Next, drag and drop two assign activities after validate and catchAll respectively to set true or false to the return value which is a boolean.See in Figure 15.</span></div>
<div style="text-align: left;">
<span style="font-family: Times New Roman, serif;"><br /></span></div>
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjYWrfpVFirjlX_0gV8XFWDClCY7_wYffiYkeMb5CCYW4Xmf1hRjbZvvMVchRcFiZdDsYawJmgdzLlSOj3yevquSurBNvcR5NknrSc7wtZ9MmMesvb8sY1muLehpbpzj9Xis3bn3dpotYE-/s1600/15.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img alt="RESTful Services In SOA" border="0" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjYWrfpVFirjlX_0gV8XFWDClCY7_wYffiYkeMb5CCYW4Xmf1hRjbZvvMVchRcFiZdDsYawJmgdzLlSOj3yevquSurBNvcR5NknrSc7wtZ9MmMesvb8sY1muLehpbpzj9Xis3bn3dpotYE-/s1600/15.png" height="160" title="RESTful Services In SOA" width="320" /></a></div>
<div class="separator" style="clear: both; text-align: center;">
Figure 15</div>
<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhJbTzga59Hdm-wb1JIqhc-KLGdUGdPwd8o3uRW9q6qIqiuP5M5hk7vixef7P6sNQSFJzctd4btKcaku-Ta-UwBem6IcKji68N4r08eQzW_xGR62UpT587XbSoZMTaqwJHQt_hBU639UGau/s1600/16.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img alt="RESTful Services In SOA" border="0" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhJbTzga59Hdm-wb1JIqhc-KLGdUGdPwd8o3uRW9q6qIqiuP5M5hk7vixef7P6sNQSFJzctd4btKcaku-Ta-UwBem6IcKji68N4r08eQzW_xGR62UpT587XbSoZMTaqwJHQt_hBU639UGau/s1600/16.png" height="173" title="RESTful Services In SOA" width="320" /></a></div>
<div style="text-align: center;">
<span style="font-family: Times New Roman, serif;">Figure 16</span></div>
<div style="text-align: center;">
<span style="font-family: 'Times New Roman', serif; font-size: 16px;"><br /></span></div>
<div style="text-align: left;">
<br /></div>
<div style="text-align: left;">
In Figure 16 we see the whole Bpel process completed.</div>
<div style="text-align: left;">
<br /></div>
<div style="text-align: left;">
<u style="font-family: 'Times New Roman', serif; font-size: 16px; font-weight: bold;">Test the Restful Service:</u></div>
<div style="text-align: left;">
<u style="font-family: 'Times New Roman', serif; font-size: 16px; font-weight: bold;"><br /></u></div>
<div style="text-align: left;">
<span style="font-family: 'Times New Roman', serif; font-size: 16px;"> Testing a Restful service is different than testing a Soap based service.First deploy the project after starting the integrated weblogic server.</span></div>
<div style="text-align: left;">
<span style="font-family: 'Times New Roman', serif; font-size: 16px;"><br /></span></div>
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhlYEPPYf6Ch8e-Jbj3mM1OQyqZcewy-wS26yUg5Z0MD3OhjPl2n78xPxfTBS86Ot9xF3O47SrE4Gr1ygXYYcClHEQYPaUiGRjXaixIju5QPNmo62Thzuacq4G6Vw1UEFkBofPEib0RdQbM/s1600/17.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img alt="RESTful Services In SOA" border="0" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhlYEPPYf6Ch8e-Jbj3mM1OQyqZcewy-wS26yUg5Z0MD3OhjPl2n78xPxfTBS86Ot9xF3O47SrE4Gr1ygXYYcClHEQYPaUiGRjXaixIju5QPNmo62Thzuacq4G6Vw1UEFkBofPEib0RdQbM/s1600/17.png" height="240" title="RESTful Services In SOA" width="320" /></a></div>
<div style="text-align: center;">
<span style="font-family: 'Times New Roman', serif; font-size: 16px;">Figure 17</span></div>
<div style="text-align: center;">
<span style="font-family: 'Times New Roman', serif; font-size: 16px;"><br /></span></div>
<div style="text-align: left;">
<span style="font-family: 'Times New Roman', serif; font-size: 16px;">Now, we have to go to the enterprise manager and obtain the wadl of our service.Go to the http://localhost:7101/em, click on the project under soa-infra->Default, then click on the image that two after the "Settings..." button.Copy the wadl address that you see in Figure 18 and 19.</span></div>
<div style="text-align: left;">
<span style="font-family: 'Times New Roman', serif; font-size: 16px;"><br /></span></div>
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiCsnqRyjTgmiNRFfkNWRp4pYHGrCjxJ8xRIO-tTTj9Cdtugv_ifPKbk7bkmWg89CUxbBc8wXTlaavNptZImQkt8felmSQSBGZF5tLec8DTCKZnJRNyiO44k2pxmeju_hl68-ulV_CPx8Xm/s1600/18.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img alt="RESTful Services In SOA" border="0" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiCsnqRyjTgmiNRFfkNWRp4pYHGrCjxJ8xRIO-tTTj9Cdtugv_ifPKbk7bkmWg89CUxbBc8wXTlaavNptZImQkt8felmSQSBGZF5tLec8DTCKZnJRNyiO44k2pxmeju_hl68-ulV_CPx8Xm/s1600/18.png" height="173" title="RESTful Services In SOA" width="320" /></a></div>
<div style="text-align: center;">
<span style="font-family: 'Times New Roman', serif; font-size: 16px;">Figure 18</span></div>
<div style="text-align: center;">
<span style="font-family: 'Times New Roman', serif; font-size: 16px;"><br /></span></div>
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhkdd_Ny2nlGzYHAYpGZQi9C9Q6CLW01eH6W1s2ngnLursL21j-UD2-NuytNZjwQe5TqBY_GW2Q49H9pj6DWj0reoTy-fkpIHDIRjUvm-1jHOwox_v7Y1s0ccZHeHbTg2k6W2Hw0XhygYks/s1600/19.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img alt="RESTful Services In SOA" border="0" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhkdd_Ny2nlGzYHAYpGZQi9C9Q6CLW01eH6W1s2ngnLursL21j-UD2-NuytNZjwQe5TqBY_GW2Q49H9pj6DWj0reoTy-fkpIHDIRjUvm-1jHOwox_v7Y1s0ccZHeHbTg2k6W2Hw0XhygYks/s1600/19.png" height="173" title="RESTful Services In SOA" width="320" /></a></div>
<div style="text-align: center;">
<span style="font-family: 'Times New Roman', serif; font-size: 16px;">Figure 19</span></div>
<div style="text-align: center;">
<u style="font-family: 'Times New Roman', serif; font-size: 16px; font-weight: bold;"><br /></u></div>
<div style="text-align: left;">
<u style="font-family: 'Times New Roman', serif; font-size: 16px; font-weight: bold;"><br /></u></div>
<div style="text-align: left;">
We can now go to the Jdeveloper again, and choose Tools->HTTP Analyzer.</div>
<div style="text-align: left;">
<br /></div>
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgMAyYMGulF2YMp0UCyUSWKRuxLMTCuvGRuCzUVffvgCtQ3hOQKlfoDEJOqjW4C-pkvAtA1qJLR-lvgQUpObYZCkQe7jXjIgo66kQ08SbMUKQ52SZSU46WPosLZpcm2P7hO86s1oB3twiPL/s1600/20.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img alt="RESTful Services In SOA" border="0" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgMAyYMGulF2YMp0UCyUSWKRuxLMTCuvGRuCzUVffvgCtQ3hOQKlfoDEJOqjW4C-pkvAtA1qJLR-lvgQUpObYZCkQe7jXjIgo66kQ08SbMUKQ52SZSU46WPosLZpcm2P7hO86s1oB3twiPL/s1600/20.png" height="173" title="RESTful Services In SOA" width="320" /></a></div>
<div style="text-align: center;">
Figure 20</div>
<div style="text-align: center;">
<br /></div>
<div style="text-align: left;">
Click on "Open Url" on the opened page and paste the wadl you just copied.</div>
<div style="text-align: left;">
<br /></div>
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEin2GaYlXaQpnC_4H-miclHEY493uz1Nwra7NRMDwVXBW10-4PrMBM0blrBlOLygjDseYOAAd3WsBFWhHXvOMugLRwTvvu7Tk5YFdbRjkJCYjbTVgfusLl_cHNYIwjs_UF1jC46dusVkvsM/s1600/21.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img alt="RESTful Services In SOA" border="0" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEin2GaYlXaQpnC_4H-miclHEY493uz1Nwra7NRMDwVXBW10-4PrMBM0blrBlOLygjDseYOAAd3WsBFWhHXvOMugLRwTvvu7Tk5YFdbRjkJCYjbTVgfusLl_cHNYIwjs_UF1jC46dusVkvsM/s1600/21.png" height="173" title="RESTful Services In SOA" width="320" /></a></div>
<div style="text-align: center;">
Figure 21</div>
<div style="text-align: center;">
<br /></div>
<div style="text-align: left;">
You can see wadl of your service in Jdeveloper now like in Figure 22.Click on Test button.</div>
<div style="text-align: left;">
<br /></div>
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEg8gA908kafhBLid96kFXMMCBSg75LKJx43twfXr7VfcJUzdzxloeFBAY3ByfNo11ixVQo-aB0SQ2tLS-5bnq72QdXkqz54UYCmjTTDb2B5fWcYFsNkikNvm5bT-JDI3FUp8ljlwWcbs4l8/s1600/22.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img alt="RESTful Services In SOA" border="0" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEg8gA908kafhBLid96kFXMMCBSg75LKJx43twfXr7VfcJUzdzxloeFBAY3ByfNo11ixVQo-aB0SQ2tLS-5bnq72QdXkqz54UYCmjTTDb2B5fWcYFsNkikNvm5bT-JDI3FUp8ljlwWcbs4l8/s1600/22.png" height="173" title="RESTful Services In SOA" width="320" /></a></div>
<div style="text-align: center;">
Figure 22</div>
<div style="text-align: center;">
<br /></div>
<div style="text-align: left;">
Enter a valid and non-valid date value in to the second parameter and see the result like in Figure 23 and 24.</div>
<div style="text-align: left;">
<br /></div>
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEj9Z9Qj4fluBjhb05UtRJ4WElpgWTJNL8MLpyKSdTsHOKjdGxY1BWZIFcuG2uVyQeh85gnZU3a1t5CgBFtABR58lfilaV0ag-6Q0E7HGJjFik5Tcj3DsKY_Xrx3KKNebBjgcehXTvG0yfs5/s1600/23.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img alt="RESTful Services In SOA" border="0" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEj9Z9Qj4fluBjhb05UtRJ4WElpgWTJNL8MLpyKSdTsHOKjdGxY1BWZIFcuG2uVyQeh85gnZU3a1t5CgBFtABR58lfilaV0ag-6Q0E7HGJjFik5Tcj3DsKY_Xrx3KKNebBjgcehXTvG0yfs5/s1600/23.png" height="173" title="RESTful Services In SOA" width="320" /></a></div>
<div class="separator" style="clear: both; text-align: center;">
Figure 23</div>
<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjaZGyxwELygsrMpiZbkbaALMZCBg5LBP099GVR2yS2DsaGV8HYSuh8d-S1OZm2IhBHuC-HA4HomvzgiTTRCtCwEQ7pXiF3mB1CxvbVYuvlkTQop_US4zBL6VDVSPKUMQiE4tm_Bav88_P0/s1600/24.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img alt="RESTful Services In SOA" border="0" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjaZGyxwELygsrMpiZbkbaALMZCBg5LBP099GVR2yS2DsaGV8HYSuh8d-S1OZm2IhBHuC-HA4HomvzgiTTRCtCwEQ7pXiF3mB1CxvbVYuvlkTQop_US4zBL6VDVSPKUMQiE4tm_Bav88_P0/s1600/24.png" height="173" title="RESTful Services In SOA" width="320" /></a></div>
<div class="separator" style="clear: both; text-align: center;">
Figure 24</div>
<div class="separator" style="clear: both; text-align: center;">
<br /></div>
<div class="separator" style="clear: both; text-align: left;">
<b style="font-family: 'Times New Roman', serif; font-size: 12pt;"><u>Conclusion:</u></b></div>
<div class="separator" style="clear: both; text-align: left;">
<b style="font-family: 'Times New Roman', serif; font-size: 12pt;"><u><br /></u></b></div>
<div class="separator" style="clear: both; text-align: left;">
<span style="font-family: 'Times New Roman', serif; font-size: 12pt;"> Today, I explained the usage of Restful services in SOA Suite with a validate data example.You can sometimes choose to use the lightweight Restful approach.However, you need to develop some builtin capabilities by hand by this approach that are already implemented in Soap based approach until Restful approach become more popular and engineered as Soap based approach.</span></div>
<div class="separator" style="clear: both; text-align: left;">
<span style="font-family: 'Times New Roman', serif; font-size: 12pt;"><br /></span></div>
<div style="text-align: center;">
<div style="text-align: left;">
You can download the source code from <a href="https://github.com/agelenler/myblog/tree/master/soa/RestApp" target="_blank">here</a>.</div>
</div>
Ali Gelenlerhttp://www.blogger.com/profile/09439697648573423668noreply@blogger.com0tag:blogger.com,1999:blog-3858181542467916490.post-74920247684752877882014-11-13T13:44:00.001+02:002015-02-24T21:04:49.709+02:00Using Subprocess In SOA<u style="font-family: 'Times New Roman', serif; font-size: 16px; font-weight: bold;">Introduction:</u><br />
<u style="font-family: 'Times New Roman', serif; font-size: 16px; font-weight: bold;"><br /></u>
<span style="font-family: 'Times New Roman', serif; font-size: 16px;"> Today I'll talk about a new feature of SOA Suite 12c environment, subprocesses. We'll see two type of subprocess </span><span style="font-family: 'Times New Roman', serif; font-size: 16px;">which are "inline" and "standalone".The main purpose is to create reusable components that include more than one activities.Using subprocess we can develop less code for repeating operations incresing the reusability and maintainability.</span><br />
<span style="font-family: 'Times New Roman', serif; font-size: 16px;"><br /></span>
<u style="font-family: 'Times New Roman', serif; font-size: 16px; font-weight: bold;">Inline Subprocess:</u><br />
<u style="font-family: 'Times New Roman', serif; font-size: 16px; font-weight: bold;"><br /></u>
<span style="font-family: 'Times New Roman', serif; font-size: 16px;"> You can use inline subprocess if you want to reuse a group of activities in a single bpel process rather than using it in more than one process.It will be part of a main bpel process.You have to combine reusable activities in a scope to be able make them as subprocess.There will be only one subprocess in the memory.</span><br />
<span style="font-family: 'Times New Roman', serif; font-size: 16px;"><br /></span>
<span style="font-family: 'Times New Roman', serif; font-size: 16px;">Here is an example bpel process for inline subprocess.</span><br />
<span style="font-family: 'Times New Roman', serif; font-size: 16px;"><br /></span>
<span style="font-family: 'Times New Roman', serif; font-size: 16px;">The example is just for the explanation of the inline subprocess.</span><span style="font-family: 'Times New Roman', serif;">We'll create a bpel process which take 2 string input parameters, write the first parameter to a file in a file names as "yyyyMMddHHmmssSSz" and then check if the second parameter's length is greater that 5, if so write that parameter to another file again in a file named as "</span><span style="font-family: Times New Roman, serif;">yyyyMMddHHmmssSSz".Here we need 2 write process and so need 2 invoke for the same file write adapter.At this point inline subprocess comes to rescue and helps us to create a reusable subprocess to be able to call write process many times with only one implementation.</span><br />
<span style="font-family: Times New Roman, serif;"><br /></span>
<span style="font-family: Times New Roman, serif;">At the end of the example we should get the following composite.</span><br />
<span style="font-family: Times New Roman, serif;"><br /></span>
<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEj4ENLQiGJVxZhyphenhyphenhcKHq8QiopNrVtfNBBgv3tBCkXjHLKU_S5NuE-ko3zHFDxCbF2KcaOzMdCmArl0bhStE8ZkfvJjoCuU0wa8ZwAH25jt7SGaLaqmjlB0DPtixG8QabV24B3V7EOvT4wUH/s1600/1.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img alt="Using Subprocess In SOA" border="0" height="173" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEj4ENLQiGJVxZhyphenhyphenhcKHq8QiopNrVtfNBBgv3tBCkXjHLKU_S5NuE-ko3zHFDxCbF2KcaOzMdCmArl0bhStE8ZkfvJjoCuU0wa8ZwAH25jt7SGaLaqmjlB0DPtixG8QabV24B3V7EOvT4wUH/s320/1.png" title="Using Subprocess In SOA" width="320" /></a></div>
<div class="separator" style="clear: both; text-align: center;">
Figure 1</div>
<div style="text-align: center;">
<span style="font-family: Times New Roman, serif;"><br /></span></div>
<div style="text-align: left;">
<span style="font-family: Times New Roman, serif;">Create a synchron bpel process with an xsd file with 2 string input variables.</span></div>
<div style="text-align: left;">
<span style="font-family: Times New Roman, serif;"><br /></span></div>
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjHM8L4DpFuVZK9sJVivpvwfSshumPX4R7Qdtp11eTrv9zdwi-WeWSJLHaYvx478Z3TDfpepD4lIotE_XA92iqjOCeL5xHPIMLHm4GQybx-z4GzlAh5qq9Gxuzwdz5xnnMPnaPGHNRxFR-6/s1600/2.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img alt="Using Subprocess In SOA" border="0" height="173" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjHM8L4DpFuVZK9sJVivpvwfSshumPX4R7Qdtp11eTrv9zdwi-WeWSJLHaYvx478Z3TDfpepD4lIotE_XA92iqjOCeL5xHPIMLHm4GQybx-z4GzlAh5qq9Gxuzwdz5xnnMPnaPGHNRxFR-6/s320/2.png" title="Using Subprocess In SOA" width="320" /></a></div>
<div class="separator" style="clear: both; text-align: center;">
Figure 2</div>
<div class="separator" style="clear: both; text-align: center;">
<br /></div>
<div class="separator" style="clear: both; text-align: left;">
Create a file adapter by right clicking in the external references and follow the wizard by entering the File server JNDI name as "eis/FileAdapter" as in Figure 3 and 4.</div>
<div class="separator" style="clear: both; text-align: left;">
<br /></div>
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEi17NWl0XQYS56wPrJNPH8I9MdkMty7N9_rpkpC7Pci6b2PPBWs2QOa2cD2o7MDpMuK3W1HBxzMHiV5Sqi_MdMm5wBRhtpeNDlbekoLfxSzdkYQA_VZ9yk5r8lCusCoI2PYtqtdpxAFbIhr/s1600/3.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img alt="Using Subprocess In SOA" border="0" height="266" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEi17NWl0XQYS56wPrJNPH8I9MdkMty7N9_rpkpC7Pci6b2PPBWs2QOa2cD2o7MDpMuK3W1HBxzMHiV5Sqi_MdMm5wBRhtpeNDlbekoLfxSzdkYQA_VZ9yk5r8lCusCoI2PYtqtdpxAFbIhr/s320/3.png" title="Using Subprocess In SOA" width="320" /></a></div>
<div class="separator" style="clear: both; text-align: center;">
Figure 3</div>
<div class="separator" style="clear: both; text-align: center;">
<br /></div>
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjjEfsm4BLefVfUKt0YCnTZR7vvUr3jmeYfJ8Y3-619kam0NRYMcU8d-8VK1SYIsusUFxksC1p8vJvFucurV3QcDfRa5vG4XQqXv3C-UMBG0oNGdS_RwsEvKu2ZpkICwzqGcfGvcyVAD3Rq/s1600/4.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img alt="Using Subprocess In SOA" border="0" height="266" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjjEfsm4BLefVfUKt0YCnTZR7vvUr3jmeYfJ8Y3-619kam0NRYMcU8d-8VK1SYIsusUFxksC1p8vJvFucurV3QcDfRa5vG4XQqXv3C-UMBG0oNGdS_RwsEvKu2ZpkICwzqGcfGvcyVAD3Rq/s320/4.png" title="Using Subprocess In SOA" width="320" /></a></div>
<div class="separator" style="clear: both; text-align: center;">
Figure 4</div>
<div class="separator" style="clear: both; text-align: center;">
<br /></div>
<div class="separator" style="clear: both; text-align: left;">
Then choose the "Write" operation and enter the file directory and the file name convention as in Figure 5 and 6.</div>
<div class="separator" style="clear: both; text-align: left;">
<br /></div>
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiBnU5RO-t580Qhv5bClpVjM19ItVYXsbS9Vih5YlghB24EKCwX4PL9HjmgknRZPIaj6iWvc3yORPWsZv6N4H638Mv_TcW2ma8gOtT-kXmHBwfcu0k1PVzGUUu5DnbdSmzjbAYkcbz6bb2B/s1600/5.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img alt="Using Subprocess In SOA" border="0" height="266" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiBnU5RO-t580Qhv5bClpVjM19ItVYXsbS9Vih5YlghB24EKCwX4PL9HjmgknRZPIaj6iWvc3yORPWsZv6N4H638Mv_TcW2ma8gOtT-kXmHBwfcu0k1PVzGUUu5DnbdSmzjbAYkcbz6bb2B/s320/5.png" title="Using Subprocess In SOA" width="320" /></a></div>
<div class="separator" style="clear: both; text-align: center;">
Figure 5</div>
<div class="separator" style="clear: both; text-align: center;">
<br /></div>
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEi4oj-EFIEcgjOT3R8LiHuLBeEoCk9vtUgCkMulVXoC28XEeiuqmQSDt_MIFUzli4naD7m0L243HOi-huexKJxR3nV4TNBPxV8UjXDpri-qnRvWfZK_F3byQfE_lyJGyJRNfjQ9BHoEsSfF/s1600/6.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img alt="Using Subprocess In SOA" border="0" height="266" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEi4oj-EFIEcgjOT3R8LiHuLBeEoCk9vtUgCkMulVXoC28XEeiuqmQSDt_MIFUzli4naD7m0L243HOi-huexKJxR3nV4TNBPxV8UjXDpri-qnRvWfZK_F3byQfE_lyJGyJRNfjQ9BHoEsSfF/s320/6.png" title="Using Subprocess In SOA" width="320" /></a></div>
<div class="separator" style="clear: both; text-align: center;">
Figure 6</div>
<div class="separator" style="clear: both; text-align: center;">
<br /></div>
<div class="separator" style="clear: both; text-align: left;">
Finally we choose the input xsd file as the input of our file write adapter just to be an example.</div>
<div class="separator" style="clear: both; text-align: left;">
<br /></div>
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgSqrKtPYA0qv5ECMlIJg78fY4j-e_a4ekHU4fLayybmbdVn6xl8ua2JIlvEXNIvx1xfG2EpnXOgm7yNQM1IHp751_RN0MrJOyX7CL2UMoHTnNHDYmQj6pVGJ9MS3lDOJHCIJK_u1AlgAGq/s1600/7.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img alt="Using Subprocess In SOA" border="0" height="266" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgSqrKtPYA0qv5ECMlIJg78fY4j-e_a4ekHU4fLayybmbdVn6xl8ua2JIlvEXNIvx1xfG2EpnXOgm7yNQM1IHp751_RN0MrJOyX7CL2UMoHTnNHDYmQj6pVGJ9MS3lDOJHCIJK_u1AlgAGq/s320/7.png" title="Using Subprocess In SOA" width="320" /></a></div>
<div class="separator" style="clear: both; text-align: center;">
Figure 7</div>
<div class="separator" style="clear: both; text-align: center;">
<br /></div>
<div class="separator" style="clear: both; text-align: left;">
Now go to the bpel process editor and drag and drop a scope,an assing and an invoke activity after the ReceiveInput component, reference the file adapter from the invoke and place the assign and invoke in the scope activity since the activities should be in a scope activity to create an inline subprocess.See in Figure 8.</div>
<div class="separator" style="clear: both; text-align: left;">
<br /></div>
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiOoGMk71g8ugb-plBpRt2lbUeV-kgI5tDqHYMOrpw_N7ZLGPz50F27r2C6i0vhPUK2rqVYCP3IxOXgKgKV9l2GhNRFxiFe14BPjutU4qKUarbPWD6uLZAzSkowDTTapV6azmG5nx4pa3tn/s1600/10.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img alt="Using Subprocess In SOA" border="0" height="173" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiOoGMk71g8ugb-plBpRt2lbUeV-kgI5tDqHYMOrpw_N7ZLGPz50F27r2C6i0vhPUK2rqVYCP3IxOXgKgKV9l2GhNRFxiFe14BPjutU4qKUarbPWD6uLZAzSkowDTTapV6azmG5nx4pa3tn/s320/10.png" title="Using Subprocess In SOA" width="320" /></a></div>
<div class="separator" style="clear: both; text-align: center;">
Figure 8</div>
<div class="separator" style="clear: both; text-align: center;">
<br /></div>
<div class="separator" style="clear: both; text-align: left;">
Below is the invoke activity edit page.</div>
<div class="separator" style="clear: both; text-align: left;">
<br /></div>
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhxUWW6y9lyfJsgzPOLrfv6F53PUT3siEIeyb8CvdSu01ki8a9jRbWPkbSHn6UBt5ktxoVIzwfRxjkD5oOuygEx7_f8qBUBRo6dkoq0W9Sq6fWHgCQ-Wl7EkN_ZIjHCvF0cK5FIz7M0Wk0h/s1600/17.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img alt="Using Subprocess In SOA" border="0" height="320" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhxUWW6y9lyfJsgzPOLrfv6F53PUT3siEIeyb8CvdSu01ki8a9jRbWPkbSHn6UBt5ktxoVIzwfRxjkD5oOuygEx7_f8qBUBRo6dkoq0W9Sq6fWHgCQ-Wl7EkN_ZIjHCvF0cK5FIz7M0Wk0h/s320/17.png" title="Using Subprocess In SOA" width="290" /></a></div>
<div class="separator" style="clear: both; text-align: center;">
Figure 9</div>
<div class="separator" style="clear: both; text-align: left;">
<br /></div>
<div class="separator" style="clear: both; text-align: left;">
You can now right click the scope activity and choose "Convert to a Subprocess" as in Figure 9.</div>
<div class="separator" style="clear: both; text-align: left;">
<br /></div>
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEj4cDEwUtJdF9eGkMu3AYxHlaMBJBEVu4RwvxxOOXlbvKSX0L-E1hMkCev1f9fcJiCR_vAjJB4BslhuWlCPGHR9stJ3vNGnzQYxv4u8NttzRZC-pqqqyJk6EKRVvS2izM4chyeeIPm7bhA9/s1600/11.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img alt="Using Subprocess In SOA" border="0" height="173" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEj4cDEwUtJdF9eGkMu3AYxHlaMBJBEVu4RwvxxOOXlbvKSX0L-E1hMkCev1f9fcJiCR_vAjJB4BslhuWlCPGHR9stJ3vNGnzQYxv4u8NttzRZC-pqqqyJk6EKRVvS2izM4chyeeIPm7bhA9/s320/11.png" title="Using Subprocess In SOA" width="320" /></a></div>
<div class="separator" style="clear: both; text-align: center;">
Figure 10</div>
<div class="separator" style="clear: both; text-align: center;">
<br /></div>
<div class="separator" style="clear: both; text-align: left;">
Give a name to your subprocess, you can also choose immediately replacing your scope with the call of created subprocess as shown in Figure 10.</div>
<div class="separator" style="clear: both; text-align: left;">
<br /></div>
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjMNfsHovbZNGUWA52xchDHJji0yAfRdY6EFocvr_zkdOz3VJNyv_QkzKNYsrDpnbbsKFk4Z8I-a7eDp_EZsKDBgmEls9TDFRltIYN3Mn8L6n8QfWf0HgfVsFJemJsk3fsk0hJPvkG95ntT/s1600/12.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img alt="Using Subprocess In SOA" border="0" height="261" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjMNfsHovbZNGUWA52xchDHJji0yAfRdY6EFocvr_zkdOz3VJNyv_QkzKNYsrDpnbbsKFk4Z8I-a7eDp_EZsKDBgmEls9TDFRltIYN3Mn8L6n8QfWf0HgfVsFJemJsk3fsk0hJPvkG95ntT/s320/12.png" title="Using Subprocess In SOA" width="320" /></a></div>
<div class="separator" style="clear: both; text-align: center;">
Figure 11</div>
<div class="separator" style="clear: both; text-align: center;">
<br /></div>
<div class="separator" style="clear: both; text-align: left;">
You can see your subprocess by choosing the subprocess in the left top corner as shown in the Figure 11 with a red arrow.</div>
<div class="separator" style="clear: both; text-align: left;">
<br /></div>
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEi-zl7d5OWF019cQCs0Hm5FlyzvPAQHS0Pd5liftrIct3SmTPyvcMSOyt6TtozFg6bHkpKGM8ai7eb39dgSNPd1F-Ek4o-N3SB8wvB3RdPzhJNqpohfIEtxrOYR1K2uzzKHOTO7z1h1X0hp/s1600/9.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img alt="Using Subprocess In SOA" border="0" height="173" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEi-zl7d5OWF019cQCs0Hm5FlyzvPAQHS0Pd5liftrIct3SmTPyvcMSOyt6TtozFg6bHkpKGM8ai7eb39dgSNPd1F-Ek4o-N3SB8wvB3RdPzhJNqpohfIEtxrOYR1K2uzzKHOTO7z1h1X0hp/s320/9.png" title="Using Subprocess In SOA" width="320" /></a></div>
<div class="separator" style="clear: both; text-align: center;">
Figure 12</div>
<div class="separator" style="clear: both; text-align: center;">
<br /></div>
<div class="separator" style="clear: both; text-align: left;">
You can change your subprocess call name in the edit page.</div>
<div class="separator" style="clear: both; text-align: left;">
<br /></div>
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEh1jqrv4fv6S4mNas497vVLO9jvvy_kEUIrdoIbaoqTiYGjt9W3O1h8XCDWh5SsDQG2NEwlgcN2SCvO6wb8gveQRWHXf1LBBZcJl1D0RaskBrGvhBthknzGSM31bKjmLMHjh4Owy-NEBLaY/s1600/15.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img alt="Using Subprocess In SOA" border="0" height="297" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEh1jqrv4fv6S4mNas497vVLO9jvvy_kEUIrdoIbaoqTiYGjt9W3O1h8XCDWh5SsDQG2NEwlgcN2SCvO6wb8gveQRWHXf1LBBZcJl1D0RaskBrGvhBthknzGSM31bKjmLMHjh4Owy-NEBLaY/s320/15.png" title="Using Subprocess In SOA" width="320" /></a></div>
<div class="separator" style="clear: both; text-align: center;">
Figure 13</div>
<div class="separator" style="clear: both; text-align: center;">
<br /></div>
<div class="separator" style="clear: both; text-align: left;">
At this point we define the input of file adapter with the help of the assign activity.We either define a variable in the main process and assign that variable before calling the subprocess and assign that variable to the input of file adapter in the subprocess as shown in Figure 14 and 15 or define a variable in the subprocess and make a relation with the input variable of the main process and the variable created in the subprocess.Since an inline subprocess can see the main process's variables it's no matter here, however when we use the standalone subprocess we have to create a variable in the subprocess and make a relation with the main process variable as we'll see in the standalone subprocess part of this write.</div>
<div class="separator" style="clear: both; text-align: left;">
<br /></div>
<div style="text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgOscuXyiyI4Hdn4TiF54IHGx3-Htfuv8xRk6Wkirb-HBZn4_CvGZvV1nXp3C1_DO-G6HYfzWdWpOw42_HL-3pVaZWTqz_D-YUcgPStO9-qXTZp3PgcVSTwG5_EX1EUeaZd7uv6pRLOw9Q1/s1600/14.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img alt="Using Subprocess In SOA" border="0" height="160" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgOscuXyiyI4Hdn4TiF54IHGx3-Htfuv8xRk6Wkirb-HBZn4_CvGZvV1nXp3C1_DO-G6HYfzWdWpOw42_HL-3pVaZWTqz_D-YUcgPStO9-qXTZp3PgcVSTwG5_EX1EUeaZd7uv6pRLOw9Q1/s320/14.png" title="Using Subprocess In SOA" width="320" /></a></div>
<div style="text-align: center;">
Figure 14</div>
<div style="text-align: center;">
<br /></div>
<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEikSavXJ8-DIaxTX3tUrmCNTZ5Ogng5vCtS82bg8V2aoq5um7aKEGuPwWIX1NDenJd6h1jr1-G30baCCDzbMedxJ9n33ixbXQWAtEMhITNd8opM6sAA_dnLxTeeqOTSxvDyBB4bDJ9Fq607/s1600/16.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img alt="Using Subprocess In SOA" border="0" height="160" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEikSavXJ8-DIaxTX3tUrmCNTZ5Ogng5vCtS82bg8V2aoq5um7aKEGuPwWIX1NDenJd6h1jr1-G30baCCDzbMedxJ9n33ixbXQWAtEMhITNd8opM6sAA_dnLxTeeqOTSxvDyBB4bDJ9Fq607/s320/16.png" title="Using Subprocess In SOA" width="320" /></a></div>
<div class="" style="clear: both; text-align: center;">
Figure 15</div>
<div class="separator" style="clear: both; text-align: center;">
<br /></div>
<div class="separator" style="clear: both; text-align: left;">
In the bpel process editor place an If activity after the just created subprocess call and check if the second input parameter length is greater than 5.</div>
<div class="separator" style="clear: both; text-align: left;">
<br /></div>
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEii3pl_MpsdvXPir02navebB26V442XFR4uThz3uWGC2I_qVK5LwCxe2a9G0IhecM51GZZzbpQNfWLhOKfcPDwi-lC4T-vHbj9wBPozbkoh8prjM06GTetYl0xeWMrOvRg0JF1PH4GbYx90/s1600/13.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img alt="Using Subprocess In SOA" border="0" height="297" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEii3pl_MpsdvXPir02navebB26V442XFR4uThz3uWGC2I_qVK5LwCxe2a9G0IhecM51GZZzbpQNfWLhOKfcPDwi-lC4T-vHbj9wBPozbkoh8prjM06GTetYl0xeWMrOvRg0JF1PH4GbYx90/s320/13.png" title="Using Subprocess In SOA" width="320" /></a></div>
<div class="separator" style="clear: both; text-align: center;">
Figure 16</div>
<div class="separator" style="clear: both; text-align: center;">
<br /></div>
<div class="separator" style="clear: both; text-align: left;">
You can see the inline subprocess in the Components -> Subprocesses as shown with a red arrow in the Figure 17. Simply drag and drop it in the if activity to call the file process second time after defining an assign activity similar to the previous subprocess call.</div>
<div class="separator" style="clear: both; text-align: left;">
<br /></div>
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjYN-RbuC5aHrL-u97BtbXzeKpRdUcMhpbvjjR0UfJMc8Huu3KIaxEKPH3Faun5pZZQCe6hLfc3URCsKe2x6tq3AWMKjAvtrqdrHjQgM9fuUgG8Z6h3l9D0UaS5x_AWd0rVhBvW3QBsTDU1/s1600/18.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img alt="Using Subprocess In SOA" border="0" height="173" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjYN-RbuC5aHrL-u97BtbXzeKpRdUcMhpbvjjR0UfJMc8Huu3KIaxEKPH3Faun5pZZQCe6hLfc3URCsKe2x6tq3AWMKjAvtrqdrHjQgM9fuUgG8Z6h3l9D0UaS5x_AWd0rVhBvW3QBsTDU1/s320/18.png" title="Using Subprocess In SOA" width="320" /></a></div>
<div class="separator" style="clear: both; text-align: center;">
Figure 17</div>
<div class="separator" style="clear: both; text-align: center;">
<br /></div>
<div class="separator" style="clear: both; text-align: left;">
The final bpel process should now look like as in Figure 18.</div>
<div class="separator" style="clear: both; text-align: left;">
<br /></div>
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhTFM4qEVKiADxIh5J_MpR6fxZFh5Xp0UQhukDunkolceU54OSmTz-KIRo84s6U1Iv4C1cyVo_vma8u33sMFYHZl85EXknT7im1yQrT6yeEwkdHne_9g0_yFB2Xdcsxa4eilTeSN1BzrUYX/s1600/8.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img alt="Using Subprocess In SOA" border="0" height="173" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhTFM4qEVKiADxIh5J_MpR6fxZFh5Xp0UQhukDunkolceU54OSmTz-KIRo84s6U1Iv4C1cyVo_vma8u33sMFYHZl85EXknT7im1yQrT6yeEwkdHne_9g0_yFB2Xdcsxa4eilTeSN1BzrUYX/s320/8.png" title="Using Subprocess In SOA" width="320" /></a></div>
<div class="separator" style="clear: both; text-align: center;">
Figure 18</div>
<div class="separator" style="clear: both; text-align: center;">
<br /></div>
<div class="separator" style="clear: both; text-align: left;">
Let's now test our bpel process first with a second input with a length less than 5 and then greater than 5.We should see two files created in the later case.</div>
<div class="separator" style="clear: both; text-align: left;">
<br /></div>
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEirM_4_UGdCMeprovuPzYzvMtCPmvPnhOc9i7jMLnpKNkByxXACLKTV1udMZRxaP7Xuw0whRp7VqtMYxPSsNoJrKvNru4oVI68U0oNL9tAIY9buFGwoyuRec0vEnsjwQEPmVx8IYWapUAMK/s1600/19.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img alt="Using Subprocess In SOA" border="0" height="173" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEirM_4_UGdCMeprovuPzYzvMtCPmvPnhOc9i7jMLnpKNkByxXACLKTV1udMZRxaP7Xuw0whRp7VqtMYxPSsNoJrKvNru4oVI68U0oNL9tAIY9buFGwoyuRec0vEnsjwQEPmVx8IYWapUAMK/s320/19.png" title="Using Subprocess In SOA" width="320" /></a></div>
<div class="separator" style="clear: both; text-align: center;">
Figure 19</div>
<div class="separator" style="clear: both; text-align: center;">
<br /></div>
<div class="separator" style="clear: both; text-align: left;">
Since the second input is "test" which has 4 length there will be one file created in the target directory as in Figure 20.</div>
<div class="separator" style="clear: both; text-align: center;">
<br /></div>
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgkPh2A8YxJVl9oeixfLPpvb09J9YUIxgc3O35HrgvQkG56vTlGbTaNbCKogcIq6xQvfsx984v7_V2vZyuLWDhJUshCHpL2X6RX5j4myHYRCPOMJLOd1srn0nj5TbFhP4MYQcB3PsVb2TBo/s1600/20.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img alt="Using Subprocess In SOA" border="0" height="178" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgkPh2A8YxJVl9oeixfLPpvb09J9YUIxgc3O35HrgvQkG56vTlGbTaNbCKogcIq6xQvfsx984v7_V2vZyuLWDhJUshCHpL2X6RX5j4myHYRCPOMJLOd1srn0nj5TbFhP4MYQcB3PsVb2TBo/s320/20.png" title="Using Subprocess In SOA" width="320" /></a></div>
<div class="separator" style="clear: both; text-align: center;">
Figure 20</div>
<div class="separator" style="clear: both; text-align: center;">
<br /></div>
<div class="separator" style="clear: both; text-align: left;">
The content of the created file will be like in the following figure</div>
<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEga_KlePAbzdtgXcuISZxBKR9VM-rvPAVml3ZaJ4LnpD1ZL_Im-nFJI9fw7vtjkb_hVehBM5yqXHikM5bs0M_mQu0R-7uIvk06nwhV7_f3hZZPBp2xUl7SIMuoN3uLT8QuXQTPUqsSX9jqD/s1600/21.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img alt="Using Subprocess In SOA" border="0" height="142" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEga_KlePAbzdtgXcuISZxBKR9VM-rvPAVml3ZaJ4LnpD1ZL_Im-nFJI9fw7vtjkb_hVehBM5yqXHikM5bs0M_mQu0R-7uIvk06nwhV7_f3hZZPBp2xUl7SIMuoN3uLT8QuXQTPUqsSX9jqD/s320/21.png" title="Using Subprocess In SOA" width="320" /></a></div>
<div class="separator" style="clear: both; text-align: center;">
Figure 21</div>
<div class="separator" style="clear: both; text-align: center;">
<br /></div>
<div class="separator" style="clear: both; text-align: left;">
If we run the process with a parameter like "test77" we'll end up with 2 files created as in Figure 22.</div>
<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgumj8mf7Fjg64OC5F0P_vLh5gmCNfVT6M34cvGQGVw4v5qW8N5eiH6STOwtHnFuYFUsVimiDuqaNUpYVvkPPN6NW7azMs2UoYoyQumm5aTzFAVoTy9MWtD9myNuYUf_TB4IYzTSpmEG3XP/s1600/22.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img alt="Using Subprocess In SOA" border="0" height="178" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgumj8mf7Fjg64OC5F0P_vLh5gmCNfVT6M34cvGQGVw4v5qW8N5eiH6STOwtHnFuYFUsVimiDuqaNUpYVvkPPN6NW7azMs2UoYoyQumm5aTzFAVoTy9MWtD9myNuYUf_TB4IYzTSpmEG3XP/s320/22.png" title="Using Subprocess In SOA" width="320" /></a></div>
<div class="separator" style="clear: both; text-align: center;">
Figure 22</div>
<div class="separator" style="clear: both; text-align: center;">
<br /></div>
<div class="separator" style="clear: both; text-align: left;">
<u style="font-family: 'Times New Roman', serif; font-size: 16px; font-weight: bold;">Standalone Subprocess:</u></div>
<div class="separator" style="clear: both; text-align: left;">
<u style="font-family: 'Times New Roman', serif; font-size: 16px; font-weight: bold;"><br /></u></div>
<div class="separator" style="clear: both; text-align: left;">
<span style="font-family: 'Times New Roman', serif; font-size: 16px;"> The second type of subprocess is standalone which can be reused accross multiple bpel processes.For the first release of Soa Suite 12c its only supported in the same composite.We may use "Create SOA Template" feature to create a template with the standalone subprocess and then reused in different composites. </span></div>
<div class="separator" style="clear: both; text-align: left;">
<span style="font-family: 'Times New Roman', serif; font-size: 16px;"><br /></span></div>
<div class="separator" style="clear: both; text-align: left;">
<span style="font-family: 'Times New Roman', serif; font-size: 16px;">Here is an example bpel process for standalone subprocess.</span></div>
<div class="separator" style="clear: both; text-align: left;">
<span style="font-family: 'Times New Roman', serif; font-size: 16px;"><br /></span></div>
<div class="separator" style="clear: both; text-align: left;">
<span style="font-family: 'Times New Roman', serif; font-size: 16px;">The example is just for the explanation of the standalone subprocess.</span><span style="font-family: 'Times New Roman', serif; font-size: 16px;">We'll create a bpel process that takes 1 string input variable and persist it to database using a standalone subprocess which will include a database adapter.We'll create a table named "TEST" that include only one column to hold the string input value.We'll call the subprocess to insert the value and then will check if the count of the "TEST" table is less than 5 using another database adapter with a pure sql to get the count of the rows.If its less than 5 we call the subprocess again to insert the table this time input value concatenated with "-" and the "COUNT" of the table.</span></div>
<div class="separator" style="clear: both; text-align: left;">
<span style="font-family: 'Times New Roman', serif; font-size: 16px;"><br /></span></div>
<div class="separator" style="clear: both; text-align: left;">
<span style="font-family: 'Times New Roman', serif; font-size: 16px;">At the end of the example we should get the below composite.</span></div>
<div class="separator" style="clear: both; text-align: center;">
<span style="font-family: 'Times New Roman', serif; font-size: 16px;"><br /></span></div>
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhZajpuUr4bp7bTt82bSidyg1CyGGMyKJfNilArDV4J5GxIfK9TFnO6JkqA1RmJJyldbXZ3aVr3xwIR4Zs_EeOeKrAGh59eVAEELds1m9tCWjtckc2JwF7EL4JPaavADk9Kk3C_4jZHFli2/s1600/23.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img alt="Using Subprocess In SOA" border="0" height="173" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhZajpuUr4bp7bTt82bSidyg1CyGGMyKJfNilArDV4J5GxIfK9TFnO6JkqA1RmJJyldbXZ3aVr3xwIR4Zs_EeOeKrAGh59eVAEELds1m9tCWjtckc2JwF7EL4JPaavADk9Kk3C_4jZHFli2/s320/23.png" title="Using Subprocess In SOA" width="320" /></a></div>
<div class="separator" style="clear: both; text-align: center;">
Figure 23</div>
<div class="separator" style="clear: both; text-align: center;">
<br /></div>
<div class="separator" style="clear: both; text-align: left;">
First let's create a synchron bpel process with one input variable like in Figure 24.</div>
<div class="separator" style="clear: both; text-align: left;">
<br /></div>
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEj9ewEsF50fTQoE8Yph1unI09tX2gbZL-fSJWpZtAEnUhl7C1cPCKEFCtEQPfQvD7FfTxcHpR3gy5W9ORrhtfWh6-0AmnsCadLdzpXT7c5EhCe8UOv7pAIAnk04-_SE8-lvfnVaOx-mrQDk/s1600/25.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img alt="Using Subprocess In SOA" border="0" height="173" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEj9ewEsF50fTQoE8Yph1unI09tX2gbZL-fSJWpZtAEnUhl7C1cPCKEFCtEQPfQvD7FfTxcHpR3gy5W9ORrhtfWh6-0AmnsCadLdzpXT7c5EhCe8UOv7pAIAnk04-_SE8-lvfnVaOx-mrQDk/s320/25.png" title="Using Subprocess In SOA" width="320" /></a></div>
<div class="separator" style="clear: both; text-align: center;">
Figure 24</div>
<div class="separator" style="clear: both; text-align: center;">
<br /></div>
<div class="separator" style="clear: both; text-align: left;">
Then create a standalone subprocess by right clicking the Components part of the composite page as shown in Figure 25.</div>
<div class="separator" style="clear: both; text-align: left;">
<br /></div>
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEg-GcG9o3sSW9FXU0Ksc6zBrqn2NalChz12lJQ97CjBJAxxQ1zxZbpx40bCLk4YbKhgdufzQGI246DizS4kA81KutUeKheQ1uX4pjEy5DExMFtp1joJR1q_k3HhR8PP2q98CaFPpNTdqEVE/s1600/24.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img alt="Using Subprocess In SOA" border="0" height="173" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEg-GcG9o3sSW9FXU0Ksc6zBrqn2NalChz12lJQ97CjBJAxxQ1zxZbpx40bCLk4YbKhgdufzQGI246DizS4kA81KutUeKheQ1uX4pjEy5DExMFtp1joJR1q_k3HhR8PP2q98CaFPpNTdqEVE/s320/24.png" title="Using Subprocess In SOA" width="320" /></a></div>
<div class="separator" style="clear: both; text-align: center;">
Figure 25</div>
<div class="separator" style="clear: both; text-align: center;">
<br /></div>
<div class="separator" style="clear: both; text-align: left;">
Create a connection under Connections -> Database and create a table name "TEST" under SOAINFRA -> Tables as in following figure.</div>
<div class="separator" style="clear: both; text-align: left;">
<br /></div>
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgSyZP-LKfC6KREskM6-r5uX0X7cocRAmsQJRHFX3DR17oDQcK3J2UbJaRdfZsQYSzOHE_PBWdPV9ohzedtAzQCAjkB0phj-IIpjxaWLOAjsxLOlOWFNbu3O9IFKiArV_iR9m3X5KeF4nrp/s1600/28.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img alt="Using Subprocess In SOA" border="0" height="240" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgSyZP-LKfC6KREskM6-r5uX0X7cocRAmsQJRHFX3DR17oDQcK3J2UbJaRdfZsQYSzOHE_PBWdPV9ohzedtAzQCAjkB0phj-IIpjxaWLOAjsxLOlOWFNbu3O9IFKiArV_iR9m3X5KeF4nrp/s320/28.png" title="Using Subprocess In SOA" width="320" /></a></div>
<div class="separator" style="clear: both; text-align: center;">
Figure 26</div>
<div class="separator" style="clear: both; text-align: center;">
<br /></div>
<div class="separator" style="clear: both; text-align: left;">
Before editing the standalone subprocess create a database adapter to persist the input to the database.Choose the connection you created and enter the prebuilt JNDI name as eis/DB/SOA.</div>
<div class="separator" style="clear: both; text-align: left;">
<br /></div>
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjhdBXNS7tploQTZXVGPQeaHgV6fcYAUeec8bLG4GXhN4s_EqQEU6fzhovUl2xRvuDhf96XLP-8AS_d7bxLSWXXVwSxArUtg1gYdrK-EcZ8fSWqiYUQZIA94lTPG7kgmk-X57H4xsoB9Xuv/s1600/29.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img alt="Using Subprocess In SOA" border="0" height="266" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjhdBXNS7tploQTZXVGPQeaHgV6fcYAUeec8bLG4GXhN4s_EqQEU6fzhovUl2xRvuDhf96XLP-8AS_d7bxLSWXXVwSxArUtg1gYdrK-EcZ8fSWqiYUQZIA94lTPG7kgmk-X57H4xsoB9Xuv/s320/29.png" title="Using Subprocess In SOA" width="320" /></a></div>
<div class="separator" style="clear: both; text-align: center;">
Figure 27</div>
<div class="separator" style="clear: both; text-align: center;">
<br /></div>
<div class="separator" style="clear: both; text-align: left;">
Choose "Insert Only" option and left the "Attribute Filtering" as it is.See in Figure 28 and 29.</div>
<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiQqfHBxuTC4agAj1NttwfT1WNzHKWqi__AkD53RweindkMMJfHLS_63bRA11Q_zqx989gZqBjWlTKLbJRTGsS_V-lTh6-qSVEfkDO17OHlk8ar2rGtEnO6i0XsqqHVh1J2ql2TqtlwwRzN/s1600/30.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img alt="Using Subprocess In SOA" border="0" height="266" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiQqfHBxuTC4agAj1NttwfT1WNzHKWqi__AkD53RweindkMMJfHLS_63bRA11Q_zqx989gZqBjWlTKLbJRTGsS_V-lTh6-qSVEfkDO17OHlk8ar2rGtEnO6i0XsqqHVh1J2ql2TqtlwwRzN/s320/30.png" title="Using Subprocess In SOA" width="320" /></a></div>
<div class="separator" style="clear: both; text-align: center;">
Figure 28</div>
<div class="separator" style="clear: both; text-align: center;">
<br /></div>
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjQ7T8tXaQOksJ_JAuSfsTAZYFs6YTo2XmgLleamnXon0WefA9XBLCDepDUZdFcBnVzVeVYs5Y7RBbolEYpEyFprdrguQOSeazgTwe_hdpb6C22ndhpWVGV2367is9NqhkK2FMBqfXTm0OX/s1600/31.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img alt="Using Subprocess In SOA" border="0" height="266" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjQ7T8tXaQOksJ_JAuSfsTAZYFs6YTo2XmgLleamnXon0WefA9XBLCDepDUZdFcBnVzVeVYs5Y7RBbolEYpEyFprdrguQOSeazgTwe_hdpb6C22ndhpWVGV2367is9NqhkK2FMBqfXTm0OX/s320/31.png" title="Using Subprocess In SOA" width="320" /></a></div>
<div class="separator" style="clear: both; text-align: center;">
Figure 29</div>
<div class="separator" style="clear: both; text-align: center;">
<br /></div>
<div class="separator" style="clear: both; text-align: left;">
Now double click to the standalone subprocess and go to the bpel editor.Drag and drog an assing and an invoke activity referencing to the database adapter as in the following figure.</div>
<div class="separator" style="clear: both; text-align: left;">
<br /></div>
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhVk-vdixB7gSQA19w3aUXyZhNCJHDoLgKjoPNUvZ-bTYDsq7yAzoMKGmUs7J1_rkRaZO90q5oWmw8jpCyz1d6G5o4-md1PUfz7XrI5Ii6fU-ftoE3ut8CVY7Pa-PWuBf2YaMa1eZ33cBGu/s1600/27.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img alt="Using Subprocess In SOA" border="0" height="173" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhVk-vdixB7gSQA19w3aUXyZhNCJHDoLgKjoPNUvZ-bTYDsq7yAzoMKGmUs7J1_rkRaZO90q5oWmw8jpCyz1d6G5o4-md1PUfz7XrI5Ii6fU-ftoE3ut8CVY7Pa-PWuBf2YaMa1eZ33cBGu/s320/27.png" title="Using Subprocess In SOA" width="320" /></a></div>
<div class="separator" style="clear: both; text-align: center;">
Figure 30</div>
<div class="separator" style="clear: both; text-align: center;">
<br /></div>
<div class="separator" style="clear: both; text-align: left;">
To be able to assign the input of database adapter in the subprocess, unlike inline subprocess you must define a variable in the standalone subprocess and link that variable to a variable in the main process.Drag and drop an assign activity after the ReceiveInput of the main process and define a variable named InputValue in the main process and assign it by the input of the schema as in Figure 31.</div>
<div class="separator" style="clear: both; text-align: left;">
<br /></div>
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgFAXRsgm5aDgY5ygox0_g9P1zh237_xfcNDUtSUW00ZyfAqDis4PBxKnsTQZTiFOidFrK5NUvrDpKnQYbQLXrQaWoRMkTX-jXi4YC4-nk0g-4yPP85dWz8PhR-fNv3oiARGDL13GOoElET/s1600/35.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img alt="Using Subprocess In SOA" border="0" height="160" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgFAXRsgm5aDgY5ygox0_g9P1zh237_xfcNDUtSUW00ZyfAqDis4PBxKnsTQZTiFOidFrK5NUvrDpKnQYbQLXrQaWoRMkTX-jXi4YC4-nk0g-4yPP85dWz8PhR-fNv3oiARGDL13GOoElET/s320/35.png" title="Using Subprocess In SOA" width="320" /></a></div>
<div class="separator" style="clear: both; text-align: center;">
Figure 31</div>
<div class="separator" style="clear: both; text-align: center;">
<br /></div>
<div class="separator" style="clear: both; text-align: left;">
As you can see in Figure 32, standalone subprocess is now in in the components tab.</div>
<div class="separator" style="clear: both; text-align: left;">
<br /></div>
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiee1xkjq-ZhF6q7KJv_rB-iFq8DeX9dzggePGTOHX43GkJoLwDeNCcnYolFnrjb-pCIJYHsjla9WDdUp-1cjpX0weWwubd0u26ngzQKRQaTQ2SUrconOH_yRluPTWwUdCTpR2cARvNSru5/s1600/34.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img alt="Using Subprocess In SOA" border="0" height="173" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiee1xkjq-ZhF6q7KJv_rB-iFq8DeX9dzggePGTOHX43GkJoLwDeNCcnYolFnrjb-pCIJYHsjla9WDdUp-1cjpX0weWwubd0u26ngzQKRQaTQ2SUrconOH_yRluPTWwUdCTpR2cARvNSru5/s320/34.png" title="Using Subprocess In SOA" width="320" /></a></div>
<div class="separator" style="clear: both; text-align: center;">
Figure 32</div>
<div class="separator" style="clear: both; text-align: center;">
<br /></div>
<div class="separator" style="clear: both; text-align: left;">
<br /></div>
<div class="separator" style="clear: both; text-align: left;">
Now go to the subprocess create a variable named "InputVar" and then in the main process editor drag and drop the standalone subprocess after the assign activity and link the "InputValue" variable of the main process with the "InputVar" variable of the subprocess in the "Edit Call" page as in Figure 33.</div>
<div class="separator" style="clear: both; text-align: left;">
<br /></div>
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgdKLBQjOCvez_JJ_Xdk8OgZL1YIN8vLG-ASWV3GAbwpyHzwvFJyBhMEi-RmKVwAdveGbTVnpqx12DKdxo0D-QrJMTkZ8IIRcKmhd2uwRi-Z_yodlvTe7FgnD6v1hEl-okzc-c0M62C9MFa/s1600/36.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img alt="Using Subprocess In SOA" border="0" height="297" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgdKLBQjOCvez_JJ_Xdk8OgZL1YIN8vLG-ASWV3GAbwpyHzwvFJyBhMEi-RmKVwAdveGbTVnpqx12DKdxo0D-QrJMTkZ8IIRcKmhd2uwRi-Z_yodlvTe7FgnD6v1hEl-okzc-c0M62C9MFa/s320/36.png" title="Using Subprocess In SOA" width="320" /></a></div>
<div class="separator" style="clear: both; text-align: center;">
Figure 33</div>
<div class="separator" style="clear: both; text-align: center;">
<br /></div>
<div class="separator" style="clear: both; text-align: left;">
You should then assign the InputVar to the input of database adapter in the subprocess as in the following figure.</div>
<div class="separator" style="clear: both; text-align: left;">
<br /></div>
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhmd8-okdzfF45qzATJgO2JY0bK6EqnHrq26hVt7bH0_cfsNEIXj4vWNUBLj1Br1sRKGUqUrQnvPib2BBrjwjF5Te8V-hqFn79PYgMAp2sqXlPywG2o5V-I3tCraIVtHTrA1f_jZaNshtGj/s1600/39.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img alt="Using Subprocess In SOA" border="0" height="160" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhmd8-okdzfF45qzATJgO2JY0bK6EqnHrq26hVt7bH0_cfsNEIXj4vWNUBLj1Br1sRKGUqUrQnvPib2BBrjwjF5Te8V-hqFn79PYgMAp2sqXlPywG2o5V-I3tCraIVtHTrA1f_jZaNshtGj/s320/39.png" title="Using Subprocess In SOA" width="320" /></a></div>
<div class="separator" style="clear: both; text-align: center;">
Figure 34</div>
<div class="separator" style="clear: both; text-align: center;">
<br /></div>
<div class="separator" style="clear: both; text-align: left;">
Let's now define another database adapter to get the count of the table as in the Figures 35 and 36.We define a pure sql to get the count.</div>
<div class="separator" style="clear: both; text-align: left;">
<br /></div>
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjM-pk7qyAVynkLkzVH4fLgEqg5wTDzmlM8PgYW0Pw5PyYAqLy0KlSCu9sDs4EAZEnHYlqd_VGydiNZiJBgF1E2VDz4R-wuCwkcgY0xf_ABJAOntAiSCZUlTr9fH13pZZM41z0dEa3KIDHs/s1600/32.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img alt="Using Subprocess In SOA" border="0" height="266" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjM-pk7qyAVynkLkzVH4fLgEqg5wTDzmlM8PgYW0Pw5PyYAqLy0KlSCu9sDs4EAZEnHYlqd_VGydiNZiJBgF1E2VDz4R-wuCwkcgY0xf_ABJAOntAiSCZUlTr9fH13pZZM41z0dEa3KIDHs/s320/32.png" title="Using Subprocess In SOA" width="320" /></a></div>
<div class="separator" style="clear: both; text-align: center;">
Figure 35</div>
<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhIDouXx0xvwvkTzlACcLpNJgqxvi4SegRaYCfkcGrHMoyXox1rioqDvK3qylDRu8RWWZtlDpIT9qUalL62JE946QK4Oaq1ZhNIX_V-tvARzT89_7fnrYYq9Qfi2LrCGeEapl_0ukQ7IO6j/s1600/33.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img alt="Using Subprocess In SOA" border="0" height="234" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhIDouXx0xvwvkTzlACcLpNJgqxvi4SegRaYCfkcGrHMoyXox1rioqDvK3qylDRu8RWWZtlDpIT9qUalL62JE946QK4Oaq1ZhNIX_V-tvARzT89_7fnrYYq9Qfi2LrCGeEapl_0ukQ7IO6j/s320/33.png" title="Using Subprocess In SOA" width="320" /></a></div>
<div class="separator" style="clear: both; text-align: center;">
Figure 36</div>
<div class="separator" style="clear: both; text-align: center;">
<br /></div>
<div class="separator" style="clear: both; text-align: left;">
We now use an If activity after calling the "count" database adapter and if the count is less than 5 we add another call to the standalone subprocess with an input value of the form "input-count".See in Figures 37 and 38.</div>
<div class="separator" style="clear: both; text-align: left;">
<br /></div>
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgjELVgCIdUGf_jWa7eH98b1zkRmbbWrN9eEXyD1U68OYV-fM6L0KcZOWe6Ll4niGFz3b5xBFD3Fyk9YKUB8TZCCeozUS4fPyt8wLgH-FzvH0pjzlw_1ycHSaDWYUftdvOyiwMg82tso6dF/s1600/37.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img alt="Using Subprocess In SOA" border="0" height="297" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgjELVgCIdUGf_jWa7eH98b1zkRmbbWrN9eEXyD1U68OYV-fM6L0KcZOWe6Ll4niGFz3b5xBFD3Fyk9YKUB8TZCCeozUS4fPyt8wLgH-FzvH0pjzlw_1ycHSaDWYUftdvOyiwMg82tso6dF/s320/37.png" title="Using Subprocess In SOA" width="320" /></a></div>
<div class="separator" style="clear: both; text-align: center;">
Figure 37</div>
<div class="separator" style="clear: both; text-align: center;">
<br /></div>
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjynXqhT6pSQSTZ802Uk4QcuciFv_KdfBU5Lc8IIxytPNTFAYDXv9jtSLM316wyS4_GKm402rQg4UK8UHRBD-dz6O5qJ0D6NeSyaxBkNIBFIlIsyv9gYMkDAKpS8_oZp3CT2lW9kVylbJ_2/s1600/38.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img alt="Using Subprocess In SOA" border="0" height="160" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjynXqhT6pSQSTZ802Uk4QcuciFv_KdfBU5Lc8IIxytPNTFAYDXv9jtSLM316wyS4_GKm402rQg4UK8UHRBD-dz6O5qJ0D6NeSyaxBkNIBFIlIsyv9gYMkDAKpS8_oZp3CT2lW9kVylbJ_2/s320/38.png" title="Using Subprocess In SOA" width="320" /></a></div>
<div class="separator" style="clear: both; text-align: center;">
Figure 38</div>
<div class="separator" style="clear: both; text-align: center;">
<br /></div>
<div class="separator" style="clear: both; text-align: left;">
Finally we should get the following bpel process with 2 subprocess calls.</div>
<div class="separator" style="clear: both; text-align: left;">
<br /></div>
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiFFSjqDmUe13xw75_EFp8NiDCRht_9Q4ch3B-OyYetP8SlQJYdY88CZuQqntJtjGJWA-i4Z6hRQnceSU9pLptQng99mhUaO0LOUnUBHq727XdsZS-VCAyDKGHySBNr4KKNm3B4icSdyEYP/s1600/26.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img alt="Using Subprocess In SOA" border="0" height="173" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiFFSjqDmUe13xw75_EFp8NiDCRht_9Q4ch3B-OyYetP8SlQJYdY88CZuQqntJtjGJWA-i4Z6hRQnceSU9pLptQng99mhUaO0LOUnUBHq727XdsZS-VCAyDKGHySBNr4KKNm3B4icSdyEYP/s320/26.png" title="Using Subprocess In SOA" width="320" /></a></div>
<div class="separator" style="clear: both; text-align: center;">
Figure 39</div>
<div class="separator" style="clear: both; text-align: center;">
<br /></div>
<div class="separator" style="clear: both; text-align: left;">
Let's test the bpel process running it 3 times with the test, test2 and test3 values respectively.In the first two calls we should see two inserts.In the last call since the row count will be 5 the second subprocess call will not be executed.See in Figures 40, 41 and 42 for the results.You can use the Tools -> Database -> SQLWorksheet to see the records in the table.</div>
<div class="separator" style="clear: both; text-align: left;">
<br /></div>
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEg07yCZal4uhaOB9E9RidiPqZkVzGxtvXcJ6h0Wdf-_6QPne9gpOAoF8F9f22x3lG_PUoX4HvZxbgq48NGpr3XEPdCFOHDJnzPy1VoTj5Ymsbt5Dv9Z9OjKUsAlC3kXN4ClHSZiOGrruOj7/s1600/40.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img alt="Using Subprocess In SOA" border="0" height="173" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEg07yCZal4uhaOB9E9RidiPqZkVzGxtvXcJ6h0Wdf-_6QPne9gpOAoF8F9f22x3lG_PUoX4HvZxbgq48NGpr3XEPdCFOHDJnzPy1VoTj5Ymsbt5Dv9Z9OjKUsAlC3kXN4ClHSZiOGrruOj7/s320/40.png" title="Using Subprocess In SOA" width="320" /></a></div>
<div class="separator" style="clear: both; text-align: center;">
Figure 40</div>
<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjaCo9Wd8dMkftXmsRI-9NqV5L0EBLKoRxP9jXInoF_I02pVTftAZtJbyJnQJplJbLIaDckI97GiJ40SZWMJsXPAeG4D0uEQaYHcmfPAr7RqxVOvfQPrIGEc4N7NuXxY8A3m_NsEmntDtSz/s1600/41.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img alt="Using Subprocess In SOA" border="0" height="173" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjaCo9Wd8dMkftXmsRI-9NqV5L0EBLKoRxP9jXInoF_I02pVTftAZtJbyJnQJplJbLIaDckI97GiJ40SZWMJsXPAeG4D0uEQaYHcmfPAr7RqxVOvfQPrIGEc4N7NuXxY8A3m_NsEmntDtSz/s320/41.png" title="Using Subprocess In SOA" width="320" /></a></div>
<div class="separator" style="clear: both; text-align: center;">
Figure 41</div>
<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjusPZoE0gYBUmX7X53E4ACzlIGXgmJApGbvuiOXQ17tpbNGATwkPKmT2x7yDkZscKaMjSASX7hJIH6xW_lNiPAP1I4k2SmAgZWx8fujSdk8M5g6UAk5-JRdeyNHWq_YijK-NXFct7h2uIU/s1600/42.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img alt="Using Subprocess In SOA" border="0" height="173" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjusPZoE0gYBUmX7X53E4ACzlIGXgmJApGbvuiOXQ17tpbNGATwkPKmT2x7yDkZscKaMjSASX7hJIH6xW_lNiPAP1I4k2SmAgZWx8fujSdk8M5g6UAk5-JRdeyNHWq_YijK-NXFct7h2uIU/s320/42.png" title="Using Subprocess In SOA" width="320" /></a></div>
<div class="separator" style="clear: both; text-align: center;">
Figure 42</div>
<div class="separator" style="clear: both; text-align: center;">
<br /></div>
<div class="separator" style="clear: both; text-align: left;">
<u style="font-family: 'Times New Roman', serif; font-size: 16px; font-weight: bold;">Conclusion:</u></div>
<div class="separator" style="clear: both; text-align: left;">
<u style="font-family: 'Times New Roman', serif; font-size: 16px; font-weight: bold;"><br /></u></div>
<div class="separator" style="clear: both; text-align: left;">
<span style="font-family: 'Times New Roman', serif; font-size: 16px;"> We saw subprocesses which is a new feature of SOA Suite 12c.Subprocesses can be used to develope reusable applications and it can reduce the size of your application.You can either use inline or standalone subprocess according to your need.In the standalone subprocess you can reuse a group of activities across multiple bpel processes while inline can be used only in the same bpel process. In the first release of SOA Suite 12c the standalone subprocess can be used only in the same composite, so you should look for the latest releases.</span></div>
<div class="separator" style="clear: both; text-align: center;">
<br /></div>
<div class="separator" style="clear: both; text-align: left;">
You can download the source code from <a href="https://github.com/agelenler/myblog/tree/master/soa/SubprocessApp" target="_blank">here</a>.</div>
<div class="separator" style="clear: both; text-align: center;">
<br /></div>
<div class="separator" style="clear: both; text-align: center;">
<br /></div>
<div class="separator" style="clear: both; text-align: center;">
<br /></div>
<div class="separator" style="clear: both; text-align: center;">
<br /></div>
<div class="separator" style="clear: both; text-align: center;">
<br /></div>
<div class="separator" style="clear: both; text-align: center;">
<br /></div>
<div class="separator" style="clear: both; text-align: center;">
<br /></div>
<div class="separator" style="clear: both; text-align: center;">
<br /></div>
<div class="separator" style="clear: both; text-align: center;">
<br /></div>
<div class="separator" style="clear: both; text-align: center;">
<br /></div>
<div class="separator" style="clear: both; text-align: center;">
<br /></div>
<div style="text-align: center;">
<span style="font-family: Times New Roman, serif;"><br /></span></div>
<span style="font-family: Times New Roman, serif;"><br /></span>
<span style="font-family: 'Times New Roman', serif; font-size: 16px;"><br /></span>
<span style="font-family: 'Times New Roman', serif; font-size: 16px;"><br /></span>Ali Gelenlerhttp://www.blogger.com/profile/09439697648573423668noreply@blogger.com0tag:blogger.com,1999:blog-3858181542467916490.post-16359815581046594972014-11-11T09:22:00.001+02:002015-02-24T21:06:47.899+02:00Using UMS In SOA<u style="font-family: 'Times New Roman', serif; font-size: 16px; font-weight: bold;">Introduction:</u><br />
<br />
I'll try to explain how to use UMS which is an email adapter in SOA Suite environment today. We'll use Apache James Server as the email server and you can get the information about the installation and the configuration of Apache James Server in <a href="http://aligelenler.blogspot.com/2014/11/using-javamail-api.html" target="_blank">this </a>previous write.Let's first start with the configuration of enterprise manager and console.<br />
<br />
<u style="font-family: 'Times New Roman', serif; font-size: 16px; font-weight: bold;">Configuring Enterprise Manager and Console:</u><br />
<u style="font-family: 'Times New Roman', serif; font-size: 16px; font-weight: bold;"><br /></u>
<span style="font-family: 'Times New Roman', serif; font-size: 16px;"> You first start your weblogic server and then to go http://localhost:7101/console.Click on the "Deploymenys" link in the left "Domain Structure" menu and choose the UMSAdapter in the right side.You may have to click the next button many times.Then go to the "Targets" tab and check the DefaultServer to target our Ums adapter to our server.See in Figure 1 and 2.</span><span style="font-family: 'Times New Roman', serif; font-size: 16px; text-align: center;"> </span><br />
<span style="font-family: 'Times New Roman', serif; font-size: 16px; text-align: center;"><br /></span>
<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjidg9nlpqoWb_Z0OsmQsYU74BS0xLRnZOGGx9FIXq1d4lQ-jDiefTpImy2A43Eq8QmXQ53Z_82cjlgX5Ba3UkxhLUTQjqyNLY48x2v2YuGTQSXq3ZCPgeLltqFJKDMLVxX5w9rDxKHqEvt/s1600/6.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img alt="Using UMS In SOA" border="0" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjidg9nlpqoWb_Z0OsmQsYU74BS0xLRnZOGGx9FIXq1d4lQ-jDiefTpImy2A43Eq8QmXQ53Z_82cjlgX5Ba3UkxhLUTQjqyNLY48x2v2YuGTQSXq3ZCPgeLltqFJKDMLVxX5w9rDxKHqEvt/s1600/6.png" height="173" title="Using UMS In SOA" width="320" /></a></div>
<div class="separator" style="clear: both; text-align: center;">
Figure 1</div>
<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhPUl9A4-KHIE21jOi1VFfAS6KnEKbV9NNwqcYv0KZ4TwE3Y24LtLIDs3gZu2RxPmbOVqcyk9ApXs21a-fo15hVDPewCPKwsdegkRhjq5bx-8IQgrt9UnYcIyS2HE34ROXaYK-bHpbPBDS_/s1600/7.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img alt="Using UMS In SOA" border="0" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhPUl9A4-KHIE21jOi1VFfAS6KnEKbV9NNwqcYv0KZ4TwE3Y24LtLIDs3gZu2RxPmbOVqcyk9ApXs21a-fo15hVDPewCPKwsdegkRhjq5bx-8IQgrt9UnYcIyS2HE34ROXaYK-bHpbPBDS_/s1600/7.png" height="173" title="Using UMS In SOA" width="320" /></a></div>
<div class="separator" style="clear: both; text-align: center;">
Figure 2</div>
<div class="separator" style="clear: both; text-align: center;">
<br /></div>
<div class="separator" style="clear: both; text-align: left;">
Now we can go to http://localhost:7101/em and right click to the User Messaging Service -> usermessagingdriver-email and choose "Driver Properties".You will see the screen in Figure 3 and 4.At this point you have to configure the Apache James server and create two email users admin and test.To do that you can refer to the following write.http://aligelenler.blogspot.com/2014/11/using-javamail-api.html. After configuring James server and creating email users, you will enter the required values to the screen below like sender address as admin@localhost, mail server as localhost, mail server port as 1125, incoming mail server port as 1110.See in Figure 3 and 4.</div>
<div class="separator" style="clear: both; text-align: left;">
<span style="font-family: 'Times New Roman', serif; font-size: 16px; text-align: center;"><br /></span></div>
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjIm96NXZrZuxXFg7C_fOUM3R9fvfjUYRueeBpwwO9taWpm3ffptVaLylJxalpnTWGHDYmbj2TKEkn8UQQM_jJ0jafYDUIQyWfvt8CvbBs9GGPAyr7vDDkhTXmMAM5rCIM6EMVgz0tZqz4I/s1600/4.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img alt="Using UMS In SOA" border="0" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjIm96NXZrZuxXFg7C_fOUM3R9fvfjUYRueeBpwwO9taWpm3ffptVaLylJxalpnTWGHDYmbj2TKEkn8UQQM_jJ0jafYDUIQyWfvt8CvbBs9GGPAyr7vDDkhTXmMAM5rCIM6EMVgz0tZqz4I/s1600/4.png" height="173" title="Using UMS In SOA" width="320" /></a></div>
<div class="separator" style="clear: both; text-align: center;">
Figure 3</div>
<div class="separator" style="clear: both; text-align: center;">
<br /></div>
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEi8aK11vNlI9n0IsA3GnXWY1KpTtp0pLq6x5vYeQKK7DFafT2fTPnRFRB8PfHweUZQtN1geoIH4wKD_uawB0Q_Hdy5XDE1klLt0aRIKRzQ0-XYUCNDgTuacgpXyosAEQNKOQzC6fWGQyzfW/s1600/5.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img alt="Using UMS In SOA" border="0" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEi8aK11vNlI9n0IsA3GnXWY1KpTtp0pLq6x5vYeQKK7DFafT2fTPnRFRB8PfHweUZQtN1geoIH4wKD_uawB0Q_Hdy5XDE1klLt0aRIKRzQ0-XYUCNDgTuacgpXyosAEQNKOQzC6fWGQyzfW/s1600/5.png" height="173" title="Using UMS In SOA" width="320" /></a></div>
<div class="separator" style="clear: both; text-align: center;">
Figure 4</div>
<div class="separator" style="clear: both; text-align: center;">
<br /></div>
<div class="separator" style="clear: both; text-align: left;">
<u style="font-family: 'Times New Roman', serif; font-size: 16px; font-weight: bold;">Creating the Bpel Process with Ums Adapter:</u></div>
<div class="separator" style="clear: both; text-align: left;">
<u style="font-family: 'Times New Roman', serif; font-size: 16px; font-weight: bold;"><br /></u></div>
<div class="separator" style="clear: both; text-align: left;">
<span style="font-family: 'Times New Roman', serif; font-size: 16px;"> Create a bpel process and in the right external references part right click and create an UMS Adapter.In the first page of the create wizard choose the JNDI Name eis/ums/UMSAdapterOutbound as in Figure 5.</span></div>
<div class="separator" style="clear: both; text-align: center;">
<br /></div>
<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjSSsEwJhWvtOM7rFvsZ-ZfcZ2Hyhy5ZTdbIMoEjI42J-gXxHpHXWK0ndnvQoQsoXt1hjPhzwO_OSv1xTlQzSun8JjqRwAkemw7DSo1Y85xO7ScmZ_hFuy_hxbQjsWIFUvIVuEZvpGDSx2o/s1600/8.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img alt="Using UMS In SOA" border="0" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjSSsEwJhWvtOM7rFvsZ-ZfcZ2Hyhy5ZTdbIMoEjI42J-gXxHpHXWK0ndnvQoQsoXt1hjPhzwO_OSv1xTlQzSun8JjqRwAkemw7DSo1Y85xO7ScmZ_hFuy_hxbQjsWIFUvIVuEZvpGDSx2o/s1600/8.png" height="266" title="Using UMS In SOA" width="320" /></a></div>
<div class="separator" style="clear: both; text-align: center;">
Figure 5</div>
<div class="separator" style="clear: both; text-align: center;">
<br /></div>
<div class="separator" style="clear: both; text-align: left;">
In the next page choose Outbound Send Nofitication as the operation type.</div>
<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhWsGyR_OI6ibB7AISE2HqJQA1p48KkoS5PdvEM9TqdHriig_HoLhEXxe2rBdSq1oIXuXN0pwoiQJSdbm3wTa5c8XdBGvR_otUl0tRVn7hi8o0t1y6hgg228nKndHr8RRHmw5Mzwoe1X6bR/s1600/9.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img alt="Using UMS In SOA" border="0" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhWsGyR_OI6ibB7AISE2HqJQA1p48KkoS5PdvEM9TqdHriig_HoLhEXxe2rBdSq1oIXuXN0pwoiQJSdbm3wTa5c8XdBGvR_otUl0tRVn7hi8o0t1y6hgg228nKndHr8RRHmw5Mzwoe1X6bR/s1600/9.png" height="266" title="Using UMS In SOA" width="320" /></a></div>
<div class="separator" style="clear: both; text-align: center;">
Figure 6</div>
<div class="separator" style="clear: both; text-align: center;">
<br /></div>
<div class="separator" style="clear: both; text-align: left;">
Now you will choose Email as the type of notification and enter the Subject , From and To configuraton variables. At this point we'll do a trick and enter the admin and test email addresses ending with .com, although they are not ending with .com. That's necessary since the wizard doesn't allow you to continue if the email addresses doesn't contain .com or any other email extensions.However we have to delete this .com parts at the end of the wizard in the jca source file, otherwise Apache James server will not accept those email addresses.</div>
<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEh7_6vuyBomrm7xnsQTFheAJW51Sdr7-QtOB1ipYd3Em228lgeK7PSMRxYDYboNMZA0rv8px9y73MZNRLjQ1bZE7aqOx-zXmeAdG1qJU_nLIA_cRmsNMeSvGG11EK8H-xIuB07-pYFz6z1C/s1600/10.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img alt="Using UMS In SOA" border="0" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEh7_6vuyBomrm7xnsQTFheAJW51Sdr7-QtOB1ipYd3Em228lgeK7PSMRxYDYboNMZA0rv8px9y73MZNRLjQ1bZE7aqOx-zXmeAdG1qJU_nLIA_cRmsNMeSvGG11EK8H-xIuB07-pYFz6z1C/s1600/10.png" height="266" title="Using UMS In SOA" width="320" /></a></div>
<div class="separator" style="clear: both; text-align: center;">
Figure 7</div>
<div class="separator" style="clear: both; text-align: center;">
<br /></div>
<div class="separator" style="clear: both; text-align: left;">
Choose the message as String type as in Figure 8.</div>
<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjIiwaO4orZ1sJ9xJ5-sPvqr9MM7hdMX23IJB0hqCYMu8UKIQBXWdrjf5h6hLcPB20Cm5T19SDX9JQ1pJxsnGetGQw8NaTEAHLujXQmdx1fO5kjUdWCqr9MjiqaOMnQPFiWeZ1POSmbSU3G/s1600/11.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img alt="Using UMS In SOA" border="0" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjIiwaO4orZ1sJ9xJ5-sPvqr9MM7hdMX23IJB0hqCYMu8UKIQBXWdrjf5h6hLcPB20Cm5T19SDX9JQ1pJxsnGetGQw8NaTEAHLujXQmdx1fO5kjUdWCqr9MjiqaOMnQPFiWeZ1POSmbSU3G/s1600/11.png" height="266" title="Using UMS In SOA" width="320" /></a></div>
<div class="separator" style="clear: both; text-align: center;">
Figure 8</div>
<div class="separator" style="clear: both; text-align: center;">
<br /></div>
<div class="separator" style="clear: both; text-align: left;">
Delete the .com parts in the jca source file.</div>
<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjGiT-MEsA5sGZLpLvFJsYsFjomTGKnf1KyLvfzsZTXhMG9SvJFHWRonTDF7B6hWrGVAIoZTmV64QbEVwy7esQxLWoJy_D6Bu6i037zTeD8YyevSFg1dHJEsIxjdqD_8wzgUxWLalxdZFC9/s1600/12.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img alt="Using UMS In SOA" border="0" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjGiT-MEsA5sGZLpLvFJsYsFjomTGKnf1KyLvfzsZTXhMG9SvJFHWRonTDF7B6hWrGVAIoZTmV64QbEVwy7esQxLWoJy_D6Bu6i037zTeD8YyevSFg1dHJEsIxjdqD_8wzgUxWLalxdZFC9/s1600/12.png" height="173" title="Using UMS In SOA" width="320" /></a></div>
<div class="separator" style="clear: both; text-align: center;">
Figure 9</div>
<div class="separator" style="clear: both; text-align: center;">
<br /></div>
<div class="separator" style="clear: both; text-align: left;">
Now drag and drop an assign activity after the ReceiveInput and build the email text using concat as in the following figure.</div>
<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiZjXMLFmkBTLsiuwdf9fVWIKpQTHUsYEQK_6YP-IBFcgauodStANfkFO_I70n6O7smvFwHI2Uj7h6Kr6G0tucnFEKaPf3UiT7FTUtXLs8RzkXOV9iVAHkcb8ClsWeTNy9hdzcOW1W6jwA9/s1600/13.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img alt="Using UMS In SOA" border="0" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiZjXMLFmkBTLsiuwdf9fVWIKpQTHUsYEQK_6YP-IBFcgauodStANfkFO_I70n6O7smvFwHI2Uj7h6Kr6G0tucnFEKaPf3UiT7FTUtXLs8RzkXOV9iVAHkcb8ClsWeTNy9hdzcOW1W6jwA9/s1600/13.png" height="256" title="Using UMS In SOA" width="320" /></a></div>
<div class="separator" style="clear: both; text-align: center;">
Figure 10</div>
<div class="separator" style="clear: both; text-align: center;">
<br /></div>
<div class="separator" style="clear: both; text-align: left;">
Drag and drop an invoke activity referencing it to the Ums adapter and creating the input values like in Figure 11.</div>
<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjwYwE28bT_J65njYgQWAN8smqnn_in4giThA7qopEEjpPIMAKEunCwFdfwhVMWXUr2VqIY6zSzDJjGNlY7NxMVNV4CEhYAJFTWkRe4XnqKkyR-6SEla14Yc1bbZPOpu6dZ1BZC1kvtb5ob/s1600/14.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img alt="Using UMS In SOA" border="0" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjwYwE28bT_J65njYgQWAN8smqnn_in4giThA7qopEEjpPIMAKEunCwFdfwhVMWXUr2VqIY6zSzDJjGNlY7NxMVNV4CEhYAJFTWkRe4XnqKkyR-6SEla14Yc1bbZPOpu6dZ1BZC1kvtb5ob/s1600/14.png" height="320" title="Using UMS In SOA" width="290" /></a></div>
<div class="separator" style="clear: both; text-align: center;">
Figure 11</div>
<div class="separator" style="clear: both; text-align: center;">
<br /></div>
<div class="separator" style="clear: both; text-align: left;">
The final bpel process should now look like as in Figure 12.</div>
<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEi8th8MSxMe-9QAXwOykg7jyEpgT6vnrjSR-RXxgJ2XverX1xldb1KKfCIjegoa1dhEN1jkNdze00IhKlMBXb5Ka7HdX_xLDwZnoFmubtNQaGAvyg4KLpvfQu7Ykl4MzcruLSIzUpCLZrEq/s1600/15.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img alt="Using UMS In SOA" border="0" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEi8th8MSxMe-9QAXwOykg7jyEpgT6vnrjSR-RXxgJ2XverX1xldb1KKfCIjegoa1dhEN1jkNdze00IhKlMBXb5Ka7HdX_xLDwZnoFmubtNQaGAvyg4KLpvfQu7Ykl4MzcruLSIzUpCLZrEq/s1600/15.png" height="173" title="Using UMS In SOA" width="320" /></a></div>
<div class="separator" style="clear: both; text-align: center;">
Figure 12</div>
<div class="separator" style="clear: both; text-align: center;">
<br /></div>
<div class="separator" style="clear: both; text-align: left;">
Test the application using the Jdeveloper Debug tool and enter the input value in the Http analyzer screen.See in Figure 13.</div>
<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEi4tjDHCOR1GKI_bNcFp8W5U97VJFSVMJ5G7_KbP9E_PYV7yIwqlR1W_AarftJNEKJPIYRoSSLQsPjo-q6ObwyCgTz-DOcAP7GGI4Eq2nupncS0jcNHwzoNp36rJQk-_hTaFLs1qjRO2WaQ/s1600/16.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img alt="Using UMS In SOA" border="0" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEi4tjDHCOR1GKI_bNcFp8W5U97VJFSVMJ5G7_KbP9E_PYV7yIwqlR1W_AarftJNEKJPIYRoSSLQsPjo-q6ObwyCgTz-DOcAP7GGI4Eq2nupncS0jcNHwzoNp36rJQk-_hTaFLs1qjRO2WaQ/s1600/16.png" height="173" title="Using UMS In SOA" width="320" /></a></div>
<div class="separator" style="clear: both; text-align: center;">
Figure 13</div>
<div class="separator" style="clear: both; text-align: center;">
<br /></div>
<div class="separator" style="clear: both; text-align: left;">
<u style="font-family: 'Times New Roman', serif; font-size: 16px; font-weight: bold;">Inspect the Sent Email:</u></div>
<div class="separator" style="clear: both; text-align: left;">
<u style="font-family: 'Times New Roman', serif; font-size: 16px; font-weight: bold;"><br /></u></div>
<div class="separator" style="clear: both; text-align: left;">
Open a command window and type the following commands in Figure 14 and 15.You will see your email content like in Figure 16.</div>
<div class="separator" style="clear: both; text-align: left;">
<br /></div>
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgjlfK-28yU_IgJUUO9K0lgP5MkSmECXhnF1m6NlwcAfFYwCOPMz4PV4mtH9ejZ1D8-hASwbkCSUJlw_SPx6y4GDbpDCzPF7Y2mFJFRC6d0spdYTK_yiidyHicVG6ON_LMhklDO_WRQHxv8/s1600/17.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img alt="Using UMS In SOA" border="0" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgjlfK-28yU_IgJUUO9K0lgP5MkSmECXhnF1m6NlwcAfFYwCOPMz4PV4mtH9ejZ1D8-hASwbkCSUJlw_SPx6y4GDbpDCzPF7Y2mFJFRC6d0spdYTK_yiidyHicVG6ON_LMhklDO_WRQHxv8/s1600/17.png" height="161" title="Using UMS In SOA" width="320" /></a></div>
<div class="separator" style="clear: both; text-align: center;">
Figure 14</div>
<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEh3bEw80HBHAfaveBqOrUF-45yEiDzpqzANbWOyQMY5Ba9SZ9Ic4YhWDwVkgOXRyuV882KClijrDnscnj1fLq81S73i1hUVY6XW_F_D59aUHmjpSnBYpwE1g2p0XjAk11-ilNpek0692w9V/s1600/18.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img alt="Using UMS In SOA" border="0" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEh3bEw80HBHAfaveBqOrUF-45yEiDzpqzANbWOyQMY5Ba9SZ9Ic4YhWDwVkgOXRyuV882KClijrDnscnj1fLq81S73i1hUVY6XW_F_D59aUHmjpSnBYpwE1g2p0XjAk11-ilNpek0692w9V/s1600/18.png" height="161" title="Using UMS In SOA" width="320" /></a></div>
<div class="separator" style="clear: both; text-align: center;">
Figure 15</div>
<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgO_LxUncEr48P47d3JJvuL-AZjpwXkrw8hO-kn4vjF7hoE_jTLxAHvxTkeUwuvRNR0CvB2DcQ9Q1NRG6ITN1Ubo2z03AH0Vs82rx-u_LcjdxgnajbSNZ-ccoPepziNfBZflg6-uUbTx-Y4/s1600/19.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img alt="Using UMS In SOA" border="0" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgO_LxUncEr48P47d3JJvuL-AZjpwXkrw8hO-kn4vjF7hoE_jTLxAHvxTkeUwuvRNR0CvB2DcQ9Q1NRG6ITN1Ubo2z03AH0Vs82rx-u_LcjdxgnajbSNZ-ccoPepziNfBZflg6-uUbTx-Y4/s1600/19.png" height="144" title="Using UMS In SOA" width="320" /></a></div>
<div class="separator" style="clear: both; text-align: center;">
Figure 16</div>
<div class="separator" style="clear: both; text-align: center;">
<br /></div>
<div class="separator" style="clear: both; text-align: left;">
<u style="font-family: 'Times New Roman', serif; font-size: 16px; font-weight: bold;">Conclusion:</u></div>
<div class="separator" style="clear: both; text-align: left;">
<u style="font-family: 'Times New Roman', serif; font-size: 16px; font-weight: bold;"><br /></u></div>
<div class="separator" style="clear: both; text-align: left;">
<span style="font-family: 'Times New Roman', serif; font-size: 16px;"> Today I try to explain the usage of UMS adapter in SOA Suite environment using Apache James Server.As you can see, with the help of the UMS adapter it is quite straightforward to use email functionality in SOA applications.</span></div>
<div class="separator" style="clear: both; text-align: left;">
<u style="font-family: 'Times New Roman', serif; font-size: 16px; font-weight: bold;"><br /></u></div>
<div class="separator" style="clear: both; text-align: left;">
<span style="font-family: Times New Roman, serif;">You can download the source code from <a href="https://github.com/agelenler/myblog/tree/master/soa/UmsApp" target="_blank">here</a>.</span></div>
Ali Gelenlerhttp://www.blogger.com/profile/09439697648573423668noreply@blogger.com1tag:blogger.com,1999:blog-3858181542467916490.post-65857241061578354712014-11-10T15:17:00.001+02:002019-08-11T13:59:53.232+03:00Using Gmail Servers in JavaMail API<u style="font-family: 'Times New Roman', serif; font-size: 16px; font-weight: bold;">Introduction:</u><br />
<u style="font-family: 'Times New Roman', serif; font-size: 16px; font-weight: bold;"><br /></u>
<span style="font-family: "times new roman" , serif; font-size: 16px;"> In the <a href="http://aligelenler.blogspot.com/2014/11/using-javamail-api.html" target="_blank">previous </a>post we mention about the basics of email protocols and show how to configure Apache James server to use in JavaMail API.Today we see how to use Gmail servers instead of using local Apache James server.The JavaMail API part is same but we have to configure the properties of the email session according to Gmail servers in addition to obtaining an application password from the gmail.</span><br />
<span style="font-family: "times new roman" , serif; font-size: 16px;"><br /></span>
<u style="font-family: 'Times New Roman', serif; font-size: 16px; font-weight: bold;">Obtain Application Password:</u><br />
<u style="font-family: 'Times New Roman', serif; font-size: 16px; font-weight: bold;"><br /></u>
<span style="font-family: "times new roman" , serif; font-size: 16px;"> First of all, we have to get an application password to use in our JavaMail API. When we try to use our gmail password an error occurred indicating "Username and password are not accepted" giving the following link.</span><br />
<span style="font-family: "times new roman" , serif;">http://support.google.com/accounts/bin/answer.py?answer=185833</span><br />
<span style="font-family: "times new roman" , serif;">This link says that you have to create an application password instead of using the gmail password for security reasons. Follow the steps shown in the link and create your application password.</span><br />
<span style="font-family: "times new roman" , serif;"><br /></span>
<u style="font-family: 'Times New Roman', serif; font-size: 16px; font-weight: bold;">Sending Mail Using Gmail SMTP Server:</u><br />
<u style="font-family: 'Times New Roman', serif; font-size: 16px; font-weight: bold;"><br /></u>
<span style="font-family: "times new roman" , serif; font-size: 16px;"> The following java code can be use to send an email using Gmail SMTP server.If you want to use SSL enabled you have to comment out line 3 and 4 while commenting the line 1 and 2.As you can understand while the SMTP port of Gmail is 587 when you enable SSL it is 465.If you are not using SSL you have to set true to attribute "</span><span style="font-family: "times new roman" , serif;">mail.smtp.starttls.enable</span><span style="font-family: "times new roman" , serif; font-size: 16px;">". You don't have to set the FROM attribute as the user you provided in authentication will be </span><span style="font-family: "times new roman" , serif; font-size: 16px;">automatically</span><span style="font-family: "times new roman" , serif; font-size: 16px;"> used as the FROM attribute.</span><br />
<span style="font-family: "times new roman" , serif;"><br /></span>
<span style="font-family: "times new roman" , serif;">package tr.com.aligelenler;</span><br />
<span style="font-family: "times new roman" , serif;"><br /></span>
<span style="font-family: "times new roman" , serif;">import java.text.SimpleDateFormat;</span><br />
<span style="font-family: "times new roman" , serif;"><br /></span>
<span style="font-family: "times new roman" , serif;">import java.util.Date;</span><br />
<span style="font-family: "times new roman" , serif;">import java.util.Properties;</span><br />
<span style="font-family: "times new roman" , serif;"><br /></span>
<span style="font-family: "times new roman" , serif;">import javax.mail.Authenticator;</span><br />
<span style="font-family: "times new roman" , serif;">import javax.mail.Message;</span><br />
<span style="font-family: "times new roman" , serif;">import javax.mail.MessagingException;</span><br />
<span style="font-family: "times new roman" , serif;">import javax.mail.PasswordAuthentication;</span><br />
<span style="font-family: "times new roman" , serif;">import javax.mail.Session;</span><br />
<span style="font-family: "times new roman" , serif;">import javax.mail.Transport;</span><br />
<span style="font-family: "times new roman" , serif;">import javax.mail.internet.InternetAddress;</span><br />
<span style="font-family: "times new roman" , serif;">import javax.mail.internet.MimeMessage;</span><br />
<span style="font-family: "times new roman" , serif;"><br /></span>
<span style="font-family: "times new roman" , serif;">public class SendMailUseGmail {</span><br />
<span style="font-family: "times new roman" , serif;"><br /></span>
<span style="font-family: "times new roman" , serif;"><span class="Apple-tab-span" style="white-space: pre;"> </span>private static final String USER = "your_email@gmail.com";</span><br />
<span style="font-family: "times new roman" , serif;"><span class="Apple-tab-span" style="white-space: pre;"> </span>private static final String PASSWORD = "your_app_password";</span><br />
<span style="font-family: "times new roman" , serif;"><br /></span>
<span style="font-family: "times new roman" , serif;"><span class="Apple-tab-span" style="white-space: pre;"> </span>public static void main(String[] args) {</span><br />
<span style="font-family: "times new roman" , serif;"><span class="Apple-tab-span" style="white-space: pre;"> </span>try {</span><br />
<span style="font-family: "times new roman" , serif;"><span class="Apple-tab-span" style="white-space: pre;"> </span>Properties props = new Properties();</span><br />
<span style="font-family: "times new roman" , serif;"><span class="Apple-tab-span" style="white-space: pre;"> </span>props.put("mail.transport.protocol", "smtp");</span><br />
<span style="font-family: "times new roman" , serif;"><span class="Apple-tab-span" style="white-space: pre;"> </span>props.put("mail.smtp.auth", "true");<span class="Apple-tab-span" style="white-space: pre;"> </span></span><br />
<span style="font-family: "times new roman" , serif;"><span class="Apple-tab-span" style="white-space: pre;"> </span>props.put("mail.debug", "true");</span><br />
<span style="font-family: "times new roman" , serif;"><span class="Apple-tab-span" style="white-space: pre;"> </span>props.put("mail.smtp.host", "smtp.gmail.com");</span><br />
<span class="Apple-tab-span" style="white-space: pre;"><span style="font-family: "times new roman" , serif;"> </span></span><br />
<span style="font-family: "times new roman" , serif;"><span class="Apple-tab-span" style="white-space: pre;"> </span>1<span class="Apple-tab-span" style="white-space: pre;"> </span>props.put("mail.smtp.port", "587");<span class="Apple-tab-span" style="white-space: pre;"> </span></span><br />
<span style="font-family: "times new roman" , serif;"><span class="Apple-tab-span" style="white-space: pre;"> </span>2<span class="Apple-tab-span" style="white-space: pre;"> </span>props.put("mail.smtp.starttls.enable", "true");</span><br />
<span class="Apple-tab-span" style="white-space: pre;"><span style="font-family: "times new roman" , serif;"> </span></span><br />
<span style="font-family: "times new roman" , serif;"><span class="Apple-tab-span" style="white-space: pre;"> </span>3<span class="Apple-tab-span" style="white-space: pre;"> </span>//props.put("mail.smtp.socketFactory.port", "465");</span><br />
<span style="font-family: "times new roman" , serif;"><span class="Apple-tab-span" style="white-space: pre;"> </span>4<span class="Apple-tab-span" style="white-space: pre;"> </span>//props.put("mail.smtp.socketFactory.class", "javax.net.ssl.SSLSocketFactory");</span><br />
<span style="font-family: "times new roman" , serif;"><br /></span>
<span style="font-family: "times new roman" , serif;"><span class="Apple-tab-span" style="white-space: pre;"> </span>Session session = Session.getInstance(props, new Authenticator() {</span><br />
<span style="font-family: "times new roman" , serif;"><span class="Apple-tab-span" style="white-space: pre;"> </span>@Override</span><br />
<span style="font-family: "times new roman" , serif;"><span class="Apple-tab-span" style="white-space: pre;"> </span>protected PasswordAuthentication getPasswordAuthentication() {</span><br />
<span style="font-family: "times new roman" , serif;"><span class="Apple-tab-span" style="white-space: pre;"> </span>return new PasswordAuthentication(USER, PASSWORD);</span><br />
<span style="font-family: "times new roman" , serif;"><span class="Apple-tab-span" style="white-space: pre;"> </span>}</span><br />
<span style="font-family: "times new roman" , serif;"><span class="Apple-tab-span" style="white-space: pre;"> </span>});</span><br />
<span style="font-family: "times new roman" , serif;"><span class="Apple-tab-span" style="white-space: pre;"> </span>MimeMessage msg = new MimeMessage(session);</span><br />
<span style="font-family: "times new roman" , serif;"><span class="Apple-tab-span" style="white-space: pre;"> </span>// msg.setFrom(new InternetAddress(USER)); No need to specify FROM attribute</span><br />
<span style="font-family: "times new roman" , serif;"><span class="Apple-tab-span" style="white-space: pre;"> </span>msg.addRecipients(Message.RecipientType.TO, InternetAddress.parse("sendmail1@gmail.com, sendmail2@gmail.com"));</span><br />
<span style="font-family: "times new roman" , serif;"><span class="Apple-tab-span" style="white-space: pre;"> </span>msg.setSubject("You have a new mail");</span><br />
<span style="font-family: "times new roman" , serif;"><span class="Apple-tab-span" style="white-space: pre;"> </span>msg.setText("This is a test message send at " + new SimpleDateFormat("dd.MM.yyyy HH:mm:ss.SSSZ").format(new Date()));</span><br />
<span style="font-family: "times new roman" , serif;"><span class="Apple-tab-span" style="white-space: pre;"> </span>Transport.send(msg);</span><br />
<span style="font-family: "times new roman" , serif;"><span class="Apple-tab-span" style="white-space: pre;"> </span>} catch (MessagingException e) {</span><br />
<span style="font-family: "times new roman" , serif;"><span class="Apple-tab-span" style="white-space: pre;"> </span>System.out.println(e.getMessage());</span><br />
<span style="font-family: "times new roman" , serif;"><span class="Apple-tab-span" style="white-space: pre;"> </span>}</span><br />
<span style="font-family: "times new roman" , serif;"><span class="Apple-tab-span" style="white-space: pre;"> </span>}</span><br />
<span style="font-family: "times new roman" , serif;"></span><br />
<span style="font-family: "times new roman" , serif;">}</span><br />
<span style="font-family: "times new roman" , serif;"><br /></span>
<u style="font-family: 'Times New Roman', serif; font-size: 16px; font-weight: bold;">Reading Mail Using Gmail POP3 or IMAP Server:</u><br />
<br />
You can use the following java code to read your gmail inbox folder.The code that delete your mails is not working here, that's because i think a restriction of gmail server to prevent accidentally deleting emails. Here I use imap as the mail fetch protocol.If you want to use pop3 protocol you have to change the properties as below. Using SSL is mandatory when reading your emails.<br />
<br />
props.put("mail.store.protocol", "pop3");<br />
props.put("mail.pop3.host", "pop.gmail.com");<br />
props.put("mail.pop3.socketFactory.port", "995");<br />
props.put("mail.pop3.socketFactory.class", "javax.net.ssl.SSLSocketFactory");<br />
<br />
package tr.com.aligelenler;<br />
<br />
import java.io.IOException;<br />
import java.util.Properties;<br />
<br />
import javax.mail.Authenticator;<br />
import javax.mail.Flags;<br />
import javax.mail.Folder;<br />
import javax.mail.Message;<br />
import javax.mail.MessagingException;<br />
import javax.mail.PasswordAuthentication;<br />
import javax.mail.Session;<br />
import javax.mail.Store;<br />
import javax.mail.internet.MimeMessage;<br />
<br />
public class ReadMailUseGmail {<br />
<br />
<span class="Apple-tab-span" style="white-space: pre;"> </span>private static final String USER = "your_email@gmail.com";<br />
<span class="Apple-tab-span" style="white-space: pre;"> </span>private static final String PASSWORD = "your_app_password";<br />
<span class="Apple-tab-span" style="white-space: pre;"> </span>private static final boolean CLEAR = false;<br />
<br />
<span class="Apple-tab-span" style="white-space: pre;"> </span>public static void main(String[] args) {<br />
<span class="Apple-tab-span" style="white-space: pre;"> </span>Store store = null;<br />
<span class="Apple-tab-span" style="white-space: pre;"> </span>Folder inbox = null;<br />
<span class="Apple-tab-span" style="white-space: pre;"> </span>try {<br />
<span class="Apple-tab-span" style="white-space: pre;"> </span>Properties props = new Properties();<br />
<span class="Apple-tab-span" style="white-space: pre;"> </span>props.put("mail.store.protocol", "imap");<br />
<span class="Apple-tab-span" style="white-space: pre;"> </span>props.put("mail.imap.host", "imap.gmail.com");<br />
<span class="Apple-tab-span" style="white-space: pre;"> </span>props.put("mail.imap.socketFactory.port", "993");<br />
<span class="Apple-tab-span" style="white-space: pre;"> </span>props.put("mail.imap.socketFactory.class", "javax.net.ssl.SSLSocketFactory");<br />
<span class="Apple-tab-span" style="white-space: pre;"> </span>props.put("mail.debug", "true");<br />
<span class="Apple-tab-span" style="white-space: pre;"> </span><br />
<span class="Apple-tab-span" style="white-space: pre;"> </span>Session session = Session.getInstance(props, new Authenticator() {<br />
<span class="Apple-tab-span" style="white-space: pre;"> </span>@Override<br />
<span class="Apple-tab-span" style="white-space: pre;"> </span>protected PasswordAuthentication getPasswordAuthentication() {<br />
<span class="Apple-tab-span" style="white-space: pre;"> </span>return new PasswordAuthentication(USER, PASSWORD);<br />
<span class="Apple-tab-span" style="white-space: pre;"> </span>}<br />
<span class="Apple-tab-span" style="white-space: pre;"> </span>});<br />
<span class="Apple-tab-span" style="white-space: pre;"> </span>store = session.getStore();<br />
<span class="Apple-tab-span" style="white-space: pre;"> </span>store.connect();<br />
<span class="Apple-tab-span" style="white-space: pre;"> </span>Folder root = store.getDefaultFolder();<br />
<span class="Apple-tab-span" style="white-space: pre;"> </span>inbox = root.getFolder("inbox");<br />
<span class="Apple-tab-span" style="white-space: pre;"> </span>inbox.open(Folder.READ_WRITE);<br />
<span class="Apple-tab-span" style="white-space: pre;"> </span>Message[] mails = inbox.getMessages();<br />
<span class="Apple-tab-span" style="white-space: pre;"> </span>if (mails.length == 0) {<br />
<span class="Apple-tab-span" style="white-space: pre;"> </span>System.out.println("There are no messages");<br />
<span class="Apple-tab-span" style="white-space: pre;"> </span>}<br />
<span class="Apple-tab-span" style="white-space: pre;"> </span>for (int i = 0; i < 10; i++) {<br />
<span class="Apple-tab-span" style="white-space: pre;"> </span>MimeMessage mail = (MimeMessage) mails[i];<br />
<span class="Apple-tab-span" style="white-space: pre;"> </span>System.out.println("From: " + mail.getFrom()[0]);<br />
<span class="Apple-tab-span" style="white-space: pre;"> </span>System.out.println("To: " + mail.getRecipients(Message.RecipientType.TO)[0]);<br />
<span class="Apple-tab-span" style="white-space: pre;"> </span>System.out.println("Subject: " + mail.getSubject());<br />
<span class="Apple-tab-span" style="white-space: pre;"> </span>System.out.println("Content: " + mail.getContent());<br />
<span class="Apple-tab-span" style="white-space: pre;"> </span>if (CLEAR) {<br />
<span class="Apple-tab-span" style="white-space: pre;"> </span>mail.setFlag(Flags.Flag.DELETED, true);<br />
<span class="Apple-tab-span" style="white-space: pre;"> </span>}<br />
<span class="Apple-tab-span" style="white-space: pre;"> </span>}<br />
<span class="Apple-tab-span" style="white-space: pre;"> </span>} catch (MessagingException e) {<br />
<span class="Apple-tab-span" style="white-space: pre;"> </span>System.out.println(e.getMessage());<br />
<span class="Apple-tab-span" style="white-space: pre;"> </span>} catch (IOException e) {<br />
<span class="Apple-tab-span" style="white-space: pre;"> </span>System.out.println(e.getMessage());<br />
<span class="Apple-tab-span" style="white-space: pre;"> </span>} finally {<br />
<span class="Apple-tab-span" style="white-space: pre;"> </span>try {<br />
<span class="Apple-tab-span" style="white-space: pre;"> </span>if (inbox != null && inbox.isOpen())<br />
<span class="Apple-tab-span" style="white-space: pre;"> </span>inbox.close(true);<br />
<span class="Apple-tab-span" style="white-space: pre;"> </span>if (store != null)<br />
<span class="Apple-tab-span" style="white-space: pre;"> </span>store.close();<br />
<span class="Apple-tab-span" style="white-space: pre;"> </span>} catch (MessagingException e) {<br />
<span class="Apple-tab-span" style="white-space: pre;"> </span>System.out.println(e.getMessage());<br />
<span class="Apple-tab-span" style="white-space: pre;"> </span>}<br />
<span class="Apple-tab-span" style="white-space: pre;"> </span>}<br />
<span class="Apple-tab-span" style="white-space: pre;"> </span>}<br />
}<br />
<div>
<br /></div>
<div>
<u style="font-family: 'Times New Roman', serif; font-size: 16px; font-weight: bold;">Conclusion:</u></div>
<div>
<u style="font-family: 'Times New Roman', serif; font-size: 16px; font-weight: bold;"><br /></u></div>
<div>
<span style="font-family: "times new roman" , serif; font-size: 16px;"> Today I showed how to use simple JavaMail API using Gmail servers to send and read emails.The only trick is to obtain a application password to use in the authentication of Gmail server.</span></div>
<div>
<br />
You can download the source code from <a href="https://github.com/agelenler/myblog/tree/master/java/src/java.mail" target="_blank">here</a>.</div>
Ali Gelenlerhttp://www.blogger.com/profile/09439697648573423668noreply@blogger.com13tag:blogger.com,1999:blog-3858181542467916490.post-49039730622990350752014-11-09T19:07:00.000+02:002019-08-11T13:59:40.987+03:00Using JavaMail API<u style="font-family: 'Times New Roman', serif; font-size: 16px; font-weight: bold;">Introduction:</u><br />
<u style="font-family: 'Times New Roman', serif; font-size: 16px; font-weight: bold;"><br /></u>
<span style="font-family: "times new roman" , serif; font-size: 16px;"> I'll mention about the JavaMail API today.Before go into the details of the API we'll first look at the well known e-mail protocols SMTP, IMAP and POP3.After that we'll see how to use and configure Apache James server to use in our examples.</span><br />
<span style="font-family: "times new roman" , serif; font-size: 16px;"><br /></span>
<u style="font-family: 'Times New Roman', serif; font-size: 16px; font-weight: bold;">SMTP, IMAP and POP3 Protocols:</u><br />
<u style="font-family: 'Times New Roman', serif; font-size: 16px; font-weight: bold;"><br /></u>
<span style="font-family: "times new roman" , serif; font-size: 16px;"> These are all TCP/IP protocols used for mail delivery.In summary, when you send an email to someone, your email client first connects to your email server.Then your email server uses the receipent email address to determine where the mail will have to go and delivers the mail to the target email server.Up to now the SMTP protocol is used.When the receipent want to see the email that you send she asks to her email server to see the email.At this time IMAP or POP3 has to be used.</span><br />
<span style="font-family: "times new roman" , serif; font-size: 16px;"><br /></span>
<span style="font-family: "times new roman" , serif; font-size: 16px;">SMTP stands for Simple Mail Transfer Protocol and is used when email is delivered from the email client to the server or email is delivered from one email server to another. The default SMPT port is 25.When you are sending an email your email client first contact with the SMTP server in the mail infrastructure.If configured so, SMTP server can authenticate you and then deliver your mail to the target server.After sending the email, the mail client may either keep the sent mail in local sent mail folder as in the POP3 protocol or sent mail folder on the server as in IMAP.</span><br />
<span style="font-family: "times new roman" , serif; font-size: 16px;"><br /></span>
<span style="font-family: "times new roman" , serif; font-size: 16px;">POP3 stands for Post Office Protocol and if you use POP3, when you want to see your emails, the emails will be downloaded from the mail server to your local drive deleting the emails on the server's drive which means you work as offline. POP3 is simpler than IMAP and doesn't offer some of the features of IMAP.The default POP3 port is 110.</span><br />
<span style="font-family: "times new roman" , serif; font-size: 16px;"><br /></span>
<span style="font-family: "times new roman" , serif;">IMAP stands for Internet Message Access Protocol and if you use IMAP, when you want to see your emails, besides the ability of downloading the emails to the local drive, they still be kept on the server's drive.Because of that IMAP requires more disk space and more CPU power on the mail server than POP3.The default IMAP port is 143.</span><br />
<span style="font-family: "times new roman" , serif;"><br /></span>
<u style="font-family: 'Times New Roman', serif; font-size: 16px; font-weight: bold;">Download and Configure the Apache James Email Server:</u><br />
<u style="font-family: 'Times New Roman', serif; font-size: 16px; font-weight: bold;"><br /></u>
<span style="font-family: "times new roman" , serif; font-size: 16px;"> First go to the page </span><a href="http://james.apache.org/download.cgi" target="_blank">http://james.apache.org/download.cgi</a> and download the latest stable version of Apache James Server.(At the time of this write it is 2.3.2 version).<br />
Next, you have to configure config.xml according to your need.The config.xml should be under <span style="font-family: "calibri" , sans-serif; font-size: 11pt; line-height: 107%;">${JAMES_HOME}/apps/james/SAR-INF directory. S</span>ome of the configuration values are listed below.You can change the email delivery method either as pop3 or imap, or you can change the port values like below.<br />
* <servername><span style="font-family: "calibri" , "sans-serif"; font-size: 11.0pt; line-height: 107%;">servername -> </span>localhost</servername>...<br />
<div class="MsoNormal">
* <pop3server enabled="true"><port><!--[if gte mso 9]><xml>
<o:OfficeDocumentSettings>
<o:AllowPNG/>
</o:OfficeDocumentSettings>
</xml><![endif]--><span style="font-family: "calibri" , "sans-serif"; font-size: 11.0pt; line-height: 107%;">pop3server -> port </span><!--[if gte mso 9]><xml>
<w:WordDocument>
<w:View>Normal</w:View>
<w:Zoom>0</w:Zoom>
<w:TrackMoves/>
<w:TrackFormatting/>
<w:HyphenationZone>21</w:HyphenationZone>
<w:PunctuationKerning/>
<w:ValidateAgainstSchemas/>
<w:SaveIfXMLInvalid>false</w:SaveIfXMLInvalid>
<w:IgnoreMixedContent>false</w:IgnoreMixedContent>
<w:AlwaysShowPlaceholderText>false</w:AlwaysShowPlaceholderText>
<w:DoNotPromoteQF/>
<w:LidThemeOther>TR</w:LidThemeOther>
<w:LidThemeAsian>X-NONE</w:LidThemeAsian>
<w:LidThemeComplexScript>X-NONE</w:LidThemeComplexScript>
<w:Compatibility>
<w:BreakWrappedTables/>
<w:SnapToGridInCell/>
<w:WrapTextWithPunct/>
<w:UseAsianBreakRules/>
<w:DontGrowAutofit/>
<w:SplitPgBreakAndParaMark/>
<w:EnableOpenTypeKerning/>
<w:DontFlipMirrorIndents/>
<w:OverrideTableStyleHps/>
</w:Compatibility>
<m:mathPr>
<m:mathFont m:val="Cambria Math"/>
<m:brkBin m:val="before"/>
<m:brkBinSub m:val="--"/>
<m:smallFrac m:val="off"/>
<m:dispDef/>
<m:lMargin m:val="0"/>
<m:rMargin m:val="0"/>
<m:defJc m:val="centerGroup"/>
<m:wrapIndent m:val="1440"/>
<m:intLim m:val="subSup"/>
<m:naryLim m:val="undOvr"/>
</m:mathPr></w:WordDocument>
</xml><![endif]--><!--[if gte mso 9]><xml>
<w:LatentStyles DefLockedState="false" DefUnhideWhenUsed="true"
DefSemiHidden="true" DefQFormat="false" DefPriority="99"
LatentStyleCount="267">
<w:LsdException Locked="false" Priority="0" SemiHidden="false"
UnhideWhenUsed="false" QFormat="true" Name="Normal"/>
<w:LsdException Locked="false" Priority="9" SemiHidden="false"
UnhideWhenUsed="false" QFormat="true" Name="heading 1"/>
<w:LsdException Locked="false" Priority="9" QFormat="true" Name="heading 2"/>
<w:LsdException Locked="false" Priority="9" QFormat="true" Name="heading 3"/>
<w:LsdException Locked="false" Priority="9" QFormat="true" Name="heading 4"/>
<w:LsdException Locked="false" Priority="9" QFormat="true" Name="heading 5"/>
<w:LsdException Locked="false" Priority="9" QFormat="true" Name="heading 6"/>
<w:LsdException Locked="false" Priority="9" QFormat="true" Name="heading 7"/>
<w:LsdException Locked="false" Priority="9" QFormat="true" Name="heading 8"/>
<w:LsdException Locked="false" Priority="9" QFormat="true" Name="heading 9"/>
<w:LsdException Locked="false" Priority="39" Name="toc 1"/>
<w:LsdException Locked="false" Priority="39" Name="toc 2"/>
<w:LsdException Locked="false" Priority="39" Name="toc 3"/>
<w:LsdException Locked="false" Priority="39" Name="toc 4"/>
<w:LsdException Locked="false" Priority="39" Name="toc 5"/>
<w:LsdException Locked="false" Priority="39" Name="toc 6"/>
<w:LsdException Locked="false" Priority="39" Name="toc 7"/>
<w:LsdException Locked="false" Priority="39" Name="toc 8"/>
<w:LsdException Locked="false" Priority="39" Name="toc 9"/>
<w:LsdException Locked="false" Priority="35" QFormat="true" Name="caption"/>
<w:LsdException Locked="false" Priority="10" SemiHidden="false"
UnhideWhenUsed="false" QFormat="true" Name="Title"/>
<w:LsdException Locked="false" Priority="1" Name="Default Paragraph Font"/>
<w:LsdException Locked="false" Priority="11" SemiHidden="false"
UnhideWhenUsed="false" QFormat="true" Name="Subtitle"/>
<w:LsdException Locked="false" Priority="22" SemiHidden="false"
UnhideWhenUsed="false" QFormat="true" Name="Strong"/>
<w:LsdException Locked="false" Priority="20" SemiHidden="false"
UnhideWhenUsed="false" QFormat="true" Name="Emphasis"/>
<w:LsdException Locked="false" Priority="59" SemiHidden="false"
UnhideWhenUsed="false" Name="Table Grid"/>
<w:LsdException Locked="false" UnhideWhenUsed="false" Name="Placeholder Text"/>
<w:LsdException Locked="false" Priority="1" SemiHidden="false"
UnhideWhenUsed="false" QFormat="true" Name="No Spacing"/>
<w:LsdException Locked="false" Priority="60" SemiHidden="false"
UnhideWhenUsed="false" Name="Light Shading"/>
<w:LsdException Locked="false" Priority="61" SemiHidden="false"
UnhideWhenUsed="false" Name="Light List"/>
<w:LsdException Locked="false" Priority="62" SemiHidden="false"
UnhideWhenUsed="false" Name="Light Grid"/>
<w:LsdException Locked="false" Priority="63" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium Shading 1"/>
<w:LsdException Locked="false" Priority="64" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium Shading 2"/>
<w:LsdException Locked="false" Priority="65" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium List 1"/>
<w:LsdException Locked="false" Priority="66" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium List 2"/>
<w:LsdException Locked="false" Priority="67" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium Grid 1"/>
<w:LsdException Locked="false" Priority="68" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium Grid 2"/>
<w:LsdException Locked="false" Priority="69" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium Grid 3"/>
<w:LsdException Locked="false" Priority="70" SemiHidden="false"
UnhideWhenUsed="false" Name="Dark List"/>
<w:LsdException Locked="false" Priority="71" SemiHidden="false"
UnhideWhenUsed="false" Name="Colorful Shading"/>
<w:LsdException Locked="false" Priority="72" SemiHidden="false"
UnhideWhenUsed="false" Name="Colorful List"/>
<w:LsdException Locked="false" Priority="73" SemiHidden="false"
UnhideWhenUsed="false" Name="Colorful Grid"/>
<w:LsdException Locked="false" Priority="60" SemiHidden="false"
UnhideWhenUsed="false" Name="Light Shading Accent 1"/>
<w:LsdException Locked="false" Priority="61" SemiHidden="false"
UnhideWhenUsed="false" Name="Light List Accent 1"/>
<w:LsdException Locked="false" Priority="62" SemiHidden="false"
UnhideWhenUsed="false" Name="Light Grid Accent 1"/>
<w:LsdException Locked="false" Priority="63" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium Shading 1 Accent 1"/>
<w:LsdException Locked="false" Priority="64" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium Shading 2 Accent 1"/>
<w:LsdException Locked="false" Priority="65" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium List 1 Accent 1"/>
<w:LsdException Locked="false" UnhideWhenUsed="false" Name="Revision"/>
<w:LsdException Locked="false" Priority="34" SemiHidden="false"
UnhideWhenUsed="false" QFormat="true" Name="List Paragraph"/>
<w:LsdException Locked="false" Priority="29" SemiHidden="false"
UnhideWhenUsed="false" QFormat="true" Name="Quote"/>
<w:LsdException Locked="false" Priority="30" SemiHidden="false"
UnhideWhenUsed="false" QFormat="true" Name="Intense Quote"/>
<w:LsdException Locked="false" Priority="66" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium List 2 Accent 1"/>
<w:LsdException Locked="false" Priority="67" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium Grid 1 Accent 1"/>
<w:LsdException Locked="false" Priority="68" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium Grid 2 Accent 1"/>
<w:LsdException Locked="false" Priority="69" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium Grid 3 Accent 1"/>
<w:LsdException Locked="false" Priority="70" SemiHidden="false"
UnhideWhenUsed="false" Name="Dark List Accent 1"/>
<w:LsdException Locked="false" Priority="71" SemiHidden="false"
UnhideWhenUsed="false" Name="Colorful Shading Accent 1"/>
<w:LsdException Locked="false" Priority="72" SemiHidden="false"
UnhideWhenUsed="false" Name="Colorful List Accent 1"/>
<w:LsdException Locked="false" Priority="73" SemiHidden="false"
UnhideWhenUsed="false" Name="Colorful Grid Accent 1"/>
<w:LsdException Locked="false" Priority="60" SemiHidden="false"
UnhideWhenUsed="false" Name="Light Shading Accent 2"/>
<w:LsdException Locked="false" Priority="61" SemiHidden="false"
UnhideWhenUsed="false" Name="Light List Accent 2"/>
<w:LsdException Locked="false" Priority="62" SemiHidden="false"
UnhideWhenUsed="false" Name="Light Grid Accent 2"/>
<w:LsdException Locked="false" Priority="63" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium Shading 1 Accent 2"/>
<w:LsdException Locked="false" Priority="64" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium Shading 2 Accent 2"/>
<w:LsdException Locked="false" Priority="65" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium List 1 Accent 2"/>
<w:LsdException Locked="false" Priority="66" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium List 2 Accent 2"/>
<w:LsdException Locked="false" Priority="67" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium Grid 1 Accent 2"/>
<w:LsdException Locked="false" Priority="68" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium Grid 2 Accent 2"/>
<w:LsdException Locked="false" Priority="69" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium Grid 3 Accent 2"/>
<w:LsdException Locked="false" Priority="70" SemiHidden="false"
UnhideWhenUsed="false" Name="Dark List Accent 2"/>
<w:LsdException Locked="false" Priority="71" SemiHidden="false"
UnhideWhenUsed="false" Name="Colorful Shading Accent 2"/>
<w:LsdException Locked="false" Priority="72" SemiHidden="false"
UnhideWhenUsed="false" Name="Colorful List Accent 2"/>
<w:LsdException Locked="false" Priority="73" SemiHidden="false"
UnhideWhenUsed="false" Name="Colorful Grid Accent 2"/>
<w:LsdException Locked="false" Priority="60" SemiHidden="false"
UnhideWhenUsed="false" Name="Light Shading Accent 3"/>
<w:LsdException Locked="false" Priority="61" SemiHidden="false"
UnhideWhenUsed="false" Name="Light List Accent 3"/>
<w:LsdException Locked="false" Priority="62" SemiHidden="false"
UnhideWhenUsed="false" Name="Light Grid Accent 3"/>
<w:LsdException Locked="false" Priority="63" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium Shading 1 Accent 3"/>
<w:LsdException Locked="false" Priority="64" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium Shading 2 Accent 3"/>
<w:LsdException Locked="false" Priority="65" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium List 1 Accent 3"/>
<w:LsdException Locked="false" Priority="66" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium List 2 Accent 3"/>
<w:LsdException Locked="false" Priority="67" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium Grid 1 Accent 3"/>
<w:LsdException Locked="false" Priority="68" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium Grid 2 Accent 3"/>
<w:LsdException Locked="false" Priority="69" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium Grid 3 Accent 3"/>
<w:LsdException Locked="false" Priority="70" SemiHidden="false"
UnhideWhenUsed="false" Name="Dark List Accent 3"/>
<w:LsdException Locked="false" Priority="71" SemiHidden="false"
UnhideWhenUsed="false" Name="Colorful Shading Accent 3"/>
<w:LsdException Locked="false" Priority="72" SemiHidden="false"
UnhideWhenUsed="false" Name="Colorful List Accent 3"/>
<w:LsdException Locked="false" Priority="73" SemiHidden="false"
UnhideWhenUsed="false" Name="Colorful Grid Accent 3"/>
<w:LsdException Locked="false" Priority="60" SemiHidden="false"
UnhideWhenUsed="false" Name="Light Shading Accent 4"/>
<w:LsdException Locked="false" Priority="61" SemiHidden="false"
UnhideWhenUsed="false" Name="Light List Accent 4"/>
<w:LsdException Locked="false" Priority="62" SemiHidden="false"
UnhideWhenUsed="false" Name="Light Grid Accent 4"/>
<w:LsdException Locked="false" Priority="63" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium Shading 1 Accent 4"/>
<w:LsdException Locked="false" Priority="64" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium Shading 2 Accent 4"/>
<w:LsdException Locked="false" Priority="65" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium List 1 Accent 4"/>
<w:LsdException Locked="false" Priority="66" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium List 2 Accent 4"/>
<w:LsdException Locked="false" Priority="67" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium Grid 1 Accent 4"/>
<w:LsdException Locked="false" Priority="68" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium Grid 2 Accent 4"/>
<w:LsdException Locked="false" Priority="69" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium Grid 3 Accent 4"/>
<w:LsdException Locked="false" Priority="70" SemiHidden="false"
UnhideWhenUsed="false" Name="Dark List Accent 4"/>
<w:LsdException Locked="false" Priority="71" SemiHidden="false"
UnhideWhenUsed="false" Name="Colorful Shading Accent 4"/>
<w:LsdException Locked="false" Priority="72" SemiHidden="false"
UnhideWhenUsed="false" Name="Colorful List Accent 4"/>
<w:LsdException Locked="false" Priority="73" SemiHidden="false"
UnhideWhenUsed="false" Name="Colorful Grid Accent 4"/>
<w:LsdException Locked="false" Priority="60" SemiHidden="false"
UnhideWhenUsed="false" Name="Light Shading Accent 5"/>
<w:LsdException Locked="false" Priority="61" SemiHidden="false"
UnhideWhenUsed="false" Name="Light List Accent 5"/>
<w:LsdException Locked="false" Priority="62" SemiHidden="false"
UnhideWhenUsed="false" Name="Light Grid Accent 5"/>
<w:LsdException Locked="false" Priority="63" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium Shading 1 Accent 5"/>
<w:LsdException Locked="false" Priority="64" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium Shading 2 Accent 5"/>
<w:LsdException Locked="false" Priority="65" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium List 1 Accent 5"/>
<w:LsdException Locked="false" Priority="66" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium List 2 Accent 5"/>
<w:LsdException Locked="false" Priority="67" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium Grid 1 Accent 5"/>
<w:LsdException Locked="false" Priority="68" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium Grid 2 Accent 5"/>
<w:LsdException Locked="false" Priority="69" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium Grid 3 Accent 5"/>
<w:LsdException Locked="false" Priority="70" SemiHidden="false"
UnhideWhenUsed="false" Name="Dark List Accent 5"/>
<w:LsdException Locked="false" Priority="71" SemiHidden="false"
UnhideWhenUsed="false" Name="Colorful Shading Accent 5"/>
<w:LsdException Locked="false" Priority="72" SemiHidden="false"
UnhideWhenUsed="false" Name="Colorful List Accent 5"/>
<w:LsdException Locked="false" Priority="73" SemiHidden="false"
UnhideWhenUsed="false" Name="Colorful Grid Accent 5"/>
<w:LsdException Locked="false" Priority="60" SemiHidden="false"
UnhideWhenUsed="false" Name="Light Shading Accent 6"/>
<w:LsdException Locked="false" Priority="61" SemiHidden="false"
UnhideWhenUsed="false" Name="Light List Accent 6"/>
<w:LsdException Locked="false" Priority="62" SemiHidden="false"
UnhideWhenUsed="false" Name="Light Grid Accent 6"/>
<w:LsdException Locked="false" Priority="63" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium Shading 1 Accent 6"/>
<w:LsdException Locked="false" Priority="64" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium Shading 2 Accent 6"/>
<w:LsdException Locked="false" Priority="65" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium List 1 Accent 6"/>
<w:LsdException Locked="false" Priority="66" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium List 2 Accent 6"/>
<w:LsdException Locked="false" Priority="67" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium Grid 1 Accent 6"/>
<w:LsdException Locked="false" Priority="68" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium Grid 2 Accent 6"/>
<w:LsdException Locked="false" Priority="69" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium Grid 3 Accent 6"/>
<w:LsdException Locked="false" Priority="70" SemiHidden="false"
UnhideWhenUsed="false" Name="Dark List Accent 6"/>
<w:LsdException Locked="false" Priority="71" SemiHidden="false"
UnhideWhenUsed="false" Name="Colorful Shading Accent 6"/>
<w:LsdException Locked="false" Priority="72" SemiHidden="false"
UnhideWhenUsed="false" Name="Colorful List Accent 6"/>
<w:LsdException Locked="false" Priority="73" SemiHidden="false"
UnhideWhenUsed="false" Name="Colorful Grid Accent 6"/>
<w:LsdException Locked="false" Priority="19" SemiHidden="false"
UnhideWhenUsed="false" QFormat="true" Name="Subtle Emphasis"/>
<w:LsdException Locked="false" Priority="21" SemiHidden="false"
UnhideWhenUsed="false" QFormat="true" Name="Intense Emphasis"/>
<w:LsdException Locked="false" Priority="31" SemiHidden="false"
UnhideWhenUsed="false" QFormat="true" Name="Subtle Reference"/>
<w:LsdException Locked="false" Priority="32" SemiHidden="false"
UnhideWhenUsed="false" QFormat="true" Name="Intense Reference"/>
<w:LsdException Locked="false" Priority="33" SemiHidden="false"
UnhideWhenUsed="false" QFormat="true" Name="Book Title"/>
<w:LsdException Locked="false" Priority="37" Name="Bibliography"/>
<w:LsdException Locked="false" Priority="39" QFormat="true" Name="TOC Heading"/>
</w:LatentStyles>
</xml><![endif]--><!--[if gte mso 10]>
<style>
/* Style Definitions */
table.MsoNormalTable
{mso-style-name:"Normal Tablo";
mso-tstyle-rowband-size:0;
mso-tstyle-colband-size:0;
mso-style-noshow:yes;
mso-style-priority:99;
mso-style-parent:"";
mso-padding-alt:0in 5.4pt 0in 5.4pt;
mso-para-margin-top:0in;
mso-para-margin-right:0in;
mso-para-margin-bottom:8.0pt;
mso-para-margin-left:0in;
line-height:107%;
mso-pagination:widow-orphan;
font-size:11.0pt;
font-family:"Calibri","sans-serif";
mso-ascii-font-family:Calibri;
mso-ascii-theme-font:minor-latin;
mso-hansi-font-family:Calibri;
mso-hansi-theme-font:minor-latin;
mso-fareast-language:EN-US;}
</style>
<![endif]-->1110</port>...</pop3server></div>
<div class="MsoNormal">
* <smtpserver enabled="true"><port><!--[if gte mso 9]><xml>
<o:OfficeDocumentSettings>
<o:AllowPNG/>
</o:OfficeDocumentSettings>
</xml><![endif]--><span style="font-family: "calibri" , "sans-serif"; font-size: 11.0pt; line-height: 107%;">smtpserver -> port </span><!--[if gte mso 9]><xml>
<w:WordDocument>
<w:View>Normal</w:View>
<w:Zoom>0</w:Zoom>
<w:TrackMoves/>
<w:TrackFormatting/>
<w:HyphenationZone>21</w:HyphenationZone>
<w:PunctuationKerning/>
<w:ValidateAgainstSchemas/>
<w:SaveIfXMLInvalid>false</w:SaveIfXMLInvalid>
<w:IgnoreMixedContent>false</w:IgnoreMixedContent>
<w:AlwaysShowPlaceholderText>false</w:AlwaysShowPlaceholderText>
<w:DoNotPromoteQF/>
<w:LidThemeOther>TR</w:LidThemeOther>
<w:LidThemeAsian>X-NONE</w:LidThemeAsian>
<w:LidThemeComplexScript>X-NONE</w:LidThemeComplexScript>
<w:Compatibility>
<w:BreakWrappedTables/>
<w:SnapToGridInCell/>
<w:WrapTextWithPunct/>
<w:UseAsianBreakRules/>
<w:DontGrowAutofit/>
<w:SplitPgBreakAndParaMark/>
<w:EnableOpenTypeKerning/>
<w:DontFlipMirrorIndents/>
<w:OverrideTableStyleHps/>
</w:Compatibility>
<m:mathPr>
<m:mathFont m:val="Cambria Math"/>
<m:brkBin m:val="before"/>
<m:brkBinSub m:val="--"/>
<m:smallFrac m:val="off"/>
<m:dispDef/>
<m:lMargin m:val="0"/>
<m:rMargin m:val="0"/>
<m:defJc m:val="centerGroup"/>
<m:wrapIndent m:val="1440"/>
<m:intLim m:val="subSup"/>
<m:naryLim m:val="undOvr"/>
</m:mathPr></w:WordDocument>
</xml><![endif]--><!--[if gte mso 9]><xml>
<w:LatentStyles DefLockedState="false" DefUnhideWhenUsed="true"
DefSemiHidden="true" DefQFormat="false" DefPriority="99"
LatentStyleCount="267">
<w:LsdException Locked="false" Priority="0" SemiHidden="false"
UnhideWhenUsed="false" QFormat="true" Name="Normal"/>
<w:LsdException Locked="false" Priority="9" SemiHidden="false"
UnhideWhenUsed="false" QFormat="true" Name="heading 1"/>
<w:LsdException Locked="false" Priority="9" QFormat="true" Name="heading 2"/>
<w:LsdException Locked="false" Priority="9" QFormat="true" Name="heading 3"/>
<w:LsdException Locked="false" Priority="9" QFormat="true" Name="heading 4"/>
<w:LsdException Locked="false" Priority="9" QFormat="true" Name="heading 5"/>
<w:LsdException Locked="false" Priority="9" QFormat="true" Name="heading 6"/>
<w:LsdException Locked="false" Priority="9" QFormat="true" Name="heading 7"/>
<w:LsdException Locked="false" Priority="9" QFormat="true" Name="heading 8"/>
<w:LsdException Locked="false" Priority="9" QFormat="true" Name="heading 9"/>
<w:LsdException Locked="false" Priority="39" Name="toc 1"/>
<w:LsdException Locked="false" Priority="39" Name="toc 2"/>
<w:LsdException Locked="false" Priority="39" Name="toc 3"/>
<w:LsdException Locked="false" Priority="39" Name="toc 4"/>
<w:LsdException Locked="false" Priority="39" Name="toc 5"/>
<w:LsdException Locked="false" Priority="39" Name="toc 6"/>
<w:LsdException Locked="false" Priority="39" Name="toc 7"/>
<w:LsdException Locked="false" Priority="39" Name="toc 8"/>
<w:LsdException Locked="false" Priority="39" Name="toc 9"/>
<w:LsdException Locked="false" Priority="35" QFormat="true" Name="caption"/>
<w:LsdException Locked="false" Priority="10" SemiHidden="false"
UnhideWhenUsed="false" QFormat="true" Name="Title"/>
<w:LsdException Locked="false" Priority="1" Name="Default Paragraph Font"/>
<w:LsdException Locked="false" Priority="11" SemiHidden="false"
UnhideWhenUsed="false" QFormat="true" Name="Subtitle"/>
<w:LsdException Locked="false" Priority="22" SemiHidden="false"
UnhideWhenUsed="false" QFormat="true" Name="Strong"/>
<w:LsdException Locked="false" Priority="20" SemiHidden="false"
UnhideWhenUsed="false" QFormat="true" Name="Emphasis"/>
<w:LsdException Locked="false" Priority="59" SemiHidden="false"
UnhideWhenUsed="false" Name="Table Grid"/>
<w:LsdException Locked="false" UnhideWhenUsed="false" Name="Placeholder Text"/>
<w:LsdException Locked="false" Priority="1" SemiHidden="false"
UnhideWhenUsed="false" QFormat="true" Name="No Spacing"/>
<w:LsdException Locked="false" Priority="60" SemiHidden="false"
UnhideWhenUsed="false" Name="Light Shading"/>
<w:LsdException Locked="false" Priority="61" SemiHidden="false"
UnhideWhenUsed="false" Name="Light List"/>
<w:LsdException Locked="false" Priority="62" SemiHidden="false"
UnhideWhenUsed="false" Name="Light Grid"/>
<w:LsdException Locked="false" Priority="63" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium Shading 1"/>
<w:LsdException Locked="false" Priority="64" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium Shading 2"/>
<w:LsdException Locked="false" Priority="65" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium List 1"/>
<w:LsdException Locked="false" Priority="66" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium List 2"/>
<w:LsdException Locked="false" Priority="67" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium Grid 1"/>
<w:LsdException Locked="false" Priority="68" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium Grid 2"/>
<w:LsdException Locked="false" Priority="69" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium Grid 3"/>
<w:LsdException Locked="false" Priority="70" SemiHidden="false"
UnhideWhenUsed="false" Name="Dark List"/>
<w:LsdException Locked="false" Priority="71" SemiHidden="false"
UnhideWhenUsed="false" Name="Colorful Shading"/>
<w:LsdException Locked="false" Priority="72" SemiHidden="false"
UnhideWhenUsed="false" Name="Colorful List"/>
<w:LsdException Locked="false" Priority="73" SemiHidden="false"
UnhideWhenUsed="false" Name="Colorful Grid"/>
<w:LsdException Locked="false" Priority="60" SemiHidden="false"
UnhideWhenUsed="false" Name="Light Shading Accent 1"/>
<w:LsdException Locked="false" Priority="61" SemiHidden="false"
UnhideWhenUsed="false" Name="Light List Accent 1"/>
<w:LsdException Locked="false" Priority="62" SemiHidden="false"
UnhideWhenUsed="false" Name="Light Grid Accent 1"/>
<w:LsdException Locked="false" Priority="63" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium Shading 1 Accent 1"/>
<w:LsdException Locked="false" Priority="64" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium Shading 2 Accent 1"/>
<w:LsdException Locked="false" Priority="65" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium List 1 Accent 1"/>
<w:LsdException Locked="false" UnhideWhenUsed="false" Name="Revision"/>
<w:LsdException Locked="false" Priority="34" SemiHidden="false"
UnhideWhenUsed="false" QFormat="true" Name="List Paragraph"/>
<w:LsdException Locked="false" Priority="29" SemiHidden="false"
UnhideWhenUsed="false" QFormat="true" Name="Quote"/>
<w:LsdException Locked="false" Priority="30" SemiHidden="false"
UnhideWhenUsed="false" QFormat="true" Name="Intense Quote"/>
<w:LsdException Locked="false" Priority="66" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium List 2 Accent 1"/>
<w:LsdException Locked="false" Priority="67" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium Grid 1 Accent 1"/>
<w:LsdException Locked="false" Priority="68" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium Grid 2 Accent 1"/>
<w:LsdException Locked="false" Priority="69" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium Grid 3 Accent 1"/>
<w:LsdException Locked="false" Priority="70" SemiHidden="false"
UnhideWhenUsed="false" Name="Dark List Accent 1"/>
<w:LsdException Locked="false" Priority="71" SemiHidden="false"
UnhideWhenUsed="false" Name="Colorful Shading Accent 1"/>
<w:LsdException Locked="false" Priority="72" SemiHidden="false"
UnhideWhenUsed="false" Name="Colorful List Accent 1"/>
<w:LsdException Locked="false" Priority="73" SemiHidden="false"
UnhideWhenUsed="false" Name="Colorful Grid Accent 1"/>
<w:LsdException Locked="false" Priority="60" SemiHidden="false"
UnhideWhenUsed="false" Name="Light Shading Accent 2"/>
<w:LsdException Locked="false" Priority="61" SemiHidden="false"
UnhideWhenUsed="false" Name="Light List Accent 2"/>
<w:LsdException Locked="false" Priority="62" SemiHidden="false"
UnhideWhenUsed="false" Name="Light Grid Accent 2"/>
<w:LsdException Locked="false" Priority="63" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium Shading 1 Accent 2"/>
<w:LsdException Locked="false" Priority="64" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium Shading 2 Accent 2"/>
<w:LsdException Locked="false" Priority="65" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium List 1 Accent 2"/>
<w:LsdException Locked="false" Priority="66" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium List 2 Accent 2"/>
<w:LsdException Locked="false" Priority="67" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium Grid 1 Accent 2"/>
<w:LsdException Locked="false" Priority="68" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium Grid 2 Accent 2"/>
<w:LsdException Locked="false" Priority="69" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium Grid 3 Accent 2"/>
<w:LsdException Locked="false" Priority="70" SemiHidden="false"
UnhideWhenUsed="false" Name="Dark List Accent 2"/>
<w:LsdException Locked="false" Priority="71" SemiHidden="false"
UnhideWhenUsed="false" Name="Colorful Shading Accent 2"/>
<w:LsdException Locked="false" Priority="72" SemiHidden="false"
UnhideWhenUsed="false" Name="Colorful List Accent 2"/>
<w:LsdException Locked="false" Priority="73" SemiHidden="false"
UnhideWhenUsed="false" Name="Colorful Grid Accent 2"/>
<w:LsdException Locked="false" Priority="60" SemiHidden="false"
UnhideWhenUsed="false" Name="Light Shading Accent 3"/>
<w:LsdException Locked="false" Priority="61" SemiHidden="false"
UnhideWhenUsed="false" Name="Light List Accent 3"/>
<w:LsdException Locked="false" Priority="62" SemiHidden="false"
UnhideWhenUsed="false" Name="Light Grid Accent 3"/>
<w:LsdException Locked="false" Priority="63" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium Shading 1 Accent 3"/>
<w:LsdException Locked="false" Priority="64" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium Shading 2 Accent 3"/>
<w:LsdException Locked="false" Priority="65" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium List 1 Accent 3"/>
<w:LsdException Locked="false" Priority="66" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium List 2 Accent 3"/>
<w:LsdException Locked="false" Priority="67" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium Grid 1 Accent 3"/>
<w:LsdException Locked="false" Priority="68" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium Grid 2 Accent 3"/>
<w:LsdException Locked="false" Priority="69" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium Grid 3 Accent 3"/>
<w:LsdException Locked="false" Priority="70" SemiHidden="false"
UnhideWhenUsed="false" Name="Dark List Accent 3"/>
<w:LsdException Locked="false" Priority="71" SemiHidden="false"
UnhideWhenUsed="false" Name="Colorful Shading Accent 3"/>
<w:LsdException Locked="false" Priority="72" SemiHidden="false"
UnhideWhenUsed="false" Name="Colorful List Accent 3"/>
<w:LsdException Locked="false" Priority="73" SemiHidden="false"
UnhideWhenUsed="false" Name="Colorful Grid Accent 3"/>
<w:LsdException Locked="false" Priority="60" SemiHidden="false"
UnhideWhenUsed="false" Name="Light Shading Accent 4"/>
<w:LsdException Locked="false" Priority="61" SemiHidden="false"
UnhideWhenUsed="false" Name="Light List Accent 4"/>
<w:LsdException Locked="false" Priority="62" SemiHidden="false"
UnhideWhenUsed="false" Name="Light Grid Accent 4"/>
<w:LsdException Locked="false" Priority="63" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium Shading 1 Accent 4"/>
<w:LsdException Locked="false" Priority="64" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium Shading 2 Accent 4"/>
<w:LsdException Locked="false" Priority="65" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium List 1 Accent 4"/>
<w:LsdException Locked="false" Priority="66" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium List 2 Accent 4"/>
<w:LsdException Locked="false" Priority="67" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium Grid 1 Accent 4"/>
<w:LsdException Locked="false" Priority="68" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium Grid 2 Accent 4"/>
<w:LsdException Locked="false" Priority="69" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium Grid 3 Accent 4"/>
<w:LsdException Locked="false" Priority="70" SemiHidden="false"
UnhideWhenUsed="false" Name="Dark List Accent 4"/>
<w:LsdException Locked="false" Priority="71" SemiHidden="false"
UnhideWhenUsed="false" Name="Colorful Shading Accent 4"/>
<w:LsdException Locked="false" Priority="72" SemiHidden="false"
UnhideWhenUsed="false" Name="Colorful List Accent 4"/>
<w:LsdException Locked="false" Priority="73" SemiHidden="false"
UnhideWhenUsed="false" Name="Colorful Grid Accent 4"/>
<w:LsdException Locked="false" Priority="60" SemiHidden="false"
UnhideWhenUsed="false" Name="Light Shading Accent 5"/>
<w:LsdException Locked="false" Priority="61" SemiHidden="false"
UnhideWhenUsed="false" Name="Light List Accent 5"/>
<w:LsdException Locked="false" Priority="62" SemiHidden="false"
UnhideWhenUsed="false" Name="Light Grid Accent 5"/>
<w:LsdException Locked="false" Priority="63" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium Shading 1 Accent 5"/>
<w:LsdException Locked="false" Priority="64" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium Shading 2 Accent 5"/>
<w:LsdException Locked="false" Priority="65" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium List 1 Accent 5"/>
<w:LsdException Locked="false" Priority="66" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium List 2 Accent 5"/>
<w:LsdException Locked="false" Priority="67" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium Grid 1 Accent 5"/>
<w:LsdException Locked="false" Priority="68" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium Grid 2 Accent 5"/>
<w:LsdException Locked="false" Priority="69" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium Grid 3 Accent 5"/>
<w:LsdException Locked="false" Priority="70" SemiHidden="false"
UnhideWhenUsed="false" Name="Dark List Accent 5"/>
<w:LsdException Locked="false" Priority="71" SemiHidden="false"
UnhideWhenUsed="false" Name="Colorful Shading Accent 5"/>
<w:LsdException Locked="false" Priority="72" SemiHidden="false"
UnhideWhenUsed="false" Name="Colorful List Accent 5"/>
<w:LsdException Locked="false" Priority="73" SemiHidden="false"
UnhideWhenUsed="false" Name="Colorful Grid Accent 5"/>
<w:LsdException Locked="false" Priority="60" SemiHidden="false"
UnhideWhenUsed="false" Name="Light Shading Accent 6"/>
<w:LsdException Locked="false" Priority="61" SemiHidden="false"
UnhideWhenUsed="false" Name="Light List Accent 6"/>
<w:LsdException Locked="false" Priority="62" SemiHidden="false"
UnhideWhenUsed="false" Name="Light Grid Accent 6"/>
<w:LsdException Locked="false" Priority="63" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium Shading 1 Accent 6"/>
<w:LsdException Locked="false" Priority="64" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium Shading 2 Accent 6"/>
<w:LsdException Locked="false" Priority="65" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium List 1 Accent 6"/>
<w:LsdException Locked="false" Priority="66" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium List 2 Accent 6"/>
<w:LsdException Locked="false" Priority="67" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium Grid 1 Accent 6"/>
<w:LsdException Locked="false" Priority="68" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium Grid 2 Accent 6"/>
<w:LsdException Locked="false" Priority="69" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium Grid 3 Accent 6"/>
<w:LsdException Locked="false" Priority="70" SemiHidden="false"
UnhideWhenUsed="false" Name="Dark List Accent 6"/>
<w:LsdException Locked="false" Priority="71" SemiHidden="false"
UnhideWhenUsed="false" Name="Colorful Shading Accent 6"/>
<w:LsdException Locked="false" Priority="72" SemiHidden="false"
UnhideWhenUsed="false" Name="Colorful List Accent 6"/>
<w:LsdException Locked="false" Priority="73" SemiHidden="false"
UnhideWhenUsed="false" Name="Colorful Grid Accent 6"/>
<w:LsdException Locked="false" Priority="19" SemiHidden="false"
UnhideWhenUsed="false" QFormat="true" Name="Subtle Emphasis"/>
<w:LsdException Locked="false" Priority="21" SemiHidden="false"
UnhideWhenUsed="false" QFormat="true" Name="Intense Emphasis"/>
<w:LsdException Locked="false" Priority="31" SemiHidden="false"
UnhideWhenUsed="false" QFormat="true" Name="Subtle Reference"/>
<w:LsdException Locked="false" Priority="32" SemiHidden="false"
UnhideWhenUsed="false" QFormat="true" Name="Intense Reference"/>
<w:LsdException Locked="false" Priority="33" SemiHidden="false"
UnhideWhenUsed="false" QFormat="true" Name="Book Title"/>
<w:LsdException Locked="false" Priority="37" Name="Bibliography"/>
<w:LsdException Locked="false" Priority="39" QFormat="true" Name="TOC Heading"/>
</w:LatentStyles>
</xml><![endif]--><!--[if gte mso 10]>
<style>
/* Style Definitions */
table.MsoNormalTable
{mso-style-name:"Normal Tablo";
mso-tstyle-rowband-size:0;
mso-tstyle-colband-size:0;
mso-style-noshow:yes;
mso-style-priority:99;
mso-style-parent:"";
mso-padding-alt:0in 5.4pt 0in 5.4pt;
mso-para-margin-top:0in;
mso-para-margin-right:0in;
mso-para-margin-bottom:8.0pt;
mso-para-margin-left:0in;
line-height:107%;
mso-pagination:widow-orphan;
font-size:11.0pt;
font-family:"Calibri","sans-serif";
mso-ascii-font-family:Calibri;
mso-ascii-theme-font:minor-latin;
mso-hansi-font-family:Calibri;
mso-hansi-theme-font:minor-latin;
mso-fareast-language:EN-US;}
</style>
<![endif]-->1125</port>...</smtpserver></div>
<span style="font-family: "calibri" , "sans-serif"; font-size: 11.0pt; line-height: 107%;"></span><!--[if gte mso 9]><xml>
<w:WordDocument>
<w:View>Normal</w:View>
<w:Zoom>0</w:Zoom>
<w:TrackMoves/>
<w:TrackFormatting/>
<w:HyphenationZone>21</w:HyphenationZone>
<w:PunctuationKerning/>
<w:ValidateAgainstSchemas/>
<w:SaveIfXMLInvalid>false</w:SaveIfXMLInvalid>
<w:IgnoreMixedContent>false</w:IgnoreMixedContent>
<w:AlwaysShowPlaceholderText>false</w:AlwaysShowPlaceholderText>
<w:DoNotPromoteQF/>
<w:LidThemeOther>TR</w:LidThemeOther>
<w:LidThemeAsian>X-NONE</w:LidThemeAsian>
<w:LidThemeComplexScript>X-NONE</w:LidThemeComplexScript>
<w:Compatibility>
<w:BreakWrappedTables/>
<w:SnapToGridInCell/>
<w:WrapTextWithPunct/>
<w:UseAsianBreakRules/>
<w:DontGrowAutofit/>
<w:SplitPgBreakAndParaMark/>
<w:EnableOpenTypeKerning/>
<w:DontFlipMirrorIndents/>
<w:OverrideTableStyleHps/>
</w:Compatibility>
<m:mathPr>
<m:mathFont m:val="Cambria Math"/>
<m:brkBin m:val="before"/>
<m:brkBinSub m:val="--"/>
<m:smallFrac m:val="off"/>
<m:dispDef/>
<m:lMargin m:val="0"/>
<m:rMargin m:val="0"/>
<m:defJc m:val="centerGroup"/>
<m:wrapIndent m:val="1440"/>
<m:intLim m:val="subSup"/>
<m:naryLim m:val="undOvr"/>
</m:mathPr></w:WordDocument>
</xml><![endif]--><!--[if gte mso 9]><xml>
<w:LatentStyles DefLockedState="false" DefUnhideWhenUsed="true"
DefSemiHidden="true" DefQFormat="false" DefPriority="99"
LatentStyleCount="267">
<w:LsdException Locked="false" Priority="0" SemiHidden="false"
UnhideWhenUsed="false" QFormat="true" Name="Normal"/>
<w:LsdException Locked="false" Priority="9" SemiHidden="false"
UnhideWhenUsed="false" QFormat="true" Name="heading 1"/>
<w:LsdException Locked="false" Priority="9" QFormat="true" Name="heading 2"/>
<w:LsdException Locked="false" Priority="9" QFormat="true" Name="heading 3"/>
<w:LsdException Locked="false" Priority="9" QFormat="true" Name="heading 4"/>
<w:LsdException Locked="false" Priority="9" QFormat="true" Name="heading 5"/>
<w:LsdException Locked="false" Priority="9" QFormat="true" Name="heading 6"/>
<w:LsdException Locked="false" Priority="9" QFormat="true" Name="heading 7"/>
<w:LsdException Locked="false" Priority="9" QFormat="true" Name="heading 8"/>
<w:LsdException Locked="false" Priority="9" QFormat="true" Name="heading 9"/>
<w:LsdException Locked="false" Priority="39" Name="toc 1"/>
<w:LsdException Locked="false" Priority="39" Name="toc 2"/>
<w:LsdException Locked="false" Priority="39" Name="toc 3"/>
<w:LsdException Locked="false" Priority="39" Name="toc 4"/>
<w:LsdException Locked="false" Priority="39" Name="toc 5"/>
<w:LsdException Locked="false" Priority="39" Name="toc 6"/>
<w:LsdException Locked="false" Priority="39" Name="toc 7"/>
<w:LsdException Locked="false" Priority="39" Name="toc 8"/>
<w:LsdException Locked="false" Priority="39" Name="toc 9"/>
<w:LsdException Locked="false" Priority="35" QFormat="true" Name="caption"/>
<w:LsdException Locked="false" Priority="10" SemiHidden="false"
UnhideWhenUsed="false" QFormat="true" Name="Title"/>
<w:LsdException Locked="false" Priority="1" Name="Default Paragraph Font"/>
<w:LsdException Locked="false" Priority="11" SemiHidden="false"
UnhideWhenUsed="false" QFormat="true" Name="Subtitle"/>
<w:LsdException Locked="false" Priority="22" SemiHidden="false"
UnhideWhenUsed="false" QFormat="true" Name="Strong"/>
<w:LsdException Locked="false" Priority="20" SemiHidden="false"
UnhideWhenUsed="false" QFormat="true" Name="Emphasis"/>
<w:LsdException Locked="false" Priority="59" SemiHidden="false"
UnhideWhenUsed="false" Name="Table Grid"/>
<w:LsdException Locked="false" UnhideWhenUsed="false" Name="Placeholder Text"/>
<w:LsdException Locked="false" Priority="1" SemiHidden="false"
UnhideWhenUsed="false" QFormat="true" Name="No Spacing"/>
<w:LsdException Locked="false" Priority="60" SemiHidden="false"
UnhideWhenUsed="false" Name="Light Shading"/>
<w:LsdException Locked="false" Priority="61" SemiHidden="false"
UnhideWhenUsed="false" Name="Light List"/>
<w:LsdException Locked="false" Priority="62" SemiHidden="false"
UnhideWhenUsed="false" Name="Light Grid"/>
<w:LsdException Locked="false" Priority="63" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium Shading 1"/>
<w:LsdException Locked="false" Priority="64" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium Shading 2"/>
<w:LsdException Locked="false" Priority="65" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium List 1"/>
<w:LsdException Locked="false" Priority="66" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium List 2"/>
<w:LsdException Locked="false" Priority="67" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium Grid 1"/>
<w:LsdException Locked="false" Priority="68" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium Grid 2"/>
<w:LsdException Locked="false" Priority="69" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium Grid 3"/>
<w:LsdException Locked="false" Priority="70" SemiHidden="false"
UnhideWhenUsed="false" Name="Dark List"/>
<w:LsdException Locked="false" Priority="71" SemiHidden="false"
UnhideWhenUsed="false" Name="Colorful Shading"/>
<w:LsdException Locked="false" Priority="72" SemiHidden="false"
UnhideWhenUsed="false" Name="Colorful List"/>
<w:LsdException Locked="false" Priority="73" SemiHidden="false"
UnhideWhenUsed="false" Name="Colorful Grid"/>
<w:LsdException Locked="false" Priority="60" SemiHidden="false"
UnhideWhenUsed="false" Name="Light Shading Accent 1"/>
<w:LsdException Locked="false" Priority="61" SemiHidden="false"
UnhideWhenUsed="false" Name="Light List Accent 1"/>
<w:LsdException Locked="false" Priority="62" SemiHidden="false"
UnhideWhenUsed="false" Name="Light Grid Accent 1"/>
<w:LsdException Locked="false" Priority="63" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium Shading 1 Accent 1"/>
<w:LsdException Locked="false" Priority="64" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium Shading 2 Accent 1"/>
<w:LsdException Locked="false" Priority="65" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium List 1 Accent 1"/>
<w:LsdException Locked="false" UnhideWhenUsed="false" Name="Revision"/>
<w:LsdException Locked="false" Priority="34" SemiHidden="false"
UnhideWhenUsed="false" QFormat="true" Name="List Paragraph"/>
<w:LsdException Locked="false" Priority="29" SemiHidden="false"
UnhideWhenUsed="false" QFormat="true" Name="Quote"/>
<w:LsdException Locked="false" Priority="30" SemiHidden="false"
UnhideWhenUsed="false" QFormat="true" Name="Intense Quote"/>
<w:LsdException Locked="false" Priority="66" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium List 2 Accent 1"/>
<w:LsdException Locked="false" Priority="67" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium Grid 1 Accent 1"/>
<w:LsdException Locked="false" Priority="68" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium Grid 2 Accent 1"/>
<w:LsdException Locked="false" Priority="69" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium Grid 3 Accent 1"/>
<w:LsdException Locked="false" Priority="70" SemiHidden="false"
UnhideWhenUsed="false" Name="Dark List Accent 1"/>
<w:LsdException Locked="false" Priority="71" SemiHidden="false"
UnhideWhenUsed="false" Name="Colorful Shading Accent 1"/>
<w:LsdException Locked="false" Priority="72" SemiHidden="false"
UnhideWhenUsed="false" Name="Colorful List Accent 1"/>
<w:LsdException Locked="false" Priority="73" SemiHidden="false"
UnhideWhenUsed="false" Name="Colorful Grid Accent 1"/>
<w:LsdException Locked="false" Priority="60" SemiHidden="false"
UnhideWhenUsed="false" Name="Light Shading Accent 2"/>
<w:LsdException Locked="false" Priority="61" SemiHidden="false"
UnhideWhenUsed="false" Name="Light List Accent 2"/>
<w:LsdException Locked="false" Priority="62" SemiHidden="false"
UnhideWhenUsed="false" Name="Light Grid Accent 2"/>
<w:LsdException Locked="false" Priority="63" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium Shading 1 Accent 2"/>
<w:LsdException Locked="false" Priority="64" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium Shading 2 Accent 2"/>
<w:LsdException Locked="false" Priority="65" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium List 1 Accent 2"/>
<w:LsdException Locked="false" Priority="66" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium List 2 Accent 2"/>
<w:LsdException Locked="false" Priority="67" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium Grid 1 Accent 2"/>
<w:LsdException Locked="false" Priority="68" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium Grid 2 Accent 2"/>
<w:LsdException Locked="false" Priority="69" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium Grid 3 Accent 2"/>
<w:LsdException Locked="false" Priority="70" SemiHidden="false"
UnhideWhenUsed="false" Name="Dark List Accent 2"/>
<w:LsdException Locked="false" Priority="71" SemiHidden="false"
UnhideWhenUsed="false" Name="Colorful Shading Accent 2"/>
<w:LsdException Locked="false" Priority="72" SemiHidden="false"
UnhideWhenUsed="false" Name="Colorful List Accent 2"/>
<w:LsdException Locked="false" Priority="73" SemiHidden="false"
UnhideWhenUsed="false" Name="Colorful Grid Accent 2"/>
<w:LsdException Locked="false" Priority="60" SemiHidden="false"
UnhideWhenUsed="false" Name="Light Shading Accent 3"/>
<w:LsdException Locked="false" Priority="61" SemiHidden="false"
UnhideWhenUsed="false" Name="Light List Accent 3"/>
<w:LsdException Locked="false" Priority="62" SemiHidden="false"
UnhideWhenUsed="false" Name="Light Grid Accent 3"/>
<w:LsdException Locked="false" Priority="63" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium Shading 1 Accent 3"/>
<w:LsdException Locked="false" Priority="64" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium Shading 2 Accent 3"/>
<w:LsdException Locked="false" Priority="65" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium List 1 Accent 3"/>
<w:LsdException Locked="false" Priority="66" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium List 2 Accent 3"/>
<w:LsdException Locked="false" Priority="67" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium Grid 1 Accent 3"/>
<w:LsdException Locked="false" Priority="68" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium Grid 2 Accent 3"/>
<w:LsdException Locked="false" Priority="69" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium Grid 3 Accent 3"/>
<w:LsdException Locked="false" Priority="70" SemiHidden="false"
UnhideWhenUsed="false" Name="Dark List Accent 3"/>
<w:LsdException Locked="false" Priority="71" SemiHidden="false"
UnhideWhenUsed="false" Name="Colorful Shading Accent 3"/>
<w:LsdException Locked="false" Priority="72" SemiHidden="false"
UnhideWhenUsed="false" Name="Colorful List Accent 3"/>
<w:LsdException Locked="false" Priority="73" SemiHidden="false"
UnhideWhenUsed="false" Name="Colorful Grid Accent 3"/>
<w:LsdException Locked="false" Priority="60" SemiHidden="false"
UnhideWhenUsed="false" Name="Light Shading Accent 4"/>
<w:LsdException Locked="false" Priority="61" SemiHidden="false"
UnhideWhenUsed="false" Name="Light List Accent 4"/>
<w:LsdException Locked="false" Priority="62" SemiHidden="false"
UnhideWhenUsed="false" Name="Light Grid Accent 4"/>
<w:LsdException Locked="false" Priority="63" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium Shading 1 Accent 4"/>
<w:LsdException Locked="false" Priority="64" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium Shading 2 Accent 4"/>
<w:LsdException Locked="false" Priority="65" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium List 1 Accent 4"/>
<w:LsdException Locked="false" Priority="66" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium List 2 Accent 4"/>
<w:LsdException Locked="false" Priority="67" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium Grid 1 Accent 4"/>
<w:LsdException Locked="false" Priority="68" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium Grid 2 Accent 4"/>
<w:LsdException Locked="false" Priority="69" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium Grid 3 Accent 4"/>
<w:LsdException Locked="false" Priority="70" SemiHidden="false"
UnhideWhenUsed="false" Name="Dark List Accent 4"/>
<w:LsdException Locked="false" Priority="71" SemiHidden="false"
UnhideWhenUsed="false" Name="Colorful Shading Accent 4"/>
<w:LsdException Locked="false" Priority="72" SemiHidden="false"
UnhideWhenUsed="false" Name="Colorful List Accent 4"/>
<w:LsdException Locked="false" Priority="73" SemiHidden="false"
UnhideWhenUsed="false" Name="Colorful Grid Accent 4"/>
<w:LsdException Locked="false" Priority="60" SemiHidden="false"
UnhideWhenUsed="false" Name="Light Shading Accent 5"/>
<w:LsdException Locked="false" Priority="61" SemiHidden="false"
UnhideWhenUsed="false" Name="Light List Accent 5"/>
<w:LsdException Locked="false" Priority="62" SemiHidden="false"
UnhideWhenUsed="false" Name="Light Grid Accent 5"/>
<w:LsdException Locked="false" Priority="63" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium Shading 1 Accent 5"/>
<w:LsdException Locked="false" Priority="64" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium Shading 2 Accent 5"/>
<w:LsdException Locked="false" Priority="65" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium List 1 Accent 5"/>
<w:LsdException Locked="false" Priority="66" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium List 2 Accent 5"/>
<w:LsdException Locked="false" Priority="67" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium Grid 1 Accent 5"/>
<w:LsdException Locked="false" Priority="68" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium Grid 2 Accent 5"/>
<w:LsdException Locked="false" Priority="69" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium Grid 3 Accent 5"/>
<w:LsdException Locked="false" Priority="70" SemiHidden="false"
UnhideWhenUsed="false" Name="Dark List Accent 5"/>
<w:LsdException Locked="false" Priority="71" SemiHidden="false"
UnhideWhenUsed="false" Name="Colorful Shading Accent 5"/>
<w:LsdException Locked="false" Priority="72" SemiHidden="false"
UnhideWhenUsed="false" Name="Colorful List Accent 5"/>
<w:LsdException Locked="false" Priority="73" SemiHidden="false"
UnhideWhenUsed="false" Name="Colorful Grid Accent 5"/>
<w:LsdException Locked="false" Priority="60" SemiHidden="false"
UnhideWhenUsed="false" Name="Light Shading Accent 6"/>
<w:LsdException Locked="false" Priority="61" SemiHidden="false"
UnhideWhenUsed="false" Name="Light List Accent 6"/>
<w:LsdException Locked="false" Priority="62" SemiHidden="false"
UnhideWhenUsed="false" Name="Light Grid Accent 6"/>
<w:LsdException Locked="false" Priority="63" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium Shading 1 Accent 6"/>
<w:LsdException Locked="false" Priority="64" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium Shading 2 Accent 6"/>
<w:LsdException Locked="false" Priority="65" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium List 1 Accent 6"/>
<w:LsdException Locked="false" Priority="66" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium List 2 Accent 6"/>
<w:LsdException Locked="false" Priority="67" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium Grid 1 Accent 6"/>
<w:LsdException Locked="false" Priority="68" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium Grid 2 Accent 6"/>
<w:LsdException Locked="false" Priority="69" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium Grid 3 Accent 6"/>
<w:LsdException Locked="false" Priority="70" SemiHidden="false"
UnhideWhenUsed="false" Name="Dark List Accent 6"/>
<w:LsdException Locked="false" Priority="71" SemiHidden="false"
UnhideWhenUsed="false" Name="Colorful Shading Accent 6"/>
<w:LsdException Locked="false" Priority="72" SemiHidden="false"
UnhideWhenUsed="false" Name="Colorful List Accent 6"/>
<w:LsdException Locked="false" Priority="73" SemiHidden="false"
UnhideWhenUsed="false" Name="Colorful Grid Accent 6"/>
<w:LsdException Locked="false" Priority="19" SemiHidden="false"
UnhideWhenUsed="false" QFormat="true" Name="Subtle Emphasis"/>
<w:LsdException Locked="false" Priority="21" SemiHidden="false"
UnhideWhenUsed="false" QFormat="true" Name="Intense Emphasis"/>
<w:LsdException Locked="false" Priority="31" SemiHidden="false"
UnhideWhenUsed="false" QFormat="true" Name="Subtle Reference"/>
<w:LsdException Locked="false" Priority="32" SemiHidden="false"
UnhideWhenUsed="false" QFormat="true" Name="Intense Reference"/>
<w:LsdException Locked="false" Priority="33" SemiHidden="false"
UnhideWhenUsed="false" QFormat="true" Name="Book Title"/>
<w:LsdException Locked="false" Priority="37" Name="Bibliography"/>
<w:LsdException Locked="false" Priority="39" QFormat="true" Name="TOC Heading"/>
</w:LatentStyles>
</xml><![endif]--><!--[if gte mso 10]>
<style>
/* Style Definitions */
table.MsoNormalTable
{mso-style-name:"Normal Tablo";
mso-tstyle-rowband-size:0;
mso-tstyle-colband-size:0;
mso-style-noshow:yes;
mso-style-priority:99;
mso-style-parent:"";
mso-padding-alt:0in 5.4pt 0in 5.4pt;
mso-para-margin-top:0in;
mso-para-margin-right:0in;
mso-para-margin-bottom:8.0pt;
mso-para-margin-left:0in;
line-height:107%;
mso-pagination:widow-orphan;
font-size:11.0pt;
font-family:"Calibri","sans-serif";
mso-ascii-font-family:Calibri;
mso-ascii-theme-font:minor-latin;
mso-hansi-font-family:Calibri;
mso-hansi-theme-font:minor-latin;
mso-fareast-language:EN-US;}
</style>
<![endif]--><span style="font-family: "calibri" , "sans-serif"; font-size: 11.0pt; line-height: 107%;"><br /></span>
You can also configure your James server according to the instructions listed in <span id="goog_358169819"></span><span id="goog_358169824"></span><span id="goog_358169833"></span><a href="https://www.blogger.com/" target="_blank">this </a><span id="goog_358169834"></span><span id="goog_358169825"></span><span id="goog_358169820"></span>link.These configuration files should be in <span style="font-family: "calibri" , sans-serif; font-size: 15px; line-height: 15.6933336257935px;">${JAMES_HOME}/apps/james/conf </span>directory.<br />
<br />
In the config.xml you may also configure the gateway, gatewayPort,gatewayusername and gatewayPassword properties to be able to send emails to an external SMTP server.Remember however that, if you want to send email to an external SMTP server, you may need to sure that your James server IP address and your domain IP address are same.That's because Email servers do a reverse dns query by comparing the IP of the domain and the IP of the sender email server and doesn't accept the email if they are not the same.You can get more information about reverse dns from <a href="http://wiki.junkemailfilter.com/index.php/Fixing_Reverse_DNS" target="_blank">this</a> link.<br />
<br />
After completing the configuration you can now go to the bin directory and run the run.bat or run.sh file.Be sure to set the JAVA_HOME environment variable at this point. You should see the following command lines now.<br />
<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEg0TXQb6RNbN0AVBWU90Ryjz-Nk4i86nZCFImoTdqAOAjBU3ojz_y5fTh98L02Zyl5OY0LkV3Hklmi6vFjYADhKFmTV09Ez8eqakojV0rRYIm288CxCxNp0uuodVeUanGPqoQqPGYv-PAfj/s1600/1.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img alt="Using JavaMail API" border="0" height="161" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEg0TXQb6RNbN0AVBWU90Ryjz-Nk4i86nZCFImoTdqAOAjBU3ojz_y5fTh98L02Zyl5OY0LkV3Hklmi6vFjYADhKFmTV09Ez8eqakojV0rRYIm288CxCxNp0uuodVeUanGPqoQqPGYv-PAfj/s1600/1.png" title="Using JavaMail API" width="320" /></a></div>
<div style="text-align: center;">
Figure 1</div>
<div style="text-align: center;">
<br /></div>
<div style="text-align: left;">
You can now connect to the James server by telnet using the following command.</div>
<div style="text-align: left;">
<br /></div>
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhmmHkqaz0mg-wXjTKEpyEpILCPvm42IbpfPh2ks9UepsD6dShyphenhyphenQRZJS0FFhbxxQFc_bLtIu5LR98DQnOzl5hJXtVa6fzpqP3rX_FKU75ritpuURkkYf0Rc2IS7PfKfyrhyphenhyphen6ikVfQdfofW6/s1600/2.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img alt="Using JavaMail API" border="0" height="161" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhmmHkqaz0mg-wXjTKEpyEpILCPvm42IbpfPh2ks9UepsD6dShyphenhyphenQRZJS0FFhbxxQFc_bLtIu5LR98DQnOzl5hJXtVa6fzpqP3rX_FKU75ritpuURkkYf0Rc2IS7PfKfyrhyphenhyphen6ikVfQdfofW6/s1600/2.png" title="Using JavaMail API" width="320" /> </a></div>
<div class="separator" style="clear: both; text-align: center;">
Figure 2 </div>
<div class="separator" style="clear: both; text-align: center;">
<br /></div>
<div style="text-align: left;">
If you are using windows 7 you can enable the telnet as shown in <a href="http://social.technet.microsoft.com/wiki/contents/articles/910.windows-7-enabling-telnet-client.aspx" target="_blank">this </a>link.</div>
<div style="text-align: left;">
Enter root for login id and password and use the adduser command to add users as shown in the following figure.We add two users admin and test to use in our examples.</div>
<div style="text-align: left;">
<br /></div>
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhzaaGd2hnoyYiYhnPvNZ65Rr0PDYPQ78KMoOUIN8PT9owDVBNHugkM8zKzUU5a819ozODi2BUcKC54gWWDDP3znC0DJL2WZk_RMkLoPeES9Fr0j-jKMZLIJOA3mQpNLEaGKAQvQ_lCddFO/s1600/3.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img alt="Using JavaMail API" border="0" height="87" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhzaaGd2hnoyYiYhnPvNZ65Rr0PDYPQ78KMoOUIN8PT9owDVBNHugkM8zKzUU5a819ozODi2BUcKC54gWWDDP3znC0DJL2WZk_RMkLoPeES9Fr0j-jKMZLIJOA3mQpNLEaGKAQvQ_lCddFO/s1600/3.png" title="Using JavaMail API" width="320" /> </a></div>
<div class="separator" style="clear: both; text-align: center;">
Figure 3 </div>
<div style="text-align: center;">
<br /></div>
<div style="text-align: left;">
<u style="font-family: 'Times New Roman', serif; font-size: 16px; font-weight: bold;">Java Mail API:</u></div>
<div style="text-align: left;">
<br /></div>
<div style="text-align: left;">
To use Java Mail API you need to download the required jar from <a href="https://java.net/projects/javamail/pages/Home" target="_blank">this </a>link.You just need javax.mail.jar which include SMTP, IMAP and POP3 protocol providers.<br />
<br />
<u style="font-family: 'Times New Roman', serif; font-size: 16px; font-weight: bold;">Sending Email:</u><br />
<u style="font-family: 'Times New Roman', serif; font-size: 16px; font-weight: bold;"><br /></u>
Below java code is an example of sending an email from the "admin" user to the "test" user we have just created.<br />
<br />
package tr.com.aligelenler;<br />
<br />
import java.text.SimpleDateFormat;<br />
import java.util.Date;<br />
import java.util.Properties;<br />
<br />
import javax.mail.Authenticator;<br />
import javax.mail.Message;<br />
import javax.mail.MessagingException;<br />
import javax.mail.PasswordAuthentication;<br />
import javax.mail.Session;<br />
import javax.mail.Transport;<br />
import javax.mail.internet.InternetAddress;<br />
import javax.mail.internet.MimeMessage;<br />
<br />
public class SendMail {<br />
<br />
private static final String USER = "admin";<br />
private static final String PASSWORD = "admin";<br />
public static String FROM = "admin@localhost";<br />
public static String TO = "test@localhost";<br />
<br />
public static void main(String[] args) {<br />
try {<br />
Properties props = new Properties();<br />
props.put("mail.transport.protocol", "smtp");<br />
props.put("mail.smtp.host", "localhost");<br />
props.put("mail.smtp.port", "1125");<br />
props.put("mail.smtp.auth", "true");<br />
props.put("mail.debug", "true");<br />
Session session = Session.getInstance(props, new Authenticator() {<br />
@Override<br />
protected PasswordAuthentication getPasswordAuthentication() {<br />
return new PasswordAuthentication(USER, PASSWORD);<br />
}<br />
});<br />
MimeMessage msg = new MimeMessage(session);<br />
msg.setFrom(new InternetAddress(FROM));<br />
msg.addRecipients(Message.RecipientType.TO,InternetAddress.parse(TO));<br />
msg.setSubject("You have a new mail");<br />
msg.setText("This is a test message send at " + new SimpleDateFormat("dd.MM.yyyy HH:mm:ss.SSSZ").format(new Date()));<br />
Transport.send(msg);<br />
} catch (MessagingException e) {<br />
System.out.println(e.getMessage());<br />
}<br />
}<br />
}<br />
<div>
<br /></div>
</div>
<div style="text-align: center;">
<div style="text-align: left;">
<span id="goog_613876563"></span>This code will send an email from admin to test and you can check that mail by using the following command lines in Figure 4 after typing the telnet localhost 1110.</div>
<div style="text-align: left;">
<br /></div>
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgknVKCkQKbOa5uoIrqJULUYWTEmjyTu2LF7tVg9ptsVO7TcZ8yr-PrRB_L1G3ht8iNFo0vsfMJRNQjKIqGlLVpOXTUo-giHXunU6HylK7JHAUoimtmyBI9YjcYEUqq6fS02zk8V_nW2otT/s1600/javaMailImage.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img alt="Using JavaMail API" border="0" height="161" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgknVKCkQKbOa5uoIrqJULUYWTEmjyTu2LF7tVg9ptsVO7TcZ8yr-PrRB_L1G3ht8iNFo0vsfMJRNQjKIqGlLVpOXTUo-giHXunU6HylK7JHAUoimtmyBI9YjcYEUqq6fS02zk8V_nW2otT/s1600/javaMailImage.png" title="Using JavaMail API" width="320" /></a></div>
<div class="separator" style="clear: both; text-align: center;">
Figure 4</div>
<div class="separator" style="clear: both; text-align: center;">
<br /></div>
<div class="separator" style="clear: both; text-align: left;">
You can also use the following properties rather than using the </div>
<div class="separator" style="clear: both; text-align: left;">
msg.setFrom(new InternetAddress(FROM)); line.</div>
<div style="text-align: left;">
props.put("mail.host", "localhost");</div>
<div style="text-align: left;">
props.put("mail.user", "admin");</div>
<div style="text-align: left;">
<br /></div>
<div style="text-align: left;">
Here we see the USER and the FROM values are same.Actually if the SMTP authentication enabled,the USER given in the authentication is used as the FROM attribute if your user is not an administrator roled user, so there is no need to define FROM attribute.However if the STMP authentication is not enabled you need to set FROM attribute or use the "mail.user" property.</div>
<div style="text-align: left;">
<br /></div>
<div style="text-align: left;">
<u style="font-family: 'Times New Roman', serif; font-size: 16px; font-weight: bold;">Reading and Deleting Email:</u></div>
<div style="text-align: left;">
<br /></div>
<div style="text-align: left;">
Below java code is an example of reading and deleting inbox folder of the test user.The user provided with the password in the authenticator which is "test" is used to fetch the inbox.</div>
<div style="text-align: left;">
<br /></div>
<div style="text-align: left;">
package tr.com.aligelenler;</div>
<div style="text-align: left;">
<br /></div>
<div style="text-align: left;">
import java.io.IOException;</div>
<div style="text-align: left;">
<br /></div>
<div style="text-align: left;">
import java.util.Properties;</div>
<div style="text-align: left;">
<br /></div>
<div style="text-align: left;">
import javax.mail.Authenticator;</div>
<div style="text-align: left;">
import javax.mail.Flags;</div>
<div style="text-align: left;">
import javax.mail.Folder;</div>
<div style="text-align: left;">
import javax.mail.Message;</div>
<div style="text-align: left;">
import javax.mail.MessagingException;</div>
<div style="text-align: left;">
import javax.mail.PasswordAuthentication;</div>
<div style="text-align: left;">
import javax.mail.Session;</div>
<div style="text-align: left;">
import javax.mail.Store;</div>
<div style="text-align: left;">
import javax.mail.internet.MimeMessage;</div>
<div style="text-align: left;">
<br /></div>
<div style="text-align: left;">
public class ReadMail {</div>
<div style="text-align: left;">
<br /></div>
<div style="text-align: left;">
<span class="Apple-tab-span" style="white-space: pre;"> </span>private static final String USER = "test";</div>
<div style="text-align: left;">
<span class="Apple-tab-span" style="white-space: pre;"> </span>private static final String PASSWORD = "test";</div>
<div style="text-align: left;">
<span class="Apple-tab-span" style="white-space: pre;"> </span>private static final boolean CLEAR = false;</div>
<div style="text-align: left;">
<br /></div>
<div style="text-align: left;">
<span class="Apple-tab-span" style="white-space: pre;"> </span>public static void main(String[] args) {</div>
<div style="text-align: left;">
<span class="Apple-tab-span" style="white-space: pre;"> </span>Store store = null;</div>
<div style="text-align: left;">
<span class="Apple-tab-span" style="white-space: pre;"> </span>Folder inbox = null;</div>
<div style="text-align: left;">
<span class="Apple-tab-span" style="white-space: pre;"> </span>try {</div>
<div style="text-align: left;">
<span class="Apple-tab-span" style="white-space: pre;"> </span>Properties props = new Properties();</div>
<div style="text-align: left;">
<span class="Apple-tab-span" style="white-space: pre;"> </span>props.put("mail.pop3.host", "localhost");</div>
<div style="text-align: left;">
<span class="Apple-tab-span" style="white-space: pre;"> </span>props.put("mail.pop3.port", "1110");</div>
<div style="text-align: left;">
<span class="Apple-tab-span" style="white-space: pre;"> </span>props.put("mail.store.protocol", "pop3");</div>
<div style="text-align: left;">
<span class="Apple-tab-span" style="white-space: pre;"> </span>props.put("mail.debug", "false");</div>
<div style="text-align: left;">
<span class="Apple-tab-span" style="white-space: pre;"> </span></div>
<div style="text-align: left;">
<span class="Apple-tab-span" style="white-space: pre;"> </span>Session session = Session.getInstance(props, new Authenticator() {</div>
<div style="text-align: left;">
<span class="Apple-tab-span" style="white-space: pre;"> </span>@Override</div>
<div style="text-align: left;">
<span class="Apple-tab-span" style="white-space: pre;"> </span>protected PasswordAuthentication getPasswordAuthentication() {</div>
<div style="text-align: left;">
return new PasswordAuthentication(USER, PASSWORD);</div>
<div style="text-align: left;">
}</div>
<div style="text-align: left;">
<span class="Apple-tab-span" style="white-space: pre;"> </span>});</div>
<div style="text-align: left;">
<span class="Apple-tab-span" style="white-space: pre;"> </span>store = session.getStore();</div>
<div style="text-align: left;">
<span class="Apple-tab-span" style="white-space: pre;"> </span>store.connect();</div>
<div style="text-align: left;">
<span class="Apple-tab-span" style="white-space: pre;"> </span>Folder root = store.getDefaultFolder();</div>
<div style="text-align: left;">
<span class="Apple-tab-span" style="white-space: pre;"> </span>inbox = root.getFolder("inbox");</div>
<div style="text-align: left;">
<span class="Apple-tab-span" style="white-space: pre;"> </span>inbox.open(Folder.READ_WRITE);</div>
<div style="text-align: left;">
<span class="Apple-tab-span" style="white-space: pre;"> </span>Message[] mails = inbox.getMessages();</div>
<div style="text-align: left;">
<span class="Apple-tab-span" style="white-space: pre;"> </span>if (mails.length == 0) {</div>
<div style="text-align: left;">
<span class="Apple-tab-span" style="white-space: pre;"> </span>System.out.println("There are no messages");</div>
<div style="text-align: left;">
<span class="Apple-tab-span" style="white-space: pre;"> </span>}</div>
<div style="text-align: left;">
<span class="Apple-tab-span" style="white-space: pre;"> </span>for (int i = 0; i < mails.length; i++) {</div>
<div style="text-align: left;">
<span class="Apple-tab-span" style="white-space: pre;"> </span>MimeMessage mail = (MimeMessage) mails[i];</div>
<div style="text-align: left;">
<span class="Apple-tab-span" style="white-space: pre;"> </span>System.out.println("From: " + mail.getFrom()[0]);</div>
<div style="text-align: left;">
<span class="Apple-tab-span" style="white-space: pre;"> </span>System.out.println("To: " + mail.getRecipients(Message.RecipientType.TO)[0]);</div>
<div style="text-align: left;">
<span class="Apple-tab-span" style="white-space: pre;"> </span>System.out.println("Subject: " + mail.getSubject());</div>
<div style="text-align: left;">
<span class="Apple-tab-span" style="white-space: pre;"> </span>System.out.println("Content: " + mail.getContent());</div>
<div style="text-align: left;">
<span class="Apple-tab-span" style="white-space: pre;"> </span>if (CLEAR) {</div>
<div style="text-align: left;">
<span class="Apple-tab-span" style="white-space: pre;"> </span>mail.setFlag(Flags.Flag.DELETED, true);</div>
<div style="text-align: left;">
<span class="Apple-tab-span" style="white-space: pre;"> </span>}</div>
<div style="text-align: left;">
<span class="Apple-tab-span" style="white-space: pre;"> </span>}</div>
<div style="text-align: left;">
<span class="Apple-tab-span" style="white-space: pre;"> </span>} catch (MessagingException e) {</div>
<div style="text-align: left;">
<span class="Apple-tab-span" style="white-space: pre;"> </span>System.out.println(e.getMessage());</div>
<div style="text-align: left;">
<span class="Apple-tab-span" style="white-space: pre;"> </span>} catch (IOException e) {</div>
<div style="text-align: left;">
<span class="Apple-tab-span" style="white-space: pre;"> </span>System.out.println(e.getMessage());</div>
<div style="text-align: left;">
<span class="Apple-tab-span" style="white-space: pre;"> </span>} finally {</div>
<div style="text-align: left;">
<span class="Apple-tab-span" style="white-space: pre;"> </span>try {</div>
<div style="text-align: left;">
<span class="Apple-tab-span" style="white-space: pre;"> </span>if (inbox != null && inbox.isOpen())</div>
<div style="text-align: left;">
<span class="Apple-tab-span" style="white-space: pre;"> </span>inbox.close(true);</div>
<div style="text-align: left;">
<span class="Apple-tab-span" style="white-space: pre;"> </span>if (store != null)</div>
<div style="text-align: left;">
<span class="Apple-tab-span" style="white-space: pre;"> </span>store.close();</div>
<div style="text-align: left;">
<span class="Apple-tab-span" style="white-space: pre;"> </span>} catch (MessagingException e) {</div>
<div style="text-align: left;">
<span class="Apple-tab-span" style="white-space: pre;"> </span>System.out.println(e.getMessage());</div>
<div style="text-align: left;">
<span class="Apple-tab-span" style="white-space: pre;"> </span>}</div>
<div style="text-align: left;">
<span class="Apple-tab-span" style="white-space: pre;"> </span>}</div>
<div style="text-align: left;">
<span class="Apple-tab-span" style="white-space: pre;"> </span>}</div>
<div style="text-align: left;">
}</div>
<div style="text-align: left;">
<br /></div>
<div style="text-align: left;">
The output of this java program will be the following.</div>
<div style="text-align: left;">
<br /></div>
<div style="text-align: left;">
<div>
From: admin@localhost</div>
<div>
To: test@localhost</div>
<div>
Subject: You have a new mail</div>
<div>
Content: This is a test message send at 09.11.2014 15:22:08.841+0200</div>
<div>
<br /></div>
<div>
If you change the CLEAR property to true the inbox folder will be cleared.</div>
</div>
<div style="text-align: left;">
When we are reading or deleting email we must provide the username and password using the Authenticator class and the fetched mails will be the mails of the provided user.</div>
<div style="text-align: left;">
<br /></div>
<div style="text-align: left;">
<span style="font-family: "times new roman" , serif;"><b><u>Conclusion:</u></b></span></div>
<div style="text-align: left;">
<span style="font-family: "times new roman" , serif;"><b><u><br /></u></b></span></div>
<div style="text-align: left;">
<span style="font-family: "times new roman" , serif;"> We see how to send email using SMTP protocol and read/delete email using POP3 protocol using Apache James Server after describing the email protocols and understanding the James server configuration.Normally you need to enable authentication of your SMTP server for security reasons and your client should provide the username and password using the Authenticator class.In this way your authentication user will be the sender.Similarly when you want to read your emails you must provide your username and password.</span></div>
<div style="text-align: center;">
<br /></div>
<div style="text-align: left;">
You can download the source code from <a href="https://github.com/agelenler/myblog/tree/master/java/src/java.mail" target="_blank">here</a>.</div>
</div>
<br />Ali Gelenlerhttp://www.blogger.com/profile/09439697648573423668noreply@blogger.com0tag:blogger.com,1999:blog-3858181542467916490.post-29731038925374434802014-11-07T13:32:00.001+02:002018-02-20T16:48:47.451+03:00Using Bitwise and Bitshift Operators In Java<u style="font-family: 'Times New Roman', serif; font-size: 16px; font-weight: bold;">Introduction:</u><br />
<u style="font-family: 'Times New Roman', serif; font-size: 16px; font-weight: bold;"><br /></u>
<span style="font-family: "times new roman" , serif;"> Today I want to talk about less commonly used and known operators that can be used on integral numbers in Java, Bitwise and Bitshift operators.</span><span style="font-family: "times new roman" , serif;">Bitwise</span><span style="font-family: "times new roman" , serif;"> </span><span style="font-family: "times new roman" , serif;">operators most commonly used in masking operations and bitshift operators may be used in encyription or hashing algorithms.I'll try to explain them with some small examples.</span><br />
<span style="font-family: "times new roman" , serif;"><br /></span>
<u style="font-family: 'Times New Roman', serif; font-size: 16px; font-weight: bold;">Bitwise Operators:</u><br />
<b style="font-family: 'Times New Roman', serif; font-size: 16px; text-decoration: underline;"><br /></b>
<b style="font-family: 'Times New Roman', serif; font-size: 16px; text-decoration: underline;">&(Bitwise and) operator</b><u style="font-family: 'Times New Roman', serif; font-size: 16px;">:</u><span style="font-family: "times new roman" , serif; font-size: 16px;"> Used to accomplish "and" operation bit by bit.</span><br />
<br />
<u>Example:</u><br />
int a = 2; //00000000000000000000000000000010 ->32 bit signed(leftmost bit for sign)<br />
<span style="font-family: "times new roman" , serif; font-size: 16px;">int b = 7: //</span>00000000000000000000000000000111 ->32 bit signed(leftmost bit for sign)<br />
<span style="font-family: "times new roman" , serif;">int result = a & b;//</span>00000000000000000000000000000010<br />
<span style="font-family: "times new roman" , serif; font-size: 16px;">System.out.println("a & b = " + </span><span style="font-family: "times new roman" , serif;">result</span><span style="font-family: "times new roman" , serif;"> </span><span style="font-family: "times new roman" , serif; font-size: 16px;">); // prints 2</span><br />
<span style="font-family: "times new roman" , serif; font-size: 16px;"><br /></span>
<u style="font-family: 'Times New Roman', serif; font-size: 16px; font-weight: bold;">Note</u><span style="font-family: "times new roman" , serif; font-size: 16px;"><b>:</b> All the primitive types are signed in Java.Therefore the max value of an int in java is max 2^31 -1 and min - </span><span style="font-family: "times new roman" , serif; font-size: 16px;">2^31.That's because the leftmost bit is used for sign and zero is count in positive numbers that is 0000..0000 is used for zero.</span><br />
<span style="font-family: "times new roman" , serif; font-size: 16px;"> </span><br />
<u style="font-family: 'Times New Roman', serif; font-size: 16px;"><b>| </b></u><u style="font-family: 'Times New Roman', serif; font-size: 16px;"><b>(Bitwise inclusive or) </b></u><u style="font-family: 'Times New Roman', serif; font-size: 16px;"><b> operator</b>:</u><span style="font-family: "times new roman" , serif; font-size: 16px;"> Used to accomplish "inclusive or" operation bit by bit.</span><br />
<br />
<u>Example: </u><br />
int a = 2; //00000000000000000000000000000010 ->32 bit signed(leftmost bit for sign)<br />
<span style="font-family: "times new roman" , serif; font-size: 16px;">int b = 7: //</span>00000000000000000000000000000111 ->32 bit signed(leftmost bit for sign)<br />
<span style="font-family: "times new roman" , serif;">int result = a | b;//</span>00000000000000000000000000000111<br />
<span style="font-family: "times new roman" , serif; font-size: 16px;">System.out.println("a | b = " + </span><span style="font-family: "times new roman" , serif;">result)</span><span style="font-family: "times new roman" , serif; font-size: 16px;">; // prints 7</span><br />
<span style="font-family: "times new roman" , serif; font-size: 16px;"><br /></span>
<u style="font-family: 'Times New Roman', serif; font-size: 16px;"><b>^</b></u><u style="font-family: 'Times New Roman', serif; font-size: 16px;"><b>(Bitwise exclusive or) </b></u><u style="font-family: 'Times New Roman', serif; font-size: 16px;"><b> operator</b>:</u><span style="font-family: "times new roman" , serif; font-size: 16px;"> Used to accomplish "exclusive or" operation bit by bit.</span><br />
<br />
<u>Example:</u><br />
int a = 2; //00000000000000000000000000000010 ->32 bit signed(leftmost bit for sign)<br />
<span style="font-family: "times new roman" , serif; font-size: 16px;">int b = 7: //</span>00000000000000000000000000000111 ->32 bit signed(leftmost bit for sign)<br />
<span style="font-family: "times new roman" , serif;">int result = a ^ b;//</span>00000000000000000000000000000101<br />
<span style="font-family: "times new roman" , serif; font-size: 16px;">System.out.println("a ^ b = " + </span><span style="font-family: "times new roman" , serif;">result </span><span style="font-family: "times new roman" , serif; font-size: 16px;">); // prints 5</span><br />
<span style="font-family: "times new roman" , serif; font-size: 16px;"><br /></span>
<span style="font-family: "times new roman" , serif; font-size: 16px;"> </span><u style="font-family: 'Times New Roman', serif; font-size: 16px;"><b>~</b></u><u style="font-family: 'Times New Roman', serif; font-size: 16px;"><b>(Bitwise negate) </b></u><u style="font-family: 'Times New Roman', serif; font-size: 16px;"><b> operator</b>:</u><span style="font-family: "times new roman" , serif; font-size: 16px;"> Used to accomplish "negate" operation bit by bit.</span><br />
<br />
<u>Example: </u><br />
int a = 2; //00000000000000000000000000000010 ->32 bit signed(leftmost bit for sign)<br />
<span style="font-family: "times new roman" , serif; font-size: 16px;">int b = 7: //</span>00000000000000000000000000000111 ->32 bit signed(leftmost bit for sign)<br />
<span style="font-family: "times new roman" , serif;">int result = ~a;//</span>11111111111111111111111111111101 (negative since the leftmost is 1)<br />
<span style="font-family: "times new roman" , serif; font-size: 16px;">System.out.println("</span><span style="font-family: "times new roman" , serif;">~a</span><span style="font-family: "times new roman" , serif; font-size: 16px;"> = " + </span><span style="font-family: "times new roman" , serif;">result </span><span style="font-family: "times new roman" , serif; font-size: 16px;">); // prints negative 3</span><br />
<span style="font-family: "times new roman" , serif; font-size: 16px;">*The result is the 2's complement of three that is negative 3.</span><br />
<span style="font-family: "times new roman" , serif;">result = ~b;//</span>11111111111111111111111111111000 (negative since the leftmost is 1)<br />
<span style="font-family: "times new roman" , serif; font-size: 16px;">System.out.println("</span><span style="font-family: "times new roman" , serif;">~b</span><span style="font-family: "times new roman" , serif; font-size: 16px;"> = " + </span><span style="font-family: "times new roman" , serif;">result </span><span style="font-family: "times new roman" , serif; font-size: 16px;">); // prints negative </span><span style="font-family: "times new roman" , serif; font-size: 16px;">8</span><br />
<span style="font-family: "times new roman" , serif; font-size: 16px;">*The result is the 2's complement of </span><span style="font-family: "times new roman" , serif; font-size: 16px;">eight </span><span style="font-family: "times new roman" , serif; font-size: 16px;">that is negative </span><span style="font-family: "times new roman" , serif; font-size: 16px;">8</span><span style="font-family: "times new roman" , serif; font-size: 16px;">.</span><br />
<span style="font-family: "times new roman" , serif; font-size: 16px;"><br /></span>
<u style="font-family: 'Times New Roman', serif; font-size: 16px; font-weight: bold;">2's Complement Form</u><span style="font-family: "times new roman" , serif; font-size: 16px;"><b>:</b>The computers use </span><span style="font-family: "times new roman" , serif; font-size: 16px;">2's complement form for the negative values so that the mathematical operations made easily like adding 2 + (-2) instead of subtracting.As an example lets obtain the 2's complement for 3 to get the form of -3 used in computer systems.</span><br />
<span style="font-family: "times new roman" , serif; font-size: 16px;"><br /></span>
<span style="font-family: "times new roman" , serif; font-size: 16px;">1.) 3 = </span>00000000000000000000000000000011<br />
2.) change 1->0 and 0->1 and get 11111111111111111111111111111100<br />
3.) add 1 and get 11111111111111111111111111111101<br />
<br />
As you can see, the result in the step 3 is the representation of -3 which we printed out in the previous example as the result of ~a.<br />
<br />
<u style="font-family: 'Times New Roman', serif; font-size: 16px; font-weight: bold;">Bitshift Operators:</u><br />
<br />
<u style="font-family: 'Times New Roman', serif; font-size: 16px;"><b>>></b></u><u style="font-family: 'Times New Roman', serif; font-size: 16px;"><b>(Bitwise signed right shift) </b></u><u style="font-family: 'Times New Roman', serif; font-size: 16px;"><b> and <<</b></u><u style="font-family: 'Times New Roman', serif; font-size: 16px;"><b>(Bitwise </b></u><u style="font-family: 'Times New Roman', serif; font-size: 16px;"><b>signed left shift</b></u><u style="font-family: 'Times New Roman', serif; font-size: 16px;"><b>) </b></u><u style="font-family: 'Times New Roman', serif; font-size: 16px;"><b> operators</b>:</u><span style="font-family: "times new roman" , serif; font-size: 16px;"> Used to shift a bit pattern to left or right by the given number. If the number is negative the signed shift operator will complete the number with 1 instead 0.</span><br />
<span style="font-family: "times new roman" , serif; font-size: 16px;"><br /></span>
<span style="font-family: "times new roman" , serif; font-size: 16px;"><u>Example:</u></span><br />
int a = 2; //00000000000000000000000000000010 ->32 bit signed(leftmost bit for sign)<br />
<span style="font-family: "times new roman" , serif; font-size: 16px;">int b = 7: //</span>00000000000000000000000000000111 ->32 bit signed(leftmost bit for sign)<br />
<span style="font-family: "times new roman" , serif; font-size: 16px;">int c = -7: //</span>11111111111111111111111111111001 ->32 bit signed(leftmost bit for sign)<br />
int result = a << 2;//00000000000000000000000000001000<br />
<span style="font-family: "times new roman" , serif; font-size: 16px;">System.out.println("</span>a << 2<span style="font-family: "times new roman" , serif; font-size: 16px;"> = " + </span><span style="font-family: "times new roman" , serif;">result </span><span style="font-family: "times new roman" , serif; font-size: 16px;">); // prints </span><span style="font-family: "times new roman" , serif; font-size: 16px;">8</span><br />
result = b >> 2;//00000000000000000000000000000001<br />
<span style="font-family: "times new roman" , serif; font-size: 16px;">System.out.println("</span>b >> 2<span style="font-family: "times new roman" , serif; font-size: 16px;"> = " + </span><span style="font-family: "times new roman" , serif;">result </span><span style="font-family: "times new roman" , serif; font-size: 16px;">); // prints </span><span style="font-family: "times new roman" , serif; font-size: 16px;">1</span><br />
result = c >> 2;//11111111111111111111111111111110<br />
<span style="font-family: "times new roman" , serif; font-size: 16px;"></span><br />
<span style="font-family: "times new roman" , serif; font-size: 16px;">System.out.println("</span>c >> 2<span style="font-family: "times new roman" , serif; font-size: 16px;"> = " + </span><span style="font-family: "times new roman" , serif;">result </span><span style="font-family: "times new roman" , serif; font-size: 16px;">); // prints </span><span style="font-family: "times new roman" , serif; font-size: 16px;">-2</span><br />
<span style="font-family: "times new roman" , serif; font-size: 16px;"><br /></span>
<u style="font-family: 'Times New Roman', serif; font-size: 16px;"><b>>>></b></u><u style="font-family: 'Times New Roman', serif; font-size: 16px;"><b>(Bitwise unsigned right shift)</b></u><u style="font-family: 'Times New Roman', serif; font-size: 16px;"><b> operator:</b></u><span style="font-family: "times new roman" , serif; font-size: 16px;"> Used to shift zero into the leftmost position </span><span style="font-family: "times new roman" , serif; font-size: 16px;">by the given number even if the number is negative. (unlike signed shift operator)</span><br />
<span style="font-family: "times new roman" , serif; font-size: 16px;"><br /></span>
<span style="font-family: "times new roman" , serif; font-size: 16px;"><u>Example:</u></span><br />
int a = 2; //00000000000000000000000000000010 ->32 bit signed(leftmost bit for sign)<br />
<span style="font-family: "times new roman" , serif; font-size: 16px;">int b = 7: //</span>00000000000000000000000000000111 ->32 bit signed(leftmost bit for sign)<br />
<span style="font-family: "times new roman" , serif; font-size: 16px;">int c = -7: //</span>11111111111111111111111111111001 ->32 bit signed(leftmost bit for sign)<br />
int result = a >>> 1;//00000000000000000000000000000001<br />
<span style="font-family: "times new roman" , serif; font-size: 16px;">System.out.println("</span>a >>> 1<span style="font-family: "times new roman" , serif; font-size: 16px;"> = " + </span><span style="font-family: "times new roman" , serif;">result </span><span style="font-family: "times new roman" , serif; font-size: 16px;">); // prints </span><span style="font-family: "times new roman" , serif; font-size: 16px;">1</span><br />
result = b >>> 1;//00000000000000000000000000000011<br />
<span style="font-family: "times new roman" , serif; font-size: 16px;">System.out.println("</span>b >>> 1<span style="font-family: "times new roman" , serif; font-size: 16px;"> = " + </span><span style="font-family: "times new roman" , serif;">result </span><span style="font-family: "times new roman" , serif; font-size: 16px;">); // prints </span><span style="font-family: "times new roman" , serif; font-size: 16px;">3</span><br />
result = c >>> 2;//00111111111111111111111111111110 (in 2s complement form)<br />
<span style="font-family: "times new roman" , serif; font-size: 16px;"></span><br />
<span style="font-family: "times new roman" , serif; font-size: 16px;">System.out.println("</span>c >>> 2<span style="font-family: "times new roman" , serif; font-size: 16px;"> = " + </span><span style="font-family: "times new roman" , serif;">result </span><span style="font-family: "times new roman" , serif; font-size: 16px;">); // prints </span><span style="font-family: "times new roman" , serif; font-size: 16px;">1073741822</span><br />
<br />
<span style="font-family: "times new roman" , serif; font-size: 16px;"><u style="font-weight: bold;">An Example:</u></span><br />
<br />
Say we want to count the number of ones in a number. To do that we need to find a way to correctly extract the information from each bit of a number. We can accomplish this by using a mask. For example if you mask each bit with 1 using bitwise and operator, only the bits with value 1 will return 1 and other will return zero. We can use the below method which compare the least significant bit in number by 1 and shift the number to right by 1. Note that this is an unsigned shift.<br />
<br />
int getNumberOfOnesInNumber(int num) {<br />
int countOnes = 0;<br />
while (num != 0) {<br />
if ((num & 1 ) == 1) { //compare the LSB with 1<br />
countOnes ++;<br />
}<br />
num = num>>> 1;<br />
}<br />
return countOnes ;<br />
}<br />
<span style="font-family: "times new roman" , serif; font-size: 16px;"><u style="font-weight: bold;"><br /></u></span>
<span style="font-family: "times new roman" , serif; font-size: 16px;"><br /></span>
<u style="font-family: 'Times New Roman', serif; font-size: 16px; font-weight: bold;">Real World Examples:</u><br />
<u style="font-family: 'Times New Roman', serif; font-size: 16px; font-weight: bold;"><br /></u>
<span style="font-family: "times new roman" , serif; font-size: 16px; font-weight: bold;">1.)</span><span style="font-family: "times new roman" , serif; font-size: 16px; font-weight: bold;"> Compare roles:</span><br />
<span style="font-family: "times new roman" , serif; font-size: 16px; font-weight: bold;"><br /></span>
<span style="font-family: "times new roman" , serif; font-size: 16px; font-weight: bold;"> </span><span style="font-family: "times new roman" , serif; font-size: 16px;">When you need masking you can use & operator like below.</span><br />
<span style="font-family: "times new roman" , serif; font-size: 16px;"><br /></span>
<span style="font-family: "times new roman" , serif; font-size: 16px;"><u>Example:</u> suppose in a byte the right most bit shows whether it's an admin or not.</span><br />
<span style="font-family: "times new roman" , serif; font-size: 16px;">byte admin = 1;//00000001</span><br />
<span style="font-family: "times new roman" , serif; font-size: 16px;">byte </span><span style="font-family: "times new roman" , serif; font-size: 16px;">role1 </span><span style="font-family: "times new roman" , serif; font-size: 16px;">= 1;//00000001 --> admin</span><br />
<span style="font-family: "times new roman" , serif; font-size: 16px;">byte </span><span style="font-family: "times new roman" , serif; font-size: 16px;">role2 = 2;//00000010 --> not admin</span><br />
<span style="font-family: "times new roman" , serif; font-size: 16px;">byte </span><span style="font-family: "times new roman" , serif; font-size: 16px;">role3 = 3;//00000011 --> admin</span><br />
<span style="font-family: "times new roman" , serif; font-size: 16px;">byte </span><span style="font-family: "times new roman" , serif; font-size: 16px;">readRoleFromDatabase = 3;//say we read 3 from the database for the user's role.</span><br />
<span style="font-family: "times new roman" , serif; font-size: 16px;">If you need to understand whether a user in the database is in role admin you can use "bitwise and";</span><br />
<span style="font-family: "times new roman" , serif; font-size: 16px;"> if ((</span><span style="font-family: "times new roman" , serif; font-size: 16px;">readRoleFromDatabase</span><span style="font-family: "times new roman" , serif; font-size: 16px;"> & </span><span style="font-family: "times new roman" , serif; font-size: 16px;">admin </span><span style="font-family: "times new roman" , serif; font-size: 16px;">) > 0</span><span style="font-family: "times new roman" , serif; font-size: 16px;">) {</span><br />
<span style="font-family: "times new roman" , serif; font-size: 16px;"> System.out.println("admin");</span><br />
<span style="font-family: "times new roman" , serif; font-size: 16px;"> }</span><br />
<span style="font-family: "times new roman" , serif; font-size: 16px;"><br /></span><span style="font-family: "times new roman" , serif; font-size: 16px; font-weight: bold;">2.)</span><span style="font-family: "times new roman" , serif; font-size: 16px; font-weight: bold;"> Check Odd or Even:</span><br />
<span style="font-family: "times new roman" , serif; font-size: 16px; font-weight: bold;"><br /></span>
<span style="font-family: "times new roman" , serif; font-size: 16px; font-weight: bold;"> </span><span style="font-family: "times new roman" , serif; font-size: 16px;">You can use "bitwise and" operator to understand a value is odd or even like below.</span><br />
<span style="font-family: "times new roman" , serif; font-size: 16px;"><br /></span>
<span style="font-family: "times new roman" , serif; font-size: 16px;"><u>Example:</u> </span><br />
<span style="font-family: "times new roman" , serif; font-size: 16px;">byte oddV</span><span style="font-family: "times new roman" , serif;">al = 3;//00000011</span><br />
<span style="font-family: "times new roman" , serif; font-size: 16px;">byte evenV</span><span style="font-family: "times new roman" , serif;">al = 6;//00000110</span><br />
<span style="font-family: "times new roman" , serif; font-size: 16px;">byte </span><span style="font-family: "times new roman" , serif;">compareVal = 1;//00000001</span><br />
<span style="font-family: "times new roman" , serif;"> if ((</span><span style="font-family: "times new roman" , serif; font-size: 16px;">oddV</span><span style="font-family: "times new roman" , serif;">al </span><span style="font-family: "times new roman" , serif;">& </span><span style="font-family: "times new roman" , serif;">compareVal</span><span style="font-family: "times new roman" , serif;">) > 0</span><span style="font-family: "times new roman" , serif;">) {</span><br />
<span style="font-family: "times new roman" , serif;"> </span><span style="font-family: "times new roman" , serif; font-size: 16px;">System.out.println(</span><span style="font-family: "times new roman" , serif; font-size: 16px;">oddV</span><span style="font-family: "times new roman" , serif;">al + </span><span style="font-family: "times new roman" , serif; font-size: 16px;">"is and odd value");</span><br />
<span style="font-family: "times new roman" , serif;"> }</span><br />
<span style="font-family: "times new roman" , serif;"> </span><span style="font-family: "times new roman" , serif;">if ((</span><span style="font-family: "times new roman" , serif; font-size: 16px;">evenV</span><span style="font-family: "times new roman" , serif;">al </span><span style="font-family: "times new roman" , serif;">& </span><span style="font-family: "times new roman" , serif;">compareVal</span><span style="font-family: "times new roman" , serif;">) == 0</span><span style="font-family: "times new roman" , serif;">) {</span><br />
<span style="font-family: "times new roman" , serif;"> </span><span style="font-family: "times new roman" , serif; font-size: 16px;">System.out.println(</span><span style="font-family: "times new roman" , serif; font-size: 16px;">evenV</span><span style="font-family: "times new roman" , serif;">al + </span><span style="font-family: "times new roman" , serif; font-size: 16px;">" is an even value");</span><br />
<span style="font-family: "times new roman" , serif;"> }</span><br />
<span style="font-family: "times new roman" , serif;"><br /></span>
<u style="font-family: 'Times New Roman', serif; font-size: 16px; font-weight: bold;">Note</u><span style="font-family: "times new roman" , serif; font-size: 16px;"><b>: </b>In the real world examples we use byte variables and shows 8 bits for them in the command lines.However in the real world the computers use 4 bytes even for the byte variables because of the memory model of the 32 bits computers.If we really want to use 1 byte for a byte variable we have to use a byte array.Since the byte array itself uses 4 bytes for its memory representation, the byte values in it need not has to have 4 bytes instead they has 1 byte for each variable.</span><br />
<span style="font-family: "times new roman" , serif; font-size: 16px;"><br /></span>
<u style="font-family: 'Times New Roman', serif; font-size: 16px; font-weight: bold;">Conclusion:</u><br />
<u style="font-family: 'Times New Roman', serif; font-size: 16px; font-weight: bold;"><br /></u>
<span style="font-family: "times new roman" , serif; font-size: 16px;"> I tried to summarize the usage of the Bitwise and Bitshift operators in Java.As I said, they can be used for masking or in encyription algorithms and they have limited usage in Java.You may use "bitwise and" operator for comparing values or checking if it is odd or even, and may use bitshift operators mostly in encyription or hashing algorithms.</span><br />
<br />
<span style="font-family: "times new roman" , serif; font-size: 16px;"><br /></span>Ali Gelenlerhttp://www.blogger.com/profile/09439697648573423668noreply@blogger.com0