<?xml version='1.0' encoding='UTF-8'?><?xml-stylesheet href="http://www.blogger.com/styles/atom.css" type="text/css"?><feed xmlns='http://www.w3.org/2005/Atom' xmlns:openSearch='http://a9.com/-/spec/opensearchrss/1.0/' xmlns:blogger='http://schemas.google.com/blogger/2008' xmlns:georss='http://www.georss.org/georss' xmlns:gd="http://schemas.google.com/g/2005" xmlns:thr='http://purl.org/syndication/thread/1.0'><id>tag:blogger.com,1999:blog-4216772231114158071</id><updated>2024-09-16T15:30:24.552-07:00</updated><category term="java heap size"/><category term="java memory settings"/><title type='text'>JAVA prompt</title><subtitle type='html'>Visit once, Share EveryWhere</subtitle><link rel='http://schemas.google.com/g/2005#feed' type='application/atom+xml' href='http://javaprompt.blogspot.com/feeds/posts/default'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4216772231114158071/posts/default?redirect=false'/><link rel='alternate' type='text/html' href='http://javaprompt.blogspot.com/'/><link rel='hub' href='http://pubsubhubbub.appspot.com/'/><author><name>Unknown</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><generator version='7.00' uri='http://www.blogger.com'>Blogger</generator><openSearch:totalResults>20</openSearch:totalResults><openSearch:startIndex>1</openSearch:startIndex><openSearch:itemsPerPage>25</openSearch:itemsPerPage><entry><id>tag:blogger.com,1999:blog-4216772231114158071.post-2621079547607312064</id><published>2012-10-29T11:00:00.006-07:00</published><updated>2012-10-29T11:00:53.514-07:00</updated><title type='text'>finalize() method in java</title><content type='html'>&lt;br /&gt;
&lt;pre class=&quot;lang-java prettyprint prettyprinted&quot; style=&quot;background-color: #eeeeee; border: 0px; font-family: Consolas, Menlo, Monaco, &#39;Lucida Console&#39;, &#39;Liberation Mono&#39;, &#39;DejaVu Sans Mono&#39;, &#39;Bitstream Vera Sans Mono&#39;, &#39;Courier New&#39;, monospace, serif; font-size: 14px; line-height: 18px; margin-bottom: 10px; max-height: 600px; overflow: auto; padding: 5px; vertical-align: baseline; width: auto;&quot;&gt;&lt;code style=&quot;border: 0px; font-family: Consolas, Menlo, Monaco, &#39;Lucida Console&#39;, &#39;Liberation Mono&#39;, &#39;DejaVu Sans Mono&#39;, &#39;Bitstream Vera Sans Mono&#39;, &#39;Courier New&#39;, monospace, serif; margin: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&lt;span class=&quot;kwd&quot; style=&quot;background-color: transparent; border: 0px; color: darkblue; margin: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;protected&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;background-color: transparent; border: 0px; margin: 0px; padding: 0px; vertical-align: baseline;&quot;&gt; &lt;/span&gt;&lt;span class=&quot;kwd&quot; style=&quot;background-color: transparent; border: 0px; color: darkblue; margin: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;void&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;background-color: transparent; border: 0px; margin: 0px; padding: 0px; vertical-align: baseline;&quot;&gt; finalize&lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;background-color: transparent; border: 0px; margin: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;()&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;background-color: transparent; border: 0px; margin: 0px; padding: 0px; vertical-align: baseline;&quot;&gt; &lt;/span&gt;&lt;span class=&quot;kwd&quot; style=&quot;background-color: transparent; border: 0px; color: darkblue; margin: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;throws&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;background-color: transparent; border: 0px; margin: 0px; padding: 0px; vertical-align: baseline;&quot;&gt; &lt;/span&gt;&lt;span class=&quot;typ&quot; style=&quot;background-color: transparent; border: 0px; color: #2b91af; margin: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;Throwable&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;background-color: transparent; border: 0px; margin: 0px; padding: 0px; vertical-align: baseline;&quot;&gt; &lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;background-color: transparent; border: 0px; margin: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;{}&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;ul style=&quot;border: 0px; font-family: Arial, &#39;Liberation Sans&#39;, &#39;DejaVu Sans&#39;, sans-serif; font-size: 14px; line-height: 18px; list-style-image: initial; list-style-position: initial; margin: 0px 0px 1em 30px; padding: 0px; vertical-align: baseline;&quot;&gt;
&lt;li style=&quot;border: 0px; margin: 0px; padding: 0px; vertical-align: baseline; word-wrap: break-word;&quot;&gt;every class inherits the&amp;nbsp;&lt;code style=&quot;background-color: #eeeeee; border: 0px; font-family: Consolas, Menlo, Monaco, &#39;Lucida Console&#39;, &#39;Liberation Mono&#39;, &#39;DejaVu Sans Mono&#39;, &#39;Bitstream Vera Sans Mono&#39;, &#39;Courier New&#39;, monospace, serif; margin: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;finalize()&lt;/code&gt;&amp;nbsp;method from java.lang.Object&lt;/li&gt;
&lt;li style=&quot;border: 0px; margin: 0px; padding: 0px; vertical-align: baseline; word-wrap: break-word;&quot;&gt;&lt;strong style=&quot;border: 0px; margin: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;the method is called by the garbage collector when it determines no more references to the object exist&lt;/strong&gt;&lt;/li&gt;
&lt;li style=&quot;border: 0px; margin: 0px; padding: 0px; vertical-align: baseline; word-wrap: break-word;&quot;&gt;the Object finalize method performs no actions but it may be overridden by any class&lt;/li&gt;
&lt;li style=&quot;border: 0px; margin: 0px; padding: 0px; vertical-align: baseline; word-wrap: break-word;&quot;&gt;normally it should be overridden to clean-up non-Java resources ie closing a file&lt;/li&gt;
&lt;li style=&quot;border: 0px; margin: 0px; padding: 0px; vertical-align: baseline; word-wrap: break-word;&quot;&gt;&lt;div style=&quot;border: 0px; clear: both; margin-bottom: 1em; padding: 0px; vertical-align: baseline; word-wrap: break-word;&quot;&gt;
if overridding&amp;nbsp;&lt;code style=&quot;background-color: #eeeeee; border: 0px; font-family: Consolas, Menlo, Monaco, &#39;Lucida Console&#39;, &#39;Liberation Mono&#39;, &#39;DejaVu Sans Mono&#39;, &#39;Bitstream Vera Sans Mono&#39;, &#39;Courier New&#39;, monospace, serif; margin: 0px; padding: 1px 5px; vertical-align: baseline;&quot;&gt;finalize()&lt;/code&gt;&amp;nbsp;it is good programming practice to use a try-catch-finally statement and to always call&amp;nbsp;&lt;code style=&quot;background-color: #eeeeee; border: 0px; font-family: Consolas, Menlo, Monaco, &#39;Lucida Console&#39;, &#39;Liberation Mono&#39;, &#39;DejaVu Sans Mono&#39;, &#39;Bitstream Vera Sans Mono&#39;, &#39;Courier New&#39;, monospace, serif; margin: 0px; padding: 1px 5px; vertical-align: baseline;&quot;&gt;super.finalize()&lt;/code&gt;. This is a safety measure to ensure you do not inadvertently miss closing a resource used by the objects calling class&lt;/div&gt;
&lt;pre class=&quot;lang-java prettyprint prettyprinted&quot; style=&quot;background-color: #eeeeee; border: 0px; font-family: Consolas, Menlo, Monaco, &#39;Lucida Console&#39;, &#39;Liberation Mono&#39;, &#39;DejaVu Sans Mono&#39;, &#39;Bitstream Vera Sans Mono&#39;, &#39;Courier New&#39;, monospace, serif; margin-bottom: 10px; max-height: 600px; overflow: auto; padding: 5px; vertical-align: baseline; width: auto; word-wrap: normal;&quot;&gt;&lt;code style=&quot;border: 0px; font-family: Consolas, Menlo, Monaco, &#39;Lucida Console&#39;, &#39;Liberation Mono&#39;, &#39;DejaVu Sans Mono&#39;, &#39;Bitstream Vera Sans Mono&#39;, &#39;Courier New&#39;, monospace, serif; margin: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&lt;span class=&quot;kwd&quot; style=&quot;background-color: transparent; border: 0px; color: darkblue; margin: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;protected&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;background-color: transparent; border: 0px; margin: 0px; padding: 0px; vertical-align: baseline;&quot;&gt; &lt;/span&gt;&lt;span class=&quot;kwd&quot; style=&quot;background-color: transparent; border: 0px; color: darkblue; margin: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;void&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;background-color: transparent; border: 0px; margin: 0px; padding: 0px; vertical-align: baseline;&quot;&gt; finalize&lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;background-color: transparent; border: 0px; margin: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;()&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;background-color: transparent; border: 0px; margin: 0px; padding: 0px; vertical-align: baseline;&quot;&gt; &lt;/span&gt;&lt;span class=&quot;kwd&quot; style=&quot;background-color: transparent; border: 0px; color: darkblue; margin: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;throws&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;background-color: transparent; border: 0px; margin: 0px; padding: 0px; vertical-align: baseline;&quot;&gt; &lt;/span&gt;&lt;span class=&quot;typ&quot; style=&quot;background-color: transparent; border: 0px; color: #2b91af; margin: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;Throwable&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;background-color: transparent; border: 0px; margin: 0px; padding: 0px; vertical-align: baseline;&quot;&gt; &lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;background-color: transparent; border: 0px; margin: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;background-color: transparent; border: 0px; margin: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
     &lt;/span&gt;&lt;span class=&quot;kwd&quot; style=&quot;background-color: transparent; border: 0px; color: darkblue; margin: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;try&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;background-color: transparent; border: 0px; margin: 0px; padding: 0px; vertical-align: baseline;&quot;&gt; &lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;background-color: transparent; border: 0px; margin: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;background-color: transparent; border: 0px; margin: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
         close&lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;background-color: transparent; border: 0px; margin: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;();&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;background-color: transparent; border: 0px; margin: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;        &lt;/span&gt;&lt;span class=&quot;com&quot; style=&quot;background-color: transparent; border: 0px; color: grey; margin: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;// close open files&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;background-color: transparent; border: 0px; margin: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
     &lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;background-color: transparent; border: 0px; margin: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;background-color: transparent; border: 0px; margin: 0px; padding: 0px; vertical-align: baseline;&quot;&gt; &lt;/span&gt;&lt;span class=&quot;kwd&quot; style=&quot;background-color: transparent; border: 0px; color: darkblue; margin: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;finally&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;background-color: transparent; border: 0px; margin: 0px; padding: 0px; vertical-align: baseline;&quot;&gt; &lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;background-color: transparent; border: 0px; margin: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;background-color: transparent; border: 0px; margin: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
         &lt;/span&gt;&lt;span class=&quot;kwd&quot; style=&quot;background-color: transparent; border: 0px; color: darkblue; margin: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;super&lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;background-color: transparent; border: 0px; margin: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;background-color: transparent; border: 0px; margin: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;finalize&lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;background-color: transparent; border: 0px; margin: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;();&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;background-color: transparent; border: 0px; margin: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
     &lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;background-color: transparent; border: 0px; margin: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;background-color: transparent; border: 0px; margin: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
 &lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;background-color: transparent; border: 0px; margin: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;}&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;/li&gt;
&lt;li style=&quot;border: 0px; margin: 0px; padding: 0px; vertical-align: baseline; word-wrap: break-word;&quot;&gt;&lt;div style=&quot;border: 0px; clear: both; margin-bottom: 1em; padding: 0px; vertical-align: baseline; word-wrap: break-word;&quot;&gt;
any exception thrown by&amp;nbsp;&lt;code style=&quot;background-color: #eeeeee; border: 0px; font-family: Consolas, Menlo, Monaco, &#39;Lucida Console&#39;, &#39;Liberation Mono&#39;, &#39;DejaVu Sans Mono&#39;, &#39;Bitstream Vera Sans Mono&#39;, &#39;Courier New&#39;, monospace, serif; margin: 0px; padding: 1px 5px; vertical-align: baseline;&quot;&gt;finalize()&lt;/code&gt;&amp;nbsp;during garbage collection halts the finalization but is otherwise ignored&lt;/div&gt;
&lt;/li&gt;
&lt;li style=&quot;border: 0px; margin: 0px; padding: 0px; vertical-align: baseline; word-wrap: break-word;&quot;&gt;&lt;code style=&quot;background-color: #eeeeee; border: 0px; font-family: Consolas, Menlo, Monaco, &#39;Lucida Console&#39;, &#39;Liberation Mono&#39;, &#39;DejaVu Sans Mono&#39;, &#39;Bitstream Vera Sans Mono&#39;, &#39;Courier New&#39;, monospace, serif; margin: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;finalize()&lt;/code&gt;&amp;nbsp;is never run more than once on any object&lt;/li&gt;
&lt;/ul&gt;
&lt;div&gt;
&lt;span style=&quot;font-family: Arial, Liberation Sans, DejaVu Sans, sans-serif;&quot;&gt;&lt;span style=&quot;font-size: 14px; line-height: 18px;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;font-family: Arial, Liberation Sans, DejaVu Sans, sans-serif;&quot;&gt;&lt;span style=&quot;font-size: 14px; line-height: 18px;&quot;&gt;Reference -&amp;nbsp;&lt;/span&gt;&lt;/span&gt;&lt;a href=&quot;http://stackoverflow.com/questions/2506488/java-finalize-method-call&quot;&gt;http://stackoverflow.com/questions/2506488/java-finalize-method-call&lt;/a&gt;&lt;/div&gt;
</content><link rel='replies' type='application/atom+xml' href='http://javaprompt.blogspot.com/feeds/2621079547607312064/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://javaprompt.blogspot.com/2012/10/finalize-method-in-java.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4216772231114158071/posts/default/2621079547607312064'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4216772231114158071/posts/default/2621079547607312064'/><link rel='alternate' type='text/html' href='http://javaprompt.blogspot.com/2012/10/finalize-method-in-java.html' title='finalize() method in java'/><author><name>Unknown</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4216772231114158071.post-9109627032272659319</id><published>2012-10-23T07:15:00.001-07:00</published><updated>2012-10-23T07:28:59.994-07:00</updated><title type='text'>Plain Old Java Objects (POJO)</title><content type='html'>&lt;span style=&quot;font-family: Helvetica Neue, Arial, Helvetica, sans-serif;&quot;&gt;&lt;b&gt;What is a POJO?&lt;/b&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Helvetica Neue, Arial, Helvetica, sans-serif;&quot;&gt;&lt;b&gt;&lt;br /&gt;&lt;/b&gt;&lt;/span&gt;
&lt;span style=&quot;font-family: Helvetica Neue, Arial, Helvetica, sans-serif;&quot;&gt;&lt;b&gt;&quot;A POJO is a simple ordinary java object that does not extends classes or implements interfaces from any frameworks or APIs&quot;&lt;/b&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Helvetica Neue, Arial, Helvetica, sans-serif;&quot;&gt;&lt;br /&gt;&lt;/span&gt;
&lt;span style=&quot;font-family: Helvetica Neue, Arial, Helvetica, sans-serif;&quot;&gt;&lt;span style=&quot;background-color: white; line-height: 19.200000762939453px;&quot;&gt;The term &quot;POJO&quot; is mainly used to denote a Java object which does not follow any of the major Java object models, conventions, or frameworks.&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;background-color: white; line-height: 19px;&quot;&gt;A POJO is a Java object that doesn&#39;t implement any special interfaces&lt;/span&gt;&lt;span style=&quot;background-color: white; line-height: 19px;&quot;&gt;&amp;nbsp;,extends classes, defined in frameworks and APIs.&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;background-color: white; line-height: 19.200000762939453px;&quot;&gt;Ideally speaking, a POJO is a Java object not bound by any restriction other than those forced by the Java Language Specification. i.e a&lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;background-color: white; font-family: sans-serif; font-size: 13px; line-height: 19.200000762939453px;&quot;&gt;&amp;nbsp;POJO&amp;nbsp;&lt;/span&gt;&lt;b style=&quot;background-color: white; font-family: sans-serif; font-size: 13px; line-height: 19.200000762939453px;&quot;&gt;should not&lt;/b&gt;&lt;span style=&quot;background-color: white; font-family: sans-serif; font-size: 13px; line-height: 19.200000762939453px;&quot;&gt;&amp;nbsp;have to.&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;background-color: white; line-height: 19.200000762939453px;&quot;&gt;&lt;span style=&quot;font-family: Helvetica Neue, Arial, Helvetica, sans-serif;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;
&lt;br /&gt;
&lt;span style=&quot;background-color: white; line-height: 19.200000762939453px;&quot;&gt;&lt;/span&gt;&lt;br /&gt;
&lt;ol style=&quot;font-family: sans-serif; font-size: 13px; list-style-image: none; margin: 0.3em 0px 0px 3.2em; padding: 0px;&quot;&gt;
&lt;li style=&quot;margin-bottom: 0.1em;&quot;&gt;&lt;span style=&quot;background-color: white; line-height: 19.200000762939453px;&quot;&gt;Extend prespecified classes, as in&lt;div class=&quot;mw-geshi mw-code mw-content-ltr&quot; dir=&quot;ltr&quot; style=&quot;background-color: #f9f9f9; border: 1px dashed rgb(47, 111, 171); direction: ltr; font-family: monospace, Courier; line-height: 1.1em; padding: 1em;&quot;&gt;
&lt;div class=&quot;java source-java&quot; style=&quot;font-family: monospace; line-height: normal;&quot;&gt;
&lt;pre class=&quot;de1&quot; style=&quot;background-image: none; border: 0px none white; font-size: 1em; line-height: 1.2em; padding: 0px; vertical-align: top;&quot;&gt;&lt;span class=&quot;kw1&quot; style=&quot;font-weight: bold;&quot;&gt;public&lt;/span&gt; &lt;span class=&quot;kw1&quot; style=&quot;font-weight: bold;&quot;&gt;class&lt;/span&gt; Foo &lt;span class=&quot;kw1&quot; style=&quot;font-weight: bold;&quot;&gt;extends&lt;/span&gt; javax.&lt;span class=&quot;me1&quot; style=&quot;color: #006633;&quot;&gt;servlet&lt;/span&gt;.&lt;span class=&quot;me1&quot; style=&quot;color: #006633;&quot;&gt;http&lt;/span&gt;.&lt;span class=&quot;me1&quot; style=&quot;color: #006633;&quot;&gt;HttpServlet&lt;/span&gt; &lt;span class=&quot;br0&quot; style=&quot;color: #009900;&quot;&gt;{&lt;/span&gt; ...
&lt;/pre&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/span&gt;&lt;/li&gt;
&lt;li style=&quot;margin-bottom: 0.1em;&quot;&gt;&lt;span style=&quot;background-color: white; line-height: 19.200000762939453px;&quot;&gt;Implement prespecified interfaces, as in&lt;div class=&quot;mw-geshi mw-code mw-content-ltr&quot; dir=&quot;ltr&quot; style=&quot;background-color: #f9f9f9; border: 1px dashed rgb(47, 111, 171); direction: ltr; font-family: monospace, Courier; line-height: 1.1em; padding: 1em;&quot;&gt;
&lt;div class=&quot;java source-java&quot; style=&quot;font-family: monospace; line-height: normal;&quot;&gt;
&lt;pre class=&quot;de1&quot; style=&quot;background-image: none; border: 0px none white; font-size: 1em; line-height: 1.2em; padding: 0px; vertical-align: top;&quot;&gt;&lt;span class=&quot;kw1&quot; style=&quot;font-weight: bold;&quot;&gt;public&lt;/span&gt; &lt;span class=&quot;kw1&quot; style=&quot;font-weight: bold;&quot;&gt;class&lt;/span&gt; Bar &lt;span class=&quot;kw1&quot; style=&quot;font-weight: bold;&quot;&gt;implements&lt;/span&gt; javax.&lt;span class=&quot;me1&quot; style=&quot;color: #006633;&quot;&gt;ejb&lt;/span&gt;.&lt;span class=&quot;me1&quot; style=&quot;color: #006633;&quot;&gt;EntityBean&lt;/span&gt; &lt;span class=&quot;br0&quot; style=&quot;color: #009900;&quot;&gt;{&lt;/span&gt; ...
&lt;/pre&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/span&gt;&lt;/li&gt;
&lt;li style=&quot;margin-bottom: 0.1em;&quot;&gt;&lt;span style=&quot;background-color: white; line-height: 19.200000762939453px;&quot;&gt;Contain prespecified annotations, as in&lt;div class=&quot;mw-geshi mw-code mw-content-ltr&quot; dir=&quot;ltr&quot; style=&quot;background-color: #f9f9f9; border: 1px dashed rgb(47, 111, 171); direction: ltr; font-family: monospace, Courier; line-height: 1.1em; padding: 1em;&quot;&gt;
&lt;div class=&quot;java source-java&quot; style=&quot;font-family: monospace; line-height: normal;&quot;&gt;
&lt;pre class=&quot;de1&quot; style=&quot;background-image: none; border: 0px none white; font-size: 1em; line-height: 1.2em; padding: 0px; vertical-align: top;&quot;&gt;@javax.&lt;span class=&quot;me1&quot; style=&quot;color: #006633;&quot;&gt;persistence&lt;/span&gt;.&lt;span class=&quot;kw3&quot; style=&quot;color: #003399;&quot;&gt;Entity&lt;/span&gt; &lt;span class=&quot;kw1&quot; style=&quot;font-weight: bold;&quot;&gt;public&lt;/span&gt; &lt;span class=&quot;kw1&quot; style=&quot;font-weight: bold;&quot;&gt;class&lt;/span&gt; Baz &lt;span class=&quot;br0&quot; style=&quot;color: #009900;&quot;&gt;{&lt;/span&gt; ...&lt;/pre&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/span&gt;&lt;/li&gt;
&lt;/ol&gt;
&lt;br /&gt;
&lt;span style=&quot;background-color: white; line-height: 19.200000762939453px;&quot;&gt;&lt;span style=&quot;font-family: Helvetica Neue, Arial, Helvetica, sans-serif;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;
&lt;span style=&quot;background-color: white; line-height: 19.200000762939453px;&quot;&gt;&lt;span style=&quot;font-family: sans-serif; font-size: 13px;&quot;&gt;However, due to technical difficulties and other reasons, many software products or frameworks described as POJO-compliant actually still require the use of prespecified annotations for features such as persistence to work properly.&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;background-color: white; line-height: 19.200000762939453px;&quot;&gt;&lt;span style=&quot;font-family: Helvetica Neue, Arial, Helvetica, sans-serif;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;
&lt;div style=&quot;background-color: white; line-height: 19px; padding: 0px 0px 8px;&quot;&gt;
&lt;strong&gt;&lt;span style=&quot;font-family: Helvetica Neue, Arial, Helvetica, sans-serif;&quot;&gt;The Benefits of POJOs&lt;/span&gt;&lt;/strong&gt;&lt;/div&gt;
&lt;div style=&quot;background-color: white; line-height: 19px; padding: 0px 0px 8px;&quot;&gt;
&lt;span style=&quot;font-family: Helvetica Neue, Arial, Helvetica, sans-serif;&quot;&gt;&lt;b&gt;&lt;br /&gt;&lt;/b&gt;Decoupling the application code from the infrastructure frameworks is one of the many benefits of using POJOs. They also simplify development because rather than being forced to think about everything - business logic, persistence, transactions, etc. - at once, you can focus instead on one thing at a time. You can design and implement the business logic and then, once that&#39;s working, you can deal with persistence and transactions.&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;background-color: white; line-height: 19px; padding: 0px 0px 8px;&quot;&gt;
&lt;span style=&quot;font-family: Helvetica Neue, Arial, Helvetica, sans-serif;&quot;&gt;POJOs also accelerate development. You can test your business logic outside of the application server and without a database. You don&#39;t have to package your code and deploy it in the application server. You also don&#39;t have to keep the database schema constantly in sync with the object model or spend time waiting for slow-running database tests to finish. Tests run in a few seconds and development can happen at the speed of thought - or at least as fast as you can type!&lt;/span&gt;&lt;/div&gt;
&lt;br /&gt;
&lt;span style=&quot;background-color: white; line-height: 19.200000762939453px;&quot;&gt;&lt;span style=&quot;font-family: Helvetica Neue, Arial, Helvetica, sans-serif;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;
&lt;span style=&quot;background-color: white; line-height: 19.200000762939453px;&quot;&gt;&lt;span style=&quot;font-family: Helvetica Neue, Arial, Helvetica, sans-serif;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;
&lt;span style=&quot;background-color: white; line-height: 19.200000762939453px;&quot;&gt;&lt;span style=&quot;font-family: Helvetica Neue, Arial, Helvetica, sans-serif;&quot;&gt;An Example of POJO can be as follows,&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;background-color: white; line-height: 19.200000762939453px;&quot;&gt;&lt;span style=&quot;font-family: Helvetica Neue, Arial, Helvetica, sans-serif;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;
&lt;br /&gt;
&lt;pre class=&quot;de1&quot; style=&quot;background-color: #f9f9f9; background-image: none; border: 0px none white; line-height: 1.2em; padding: 0px; vertical-align: top;&quot;&gt;&lt;span style=&quot;font-family: Helvetica Neue, Arial, Helvetica, sans-serif;&quot;&gt;&lt;span class=&quot;kw1&quot; style=&quot;font-weight: bold;&quot;&gt;public&lt;/span&gt; &lt;span class=&quot;kw1&quot; style=&quot;font-weight: bold;&quot;&gt;class&lt;/span&gt; MyBean &lt;span class=&quot;br0&quot;&gt;{&lt;/span&gt;
 
    &lt;span class=&quot;kw1&quot; style=&quot;font-weight: bold;&quot;&gt;private&lt;/span&gt; &lt;span class=&quot;kw3&quot;&gt;String&lt;/span&gt; someProperty&lt;span class=&quot;sy0&quot;&gt;;&lt;/span&gt;
 
    &lt;span class=&quot;kw1&quot; style=&quot;font-weight: bold;&quot;&gt;public&lt;/span&gt; &lt;span class=&quot;kw3&quot;&gt;String&lt;/span&gt; getSomeProperty&lt;span class=&quot;br0&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;br0&quot;&gt;{&lt;/span&gt;
         &lt;span class=&quot;kw1&quot; style=&quot;font-weight: bold;&quot;&gt;return&lt;/span&gt; someProperty&lt;span class=&quot;sy0&quot;&gt;;&lt;/span&gt;
    &lt;span class=&quot;br0&quot;&gt;}&lt;/span&gt;
 
    &lt;span class=&quot;kw1&quot; style=&quot;font-weight: bold;&quot;&gt;public&lt;/span&gt; &lt;span class=&quot;kw4&quot; style=&quot;font-weight: bold;&quot;&gt;void&lt;/span&gt; setSomeProperty&lt;span class=&quot;br0&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;kw3&quot;&gt;String&lt;/span&gt; someProperty&lt;span class=&quot;br0&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;br0&quot;&gt;{&lt;/span&gt;
        &lt;span class=&quot;kw1&quot; style=&quot;font-weight: bold;&quot;&gt;this&lt;/span&gt;.&lt;span class=&quot;me1&quot;&gt;someProperty&lt;/span&gt; &lt;span class=&quot;sy0&quot;&gt;=&lt;/span&gt; someProperty&lt;span class=&quot;sy0&quot;&gt;;&lt;/span&gt;
    &lt;span class=&quot;br0&quot;&gt;}&lt;/span&gt;
&lt;span class=&quot;br0&quot;&gt;}&lt;/span&gt;&lt;/span&gt;&lt;/pre&gt;
&lt;pre class=&quot;de1&quot; style=&quot;background-color: #f9f9f9; background-image: none; border: 0px none white; line-height: 1.2em; padding: 0px; vertical-align: top;&quot;&gt;&lt;span style=&quot;font-family: Helvetica Neue, Arial, Helvetica, sans-serif;&quot;&gt;&lt;span class=&quot;br0&quot;&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/pre&gt;
&lt;pre class=&quot;de1&quot; style=&quot;background-color: #f9f9f9; background-image: none; border: 0px none white; line-height: 1.2em; padding: 0px; vertical-align: top;&quot;&gt;&lt;span style=&quot;font-family: Helvetica Neue, Arial, Helvetica, sans-serif;&quot;&gt;&lt;span class=&quot;br0&quot; style=&quot;font-size: xx-small;&quot;&gt;&lt;b&gt;Thanks wikipedia&lt;/b&gt;&lt;/span&gt;&lt;/span&gt;&lt;/pre&gt;
</content><link rel='replies' type='application/atom+xml' href='http://javaprompt.blogspot.com/feeds/9109627032272659319/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://javaprompt.blogspot.com/2012/10/plain-old-java-objects-pojo.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4216772231114158071/posts/default/9109627032272659319'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4216772231114158071/posts/default/9109627032272659319'/><link rel='alternate' type='text/html' href='http://javaprompt.blogspot.com/2012/10/plain-old-java-objects-pojo.html' title='Plain Old Java Objects (POJO)'/><author><name>Unknown</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4216772231114158071.post-3219419855429457541</id><published>2012-09-02T13:07:00.000-07:00</published><updated>2012-09-02T13:07:01.420-07:00</updated><title type='text'>Create a domain in glassfish server</title><content type='html'>&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;
&lt;br /&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;span style=&quot;font-family: Arial, Helvetica, sans-serif;&quot;&gt;While installing Glassfish, sometimes it does not create
domain due to java path error.&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;background: white; line-height: 13.5pt; margin-bottom: 12.0pt; vertical-align: baseline;&quot;&gt;
&lt;span style=&quot;font-family: Arial, Helvetica, sans-serif;&quot;&gt;&lt;span style=&quot;background-color: white; font-size: 10.5pt;&quot;&gt;Edit asenv and point to your JDK installation for
set AS_JAVA=C:\Java\jdk.&lt;/span&gt;&lt;span style=&quot;font-size: 10.5pt;&quot;&gt;you can create a domain
with the asadmin tool&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;background: white; line-height: 13.5pt; margin-bottom: 12.0pt; vertical-align: baseline;&quot;&gt;
&lt;span style=&quot;font-family: Arial, Helvetica, sans-serif;&quot;&gt;&lt;span style=&quot;background-color: white; font-size: 10.5pt;&quot;&gt;Asenv.bat is present at the directory &lt;/span&gt;&lt;b&gt;&lt;span style=&quot;font-size: 10.5pt;&quot;&gt;C:\glassfish3\glassfish\config&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/b&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;background: #EEEEEE; line-height: 13.5pt; margin-bottom: .0001pt; margin-bottom: 0in; tab-stops: 45.8pt 91.6pt 137.4pt 183.2pt 229.0pt 274.8pt 320.6pt 366.4pt 412.2pt 458.0pt 503.8pt 549.6pt 595.4pt 641.2pt 687.0pt 732.8pt; vertical-align: baseline;&quot;&gt;
&lt;span style=&quot;font-family: Arial, Helvetica, sans-serif;&quot;&gt;&lt;b&gt;&lt;span style=&quot;font-size: 10.5pt;&quot;&gt;glassfish-install-dir\bin\&lt;/span&gt;&lt;/b&gt;&lt;i&gt;&lt;span style=&quot;font-size: 10.5pt;&quot;&gt;asadmin create-domain your-domain-name&lt;/span&gt;&lt;/i&gt;&lt;i&gt;&lt;span style=&quot;font-size: 10.5pt;&quot;&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/i&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;span style=&quot;font-family: Arial, Helvetica, sans-serif;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;br /&gt;&lt;!--[endif]--&gt;&lt;/div&gt;
&lt;/div&gt;
</content><link rel='replies' type='application/atom+xml' href='http://javaprompt.blogspot.com/feeds/3219419855429457541/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://javaprompt.blogspot.com/2012/09/create-domain-in-glassfish-server.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4216772231114158071/posts/default/3219419855429457541'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4216772231114158071/posts/default/3219419855429457541'/><link rel='alternate' type='text/html' href='http://javaprompt.blogspot.com/2012/09/create-domain-in-glassfish-server.html' title='Create a domain in glassfish server'/><author><name>Unknown</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4216772231114158071.post-3080717121817637919</id><published>2012-09-02T12:50:00.002-07:00</published><updated>2012-09-02T12:55:09.446-07:00</updated><title type='text'>Deploying a web module in glassfish server</title><content type='html'>&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;
&lt;br /&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;b&gt;&lt;span style=&quot;font-family: Arial, Helvetica, sans-serif;&quot;&gt;To Start Glass Fish
Server &lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/b&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;b&gt;&lt;span style=&quot;font-family: Arial, Helvetica, sans-serif;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/b&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;span style=&quot;font-family: Arial, Helvetica, sans-serif;&quot;&gt;Open command Prompt and type any of below commands&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;span style=&quot;font-family: Arial, Helvetica, sans-serif;&quot;&gt;&lt;i&gt;asadmin&amp;nbsp; start-domain&lt;/i&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;span style=&quot;font-family: Arial, Helvetica, sans-serif;&quot;&gt;&lt;i&gt;asadmin start-domain&lt;/i&gt; [domain name] [--verbose]&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;span style=&quot;font-family: Arial, Helvetica, sans-serif;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;b&gt;&lt;span style=&quot;font-family: Arial, Helvetica, sans-serif;&quot;&gt;To Stop Glass Fish
server&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/b&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;b&gt;&lt;span style=&quot;font-family: Arial, Helvetica, sans-serif;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/b&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;span style=&quot;font-family: Arial, Helvetica, sans-serif;&quot;&gt;&lt;i&gt;asadmin stop-domain&lt;/i&gt; [domain name]&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;span style=&quot;font-family: Arial, Helvetica, sans-serif;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;b&gt;&lt;span style=&quot;font-family: Arial, Helvetica, sans-serif;&quot;&gt;To view the deployed
applications&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/b&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;b&gt;&lt;span style=&quot;font-family: Arial, Helvetica, sans-serif;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/b&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;span style=&quot;font-family: Arial, Helvetica, sans-serif;&quot;&gt;&lt;i&gt;asadmin list-applications&lt;/i&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;span style=&quot;font-family: Arial, Helvetica, sans-serif;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;b&gt;&lt;span style=&quot;font-family: Arial, Helvetica, sans-serif;&quot;&gt;To build, deploy,
clean, undeploy &amp;nbsp;a web module using Ant &lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/b&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;span style=&quot;text-indent: -0.25in;&quot;&gt;&lt;span style=&quot;font-family: Arial, Helvetica, sans-serif;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;font-family: Arial, Helvetica, sans-serif;&quot;&gt;&lt;span style=&quot;text-indent: -0.25in;&quot;&gt;1.&lt;/span&gt;&lt;span style=&quot;font-size: 7pt; text-indent: -0.25in;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp;&lt;/span&gt;&lt;span style=&quot;text-indent: -0.25in;&quot;&gt;open command prompt&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;text-indent: -0.25in;&quot;&gt;2.&lt;/span&gt;&lt;span style=&quot;font-size: 7pt; text-indent: -0.25in;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;
&lt;/span&gt;&lt;span style=&quot;text-indent: -0.25in;&quot;&gt;Go to the application context directory&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;text-indent: -0.25in;&quot;&gt;3.&lt;/span&gt;&lt;span style=&quot;font-size: 7pt; text-indent: -0.25in;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;
&lt;/span&gt;&lt;span style=&quot;text-indent: -0.25in;&quot;&gt;Type &lt;/span&gt;&lt;b style=&quot;text-indent: -0.25in;&quot;&gt;&lt;i&gt;ant&lt;/i&gt;&lt;/b&gt;&lt;br /&gt;&lt;span style=&quot;text-indent: -0.25in;&quot;&gt;4.&lt;/span&gt;&lt;span style=&quot;font-size: 7pt; text-indent: -0.25in;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;
&lt;/span&gt;&lt;b style=&quot;text-indent: -0.25in;&quot;&gt;&lt;i&gt;ant
deploy&lt;/i&gt;&lt;/b&gt;&lt;span style=&quot;text-indent: -0.25in;&quot;&gt; for deploy a web module to domain&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;text-indent: -0.25in;&quot;&gt;5.&lt;/span&gt;&lt;span style=&quot;font-size: 7pt; text-indent: -0.25in;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;
&lt;/span&gt;&lt;b style=&quot;text-indent: -0.25in;&quot;&gt;&lt;i&gt;ant clean&lt;/i&gt;&lt;/b&gt;&lt;span style=&quot;text-indent: -0.25in;&quot;&gt;
to clean all build artifacts (deletes the built and dest folder)&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;text-indent: -0.25in;&quot;&gt;6.&lt;/span&gt;&lt;span style=&quot;font-size: 7pt; text-indent: -0.25in;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;
&lt;/span&gt;&lt;b style=&quot;text-indent: -0.25in;&quot;&gt;&lt;i&gt;ant
undeploy&lt;/i&gt;&lt;/b&gt;&lt;span style=&quot;text-indent: -0.25in;&quot;&gt; un deploys web module from domain&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;/div&gt;
</content><link rel='replies' type='application/atom+xml' href='http://javaprompt.blogspot.com/feeds/3080717121817637919/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://javaprompt.blogspot.com/2012/09/deploying-web-module-in-glassfish-server.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4216772231114158071/posts/default/3080717121817637919'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4216772231114158071/posts/default/3080717121817637919'/><link rel='alternate' type='text/html' href='http://javaprompt.blogspot.com/2012/09/deploying-web-module-in-glassfish-server.html' title='Deploying a web module in glassfish server'/><author><name>Unknown</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4216772231114158071.post-4417919768501090459</id><published>2012-09-02T12:37:00.001-07:00</published><updated>2012-09-02T12:38:34.743-07:00</updated><title type='text'>Java EE 6 Software Development Kit installation</title><content type='html'>&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;
&lt;span style=&quot;font-family: Arial, Helvetica, sans-serif;&quot;&gt;Java EE 6 Software Development Kit installation setup requires JRE at the default installation path. Otherwise it will pop up warning message like &quot;This application needs version 1.6 or higher of the java(TM) Runtime Environment.&quot;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Arial, Helvetica, sans-serif;&quot;&gt;&lt;br /&gt;&lt;/span&gt;
&lt;span style=&quot;font-family: Arial, Helvetica, sans-serif;&quot;&gt;1. Double click the java-ee-sdk-windows.exe to start installtion process&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Arial, Helvetica, sans-serif;&quot;&gt;&lt;br /&gt;&lt;/span&gt;
&lt;span style=&quot;font-family: Arial, Helvetica, sans-serif;&quot;&gt;2.If the application does note found jre, installation can be done from command prompt.&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Arial, Helvetica, sans-serif;&quot;&gt;&lt;br /&gt;&lt;/span&gt;
&lt;span style=&quot;font-family: Arial, Helvetica, sans-serif;&quot;&gt;3.In command prompt , Go to the path where setup is present&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Arial, Helvetica, sans-serif;&quot;&gt;&lt;br /&gt;&lt;/span&gt;
&lt;span style=&quot;font-family: Arial, Helvetica, sans-serif;&quot;&gt;4.Type setup name - j followed by jre path in double quotes. ( java_ee_sdk-6u4-windows-ml -j &quot;C:\Program Files\Java\jre7&quot;)&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Arial, Helvetica, sans-serif;&quot;&gt;&lt;br /&gt;&lt;/span&gt;
&lt;span style=&quot;font-family: Arial, Helvetica, sans-serif;&quot;&gt;5.During the installation of the SDK, do the following.&lt;/span&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;ul style=&quot;text-align: left;&quot;&gt;
&lt;li&gt;&lt;span style=&quot;font-family: Arial, Helvetica, sans-serif;&quot;&gt;Configure the GlassFish Server administration user name as admin, and specify no&amp;nbsp;password. This is the default setting.&lt;/span&gt;&lt;/li&gt;
&lt;li&gt;&lt;span style=&quot;font-family: Arial, Helvetica, sans-serif;&quot;&gt;&amp;nbsp;Accept the default port values for the Admin Port (4848) and the HTTP Port (8080).&lt;/span&gt;&lt;/li&gt;
&lt;li&gt;&lt;span style=&quot;font-family: Arial, Helvetica, sans-serif;&quot;&gt;&amp;nbsp;Allow the installer to download and configure the Update Tool. If you access the Internet&amp;nbsp;through a firewall, provide the proxy host and port.&lt;/span&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;/div&gt;
</content><link rel='replies' type='application/atom+xml' href='http://javaprompt.blogspot.com/feeds/4417919768501090459/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://javaprompt.blogspot.com/2012/09/java-ee-6-softwaredevelopment-kit.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4216772231114158071/posts/default/4417919768501090459'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4216772231114158071/posts/default/4417919768501090459'/><link rel='alternate' type='text/html' href='http://javaprompt.blogspot.com/2012/09/java-ee-6-softwaredevelopment-kit.html' title='Java EE 6 Software Development Kit installation'/><author><name>Unknown</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4216772231114158071.post-466232310642773348</id><published>2012-02-17T01:03:00.000-08:00</published><updated>2012-02-17T01:04:21.989-08:00</updated><title type='text'>How to set current jre version in windows environment</title><content type='html'>&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;
You can set the current version of JRE in windows as given below.&lt;br /&gt;
&lt;br /&gt;
&lt;ol style=&quot;text-align: left;&quot;&gt;
&lt;li&gt;Open windows registry. (Run --&amp;gt; regedit)&lt;/li&gt;
&lt;li&gt;Go to HKEY_LOCAL_MACHINE --&amp;gt;SOFTWARE --&amp;gt; Javasoft --&amp;gt; Java Runtime Enviroment&lt;/li&gt;
&lt;li&gt;Edit and Change the Current Version in Java Runtime Environment&lt;/li&gt;
&lt;/ol&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;
&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEh8E9nff0V6eFUfQz2EfU6ZwHhydXwEa28GoRXNqtsfNqROL2k7Lul4g0KEr4gKq77xhxmVb9hQEWEXBpLYI3fkrdku5_uEMeVctECKf6LsHnEJx6UNMdQTlR25gP-iAh4V0ubS934cT8IU/s1600/JRE+Current+version.JPG&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEh8E9nff0V6eFUfQz2EfU6ZwHhydXwEa28GoRXNqtsfNqROL2k7Lul4g0KEr4gKq77xhxmVb9hQEWEXBpLYI3fkrdku5_uEMeVctECKf6LsHnEJx6UNMdQTlR25gP-iAh4V0ubS934cT8IU/s1600/JRE+Current+version.JPG&quot; /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://javaprompt.blogspot.com/feeds/466232310642773348/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://javaprompt.blogspot.com/2012/02/how-to-set-current-jre-version-in.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4216772231114158071/posts/default/466232310642773348'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4216772231114158071/posts/default/466232310642773348'/><link rel='alternate' type='text/html' href='http://javaprompt.blogspot.com/2012/02/how-to-set-current-jre-version-in.html' title='How to set current jre version in windows environment'/><author><name>Unknown</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEh8E9nff0V6eFUfQz2EfU6ZwHhydXwEa28GoRXNqtsfNqROL2k7Lul4g0KEr4gKq77xhxmVb9hQEWEXBpLYI3fkrdku5_uEMeVctECKf6LsHnEJx6UNMdQTlR25gP-iAh4V0ubS934cT8IU/s72-c/JRE+Current+version.JPG" height="72" width="72"/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4216772231114158071.post-4607059950906299839</id><published>2012-02-15T21:20:00.000-08:00</published><updated>2012-02-15T21:20:25.917-08:00</updated><title type='text'>Java code compilation process</title><content type='html'>&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;
When you compile a java file using &lt;b&gt;javac&lt;/b&gt; compiler, it produces a file with .class extension. The class file consists of bytes code. Byte code is platform independent as it can be run on any platform once it is compiled.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;
&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiBgmiVZeHOR0uSeFeTaQBsC-2hou51eVpWXAapnyse5ovNkZharj6JkTxQJnFD1ZnqXB1dsWYzDTqS4O8vslqhr1pKlCUqwPqSE52ig9xlQrwZlZf0vELLqEIwkAD5K_NhYKQI3UK_RVVP/s1600/java+compilation.jpg&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiBgmiVZeHOR0uSeFeTaQBsC-2hou51eVpWXAapnyse5ovNkZharj6JkTxQJnFD1ZnqXB1dsWYzDTqS4O8vslqhr1pKlCUqwPqSE52ig9xlQrwZlZf0vELLqEIwkAD5K_NhYKQI3UK_RVVP/s1600/java+compilation.jpg&quot; /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;br /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://javaprompt.blogspot.com/feeds/4607059950906299839/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://javaprompt.blogspot.com/2012/02/java-code-compilation-process.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4216772231114158071/posts/default/4607059950906299839'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4216772231114158071/posts/default/4607059950906299839'/><link rel='alternate' type='text/html' href='http://javaprompt.blogspot.com/2012/02/java-code-compilation-process.html' title='Java code compilation process'/><author><name>Unknown</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiBgmiVZeHOR0uSeFeTaQBsC-2hou51eVpWXAapnyse5ovNkZharj6JkTxQJnFD1ZnqXB1dsWYzDTqS4O8vslqhr1pKlCUqwPqSE52ig9xlQrwZlZf0vELLqEIwkAD5K_NhYKQI3UK_RVVP/s72-c/java+compilation.jpg" height="72" width="72"/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4216772231114158071.post-2385545591866779813</id><published>2012-02-14T22:25:00.000-08:00</published><updated>2012-02-14T22:25:23.823-08:00</updated><title type='text'>Prevent Winmail.dat Attachments from Being Sent in Outlook</title><content type='html'>&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;
&lt;br /&gt;
&lt;ol style=&quot;text-align: left;&quot;&gt;
&lt;li&gt;Select &lt;i&gt;Tools | Options...&lt;/i&gt; from the menu.&lt;/li&gt;
&lt;li&gt;Go to the &lt;i&gt;Mail Format&lt;/i&gt; tab.&lt;/li&gt;
&lt;li&gt;Under &lt;i&gt;Compose in this message format:&lt;/i&gt;, make sure either &lt;i&gt;HTML&lt;/i&gt; 
or &lt;i&gt;Plain Text&lt;/i&gt; is selected.&lt;/li&gt;
&lt;li&gt;Click &lt;i&gt;Internet Format&lt;/i&gt;.&lt;/li&gt;
&lt;li&gt;Make sure either &lt;i&gt;Convert to Plain Text format&lt;/i&gt; or &lt;i&gt;Convert to HTML 
format&lt;/i&gt; is selected under &lt;i&gt;When sending Outlook Rich Text messages to 
Internet recipients, use this format:&lt;/i&gt;&lt;/li&gt;
&lt;li&gt;Click &lt;i&gt;OK&lt;/i&gt;.&lt;/li&gt;
&lt;li&gt;Click &lt;i&gt;OK&lt;/i&gt; again.&amp;nbsp;&lt;/li&gt;
&lt;/ol&gt;
&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://javaprompt.blogspot.com/feeds/2385545591866779813/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://javaprompt.blogspot.com/2012/02/prevent-winmaildat-attachments-from.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4216772231114158071/posts/default/2385545591866779813'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4216772231114158071/posts/default/2385545591866779813'/><link rel='alternate' type='text/html' href='http://javaprompt.blogspot.com/2012/02/prevent-winmaildat-attachments-from.html' title='Prevent Winmail.dat Attachments from Being Sent in Outlook'/><author><name>Unknown</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4216772231114158071.post-1768325188872816330</id><published>2012-02-14T22:19:00.001-08:00</published><updated>2012-02-14T22:19:44.467-08:00</updated><title type='text'>Why Email attachments are downloaded as winmail.dat file ?</title><content type='html'>&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;
Transport-Neutral Encapsulation Format (TNEF) is Microsoft&#39;s non-standard format 
for encapsulating mail which has any non-plain-text content or properties (such 
as rich text, embedded OLE objects, voting buttons, and sometimes just 
attachments). Whether or not a given message is encoded using TNEF is determined 
by the Outlook default settings, per-recipient setting, Exchange Server 
settings, and message type and content. 
&lt;br /&gt;
&lt;br /&gt;
Once a TNEF message is used, the entire message, including all the original 
attachments and properties, is encapsulated in a single attachment of mime type 
&quot;application/ms-tnef&quot; added to the message to be sent over the Internet. This 
attachment is usually named &quot;WINMAIL.DAT&quot;, and when sent to any non-MS mail 
client, is useless, and makes access to the original message attachments 
impossible.&lt;br /&gt;
&lt;br /&gt;
&lt;b&gt;You can parse the winmail.dat file using the tnef.jar file in order to extract the attachments&lt;/b&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
For more information please visit the below link.&lt;br /&gt;
&lt;br /&gt;
&lt;a href=&quot;http://www.freeutils.net/source/jtnef/&quot;&gt;http://www.freeutils.net/source/jtnef/&lt;/a&gt;&lt;br /&gt;
&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://javaprompt.blogspot.com/feeds/1768325188872816330/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://javaprompt.blogspot.com/2012/02/why-email-attachments-are-downloaded-as.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4216772231114158071/posts/default/1768325188872816330'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4216772231114158071/posts/default/1768325188872816330'/><link rel='alternate' type='text/html' href='http://javaprompt.blogspot.com/2012/02/why-email-attachments-are-downloaded-as.html' title='Why Email attachments are downloaded as winmail.dat file ?'/><author><name>Unknown</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4216772231114158071.post-313768024478435405</id><published>2012-02-14T22:00:00.000-08:00</published><updated>2012-02-14T22:00:40.122-08:00</updated><title type='text'>Creating a Thread</title><content type='html'>&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: left;&quot;&gt;
A Thread can be created in two ways.&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: left;&quot;&gt;
&lt;/div&gt;
&lt;ol style=&quot;text-align: left;&quot;&gt;
&lt;li&gt;By Extending Thread class&lt;/li&gt;
&lt;li&gt;By Implementing Runnable interface&lt;/li&gt;
&lt;/ol&gt;
&lt;br /&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;
&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEilx-41xqx5nYfOzZ6D1J3lz8cqemcMtfzwsMESKFvyMWxSW6kf2xO1yKM5YDgU-APJEpk5Unp9yXWEZ20TWQPXg8z-ECHqipXK4xIu2EIp8KnU_CiL4Azofvdj-8zHl5cify_1RxKQjxS5/s1600/Thread+creation.gif&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; height=&quot;215&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEilx-41xqx5nYfOzZ6D1J3lz8cqemcMtfzwsMESKFvyMWxSW6kf2xO1yKM5YDgU-APJEpk5Unp9yXWEZ20TWQPXg8z-ECHqipXK4xIu2EIp8KnU_CiL4Azofvdj-8zHl5cify_1RxKQjxS5/s320/Thread+creation.gif&quot; width=&quot;320&quot; /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;br /&gt;&lt;div&gt;
&lt;b&gt;Examples&lt;/b&gt;&lt;/div&gt;
&lt;div&gt;
&lt;b&gt;&lt;br /&gt;&lt;/b&gt;&lt;/div&gt;
&lt;div&gt;
&lt;b&gt;1. Creating a Thread by extending Thread class&lt;/b&gt;&lt;/div&gt;
&lt;div&gt;
&lt;b&gt;&lt;br /&gt;&lt;/b&gt;&lt;/div&gt;
&lt;div&gt;
&lt;code&gt;&lt;span style=&quot;color: #7f0055;&quot;&gt;&lt;b&gt;class&amp;nbsp;&lt;/b&gt;&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;MyThread&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: #7f0055;&quot;&gt;&lt;b&gt;extends&amp;nbsp;&lt;/b&gt;&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;Thread{&lt;/span&gt;&lt;/code&gt; 
&lt;code&gt;&lt;span style=&quot;color: black;&quot;&gt;&amp;nbsp; &lt;/span&gt;&lt;span style=&quot;color: maroon;&quot;&gt;&lt;b&gt;String&lt;/b&gt;&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt; 
s=null;&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;color: white;&quot;&gt;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;MyThread(String&amp;nbsp;s1){&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;color: white;&quot;&gt;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;s=s1;&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;color: white;&quot;&gt;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;start();&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;color: white;&quot;&gt;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;}&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;color: white;&quot;&gt;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: #7f0055;&quot;&gt;&lt;b&gt;public&amp;nbsp;void&amp;nbsp;&lt;/b&gt;&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;run(){&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;color: white;&quot;&gt;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;System.out.println(s);&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;color: white;&quot;&gt;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;}&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;color: black;&quot;&gt;}&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;color: #7f0055;&quot;&gt;&lt;b&gt;public&amp;nbsp;class&amp;nbsp;&lt;/b&gt;&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;RunThread{&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;color: white;&quot;&gt;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: #7f0055;&quot;&gt;&lt;b&gt;public&amp;nbsp;static&amp;nbsp;void&amp;nbsp;&lt;/b&gt;&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;main(String&amp;nbsp;args[]){&lt;/span&gt;&lt;span style=&quot;color: white;&quot;&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;color: white;&quot;&gt;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;MyThread&amp;nbsp;m1=&lt;/span&gt;&lt;span style=&quot;color: #7f0055;&quot;&gt;&lt;b&gt;new&amp;nbsp;&lt;/b&gt;&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;MyThread(&lt;/span&gt;&lt;span style=&quot;color: #2a00ff;&quot;&gt;&quot;Thread&amp;nbsp;started....&quot;&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;);&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;color: white;&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;}&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;color: black;&quot;&gt;}&lt;/span&gt;&lt;/code&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: monospace;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: monospace;&quot;&gt;&lt;b&gt;&lt;br /&gt;&lt;/b&gt;&lt;/span&gt;&lt;br /&gt;
&lt;b&gt;2. Creating a Thread by implementing Runnable interface&lt;/b&gt;&lt;br /&gt;
&lt;b&gt;&lt;br /&gt;&lt;/b&gt;&lt;br /&gt;
&lt;code&gt;&lt;span style=&quot;color: #7f0055;&quot;&gt;&lt;b&gt;class&amp;nbsp;&lt;/b&gt;&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;MyThread1&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: #7f0055;&quot;&gt;&lt;b&gt;implements&amp;nbsp;&lt;/b&gt;&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;Runnable{&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;color: white;&quot;&gt;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;Thread&amp;nbsp;t;&lt;br /&gt;&amp;nbsp; &lt;/span&gt;&lt;b&gt;&lt;span style=&quot;color: maroon;&quot;&gt;String&lt;/span&gt;&lt;/b&gt;&lt;span style=&quot;color: black;&quot;&gt; s=null;&lt;/span&gt;&lt;/code&gt; 
&lt;br /&gt;
&lt;code&gt;&lt;span style=&quot;color: white;&quot;&gt;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;MyThread1(String&amp;nbsp;s1){&lt;br /&gt;&amp;nbsp;&amp;nbsp; s=s1;&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;color: white;&quot;&gt;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;t=&lt;/span&gt;&lt;span style=&quot;color: #7f0055;&quot;&gt;&lt;b&gt;new&amp;nbsp;&lt;/b&gt;&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;Thread(this);&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;color: white;&quot;&gt;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;t.start();&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;color: white;&quot;&gt;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;}&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;color: white;&quot;&gt;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: #7f0055;&quot;&gt;&lt;b&gt;public&amp;nbsp;void&amp;nbsp;&lt;/b&gt;&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;run(){&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;color: white;&quot;&gt;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;System.out.println(&lt;/span&gt;s&lt;span style=&quot;color: black;&quot;&gt;);&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;color: white;&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;}&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;color: black;&quot;&gt;}&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;color: #7f0055;&quot;&gt;&lt;b&gt;public&amp;nbsp;class&amp;nbsp;&lt;/b&gt;&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;RunableThread{&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;color: white;&quot;&gt;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: #7f0055;&quot;&gt;&lt;b&gt;public&amp;nbsp;static&amp;nbsp;void&amp;nbsp;&lt;/b&gt;&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;main(String&amp;nbsp;args[]){&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;color: white;&quot;&gt;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;MyThread1&amp;nbsp;m1=&lt;/span&gt;&lt;span style=&quot;color: #7f0055;&quot;&gt;&lt;b&gt;new&amp;nbsp;&lt;/b&gt;&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;MyThread1(&lt;/span&gt;&lt;span style=&quot;color: #2a00ff;&quot;&gt;&quot;Thread&amp;nbsp;started....&quot;&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;);&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;color: white;&quot;&gt;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;}&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;color: black;&quot;&gt;}&lt;/span&gt;&lt;/code&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;code&gt;&lt;span style=&quot;color: black;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/code&gt;&lt;/div&gt;
&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://javaprompt.blogspot.com/feeds/313768024478435405/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://javaprompt.blogspot.com/2012/02/creating-thread.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4216772231114158071/posts/default/313768024478435405'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4216772231114158071/posts/default/313768024478435405'/><link rel='alternate' type='text/html' href='http://javaprompt.blogspot.com/2012/02/creating-thread.html' title='Creating a Thread'/><author><name>Unknown</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEilx-41xqx5nYfOzZ6D1J3lz8cqemcMtfzwsMESKFvyMWxSW6kf2xO1yKM5YDgU-APJEpk5Unp9yXWEZ20TWQPXg8z-ECHqipXK4xIu2EIp8KnU_CiL4Azofvdj-8zHl5cify_1RxKQjxS5/s72-c/Thread+creation.gif" height="72" width="72"/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4216772231114158071.post-6684358358589940662</id><published>2012-02-14T21:17:00.001-08:00</published><updated>2017-11-29T05:45:31.461-08:00</updated><title type='text'>Scheduler example</title><content type='html'>&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;b&gt;Category.java&lt;o:p&gt;&lt;/o:p&gt;&lt;/b&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
package com.sandbox.scheduler.model;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
public enum Category {&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; RED(1),&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; GREEN(2),&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; BLUE(3);&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; private int value;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; public int
getValue() {&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; return value;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; private
Category(int value) {&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; this.value =
value;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
}&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;b&gt;Task.java&lt;/b&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
package com.sandbox.scheduler.model;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
import java.time.LocalDateTime;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
import java.util.UUID;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
import com.sandbox.scheduler.model.Category;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
public class Task {&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; public int urgency
= -1;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; public Category
category;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; public
LocalDateTime timestamp = LocalDateTime.now();&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; public UUID uuid =
UUID.randomUUID();&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; public Task(int
urgency, Category category) {&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; this.urgency =
urgency;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; this.category
= category;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; public String
toString() {&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; return
&quot;[TASK] UUID: &quot; + uuid.toString() + &quot; URGENCY: &quot; + urgency
+ &quot; CATEGORY: &quot; + category +&quot; TIMESTAMP: &quot; + timestamp;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; @Override&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; public boolean
equals(Object o) {&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; if (this == o)
return true;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; if (o == null
|| getClass() != o.getClass()) return false;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Task task =
(Task) o;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; if (urgency !=
task.urgency) return false;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; if
(!category.toString().equals(task.category.toString())) return false;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; if (timestamp
!= null ? !timestamp.equals(task.timestamp) : task.timestamp != null) return
false;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; return uuid !=
null ? uuid.equals(task.uuid) : task.uuid == null;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; @Override&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; public int
hashCode() {&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; int result =
urgency;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; result = 31 *
result + (category != null ? category.toString().hashCode() : 0);&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; result = 31 *
result + (timestamp != null ? timestamp.hashCode() : 0);&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; result = 31 *
result + (uuid != null ? uuid.hashCode() : 0);&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; return result;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
}&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;b&gt;App.java&lt;o:p&gt;&lt;/o:p&gt;&lt;/b&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
package com.sandbox.scheduler;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
import com.sandbox.scheduler.model.Task;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
import com.sandbox.scheduler.model.Category;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
import java.util.Arrays;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
import java.util.List;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
public class App {&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; public static void
main(String[] args) {&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Task task1 =
new Task(0, Category.RED);&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Task task2 =
new Task(0, Category.BLUE);&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Task task3 =
new Task(3, Category.GREEN);&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Task task4 =
new Task(4, Category.GREEN);&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Task task5 =
new Task(5, Category.RED);&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Task task6 =
new Task(0, Category.RED);&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;
List&amp;lt;Task&amp;gt; unsorted = Arrays.asList(task1, task2, task3, task4,
task5, task6);&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; unsorted.forEach(t
-&amp;gt; Scheduler.scheduleTask(t));&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;
//Scheduler.printSchedule();&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
}&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;b&gt;Scheduler.java&lt;/b&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
package com.sandbox.scheduler;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
import com.sandbox.scheduler.model.Task;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
public class Scheduler{&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; public
static void scheduleTask(Task t){&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; System.out.println(&quot;Task
:&quot;+t);&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/div&gt;
&lt;br /&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
}&lt;/div&gt;
&lt;/div&gt;
</content><link rel='replies' type='application/atom+xml' href='http://javaprompt.blogspot.com/feeds/6684358358589940662/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://javaprompt.blogspot.com/2012/02/blog-post.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4216772231114158071/posts/default/6684358358589940662'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4216772231114158071/posts/default/6684358358589940662'/><link rel='alternate' type='text/html' href='http://javaprompt.blogspot.com/2012/02/blog-post.html' title='Scheduler example'/><author><name>Unknown</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4216772231114158071.post-2621314618232249028</id><published>2011-11-09T23:34:00.000-08:00</published><updated>2011-11-09T23:57:24.802-08:00</updated><title type='text'>What is an interface?</title><content type='html'>Interface is a reference type which consists of only method declarations and constants.&lt;br /&gt;&lt;br /&gt;All methods in interface by default public abstract and all fields are public static final eventhough it has not been mentioned explicitly.&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;Example:&lt;/strong&gt;&lt;br /&gt;&lt;br /&gt;public interface Car&lt;br /&gt;{&lt;br /&gt;int wheel=4;&lt;br /&gt;int paintCar(String color);&lt;br /&gt;int driveCar();&lt;br /&gt;}</content><link rel='replies' type='application/atom+xml' href='http://javaprompt.blogspot.com/feeds/2621314618232249028/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://javaprompt.blogspot.com/2011/11/what-is-interface.html#comment-form' title='3 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4216772231114158071/posts/default/2621314618232249028'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4216772231114158071/posts/default/2621314618232249028'/><link rel='alternate' type='text/html' href='http://javaprompt.blogspot.com/2011/11/what-is-interface.html' title='What is an interface?'/><author><name>Unknown</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>3</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4216772231114158071.post-9190398255487891322</id><published>2011-09-16T05:12:00.000-07:00</published><updated>2011-09-16T05:13:27.456-07:00</updated><title type='text'>Why String is immutable in java?</title><content type='html'>&lt;span style=&quot;font-family:georgia;&quot;&gt;1)Imagine StringPool facility without making string immutable , its not possible at all because in case of string pool one string object/literal e.g. &quot;Test&quot; has referenced by many reference variables , so if any one of them change the value others will be automatically gets affected i.e. lets sayString A = &quot;Test&quot;String B = &quot;Test&quot; Now String B called &quot;Test&quot;.toUpperCase() which change the same object into &quot;TEST&quot; , so A will also be &quot;TEST&quot; which is not desirable.&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;font-family:georgia;&quot;&gt;&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;font-family:georgia;&quot;&gt;2)String has been widely used as parameter for many java classes e.g. for opening network connection you can pass hostname and port number as stirng , you can pass database URL as string for opening database connection, you can open any file by passing name of file as argument to File I/O classes.In case if String is not immutable , this would lead serious security threat , I mean some one can access to any file for which he has authorization and then can change the file name either deliberately or accidentally and gain access of those file.&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;font-family:georgia;&quot;&gt;&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;font-family:georgia;&quot;&gt;3)Since String is immutable it can safely shared between many threads ,which is very important for multithreaded programming and to avoid any &lt;/span&gt;&lt;a href=&quot;http://javarevisited.blogspot.com/2011/04/synchronization-in-java-synchronized.html&quot;&gt;&lt;span style=&quot;font-family:georgia;&quot;&gt;synchronization issues in Java&lt;/span&gt;&lt;/a&gt;&lt;span style=&quot;font-family:georgia;&quot;&gt;.&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;font-family:georgia;&quot;&gt;&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;font-family:georgia;&quot;&gt;4) Another reason of Why String is immutable in Java is to allow String to cache its hashcode , being immutable String in Java caches its hashcode and do not calculate every time we call hashcode method of String, which makes it very fast as hashmap key to be used in &lt;/span&gt;&lt;a href=&quot;http://javarevisited.blogspot.com/2011/02/how-hashmap-works-in-java.html&quot;&gt;&lt;span style=&quot;font-family:georgia;&quot;&gt;hashmap in Java&lt;/span&gt;&lt;/a&gt;&lt;span style=&quot;font-family:georgia;&quot;&gt;. This one is also suggested by Jaroslav Sedlacek in comments below.&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;font-family:georgia;&quot;&gt;&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;font-family:georgia;&quot;&gt;5) Another good reason of Why String is immutable in Java suggested by Dan Bergh Johnsson on comments is: The absolutely most important reason that String is immutable is that it is used by the class loading mechanism, and thus have profound and fundamental security aspects. Had String been mutable, a request to load &quot;java.io.Writer&quot; could have been changed to load &quot;mil.vogoon.DiskErasingWriter&quot;&lt;/span&gt;</content><link rel='replies' type='application/atom+xml' href='http://javaprompt.blogspot.com/feeds/9190398255487891322/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://javaprompt.blogspot.com/2011/09/why-string-is-immutable-in-java.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4216772231114158071/posts/default/9190398255487891322'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4216772231114158071/posts/default/9190398255487891322'/><link rel='alternate' type='text/html' href='http://javaprompt.blogspot.com/2011/09/why-string-is-immutable-in-java.html' title='Why String is immutable in java?'/><author><name>Unknown</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4216772231114158071.post-4364835875698389695</id><published>2011-06-30T04:41:00.001-07:00</published><updated>2012-02-13T21:37:04.171-08:00</updated><title type='text'>Asynchronous Messaging</title><content type='html'>&lt;div&gt;&lt;font face=&quot;times new roman&quot; size=&quot;3&quot;&gt;Asynchronous messaging describes communications that takes place between two applications or systems, where the system places a message in a message queue (called an &lt;/font&gt;&lt;a href=&quot;http://www.webopedia.com/TERM/E/Event_Queue.html&quot;&gt;&lt;font face=&quot;times new roman&quot; size=&quot;3&quot;&gt;Event Queue&lt;/font&gt;&lt;/a&gt;&lt;font face=&quot;times new roman&quot; size=&quot;3&quot;&gt; in &lt;/font&gt;&lt;a href=&quot;http://www.webopedia.com/TERM/E/enterprise_messaging_system.html&quot;&gt;&lt;font face=&quot;times new roman&quot; size=&quot;3&quot;&gt;enterprise messaging systems&lt;/font&gt;&lt;/a&gt;&lt;font face=&quot;times new roman&quot; size=&quot;3&quot;&gt;) and does not need to wait for a reply to continue processing. Contrast with &lt;/font&gt;&lt;a href=&quot;http://www.webopedia.com/TERM/S/synchronous_messaging.html&quot;&gt;&lt;font face=&quot;times new roman&quot; size=&quot;3&quot;&gt;synchronous messaging&lt;/font&gt;&lt;/a&gt;&lt;font face=&quot;times new roman&quot; size=&quot;3&quot;&gt;.&lt;/font&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://javaprompt.blogspot.com/feeds/4364835875698389695/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://javaprompt.blogspot.com/2011/06/asynchronous-messaging_30.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4216772231114158071/posts/default/4364835875698389695'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4216772231114158071/posts/default/4364835875698389695'/><link rel='alternate' type='text/html' href='http://javaprompt.blogspot.com/2011/06/asynchronous-messaging_30.html' title='Asynchronous Messaging'/><author><name>Unknown</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4216772231114158071.post-2273881394645307990</id><published>2011-06-30T04:41:00.000-07:00</published><updated>2011-06-30T04:42:31.045-07:00</updated><title type='text'>Asynchronous Messaging</title><content type='html'>&lt;span style=&quot;font-family:times new roman;font-size:100%;&quot;&gt;Asynchronous messaging describes communications that takes place between two applications or systems, where the system places a message in a message queue (called an &lt;/span&gt;&lt;a href=&quot;http://www.webopedia.com/TERM/E/Event_Queue.html&quot;&gt;&lt;span style=&quot;font-family:times new roman;font-size:100%;&quot;&gt;Event Queue&lt;/span&gt;&lt;/a&gt;&lt;span style=&quot;font-family:times new roman;font-size:100%;&quot;&gt; in &lt;/span&gt;&lt;a href=&quot;http://www.webopedia.com/TERM/E/enterprise_messaging_system.html&quot;&gt;&lt;span style=&quot;font-family:times new roman;font-size:100%;&quot;&gt;enterprise messaging systems&lt;/span&gt;&lt;/a&gt;&lt;span style=&quot;font-family:times new roman;font-size:100%;&quot;&gt;) and does not need to wait for a reply to continue processing. Contrast with &lt;/span&gt;&lt;a href=&quot;http://www.webopedia.com/TERM/S/synchronous_messaging.html&quot;&gt;&lt;span style=&quot;font-family:times new roman;font-size:100%;&quot;&gt;synchronous messaging&lt;/span&gt;&lt;/a&gt;&lt;span style=&quot;font-family:times new roman;font-size:100%;&quot;&gt;.&lt;/span&gt;</content><link rel='replies' type='application/atom+xml' href='http://javaprompt.blogspot.com/feeds/2273881394645307990/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://javaprompt.blogspot.com/2011/06/asynchronous-messaging.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4216772231114158071/posts/default/2273881394645307990'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4216772231114158071/posts/default/2273881394645307990'/><link rel='alternate' type='text/html' href='http://javaprompt.blogspot.com/2011/06/asynchronous-messaging.html' title='Asynchronous Messaging'/><author><name>Unknown</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4216772231114158071.post-3952377845690047768</id><published>2011-06-15T02:45:00.000-07:00</published><updated>2011-06-15T02:51:31.103-07:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="java heap size"/><category scheme="http://www.blogger.com/atom/ns#" term="java memory settings"/><title type='text'>Understanding Java Memory Settings</title><content type='html'>&lt;span style=&quot;font-family:times new roman;color:#000000;&quot;&gt;&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;font-family:times new roman;color:#000000;&quot;&gt;As part of the Best Practices, we know that we should be setting -Xms &amp;amp; -Xmx Java command line parameters. What are these settings and why is it required to set these. &lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style=&quot;font-family:times new roman;color:#000000;&quot;&gt;As JAVA starts, it creates within the systems memory a Java Virtual Machine (JVM). JVM is where the complete processing of any Java program takes place. All JAVA applications (including IQv6) by default allocates &amp;amp; reserves up to 64 MB of memory resource pool from the system on which it is running. &lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style=&quot;font-family:times new roman;color:#000000;&quot;&gt;The Xms is the initial / minimum Java memory (heap) size within the JVM. Setting the initial memory (heap) size higher can help in a couple of ways. First, it will allow garbage collection (GC) to work less which is more efficient. The higher initial memory value will cause the size of the memory (heap) not to have to grow as fast as a lower initial memory (heap) size, thereby saving the overhead of the Java VM asking the OS for more memory. &lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style=&quot;font-family:times new roman;color:#000000;&quot;&gt;The Xmx is the maximum Java memory (heap) size within the Java Virtual Memory (JVM). As the JVM gets closer to fully utilizing the initial memory, it checks the Xmx settings to find out if it can draw more memory from the system resources. If can, it does so. For the JVM to allocate contiguous memory to itself is a very expensive operation. So as the JVM gets closer to the initial memory, the JVM will use aggressive garbage collection (to clean the memory and if possible avoid memory allocation), increasing the load on the system. &lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style=&quot;font-family:times new roman;color:#000000;&quot;&gt;If JVM is in need of memory beyond the value set in Xmx, the JVM will not be able to draw more memory from system resource (even if available) and run out of memory. Hence, the -Xms and -Xmx memory parameters should be increased depending upon the demand estimation of the system. Ideally both same should be the same value (set at maximum possible as per demand estimation). This ensure that the maximum memory is allocated right at the start-up eliminating the need for extra memory allocation during program execution. We recommend aggressive maximum memory (heap) size of between 1/2 and 3/4 of physical memory. &lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;font-family:Times New Roman;color:#000000;&quot;&gt;&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;font-family:Times New Roman;color:#000000;&quot;&gt;&lt;strong&gt;NOTE:- &lt;/strong&gt;&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;font-family:Times New Roman;&quot;&gt;&lt;br /&gt;&lt;ol&gt;&lt;br /&gt;&lt;li&gt;&lt;span style=&quot;color:#000066;&quot;&gt;When determining the maximum memory (heap) size you want to set be sure to take into account other software running on the machine. &lt;/span&gt;&lt;/li&gt;&lt;br /&gt;&lt;li&gt;&lt;span style=&quot;color:#000066;&quot;&gt;When Internal database (HSQL) is used, the database server and IQuinox share the same Java environment. In this case, allocate JAVA as much as memory as possible (at least upto 75% of system memory) . e.g. if system memory = 256 MB, in the ng.bat / iq.bat set -Xms192m -Xmx192m in the java command. &lt;/span&gt;&lt;/li&gt;&lt;br /&gt;&lt;li&gt;&lt;span style=&quot;color:#000066;&quot;&gt;When External database (MySQL) is used, only IQuinox uses the Java environment. In this case, allocate JAVA only upto 50% of system memory. e.g. if system memory = 256 MB, in the ng.bat / iq.bat set -Xms128m -Xmx128m in the java command.&lt;/span&gt;&lt;/li&gt;&lt;/ol&gt;&lt;span style=&quot;color:#000000;&quot;&gt;&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;color:#000000;&quot;&gt;&lt;strong&gt;Steps to change -Xms &amp;amp; -Xmx settings: &lt;/strong&gt;&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;ul&gt;&lt;br /&gt;&lt;li&gt;&lt;span style=&quot;color:#000066;&quot;&gt;Shut down IQv6.&lt;/span&gt;&lt;/li&gt;&lt;br /&gt;&lt;li&gt;&lt;span style=&quot;color:#000066;&quot;&gt;Go to &quot;...\Program Files\QLC&quot;.&lt;/span&gt;&lt;/li&gt;&lt;br /&gt;&lt;li&gt;&lt;span style=&quot;color:#000066;&quot;&gt;Locate the file &quot;ng.bat&quot; here and open it in any Text Editor.&lt;/span&gt;&lt;/li&gt;&lt;br /&gt;&lt;li&gt;&lt;span style=&quot;color:#000066;&quot;&gt;Locate the line &quot;start shared\jre1.5\bin\javaw -Xms128m -Xmx128m .....&quot;.&lt;/span&gt;&lt;/li&gt;&lt;br /&gt;&lt;li&gt;&lt;span style=&quot;color:#000066;&quot;&gt;Change it to &quot;start shared\jre1.5\bin\javaw -Xms256m -Xmx256m .....&quot;.&lt;/span&gt;&lt;/li&gt;&lt;br /&gt;&lt;li&gt;&lt;span style=&quot;color:#000066;&quot;&gt;Save the file and close it .&lt;/span&gt;&lt;/li&gt;&lt;br /&gt;&lt;li&gt;&lt;span style=&quot;color:#000066;&quot;&gt;Start IQuinox and verify its correct functioning!!!&lt;/span&gt;&lt;/span&gt;&lt;/li&gt;&lt;/ul&gt;&lt;span style=&quot;font-family:Times New Roman;color:#000000;&quot;&gt;&lt;/span&gt;</content><link rel='replies' type='application/atom+xml' href='http://javaprompt.blogspot.com/feeds/3952377845690047768/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://javaprompt.blogspot.com/2011/06/understanding-java-memory-settings_15.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4216772231114158071/posts/default/3952377845690047768'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4216772231114158071/posts/default/3952377845690047768'/><link rel='alternate' type='text/html' href='http://javaprompt.blogspot.com/2011/06/understanding-java-memory-settings_15.html' title='Understanding Java Memory Settings'/><author><name>Unknown</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4216772231114158071.post-6682214923526172801</id><published>2011-06-15T02:42:00.000-07:00</published><updated>2011-06-15T02:43:12.165-07:00</updated><title type='text'>Understanding java Memory settings</title><content type='html'>As part of the Best Practices, we know that we should be setting -Xms &amp;amp; -Xmx Java command line parameters. What are these settings and why is it required to set these.&lt;br /&gt;As JAVA starts, it creates within the systems memory a Java Virtual Machine (JVM). JVM is where the complete processing of any Java program takes place. All JAVA applications (including IQv6) by default allocates &amp;amp; reserves up to 64 MB of memory resource pool from the system on which it is running.&lt;br /&gt;&lt;br /&gt;The Xms is the initial / minimum Java memory (heap) size within the JVM. Setting the initial memory (heap) size higher can help in a couple of ways. First, it will allow garbage collection (GC) to work less which is more efficient. The higher initial memory value will cause the size of the memory (heap) not to have to grow as fast as a lower initial memory (heap) size, thereby saving the overhead of the Java VM asking the OS for more memory.&lt;br /&gt;&lt;br /&gt;The Xmx is the maximum Java memory (heap) size within the Java Virtual Memory (JVM). As the JVM gets closer to fully utilizing the initial memory, it checks the Xmx settings to find out if it can draw more memory from the system resources. If can, it does so. For the JVM to allocate contiguous memory to itself is a very expensive operation. So as the JVM gets closer to the initial memory, the JVM will use aggressive garbage collection (to clean the memory and if possible avoid memory allocation), increasing the load on the system.&lt;br /&gt;&lt;br /&gt;If JVM is in need of memory beyond the value set in Xmx, the JVM will not be able to draw more memory from system resource (even if available) and run out of memory. Hence, the -Xms and -Xmx memory parameters should be increased depending upon the demand estimation of the system. Ideally both same should be the same value (set at maximum possible as per demand estimation). This ensure that the maximum memory is allocated right at the start-up eliminating the need for extra memory allocation during program execution. We recommend aggressive maximum memory (heap) size of between 1/2 and 3/4 of physical memory.&lt;br /&gt;&lt;br /&gt;NOTE:-&lt;br /&gt;&lt;br /&gt;When determining the maximum memory (heap) size you want to set be sure to take into account other software running on the machine.&lt;br /&gt;&lt;br /&gt;When Internal database (HSQL) is used, the database server and IQuinox share the same Java environment. In this case, allocate JAVA as much as memory as possible (at least upto 75% of system memory) . e.g. if system memory = 256 MB, in the ng.bat / iq.bat set -Xms192m -Xmx192m in the java command.&lt;br /&gt;&lt;br /&gt;When External database (MySQL) is used, only IQuinox uses the Java environment. In this case, allocate JAVA only upto 50% of system memory. e.g. if system memory = 256 MB, in the ng.bat / iq.bat set -Xms128m -Xmx128m in the java command.Steps to change -Xms &amp;amp; -Xmx settings:&lt;br /&gt;&lt;br /&gt;Shut down IQv6.&lt;br /&gt;Go to &quot;...\Program Files\QLC&quot;.&lt;br /&gt;Locate the file &quot;ng.bat&quot; here and open it in any Text Editor.&lt;br /&gt;Locate the line &quot;start shared\jre1.5\bin\javaw -Xms128m -Xmx128m .....&quot;.&lt;br /&gt;Change it to &quot;start shared\jre1.5\bin\javaw -Xms256m -Xmx256m .....&quot;.&lt;br /&gt;Save the file and close it .&lt;br /&gt;Start IQuinox and verify its correct functioning!!!</content><link rel='replies' type='application/atom+xml' href='http://javaprompt.blogspot.com/feeds/6682214923526172801/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://javaprompt.blogspot.com/2011/06/understanding-java-memory-settings.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4216772231114158071/posts/default/6682214923526172801'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4216772231114158071/posts/default/6682214923526172801'/><link rel='alternate' type='text/html' href='http://javaprompt.blogspot.com/2011/06/understanding-java-memory-settings.html' title='Understanding java Memory settings'/><author><name>Unknown</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4216772231114158071.post-2487271171156312413</id><published>2011-05-31T21:40:00.000-07:00</published><updated>2011-05-31T21:41:03.835-07:00</updated><title type='text'>What are PermSize and MaxPermSize and how they work in Java.</title><content type='html'>Permanent Generation (which is “Perm” in PermSize)&lt;br /&gt;The permanent generation is used to hold reflective of the VM itself such as class objects and method objects. These reflective objects are allocated directly into the permanent generation, and it is sized independently from the other generations. Generally, sizing of this generation can be ignored because the default size is adequate. However, programs that load many classes may need a larger permanent generation.&lt;br /&gt;PermSize is additional separate heap space to the -Xmx value set by the user. The section of the heap reserved for the permanent generation holds all of the reflective data for the JVM. You should adjust the size accordingly if your application dynamically load and unload a lot of classes in order to optimize the performance.&lt;br /&gt;By default, MaxPermSize will be 32mb for -client and 64mb for -server. However, if you do not set both PermSize and MaxPermSize, the overall heap will not increase unless it is needed. When you set both PermSize and MaxPermSize, for example, 192mb, the extra heap space will get allocated when it startup and will stay allocated.</content><link rel='replies' type='application/atom+xml' href='http://javaprompt.blogspot.com/feeds/2487271171156312413/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://javaprompt.blogspot.com/2011/05/what-are-permsize-and-maxpermsize-and.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4216772231114158071/posts/default/2487271171156312413'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4216772231114158071/posts/default/2487271171156312413'/><link rel='alternate' type='text/html' href='http://javaprompt.blogspot.com/2011/05/what-are-permsize-and-maxpermsize-and.html' title='What are PermSize and MaxPermSize and how they work in Java.'/><author><name>Unknown</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4216772231114158071.post-1493944324371356743</id><published>2011-05-01T21:24:00.000-07:00</published><updated>2012-10-23T07:21:16.899-07:00</updated><title type='text'>OOPS Concepts with realtime examples</title><content type='html'>1. Abstraction&lt;br /&gt;
&lt;br /&gt;
Abstraction helps to hide the non essential features from the user and makes the application user friendly.&lt;br /&gt;
&lt;br /&gt;
Eg. Take your mobile phone. You are having buttons and know the purpose but no need to understand how it prints number on the screen when it is pressed.&lt;br /&gt;
&lt;br /&gt;
2. Encapsulation&lt;br /&gt;
&lt;br /&gt;
It bundles the code into a single unit which makes the code very easy to handle.&lt;br /&gt;
&lt;br /&gt;
Eg.&lt;br /&gt;
&lt;br /&gt;
Take computer keyboard. All the buttons have been enclosed.&lt;br /&gt;
&lt;br /&gt;
3. Inheritance&lt;br /&gt;
&lt;br /&gt;
It helps to inherit the superclass properties to subclasses.&lt;br /&gt;
&lt;br /&gt;
Eg. Father - Son relationship.&lt;br /&gt;
&lt;br /&gt;
4. Polymorphism&lt;br /&gt;
&lt;br /&gt;
A entity which behaves differntly at different places.&lt;br /&gt;
&lt;br /&gt;
Eg. A person behaves as a good husband in family.&lt;br /&gt;
He behaves as a good employee at company.&lt;br /&gt;
He also behaves as a good citizen in public</content><link rel='replies' type='application/atom+xml' href='http://javaprompt.blogspot.com/feeds/1493944324371356743/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://javaprompt.blogspot.com/2011/05/oops-concepts-with-realtime-examples.html#comment-form' title='6 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4216772231114158071/posts/default/1493944324371356743'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4216772231114158071/posts/default/1493944324371356743'/><link rel='alternate' type='text/html' href='http://javaprompt.blogspot.com/2011/05/oops-concepts-with-realtime-examples.html' title='OOPS Concepts with realtime examples'/><author><name>Unknown</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>6</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4216772231114158071.post-1145203291855759695</id><published>2011-05-01T21:09:00.001-07:00</published><updated>2011-05-01T21:11:07.122-07:00</updated><title type='text'>Object Oriented Concepts</title><content type='html'>There are four main object oriented concepts in java.&lt;br /&gt;&lt;br /&gt;1. Abstraction&lt;br /&gt;2. Encapsultion&lt;br /&gt;3. Inheritance&lt;br /&gt;4. Polymorphism</content><link rel='replies' type='application/atom+xml' href='http://javaprompt.blogspot.com/feeds/1145203291855759695/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://javaprompt.blogspot.com/2011/05/object-oriented-concepts.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4216772231114158071/posts/default/1145203291855759695'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4216772231114158071/posts/default/1145203291855759695'/><link rel='alternate' type='text/html' href='http://javaprompt.blogspot.com/2011/05/object-oriented-concepts.html' title='Object Oriented Concepts'/><author><name>Unknown</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry></feed>