<?xml version="1.0" encoding="utf-8" standalone="yes" ?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom">
  <channel>
    <title>DHP Technologies, Inc. on DHP Technologies, Inc.</title>
    <link>http://dhptech.com/</link>
    <description>Recent content in DHP Technologies, Inc. on DHP Technologies, Inc.</description>
    <generator>Hugo -- gohugo.io</generator>
    <language>en-us</language>
    <managingEditor>danap@dhptech.com (Dana H. P&#39;Simer)</managingEditor>
    <webMaster>danap@dhptech.com (Dana H. P&#39;Simer)</webMaster>
    <copyright>Copyright Dana H. P&#39;Simer, All rights reserved</copyright>
    <lastBuildDate>Mon, 08 May 2006 00:00:00 +0000</lastBuildDate>
    <atom:link href="http://dhptech.com/" rel="self" type="application/rss+xml" />
    
    <item>
      <title>Site Redesinged</title>
      <link>http://dhptech.com/article/2015/09/30/site-redesigned/</link>
      <pubDate>Wed, 30 Sep 2015 00:00:00 +0000</pubDate>
      <author>danap@dhptech.com (Dana H. P&#39;Simer)</author>
      <guid>http://dhptech.com/article/2015/09/30/site-redesigned/</guid>
      <description>&lt;p&gt;I have redesigned the site to be more efficient to host.  I hope you like it.&lt;/p&gt;
</description>
    </item>
    
    <item>
      <title>Remembering Steve Jobs</title>
      <link>http://dhptech.com/article/2011/10/05/remembering-steve-jobs/</link>
      <pubDate>Wed, 05 Oct 2011 00:00:00 +0000</pubDate>
      <author>danap@dhptech.com (Dana H. P&#39;Simer)</author>
      <guid>http://dhptech.com/article/2011/10/05/remembering-steve-jobs/</guid>
      <description>&lt;p&gt;I was 12 years old in 1980 when I first saw an Apple computer.  It was at a friends house.  He showed me some games, used a synthesizer program to create some music and showed me a program he had written and I was hooked.  I went home that night with a recording of the music and played it for my father. I said, if we had an Apple II we could do things like that.  I really wanted it.  Well my dad, being an electrical engineer, was into electronic gadgets and I guess he thought it would be good to have a computer in the family, so he bought one!

  We got the Language Card with it so that we would have an extra 16KB of memory and UCSD Pascal.&lt;/p&gt;

&lt;p&gt;I remember playing a ton of games on that thing.  I also learned to program in AppleSoft BASIC, Pascal, and 6502 Assembler.  I loved computer graphics so I tried to write a Space Invaders clone in UCSD Pascal.  That did not work well.  The UCSD p-System was just too slow.  So I learned how to do it in 6502 Assembler.  I got pretty far with it but eventually, I eventually gave it up.  I wrote other things and continued to learn.&lt;/p&gt;

&lt;p&gt;I remember learning just about everything about that computer.  I knew all the peek and poke addresses to do all kinds of stuff.  I knew how the disk format was laid out so I could better understand how software was copy protected.  I think I explored just about every aspect of that computer.&lt;/p&gt;

&lt;p&gt;I remember reading about the 2 men who started Apple Computers, Steve Wozniak and Steve Jobs.  I remember Steve Jobs as the dynamic spokesman.  He was inspiring then.&lt;/p&gt;

&lt;p&gt;Late in the 80&amp;rsquo;s I moved away from my Apple roots and started using IBM&amp;rsquo;s &amp;amp; Microsoft&amp;rsquo;s products.  There were some interesting times then.  Businesses were using micro computers more and more and there was a lot of money to be made writing software for them.  I am not ashamed to say that I took not a small piece of that pie.&lt;/p&gt;

&lt;p&gt;When he returned to Apple I was excited to hear it.  I wanted them to do well but I had drifted away.  I could not go back to Apple when all my business was on PCs.  It wasn&amp;rsquo;t until I started looking for a UNIX that ran well on a laptop that I came back to Apple in 2006.  Since then I have not looked back.  The products that Steve Jobs brought into this world have not just revolutionized the industry they, more importantly, have revolutionized my life and my relationship with my computers.  For the longest time I struggled to make Windows do what I want and now my computer does what I want.  One of the reasons I became a computer programmer was because I loved making them do what I wanted.&lt;/p&gt;

&lt;p&gt;After that, he kept coming out with new stuff that I loved.  I have an iPhone, an iPad, an AppleTV, and a MacBook Pro.  My wife has a MacBook Pro, my son a Mac Mini, and my daughter a MacBook.&lt;/p&gt;

&lt;p&gt;Thanks, Steve, for the great ride and inspiration.  You will be missed.&lt;/p&gt;</description>
    </item>
    
    <item>
      <title>AWS Framework for Mac OS X</title>
      <link>http://dhptech.com/article/2011/10/04/aws-framework-mac-os-x/</link>
      <pubDate>Tue, 04 Oct 2011 00:00:00 +0000</pubDate>
      <author>danap@dhptech.com (Dana H. P&#39;Simer)</author>
      <guid>http://dhptech.com/article/2011/10/04/aws-framework-mac-os-x/</guid>
      <description>&lt;p&gt;
I have ported the &lt;a href=&#34;http://aws.amazon.com/sdkforios/&#34;&gt;AWS for iOS Framework&lt;/a&gt; to Mac OS X and pushed the code to &lt;a href=&#34;https://bitbucket.org/danap/osx-aws-toolkit&#34;&gt;bitbucket&lt;/a&gt;.  There&#39;s not a lot to say about it.  
&lt;/p&gt;


&lt;ul&gt;
  &lt;li&gt;I had to hack up the browser id line.  I am planning on fixing that.&lt;/li&gt;
  &lt;li&gt;There were some issues with the structure of the source code directories and import statements that needed to be ironed out.&lt;/li&gt;
  &lt;li&gt;Also, there were some mismatches in variable types that changed size between iOS and OS X so I fixed those up as well&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;
I have tested the S3 APIs to a small extent and am working on more unit tests but I think this establishes that the underlying communication mechanism is working fine under OS X.
&lt;/p&gt;&lt;p&gt;
Feel free to fork and submit pull requests.  I am going to try to keep the code as close to the original as possible so that changes from the iOS version and be merged in easily.  If you have a significant change we can push them into a branch.
&lt;/p&gt;</description>
    </item>
    
    <item>
      <title>You don&#39;t exist, go away!</title>
      <link>http://dhptech.com/article/2011/08/24/you-dont-exist-go-away/</link>
      <pubDate>Wed, 24 Aug 2011 00:00:00 +0000</pubDate>
      <author>danap@dhptech.com (Dana H. P&#39;Simer)</author>
      <guid>http://dhptech.com/article/2011/08/24/you-dont-exist-go-away/</guid>
      <description>&lt;p&gt;Today I tried to push my latest changes from a git repo on my laptop to a remote repo and got the following output:&lt;/p&gt;

&lt;p&gt;&lt;/p&gt;

&lt;div class=&#34;highlight&#34;&gt;&lt;pre class=&#34;chroma&#34;&gt;&lt;code class=&#34;language-bash&#34; data-lang=&#34;bash&#34;&gt;moe:~/dev/ihg/endeavor-stats-analyzer 
danap$ git push
You don&lt;span class=&#34;err&#34;&gt;&amp;#39;&lt;/span&gt;t exist, go away!
fatal: The remote end hung up unexpectedly&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;

&lt;p&gt;I did some googling and found that it might have something to do with SSH not being able to find out what user I am.  So I looked in /etc/passwd file and could not find my user!  I use a Mac OS X 10.7.0 system so I was not terribly alarmed.  Of course the &amp;ldquo;it just works&amp;rdquo; operating system would keep my user information in a place other then the standard Unix location.  There was a comment in the file stating that most user information was stored in opendirectory.  So I did a &amp;ldquo;ps -ef | grep opendirectory&amp;rdquo; and I found the process.  So figuring it was managed and watched by launchd, I killed it.  That worked.  I was able to SSH again.&lt;/p&gt;

&lt;p&gt;So whenever you are accused by your Mac OS X system that &amp;ldquo;You don&amp;rsquo;t exist&amp;rdquo; and are commanded to &amp;ldquo;go away&amp;rdquo; try killing opendirectory.  That might just do the trick.&lt;/p&gt;</description>
    </item>
    
    <item>
      <title>Hosting Maven Sites &amp; Repos at Google Code</title>
      <link>http://dhptech.com/article/2010/08/14/hosting-maven-sites-repos-google-code/</link>
      <pubDate>Sat, 14 Aug 2010 00:00:00 +0000</pubDate>
      <author>danap@dhptech.com (Dana H. P&#39;Simer)</author>
      <guid>http://dhptech.com/article/2010/08/14/hosting-maven-sites-repos-google-code/</guid>
      <description>&lt;p&gt;When hosting an Open Source software project you want to keep things simple and cheap.  I was struggling to figure out where I was going to put my SNAPSHOTs and site for a simple BOM striping plugin I had written and was hosting at Google Code.  I came across &lt;a href=&#34;http://www.beeworks.be/hosting-maven-repository-google-code/&#34;&gt;this article&lt;/a&gt; but it assumes you are going to use Subversion.  I prefer Mercurial so I came up with a similar method.
&lt;/p&gt;


&lt;p&gt;
What I came up with was this:  Since Google uses http/https to access the &lt;i&gt;Hg&lt;/i&gt; repository, I decided a similar arrangement would work.  However with &lt;i&gt;Hg&lt;/i&gt; you don&#39;t push revisions directly to the remote repo.  First they have to go into the local clone then they get pushed.  For &lt;i&gt;Hg&lt;/i&gt; based projects Google Code provisions two source repositories: one for the wiki and one for the code.  So I decided to use the wiki source repo to hold the maven repo and site.
&lt;/p&gt;
&lt;p&gt;
To see the entire project source code and layout go to &lt;a href=&#34;http://code.google.com/p/strip-bom-maven-plugin/&#34;&gt;The Google Code Site for the Strip BOM Maven Plugin&lt;/a&gt;.  The following are a set of steps that should help you use the same strategy in your project:
&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;In order to know where the local wiki repo directory is, I needed a property to hold that value and then we would set it in the settings.xml, however I am a fan of not having any external dependencies that could cause the build to fail.  So I added this to my POM to set a default:&lt;/li&gt;
&lt;/ol&gt;

&lt;div class=&#34;highlight&#34;&gt;&lt;pre class=&#34;chroma&#34;&gt;&lt;code class=&#34;language-xml&#34; data-lang=&#34;xml&#34;&gt;  &lt;span class=&#34;nt&#34;&gt;&amp;lt;properties&amp;gt;&lt;/span&gt;
    &lt;span class=&#34;nt&#34;&gt;&amp;lt;strip-bom.deploy.directory&amp;gt;&lt;/span&gt;${basedir}/target/deploy&lt;span class=&#34;nt&#34;&gt;&amp;lt;/strip-bom.deploy.directory&amp;gt;&lt;/span&gt;
    ...
  &lt;span class=&#34;nt&#34;&gt;&amp;lt;/properties&amp;gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;

&lt;ol&gt;
&lt;li&gt;Next I added the following to my POM to define the distributionManagement settings&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;&lt;div class=&#34;highlight&#34;&gt;&lt;pre class=&#34;chroma&#34;&gt;&lt;code class=&#34;language-xml&#34; data-lang=&#34;xml&#34;&gt;  &lt;span class=&#34;ni&#34;&gt;&amp;amp;lt;&lt;/span&gt;distributionManagement&amp;gt;
    &lt;span class=&#34;ni&#34;&gt;&amp;amp;lt;&lt;/span&gt;repository&amp;gt;
      &lt;span class=&#34;ni&#34;&gt;&amp;amp;lt;&lt;/span&gt;id&amp;gt;strip-bom-deploy&lt;span class=&#34;ni&#34;&gt;&amp;amp;lt;&lt;/span&gt;/id&amp;gt;
      &lt;span class=&#34;ni&#34;&gt;&amp;amp;lt;&lt;/span&gt;name&amp;gt;Repo&lt;span class=&#34;ni&#34;&gt;&amp;amp;lt;&lt;/span&gt;/name&amp;gt;
      &lt;span class=&#34;ni&#34;&gt;&amp;amp;lt;&lt;/span&gt;uniqueVersion&amp;gt;true&lt;span class=&#34;ni&#34;&gt;&amp;amp;lt;&lt;/span&gt;/uniqueVersion&amp;gt;
      &lt;span class=&#34;ni&#34;&gt;&amp;amp;lt;&lt;/span&gt;url&amp;gt;file:${strip-bom.deploy.directory}/repo&lt;span class=&#34;ni&#34;&gt;&amp;amp;lt;&lt;/span&gt;/url&amp;gt;
    &lt;span class=&#34;ni&#34;&gt;&amp;amp;lt;&lt;/span&gt;/repository&amp;gt;
    &lt;span class=&#34;ni&#34;&gt;&amp;amp;lt;&lt;/span&gt;site&amp;gt;
      &lt;span class=&#34;ni&#34;&gt;&amp;amp;lt;&lt;/span&gt;id&amp;gt;strip-bom-site&lt;span class=&#34;ni&#34;&gt;&amp;amp;lt;&lt;/span&gt;/id&amp;gt;
      &lt;span class=&#34;ni&#34;&gt;&amp;amp;lt;&lt;/span&gt;name&amp;gt;Site&lt;span class=&#34;ni&#34;&gt;&amp;amp;lt;&lt;/span&gt;/name&amp;gt;
      &lt;span class=&#34;ni&#34;&gt;&amp;amp;lt;&lt;/span&gt;url&amp;gt;file:${strip-bom.deploy.directory}/site&lt;span class=&#34;ni&#34;&gt;&amp;amp;lt;&lt;/span&gt;/url&amp;gt;
    &lt;span class=&#34;ni&#34;&gt;&amp;amp;lt;&lt;/span&gt;/site&amp;gt;
    &lt;span class=&#34;ni&#34;&gt;&amp;amp;lt;&lt;/span&gt;downloadUrl&amp;gt;http://code.google.com/p/strip-bom-maven-plugin/downloads&lt;span class=&#34;ni&#34;&gt;&amp;amp;lt;&lt;/span&gt;/downloadUrl&amp;gt;
  &lt;span class=&#34;ni&#34;&gt;&amp;amp;lt;&lt;/span&gt;/distributionManagement&amp;gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
The &amp;lt;repository&amp;gt; tag defines where the repo will be stored.  The &amp;lt;site&amp;gt; defines where the site will be deployed.  These will be in my &lt;i&gt;Hg&lt;/i&gt; controlled local repo.&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Next, I added this to my settings.xml:&lt;/li&gt;
&lt;/ol&gt;

&lt;div class=&#34;highlight&#34;&gt;&lt;pre class=&#34;chroma&#34;&gt;&lt;code class=&#34;language-xml&#34; data-lang=&#34;xml&#34;&gt;  &lt;span class=&#34;ni&#34;&gt;&amp;amp;lt;&lt;/span&gt;profiles&amp;gt;
    &lt;span class=&#34;ni&#34;&gt;&amp;amp;lt;&lt;/span&gt;profile&amp;gt;
      &lt;span class=&#34;ni&#34;&gt;&amp;amp;lt;&lt;/span&gt;activation&amp;gt;&lt;span class=&#34;ni&#34;&gt;&amp;amp;lt;&lt;/span&gt;activeByDefault&amp;gt;true&lt;span class=&#34;ni&#34;&gt;&amp;amp;lt;&lt;/span&gt;/activeByDefault&amp;gt;&lt;span class=&#34;ni&#34;&gt;&amp;amp;lt;&lt;/span&gt;/activation&amp;gt;
      &lt;span class=&#34;ni&#34;&gt;&amp;amp;lt;&lt;/span&gt;properties&amp;gt;
        &lt;span class=&#34;ni&#34;&gt;&amp;amp;lt;&lt;/span&gt;strip-bom.deploy.directory&amp;gt;${user.home}/dev/dhptech/strip-bom-maven-plugin-wiki&lt;span class=&#34;ni&#34;&gt;&amp;amp;lt;&lt;/span&gt;/strip-bom.deploy.directory&amp;gt;
      &lt;span class=&#34;ni&#34;&gt;&amp;amp;lt;&lt;/span&gt;/properties&amp;gt;
      &lt;span class=&#34;ni&#34;&gt;&amp;amp;lt;&lt;/span&gt;id&amp;gt;default&lt;span class=&#34;ni&#34;&gt;&amp;amp;lt;&lt;/span&gt;/id&amp;gt;
    &lt;span class=&#34;ni&#34;&gt;&amp;amp;lt;&lt;/span&gt;/profile&amp;gt;
  &lt;span class=&#34;ni&#34;&gt;&amp;amp;lt;&lt;/span&gt;/profiles&amp;gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;

&lt;p&gt;Now, when I do a snapshot build, I can execute &lt;code&gt;mvn deploy site-deploy&lt;/code&gt;, commit and push the wiki repo, and the snapshot and site are deployed at the same time.&lt;/p&gt;</description>
    </item>
    
    <item>
      <title>Subversion Version Mismatch</title>
      <link>http://dhptech.com/article/2010/04/07/subversion-version-mismatch/</link>
      <pubDate>Wed, 07 Apr 2010 00:00:00 +0000</pubDate>
      <author>danap@dhptech.com (Dana H. P&#39;Simer)</author>
      <guid>http://dhptech.com/article/2010/04/07/subversion-version-mismatch/</guid>
      <description>&lt;p&gt;I installed a new 320GB hard drive into my MacBook Pro last night.  Time Machine makes this stuff really easy now.  I left it restoring last night around 1am and came back to it around 8am and was able to simply reboot into my restored disk with 170GB free space and 7200RPM speed.  Nice.&lt;/p&gt;
&lt;p&gt;However, when I went to build the latest version of the software my team develops, I got an odd error:&lt;/p&gt;


    svn: Mismatched RA version for &#39;https&#39;: found 1.6.2, expected 1.6.5

&lt;p&gt;I had never seen this before.  I am not sure why after restoring from a backup this could have happened but it did.  So I start googling.  I found &lt;a href=&#34;http://www.svnforum.org/2017/viewtopic.php?t=9027&#34;&gt;this forum post&lt;/a&gt; over at svnforum.org.  They say reinstalling the 10.6.2 Combo patch for OS X solved their problem.  So I tried using Software Update to update the Mac&#39;s software.  There was a 10.6.3 update available so I applied it.  After that the error changed to:&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;svn: Mismatched RA version for &#39;neon&#39;: found 1.6.2, expected 1.6.5
&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;At this point, I did not think downloading a 10.6.2 patch and applying it to a 10.6.3 OS install was a good idea, to say the least.  So I thought I would just install the &lt;a href=&#34;http://www.open.collab.net/downloads/subversion/&#34;&gt;latest version of subversion&lt;/a&gt; from &lt;a href=&#34;http://collab.net&#34;&gt;Collab.Net&lt;/a&gt;.  That solved my problem, somewhat.  The installation of subversion that came with Snow Leopard is still there.  There is a new installation in &#39;/opt/subversion&#39; that was installed by Collab.Net&#39;s installer.  As long as the &#39;/opt/subversion/bin&#39; directory appears first in the path, my SVN commands execute.  Please see &lt;a href=&#34;http://dhptech.com/article/2007/02/09/setting-environment-variables-for-mac-osx-programs&#34;&gt;this article&lt;/a&gt; for information on how to set environment variables in Mac OS X.&lt;/p&gt;</description>
    </item>
    
    <item>
      <title>The Common Denominator of Successful Programmers</title>
      <link>http://dhptech.com/article/2009/06/27/the-common-denominator-of-successful-programmers/</link>
      <pubDate>Sat, 27 Jun 2009 00:00:00 +0000</pubDate>
      <author>danap@dhptech.com (Dana H. P&#39;Simer)</author>
      <guid>http://dhptech.com/article/2009/06/27/the-common-denominator-of-successful-programmers/</guid>
      <description>&lt;p&gt;I just read &lt;a href=&#34;http://dhptech.com/page/common-denominator-of-success&#34;&gt;The Common Denominator of Success&lt;/a&gt; by Albert N. E. Grey.  Please take the time to read it now as I will be referring to concepts in it.  My boss, Ashley, had suggested it as an inspirational piece.  As I read the piece I was struck by how relevant it is to so much more than just Life-Insurance salesmanship.  As he discussed some of the things that insurance salesmen do not like to do I started to list off in my head the things that Programmers do not like to do but should do if they want to be successful.

  When I read about how having a purpose makes the formation of these habits possible I started to think about what purpose a programmer would need to make forming the habits of successful programmers possible.&lt;/p&gt;

&lt;p&gt;I consider myself a successful programmer.  I have been working in this field since 1988 and have programmed in many environments and languages.  I have held positions ranging from junior programmer to architect.  I have written software that received awards from prominent publications and software that only a handful of people ever saw but generated significant revenue for my customers.  If you are interested you can find a copy of my &lt;a href=&#34;http://dhptech.com/~danap/danapsimer_resume.html&#34;&gt;resume&lt;/a&gt; in the &lt;a href=&#34;http://dhptech.com/People&#34;&gt;&#34;People&#34;&lt;/a&gt; section of this site.  I have found that many of the things that I do out of habit my less successful colleagues resist doing.  I have always been frustrated by this.  Mr. Grey&#39;s article has given me some insight into why it is that people do not do the things that are required for success.&lt;/p&gt; 

&lt;p&gt;How can we, programmers, measure success?  For insurance salesmen it is easy to measure success because the amount of money earned is directly proportional to the success of the salesperson.  For programmers the story is more complicated.  Success can be described in many ways.  For some applications, the revenue generated by the application may very well be a good measure.  However sometimes applications that make money do so despite significant flaws in the application.  Another way to measure it is by looking at the numbers of bug reports and enhancement requests.  Still another way could be to look at your own personal income since, generally speaking, better programmers get paid more money.  Yet another way to look at success is in terms of time to market.  Many applications are extremely sensitive to time to market and therefore the speed with which a product can be brought to market can determine success vs. failure.  I think how you measure success depends on your purpose.&lt;/p&gt;

&lt;p&gt;I currently work as the Technical Lead for a development group at &lt;a href=&#34;http://ihg.com&#34;&gt;IHG&lt;/a&gt;.  &lt;a href=&#34;http://ihg.com&#34;&gt;IHG&lt;/a&gt; is the largest hospitality company in the world but you may never have heard of them.  However, you have heard of our brands.  &lt;a href=&#34;http://holidayinn.com&#34;&gt;Holiday Inn&lt;/a&gt; is one.  As well as &lt;a href=&#34;http://www.hiexpress.com&#34;&gt;Holiday Inn Express&lt;/a&gt;, &lt;a href=&#34;http://www.crownplaza.com&#34;&gt;Crowne Plaza&lt;/a&gt;, &lt;a href=&#34;http://www.intercontinental.com&#34;&gt;Intercontinental Hotels&lt;/a&gt;, &lt;a href=&#34;http://www.candlewoodsuites.com&#34;&gt;Candlewood Suites&lt;/a&gt;, &lt;a href=&#34;http://www.staybridgesuites.com/&#34;&gt;Staybridge Suites&lt;/a&gt;, and &lt;a href=&#34;http://www.hotelindigo.com/&#34;&gt;Hotel Indigo&lt;/a&gt;.  We get daily revenue reports from our VP.  He obviously measures our success, at least in part, by how our revenue numbers match our target numbers.  Since our group is responsible for all revenue generating technology channels, that is a fair way to measure our success.  One way I, personally, measure our team&#39;s success is by keeping an eye on the number of defects that impact revenue.&lt;/p&gt;

&lt;p&gt;How you measure success will depend, significantly, on what your purpose is.  I will get back to that later down the line.&lt;/p&gt;

&lt;p&gt;To apply the &#34;tagline&#34; at the top of &lt;a href=&#34;http://dhptech.com/page/common-denominator-of-success&#34;&gt;The Common Denominator of Success&lt;/a&gt; we need to ask what do successful programmers do that failures do not like to do and, therefore, do not do?  A number of things come to mind immediately.   Like testing, code reviews, and documentation.  However, I think two words sum up the habits that successful programmers have: Verification &amp; Planning.&lt;/p&gt;

&lt;p&gt;Successful programmers seek verification that their code works as intended.  This takes the form of unit tests using tools like &lt;a href=&#34;http://www.junit.org&#34;&gt;JUnit&lt;/a&gt; or &lt;a href=&#34;http://www.testng.org&#34;&gt;TestNG&lt;/a&gt;, for &lt;a href=&#34;http://java.sun.com&#34;&gt;Java&lt;/a&gt;.   It takes the form of code reviews, design reviews, and just reaching out to our fellows to bounce ideas around.  It takes the form of gathering/identifying requirements.  Many of these tasks are tedious and time consuming and seem to eat up precious time to get other things done.  However, those that form the habit of doing these things fit them into their normal flow of work and can therefore save the time that will be spent tracking down an elusive bug that could easily have been caught by good unit testing or a code review.&lt;/p&gt;

&lt;p&gt;Successful programmers plan their activities.  I am not talking about hyper-planning.  I am talking about simple things like creating some form of requirements, creating a design that lays out what changes/new code needs to be written and how that code is to be laid out.  Also, they plan how their software will be verified and how it will be documented.&lt;/p&gt;

&lt;p&gt;Planning can also include developing tools and automation techniques that make the development of your software easier.  Giving thought to how you will build and deliver your application can save hours, even days, later on down the line.  The process of determining what tools will be used for development can be essential to success.  Many programmers do not take the time to learn their tools, either.  They learn just enough to get the code they write compiled and deployed.  However, sometimes knowledge of the tool can be essential to success or allow you to cut time when it is of the essence.&lt;/p&gt;

&lt;p&gt;Planning and Verification feedback on one another and that feedback is essential to successful software development.   Just as successful programmers plan to verify they must also verify their plan.  This means reviews by competent colleagues.  This does not need to be a terribly onerous process.&lt;/p&gt;

&lt;p&gt;In a previous engagement I worked for a medical device company, &lt;a href=&#34;http://www.resmed.com&#34;&gt;ResMed&lt;/a&gt;, and we developed a medical telemetry system for them that would transmit CPAP usage data using the narrow-band PCS wireless network.  We had a device that would attach to the back of the CPAP machines and we could send queries to the device to retrieve data.   As such, this product fell under the regulation of the FDA as a medical device and we had to obtain 510(k) approval to market the device in the US.  The documentation requirements for software developed under 510(k) regulations are extensive.  However, we devised a way to meet these requirements without creating a ponderous and onerous process.  One example of the kind of documentation that was required was that we needed to devise testing plans for all features of the system.  These testing plans needed to be reviewed by qualified colleagues and then executed by a member of the team other than the feature&#39;s developer.  We accomplished this using ticketing system with some custom workflow capabilities and notes added to the feature/bug&#39;s ticket.  Very simple and easily reproduced.&lt;/p&gt;

&lt;p&gt;Now, back to purpose.  What is the purpose that drives us as Programmers?  A the end of &lt;a href=&#34;http://dhptech.com/page/common-denominator-of-success&#34;&gt;The Common Denominator of Success&lt;/a&gt;, Mr Grey gives an example of a young man that he met whose purpose was to give his family a better life then he, his mother, and his sister had.  If that is your purpose, then your measure of success must be the amount of compensation you receive.   This is a good purpose.  It has the emotional context that Mr. Grey says is necessary to carry us past our needs.  It is certainly one of my purposes. 

&lt;p&gt;Let&#39;s be frank.  Most of us work for businesses.  Businesses do not write software because they like to.  They do it either because they hope to generate more revenue or reduce their costs.  They enter into the endeavor with an understanding that paying for the development will be out weighed by either the revenue generated or the costs saved.  Therefore, the measure of success of a software solution is its impact on profit.  Given that, the best way to reward the people who write the software is to give them money.  There is an equilibrium between software costs and software benefits.  The higher the benefit the higher the potential compensation.  To maximize compensation one must know the market in the area they are working.  Even the best programmers will find it hard to command compensation well outside the going rates in the local market.  Even if the profit impact of the software being written is very high.  How does one command the highest range of compensation?  They must demonstrate through their previous work experience that they are capable of a high degree of productivity.  They must also interview well and, once on the job, perform beyond expectations.  To do that, one must make a habit of things which they do not like to do.&lt;/p&gt;

&lt;p&gt;Another purpose that drives me and has just such an emotional context is my desire to leave things better then how I found them.  I feel that it is the impact our life has on those around us that is the measure of our life.  I am a programmer and therefore the best way for me to impact those around me is through that skill.  This does not mean that I wish only to improve the code.  I also wish to improve the coders.  Those men and women I have been privileged to work with in this endeavor we call programming, I hope, are better programmers because of my example.&lt;/p&gt;

&lt;p&gt;I encourage you to find a purpose that drives you beyond your needs and supports you in developing the habits necessary for success, whether you are a programmer or an insurance salesperson.&lt;/p&gt;</description>
    </item>
    
    <item>
      <title>A Throttling CompletionService</title>
      <link>http://dhptech.com/article/2009/06/08/a-throttling-completion-service/</link>
      <pubDate>Mon, 08 Jun 2009 00:00:00 +0000</pubDate>
      <author>danap@dhptech.com (Dana H. P&#39;Simer)</author>
      <guid>http://dhptech.com/article/2009/06/08/a-throttling-completion-service/</guid>
      <description>&lt;p&gt;The &lt;a href=&#34;http://java.sun.com/j2se/1.5.0/docs/api/java/util/concurrent/CompletionService.html&#34;&gt;CompletionService&lt;/a&gt; interface defines a service that allows the caller to submit tasks to be completed in the future.  A commonly used implementation is the &lt;a href=&#34;http://java.sun.com/j2se/1.5.0/docs/api/java/util/concurrent/ExecutorCompletionService.html&#34;&gt;ExecutorCompletionService&lt;/a&gt;, which uses an &lt;a href=&#34;http://java.sun.com/j2se/1.5.0/docs/api/java/util/concurrent/Executor.html&#34;&gt;Executor&lt;/a&gt; to run the tasks that have been submitted.&lt;/p&gt;

&lt;p&gt;
In most cases the &lt;a href=&#34;http://java.sun.com/j2se/1.5.0/docs/api/java/util/concurrent/Executor.html&#34;&gt;Executor&lt;/a&gt; used will be the &lt;a href=&#34;http://java.sun.com/j2se/1.5.0/docs/api/java/util/concurrent/ThreadPoolExecutor.html&#34;&gt;ThreadPoolExecutor&lt;/a&gt; which creates a pool of threads to use in executing submitted tasks.  &lt;a href=&#34;http://java.sun.com/j2se/1.5.0/docs/api/java/util/concurrent/ThreadPoolExecutor.html&#34;&gt;ThreadPoolExecutor&lt;/a&gt;s are very expensive things to create.  They should not be created on-the-fly because of this.  &lt;a href=&#34;http://java.sun.com/j2se/1.5.0/docs/api/java/util/concurrent/ThreadPoolExecutor.html&#34;&gt;ThreadPoolExecutor&lt;/a&gt;s are excellent at limiting the total number of threads running a particular type of task and therefore provide a safeguard against thread leakage or other scenarios that may result in running out of threads.  &lt;a href=&#34;http://java.sun.com/j2se/1.5.0/docs/api/java/util/concurrent/CompletionService.html&#34;&gt;CompletionService&lt;/a&gt;s are, on the other hand, rather inexpensive to create.&lt;/p&gt;

&lt;p&gt;In a recent use case I was presented with I realized that I needed to create a varying number of tasks that needed to run in parallel but I did not want one particularly large request to starve out other requests and make them wait for an available thread from the pool to execute their tasks.  That&amp;rsquo;s when I came up with the idea that if I could have a &lt;a href=&#34;http://java.sun.com/j2se/1.5.0/docs/api/java/util/concurrent/CompletionService.html&#34;&gt;CompletionService&lt;/a&gt; that would limit the number of tasks that would simultaneously be submitted to the &lt;a href=&#34;http://java.sun.com/j2se/1.5.0/docs/api/java/util/concurrent/Executor.html&#34;&gt;Executor&lt;/a&gt;, I could have one thread pool that is shared by all requests.&lt;/p&gt;

&lt;p&gt;At first I thought I would extend the &lt;a href=&#34;http://java.sun.com/j2se/1.5.0/docs/api/java/util/concurrent/ExecutorCompletionService.html&#34;&gt;ExecutorCompletionService&lt;/a&gt;.  As I wrote the code I realized I was just delegating all the behavior to the methods defined in &lt;a href=&#34;http://java.sun.com/j2se/1.5.0/docs/api/java/util/concurrent/CompletionService.html&#34;&gt;CompletionService&lt;/a&gt;.  So, I created the &amp;ldquo;ThrottledCompletionService&amp;rdquo; as a &lt;a href=&#34;http://c2.com/cgi-bin/wiki?DecoratorPattern&#34;&gt;Decorator&lt;/a&gt; which takes another &lt;a href=&#34;http://java.sun.com/j2se/1.5.0/docs/api/java/util/concurrent/CompletionService.html&#34;&gt;CompletionService&lt;/a&gt;.  In this way I was able to add this functionality to any &lt;a href=&#34;http://java.sun.com/j2se/1.5.0/docs/api/java/util/concurrent/CompletionService.html&#34;&gt;CompletionService&lt;/a&gt; not just a &lt;a href=&#34;http://java.sun.com/j2se/1.5.0/docs/api/java/util/concurrent/ExecutorCompletionService.html&#34;&gt;ExecutorCompletionService&lt;/a&gt;.&lt;/p&gt;

&lt;h3 id=&#34;here-is-the-code&#34;&gt;Here is the code:&lt;/h3&gt;

&lt;div class=&#34;highlight&#34;&gt;&lt;pre class=&#34;chroma&#34;&gt;&lt;code class=&#34;language-java&#34; data-lang=&#34;java&#34;&gt; &lt;span class=&#34;kn&#34;&gt;package&lt;/span&gt; &lt;span class=&#34;nn&#34;&gt;com.dhptech.utils.concurrent&lt;/span&gt;&lt;span class=&#34;o&#34;&gt;;&lt;/span&gt;
 
 &lt;span class=&#34;kn&#34;&gt;import&lt;/span&gt; &lt;span class=&#34;nn&#34;&gt;java.util.LinkedList&lt;/span&gt;&lt;span class=&#34;o&#34;&gt;;&lt;/span&gt;
 &lt;span class=&#34;kn&#34;&gt;import&lt;/span&gt; &lt;span class=&#34;nn&#34;&gt;java.util.Queue&lt;/span&gt;&lt;span class=&#34;o&#34;&gt;;&lt;/span&gt;
 &lt;span class=&#34;kn&#34;&gt;import&lt;/span&gt; &lt;span class=&#34;nn&#34;&gt;java.util.concurrent.Callable&lt;/span&gt;&lt;span class=&#34;o&#34;&gt;;&lt;/span&gt;
 &lt;span class=&#34;kn&#34;&gt;import&lt;/span&gt; &lt;span class=&#34;nn&#34;&gt;java.util.concurrent.CompletionService&lt;/span&gt;&lt;span class=&#34;o&#34;&gt;;&lt;/span&gt;
 &lt;span class=&#34;kn&#34;&gt;import&lt;/span&gt; &lt;span class=&#34;nn&#34;&gt;java.util.concurrent.CountDownLatch&lt;/span&gt;&lt;span class=&#34;o&#34;&gt;;&lt;/span&gt;
 &lt;span class=&#34;kn&#34;&gt;import&lt;/span&gt; &lt;span class=&#34;nn&#34;&gt;java.util.concurrent.ExecutionException&lt;/span&gt;&lt;span class=&#34;o&#34;&gt;;&lt;/span&gt;
 &lt;span class=&#34;kn&#34;&gt;import&lt;/span&gt; &lt;span class=&#34;nn&#34;&gt;java.util.concurrent.Executor&lt;/span&gt;&lt;span class=&#34;o&#34;&gt;;&lt;/span&gt;
 &lt;span class=&#34;kn&#34;&gt;import&lt;/span&gt; &lt;span class=&#34;nn&#34;&gt;java.util.concurrent.ExecutorCompletionService&lt;/span&gt;&lt;span class=&#34;o&#34;&gt;;&lt;/span&gt;
 &lt;span class=&#34;kn&#34;&gt;import&lt;/span&gt; &lt;span class=&#34;nn&#34;&gt;java.util.concurrent.Future&lt;/span&gt;&lt;span class=&#34;o&#34;&gt;;&lt;/span&gt;
 &lt;span class=&#34;kn&#34;&gt;import&lt;/span&gt; &lt;span class=&#34;nn&#34;&gt;java.util.concurrent.TimeUnit&lt;/span&gt;&lt;span class=&#34;o&#34;&gt;;&lt;/span&gt;
 &lt;span class=&#34;kn&#34;&gt;import&lt;/span&gt; &lt;span class=&#34;nn&#34;&gt;java.util.concurrent.TimeoutException&lt;/span&gt;&lt;span class=&#34;o&#34;&gt;;&lt;/span&gt;
 
 &lt;span class=&#34;kn&#34;&gt;import&lt;/span&gt; &lt;span class=&#34;nn&#34;&gt;com.dhptech.utils.concurrent.ConcurrentUtils&lt;/span&gt;&lt;span class=&#34;o&#34;&gt;;&lt;/span&gt;
 
 &lt;span class=&#34;cm&#34;&gt;/**
&lt;/span&gt;&lt;span class=&#34;cm&#34;&gt;  * This CompletionService decorates another CompleationService and throttles the
&lt;/span&gt;&lt;span class=&#34;cm&#34;&gt;  * number of concurrently submitted tasks that will be submitted and any given time.
&lt;/span&gt;&lt;span class=&#34;cm&#34;&gt;  *
&lt;/span&gt;&lt;span class=&#34;cm&#34;&gt;  * This can be used in conjunction with an Executor to complete tasks but keep
&lt;/span&gt;&lt;span class=&#34;cm&#34;&gt;  * larger batches of tasks from starving out smaller batches.  Each &amp;amp;quot;batch&amp;amp;quot; whould
&lt;/span&gt;&lt;span class=&#34;cm&#34;&gt;  * get a new ThrottledCompletionService but all of them use the same central
&lt;/span&gt;&lt;span class=&#34;cm&#34;&gt;  * Executor.
&lt;/span&gt;&lt;span class=&#34;cm&#34;&gt;  *
&lt;/span&gt;&lt;span class=&#34;cm&#34;&gt;  * This object is lightweight enough to be created and destroyed for each batch
&lt;/span&gt;&lt;span class=&#34;cm&#34;&gt;  * of tasks that need to be submitted to a common Executor.
&lt;/span&gt;&lt;span class=&#34;cm&#34;&gt;  *
&lt;/span&gt;&lt;span class=&#34;cm&#34;&gt;  * @author danap
&lt;/span&gt;&lt;span class=&#34;cm&#34;&gt;  */&lt;/span&gt;
 &lt;span class=&#34;kd&#34;&gt;public&lt;/span&gt; &lt;span class=&#34;kd&#34;&gt;class&lt;/span&gt; &lt;span class=&#34;nc&#34;&gt;ThrottledCompletionService&lt;/span&gt;&lt;span class=&#34;o&#34;&gt;&amp;lt;&lt;/span&gt;&lt;span class=&#34;n&#34;&gt;V&lt;/span&gt;&lt;span class=&#34;o&#34;&gt;&amp;gt;&lt;/span&gt; &lt;span class=&#34;kd&#34;&gt;implements&lt;/span&gt; &lt;span class=&#34;n&#34;&gt;CompletionService&lt;/span&gt;&lt;span class=&#34;o&#34;&gt;&amp;lt;&lt;/span&gt;&lt;span class=&#34;n&#34;&gt;V&lt;/span&gt;&lt;span class=&#34;o&#34;&gt;&amp;gt;&lt;/span&gt; &lt;span class=&#34;o&#34;&gt;{&lt;/span&gt;
 
   &lt;span class=&#34;cm&#34;&gt;/**
&lt;/span&gt;&lt;span class=&#34;cm&#34;&gt;    * Acts as a base class to implement the Future interface for the Runnable
&lt;/span&gt;&lt;span class=&#34;cm&#34;&gt;    * and callable variants.
&lt;/span&gt;&lt;span class=&#34;cm&#34;&gt;    *
&lt;/span&gt;&lt;span class=&#34;cm&#34;&gt;    * @param &amp;lt;T&amp;gt; the return type of the task.
&lt;/span&gt;&lt;span class=&#34;cm&#34;&gt;    */&lt;/span&gt;
   &lt;span class=&#34;kd&#34;&gt;private&lt;/span&gt; &lt;span class=&#34;kd&#34;&gt;abstract&lt;/span&gt; &lt;span class=&#34;kd&#34;&gt;class&lt;/span&gt; &lt;span class=&#34;nc&#34;&gt;ThrottledTask&lt;/span&gt;&lt;span class=&#34;o&#34;&gt;&amp;lt;&lt;/span&gt;&lt;span class=&#34;n&#34;&gt;T&lt;/span&gt;&lt;span class=&#34;o&#34;&gt;&amp;gt;&lt;/span&gt; &lt;span class=&#34;kd&#34;&gt;implements&lt;/span&gt; &lt;span class=&#34;n&#34;&gt;Future&lt;/span&gt;&lt;span class=&#34;o&#34;&gt;&amp;lt;&lt;/span&gt;&lt;span class=&#34;n&#34;&gt;T&lt;/span&gt;&lt;span class=&#34;o&#34;&gt;&amp;gt;&lt;/span&gt; &lt;span class=&#34;o&#34;&gt;{&lt;/span&gt;
     &lt;span class=&#34;kd&#34;&gt;private&lt;/span&gt; &lt;span class=&#34;n&#34;&gt;CountDownLatch&lt;/span&gt; &lt;span class=&#34;n&#34;&gt;submitted&lt;/span&gt; &lt;span class=&#34;o&#34;&gt;=&lt;/span&gt; &lt;span class=&#34;k&#34;&gt;new&lt;/span&gt; &lt;span class=&#34;n&#34;&gt;CountDownLatch&lt;/span&gt;&lt;span class=&#34;o&#34;&gt;(&lt;/span&gt;&lt;span class=&#34;n&#34;&gt;1&lt;/span&gt;&lt;span class=&#34;o&#34;&gt;);&lt;/span&gt;
     &lt;span class=&#34;kd&#34;&gt;private&lt;/span&gt; &lt;span class=&#34;n&#34;&gt;Future&lt;/span&gt;&lt;span class=&#34;o&#34;&gt;&amp;lt;&lt;/span&gt;&lt;span class=&#34;n&#34;&gt;T&lt;/span&gt;&lt;span class=&#34;o&#34;&gt;&amp;gt;&lt;/span&gt; &lt;span class=&#34;n&#34;&gt;delegateFuture&lt;/span&gt; &lt;span class=&#34;o&#34;&gt;=&lt;/span&gt; &lt;span class=&#34;kc&#34;&gt;null&lt;/span&gt;&lt;span class=&#34;o&#34;&gt;;&lt;/span&gt;
     &lt;span class=&#34;kd&#34;&gt;private&lt;/span&gt; &lt;span class=&#34;kt&#34;&gt;boolean&lt;/span&gt; &lt;span class=&#34;n&#34;&gt;cancelled&lt;/span&gt; &lt;span class=&#34;o&#34;&gt;=&lt;/span&gt; &lt;span class=&#34;kc&#34;&gt;false&lt;/span&gt;&lt;span class=&#34;o&#34;&gt;;&lt;/span&gt;
 
     &lt;span class=&#34;cm&#34;&gt;/**
&lt;/span&gt;&lt;span class=&#34;cm&#34;&gt;      * Sets the delegateFuture and counts down the submitted latch.
&lt;/span&gt;&lt;span class=&#34;cm&#34;&gt;      *
&lt;/span&gt;&lt;span class=&#34;cm&#34;&gt;      * @param delegateFuture the future from the decorated completion service.
&lt;/span&gt;&lt;span class=&#34;cm&#34;&gt;      */&lt;/span&gt;
     &lt;span class=&#34;kd&#34;&gt;protected&lt;/span&gt; &lt;span class=&#34;kt&#34;&gt;void&lt;/span&gt; &lt;span class=&#34;nf&#34;&gt;setDelegateFuture&lt;/span&gt;&lt;span class=&#34;o&#34;&gt;(&lt;/span&gt;&lt;span class=&#34;n&#34;&gt;Future&lt;/span&gt;&lt;span class=&#34;o&#34;&gt;&amp;lt;&lt;/span&gt;&lt;span class=&#34;n&#34;&gt;T&lt;/span&gt;&lt;span class=&#34;o&#34;&gt;&amp;gt;&lt;/span&gt; &lt;span class=&#34;n&#34;&gt;delegateFuture&lt;/span&gt;&lt;span class=&#34;o&#34;&gt;)&lt;/span&gt; &lt;span class=&#34;o&#34;&gt;{&lt;/span&gt;
       &lt;span class=&#34;k&#34;&gt;this&lt;/span&gt;&lt;span class=&#34;o&#34;&gt;.&lt;/span&gt;&lt;span class=&#34;na&#34;&gt;delegateFuture&lt;/span&gt; &lt;span class=&#34;o&#34;&gt;=&lt;/span&gt; &lt;span class=&#34;n&#34;&gt;delegateFuture&lt;/span&gt;&lt;span class=&#34;o&#34;&gt;;&lt;/span&gt;
       &lt;span class=&#34;n&#34;&gt;submitted&lt;/span&gt;&lt;span class=&#34;o&#34;&gt;.&lt;/span&gt;&lt;span class=&#34;na&#34;&gt;countDown&lt;/span&gt;&lt;span class=&#34;o&#34;&gt;();&lt;/span&gt;
     &lt;span class=&#34;o&#34;&gt;}&lt;/span&gt;
 
     &lt;span class=&#34;cm&#34;&gt;/**
&lt;/span&gt;&lt;span class=&#34;cm&#34;&gt;      * Should submit the task to the completion service.
&lt;/span&gt;&lt;span class=&#34;cm&#34;&gt;      */&lt;/span&gt;
     &lt;span class=&#34;kd&#34;&gt;public&lt;/span&gt; &lt;span class=&#34;kd&#34;&gt;abstract&lt;/span&gt; &lt;span class=&#34;kt&#34;&gt;void&lt;/span&gt; &lt;span class=&#34;nf&#34;&gt;submit&lt;/span&gt;&lt;span class=&#34;o&#34;&gt;();&lt;/span&gt;
 
     &lt;span class=&#34;cm&#34;&gt;/**
&lt;/span&gt;&lt;span class=&#34;cm&#34;&gt;      * @see Future#cancel(boolean)
&lt;/span&gt;&lt;span class=&#34;cm&#34;&gt;      */&lt;/span&gt;
     &lt;span class=&#34;kd&#34;&gt;public&lt;/span&gt; &lt;span class=&#34;kt&#34;&gt;boolean&lt;/span&gt; &lt;span class=&#34;nf&#34;&gt;cancel&lt;/span&gt;&lt;span class=&#34;o&#34;&gt;(&lt;/span&gt;&lt;span class=&#34;kt&#34;&gt;boolean&lt;/span&gt; &lt;span class=&#34;n&#34;&gt;mayInterruptIfRunning&lt;/span&gt;&lt;span class=&#34;o&#34;&gt;)&lt;/span&gt; &lt;span class=&#34;o&#34;&gt;{&lt;/span&gt;
       &lt;span class=&#34;k&#34;&gt;if&lt;/span&gt; &lt;span class=&#34;o&#34;&gt;(&lt;/span&gt; &lt;span class=&#34;n&#34;&gt;submitted&lt;/span&gt;&lt;span class=&#34;o&#34;&gt;.&lt;/span&gt;&lt;span class=&#34;na&#34;&gt;getCount&lt;/span&gt;&lt;span class=&#34;o&#34;&gt;()&lt;/span&gt; &lt;span class=&#34;o&#34;&gt;&amp;gt;&lt;/span&gt; &lt;span class=&#34;n&#34;&gt;0&lt;/span&gt; &lt;span class=&#34;o&#34;&gt;||&lt;/span&gt; &lt;span class=&#34;n&#34;&gt;delegateFuture&lt;/span&gt; &lt;span class=&#34;o&#34;&gt;==&lt;/span&gt; &lt;span class=&#34;kc&#34;&gt;null&lt;/span&gt; &lt;span class=&#34;o&#34;&gt;)&lt;/span&gt; &lt;span class=&#34;o&#34;&gt;{&lt;/span&gt;
         &lt;span class=&#34;n&#34;&gt;cancelled&lt;/span&gt; &lt;span class=&#34;o&#34;&gt;=&lt;/span&gt; &lt;span class=&#34;kc&#34;&gt;true&lt;/span&gt;&lt;span class=&#34;o&#34;&gt;;&lt;/span&gt;
         &lt;span class=&#34;k&#34;&gt;return&lt;/span&gt; &lt;span class=&#34;kc&#34;&gt;true&lt;/span&gt;&lt;span class=&#34;o&#34;&gt;;&lt;/span&gt;
       &lt;span class=&#34;o&#34;&gt;}&lt;/span&gt; &lt;span class=&#34;k&#34;&gt;else&lt;/span&gt; &lt;span class=&#34;o&#34;&gt;{&lt;/span&gt;
         &lt;span class=&#34;k&#34;&gt;return&lt;/span&gt; &lt;span class=&#34;n&#34;&gt;delegateFuture&lt;/span&gt;&lt;span class=&#34;o&#34;&gt;.&lt;/span&gt;&lt;span class=&#34;na&#34;&gt;cancel&lt;/span&gt;&lt;span class=&#34;o&#34;&gt;(&lt;/span&gt;&lt;span class=&#34;n&#34;&gt;mayInterruptIfRunning&lt;/span&gt;&lt;span class=&#34;o&#34;&gt;);&lt;/span&gt;
       &lt;span class=&#34;o&#34;&gt;}&lt;/span&gt;
     &lt;span class=&#34;o&#34;&gt;}&lt;/span&gt;
 
     &lt;span class=&#34;cm&#34;&gt;/**
&lt;/span&gt;&lt;span class=&#34;cm&#34;&gt;      * @see Future#isCancelled()
&lt;/span&gt;&lt;span class=&#34;cm&#34;&gt;      */&lt;/span&gt;
     &lt;span class=&#34;kd&#34;&gt;public&lt;/span&gt; &lt;span class=&#34;kt&#34;&gt;boolean&lt;/span&gt; &lt;span class=&#34;nf&#34;&gt;isCancelled&lt;/span&gt;&lt;span class=&#34;o&#34;&gt;()&lt;/span&gt; &lt;span class=&#34;o&#34;&gt;{&lt;/span&gt;
       &lt;span class=&#34;k&#34;&gt;if&lt;/span&gt; &lt;span class=&#34;o&#34;&gt;(&lt;/span&gt; &lt;span class=&#34;n&#34;&gt;cancelled&lt;/span&gt; &lt;span class=&#34;o&#34;&gt;)&lt;/span&gt; &lt;span class=&#34;o&#34;&gt;{&lt;/span&gt;
         &lt;span class=&#34;k&#34;&gt;return&lt;/span&gt; &lt;span class=&#34;kc&#34;&gt;true&lt;/span&gt;&lt;span class=&#34;o&#34;&gt;;&lt;/span&gt;
       &lt;span class=&#34;o&#34;&gt;}&lt;/span&gt;
       &lt;span class=&#34;k&#34;&gt;if&lt;/span&gt; &lt;span class=&#34;o&#34;&gt;(&lt;/span&gt; &lt;span class=&#34;n&#34;&gt;submitted&lt;/span&gt;&lt;span class=&#34;o&#34;&gt;.&lt;/span&gt;&lt;span class=&#34;na&#34;&gt;getCount&lt;/span&gt;&lt;span class=&#34;o&#34;&gt;()&lt;/span&gt; &lt;span class=&#34;o&#34;&gt;==&lt;/span&gt; &lt;span class=&#34;n&#34;&gt;0&lt;/span&gt; &lt;span class=&#34;o&#34;&gt;)&lt;/span&gt; &lt;span class=&#34;o&#34;&gt;{&lt;/span&gt;
         &lt;span class=&#34;k&#34;&gt;return&lt;/span&gt; &lt;span class=&#34;n&#34;&gt;delegateFuture&lt;/span&gt;&lt;span class=&#34;o&#34;&gt;.&lt;/span&gt;&lt;span class=&#34;na&#34;&gt;isCancelled&lt;/span&gt;&lt;span class=&#34;o&#34;&gt;();&lt;/span&gt;
       &lt;span class=&#34;o&#34;&gt;}&lt;/span&gt;
       &lt;span class=&#34;k&#34;&gt;return&lt;/span&gt; &lt;span class=&#34;kc&#34;&gt;false&lt;/span&gt;&lt;span class=&#34;o&#34;&gt;;&lt;/span&gt;
     &lt;span class=&#34;o&#34;&gt;}&lt;/span&gt;
 
     &lt;span class=&#34;cm&#34;&gt;/**
&lt;/span&gt;&lt;span class=&#34;cm&#34;&gt;      * @see Future#isDone()
&lt;/span&gt;&lt;span class=&#34;cm&#34;&gt;      */&lt;/span&gt;
     &lt;span class=&#34;kd&#34;&gt;public&lt;/span&gt; &lt;span class=&#34;kt&#34;&gt;boolean&lt;/span&gt; &lt;span class=&#34;nf&#34;&gt;isDone&lt;/span&gt;&lt;span class=&#34;o&#34;&gt;()&lt;/span&gt; &lt;span class=&#34;o&#34;&gt;{&lt;/span&gt;
       &lt;span class=&#34;k&#34;&gt;if&lt;/span&gt; &lt;span class=&#34;o&#34;&gt;(&lt;/span&gt; &lt;span class=&#34;n&#34;&gt;submitted&lt;/span&gt;&lt;span class=&#34;o&#34;&gt;.&lt;/span&gt;&lt;span class=&#34;na&#34;&gt;getCount&lt;/span&gt;&lt;span class=&#34;o&#34;&gt;()&lt;/span&gt; &lt;span class=&#34;o&#34;&gt;==&lt;/span&gt; &lt;span class=&#34;n&#34;&gt;0&lt;/span&gt; &lt;span class=&#34;o&#34;&gt;)&lt;/span&gt; &lt;span class=&#34;o&#34;&gt;{&lt;/span&gt;
         &lt;span class=&#34;k&#34;&gt;return&lt;/span&gt; &lt;span class=&#34;n&#34;&gt;delegateFuture&lt;/span&gt;&lt;span class=&#34;o&#34;&gt;.&lt;/span&gt;&lt;span class=&#34;na&#34;&gt;isDone&lt;/span&gt;&lt;span class=&#34;o&#34;&gt;();&lt;/span&gt;
       &lt;span class=&#34;o&#34;&gt;}&lt;/span&gt;
       &lt;span class=&#34;k&#34;&gt;return&lt;/span&gt; &lt;span class=&#34;kc&#34;&gt;false&lt;/span&gt;&lt;span class=&#34;o&#34;&gt;;&lt;/span&gt;
     &lt;span class=&#34;o&#34;&gt;}&lt;/span&gt;
 
     &lt;span class=&#34;cm&#34;&gt;/**
&lt;/span&gt;&lt;span class=&#34;cm&#34;&gt;      * @see Future#get()
&lt;/span&gt;&lt;span class=&#34;cm&#34;&gt;      */&lt;/span&gt;
     &lt;span class=&#34;kd&#34;&gt;public&lt;/span&gt; &lt;span class=&#34;n&#34;&gt;T&lt;/span&gt; &lt;span class=&#34;nf&#34;&gt;get&lt;/span&gt;&lt;span class=&#34;o&#34;&gt;()&lt;/span&gt; &lt;span class=&#34;kd&#34;&gt;throws&lt;/span&gt; &lt;span class=&#34;n&#34;&gt;InterruptedException&lt;/span&gt;&lt;span class=&#34;o&#34;&gt;,&lt;/span&gt; &lt;span class=&#34;n&#34;&gt;ExecutionException&lt;/span&gt; &lt;span class=&#34;o&#34;&gt;{&lt;/span&gt;
       &lt;span class=&#34;n&#34;&gt;submitted&lt;/span&gt;&lt;span class=&#34;o&#34;&gt;.&lt;/span&gt;&lt;span class=&#34;na&#34;&gt;await&lt;/span&gt;&lt;span class=&#34;o&#34;&gt;();&lt;/span&gt;
       &lt;span class=&#34;k&#34;&gt;return&lt;/span&gt; &lt;span class=&#34;n&#34;&gt;delegateFuture&lt;/span&gt;&lt;span class=&#34;o&#34;&gt;.&lt;/span&gt;&lt;span class=&#34;na&#34;&gt;get&lt;/span&gt;&lt;span class=&#34;o&#34;&gt;();&lt;/span&gt;
     &lt;span class=&#34;o&#34;&gt;}&lt;/span&gt;
 
     &lt;span class=&#34;cm&#34;&gt;/**
&lt;/span&gt;&lt;span class=&#34;cm&#34;&gt;      * Get the value from this future.
&lt;/span&gt;&lt;span class=&#34;cm&#34;&gt;      *
&lt;/span&gt;&lt;span class=&#34;cm&#34;&gt;      * @see Future#get(long, java.util.concurrent.TimeUnit)
&lt;/span&gt;&lt;span class=&#34;cm&#34;&gt;      *
&lt;/span&gt;&lt;span class=&#34;cm&#34;&gt;      * NOTE: because this operation will first wait for the task to be submitted and
&lt;/span&gt;&lt;span class=&#34;cm&#34;&gt;      * then wait for the future returned by the decorated completion service, the
&lt;/span&gt;&lt;span class=&#34;cm&#34;&gt;      * timeout is converted to nanoseconds and the time taken to wait for the
&lt;/span&gt;&lt;span class=&#34;cm&#34;&gt;      * task to be submitted is subtracted from it before passing it to the get
&lt;/span&gt;&lt;span class=&#34;cm&#34;&gt;      * method of the future returned by the decorated compleation service.
&lt;/span&gt;&lt;span class=&#34;cm&#34;&gt;      */&lt;/span&gt;
     &lt;span class=&#34;kd&#34;&gt;public&lt;/span&gt; &lt;span class=&#34;n&#34;&gt;T&lt;/span&gt; &lt;span class=&#34;nf&#34;&gt;get&lt;/span&gt;&lt;span class=&#34;o&#34;&gt;(&lt;/span&gt;&lt;span class=&#34;kt&#34;&gt;long&lt;/span&gt; &lt;span class=&#34;n&#34;&gt;timeout&lt;/span&gt;&lt;span class=&#34;o&#34;&gt;,&lt;/span&gt; &lt;span class=&#34;n&#34;&gt;TimeUnit&lt;/span&gt; &lt;span class=&#34;n&#34;&gt;unit&lt;/span&gt;&lt;span class=&#34;o&#34;&gt;)&lt;/span&gt; &lt;span class=&#34;kd&#34;&gt;throws&lt;/span&gt; &lt;span class=&#34;n&#34;&gt;InterruptedException&lt;/span&gt;&lt;span class=&#34;o&#34;&gt;,&lt;/span&gt; &lt;span class=&#34;n&#34;&gt;ExecutionException&lt;/span&gt;&lt;span class=&#34;o&#34;&gt;,&lt;/span&gt; &lt;span class=&#34;n&#34;&gt;TimeoutException&lt;/span&gt; &lt;span class=&#34;o&#34;&gt;{&lt;/span&gt;
       &lt;span class=&#34;c1&#34;&gt;// Convert the timeout unit to nanoseconds.
&lt;/span&gt;&lt;span class=&#34;c1&#34;&gt;&lt;/span&gt;       &lt;span class=&#34;kt&#34;&gt;long&lt;/span&gt; &lt;span class=&#34;n&#34;&gt;timeoutNanos&lt;/span&gt; &lt;span class=&#34;o&#34;&gt;=&lt;/span&gt; &lt;span class=&#34;n&#34;&gt;ConcurrentUtils&lt;/span&gt;&lt;span class=&#34;o&#34;&gt;.&lt;/span&gt;&lt;span class=&#34;na&#34;&gt;convertTimeUnitToNanos&lt;/span&gt;&lt;span class=&#34;o&#34;&gt;(&lt;/span&gt;&lt;span class=&#34;n&#34;&gt;timeout&lt;/span&gt;&lt;span class=&#34;o&#34;&gt;,&lt;/span&gt; &lt;span class=&#34;n&#34;&gt;unit&lt;/span&gt;&lt;span class=&#34;o&#34;&gt;);&lt;/span&gt;
       &lt;span class=&#34;c1&#34;&gt;// record the time we started waiting.
&lt;/span&gt;&lt;span class=&#34;c1&#34;&gt;&lt;/span&gt;       &lt;span class=&#34;kt&#34;&gt;long&lt;/span&gt; &lt;span class=&#34;n&#34;&gt;start&lt;/span&gt; &lt;span class=&#34;o&#34;&gt;=&lt;/span&gt; &lt;span class=&#34;n&#34;&gt;System&lt;/span&gt;&lt;span class=&#34;o&#34;&gt;.&lt;/span&gt;&lt;span class=&#34;na&#34;&gt;nanoTime&lt;/span&gt;&lt;span class=&#34;o&#34;&gt;();&lt;/span&gt;
       &lt;span class=&#34;n&#34;&gt;submitted&lt;/span&gt;&lt;span class=&#34;o&#34;&gt;.&lt;/span&gt;&lt;span class=&#34;na&#34;&gt;await&lt;/span&gt;&lt;span class=&#34;o&#34;&gt;(&lt;/span&gt;&lt;span class=&#34;n&#34;&gt;timeoutNanos&lt;/span&gt;&lt;span class=&#34;o&#34;&gt;,&lt;/span&gt; &lt;span class=&#34;n&#34;&gt;TimeUnit&lt;/span&gt;&lt;span class=&#34;o&#34;&gt;.&lt;/span&gt;&lt;span class=&#34;na&#34;&gt;NANOSECONDS&lt;/span&gt;&lt;span class=&#34;o&#34;&gt;);&lt;/span&gt;
       &lt;span class=&#34;c1&#34;&gt;// remove the time we waited from the timeout.
&lt;/span&gt;&lt;span class=&#34;c1&#34;&gt;&lt;/span&gt;       &lt;span class=&#34;kt&#34;&gt;long&lt;/span&gt; &lt;span class=&#34;n&#34;&gt;elapsed&lt;/span&gt; &lt;span class=&#34;o&#34;&gt;=&lt;/span&gt; &lt;span class=&#34;n&#34;&gt;System&lt;/span&gt;&lt;span class=&#34;o&#34;&gt;.&lt;/span&gt;&lt;span class=&#34;na&#34;&gt;nanoTime&lt;/span&gt;&lt;span class=&#34;o&#34;&gt;()&lt;/span&gt; &lt;span class=&#34;o&#34;&gt;-&lt;/span&gt; &lt;span class=&#34;n&#34;&gt;start&lt;/span&gt;&lt;span class=&#34;o&#34;&gt;;&lt;/span&gt;
       &lt;span class=&#34;n&#34;&gt;timeoutNanos&lt;/span&gt; &lt;span class=&#34;o&#34;&gt;-=&lt;/span&gt; &lt;span class=&#34;n&#34;&gt;elapsed&lt;/span&gt;&lt;span class=&#34;o&#34;&gt;;&lt;/span&gt;
       &lt;span class=&#34;c1&#34;&gt;// wait the remainder of the timeout for the result.
&lt;/span&gt;&lt;span class=&#34;c1&#34;&gt;&lt;/span&gt;       &lt;span class=&#34;k&#34;&gt;return&lt;/span&gt; &lt;span class=&#34;n&#34;&gt;delegateFuture&lt;/span&gt;&lt;span class=&#34;o&#34;&gt;.&lt;/span&gt;&lt;span class=&#34;na&#34;&gt;get&lt;/span&gt;&lt;span class=&#34;o&#34;&gt;(&lt;/span&gt;&lt;span class=&#34;n&#34;&gt;timeoutNanos&lt;/span&gt;&lt;span class=&#34;o&#34;&gt;,&lt;/span&gt;&lt;span class=&#34;n&#34;&gt;TimeUnit&lt;/span&gt;&lt;span class=&#34;o&#34;&gt;.&lt;/span&gt;&lt;span class=&#34;na&#34;&gt;NANOSECONDS&lt;/span&gt;&lt;span class=&#34;o&#34;&gt;);&lt;/span&gt;
     &lt;span class=&#34;o&#34;&gt;}&lt;/span&gt;
   &lt;span class=&#34;o&#34;&gt;}&lt;/span&gt;
 
   &lt;span class=&#34;cm&#34;&gt;/**
&lt;/span&gt;&lt;span class=&#34;cm&#34;&gt;    * An implementation of ThrottledTask that handles Runnables.
&lt;/span&gt;&lt;span class=&#34;cm&#34;&gt;    */&lt;/span&gt;
   &lt;span class=&#34;kd&#34;&gt;private&lt;/span&gt; &lt;span class=&#34;kd&#34;&gt;class&lt;/span&gt; &lt;span class=&#34;nc&#34;&gt;ThrottledRunnable&lt;/span&gt; &lt;span class=&#34;kd&#34;&gt;extends&lt;/span&gt; &lt;span class=&#34;n&#34;&gt;ThrottledTask&lt;/span&gt;&lt;span class=&#34;o&#34;&gt;&amp;lt;&lt;/span&gt;&lt;span class=&#34;n&#34;&gt;V&lt;/span&gt;&lt;span class=&#34;o&#34;&gt;&amp;gt;&lt;/span&gt; &lt;span class=&#34;kd&#34;&gt;implements&lt;/span&gt; &lt;span class=&#34;n&#34;&gt;Runnable&lt;/span&gt; &lt;span class=&#34;o&#34;&gt;{&lt;/span&gt;
     &lt;span class=&#34;kd&#34;&gt;private&lt;/span&gt; &lt;span class=&#34;n&#34;&gt;Runnable&lt;/span&gt; &lt;span class=&#34;n&#34;&gt;delegate&lt;/span&gt;&lt;span class=&#34;o&#34;&gt;;&lt;/span&gt;
     &lt;span class=&#34;kd&#34;&gt;private&lt;/span&gt; &lt;span class=&#34;n&#34;&gt;V&lt;/span&gt; &lt;span class=&#34;n&#34;&gt;value&lt;/span&gt;&lt;span class=&#34;o&#34;&gt;;&lt;/span&gt;
 
     &lt;span class=&#34;cm&#34;&gt;/**
&lt;/span&gt;&lt;span class=&#34;cm&#34;&gt;      * Contructs a new ThrottledRunnable.
&lt;/span&gt;&lt;span class=&#34;cm&#34;&gt;      *
&lt;/span&gt;&lt;span class=&#34;cm&#34;&gt;      * @param delegate the runnable that we will delegate to.
&lt;/span&gt;&lt;span class=&#34;cm&#34;&gt;      *
&lt;/span&gt;&lt;span class=&#34;cm&#34;&gt;      * @param value the value to return from this task.
&lt;/span&gt;&lt;span class=&#34;cm&#34;&gt;      */&lt;/span&gt;
     &lt;span class=&#34;kd&#34;&gt;public&lt;/span&gt; &lt;span class=&#34;nf&#34;&gt;ThrottledRunnable&lt;/span&gt;&lt;span class=&#34;o&#34;&gt;(&lt;/span&gt;&lt;span class=&#34;n&#34;&gt;Runnable&lt;/span&gt; &lt;span class=&#34;n&#34;&gt;delegate&lt;/span&gt;&lt;span class=&#34;o&#34;&gt;,&lt;/span&gt; &lt;span class=&#34;n&#34;&gt;V&lt;/span&gt; &lt;span class=&#34;n&#34;&gt;value&lt;/span&gt;&lt;span class=&#34;o&#34;&gt;)&lt;/span&gt; &lt;span class=&#34;o&#34;&gt;{&lt;/span&gt;
       &lt;span class=&#34;k&#34;&gt;this&lt;/span&gt;&lt;span class=&#34;o&#34;&gt;.&lt;/span&gt;&lt;span class=&#34;na&#34;&gt;delegate&lt;/span&gt; &lt;span class=&#34;o&#34;&gt;=&lt;/span&gt; &lt;span class=&#34;n&#34;&gt;delegate&lt;/span&gt;&lt;span class=&#34;o&#34;&gt;;&lt;/span&gt;
       &lt;span class=&#34;k&#34;&gt;this&lt;/span&gt;&lt;span class=&#34;o&#34;&gt;.&lt;/span&gt;&lt;span class=&#34;na&#34;&gt;value&lt;/span&gt; &lt;span class=&#34;o&#34;&gt;=&lt;/span&gt; &lt;span class=&#34;n&#34;&gt;value&lt;/span&gt;&lt;span class=&#34;o&#34;&gt;;&lt;/span&gt;
     &lt;span class=&#34;o&#34;&gt;}&lt;/span&gt;
 
     &lt;span class=&#34;cm&#34;&gt;/**
&lt;/span&gt;&lt;span class=&#34;cm&#34;&gt;      * @see ThrottledTask#submit()
&lt;/span&gt;&lt;span class=&#34;cm&#34;&gt;      */&lt;/span&gt;
     &lt;span class=&#34;kd&#34;&gt;public&lt;/span&gt; &lt;span class=&#34;kt&#34;&gt;void&lt;/span&gt; &lt;span class=&#34;nf&#34;&gt;submit&lt;/span&gt;&lt;span class=&#34;o&#34;&gt;()&lt;/span&gt; &lt;span class=&#34;o&#34;&gt;{&lt;/span&gt;
       &lt;span class=&#34;n&#34;&gt;setDelegateFuture&lt;/span&gt;&lt;span class=&#34;o&#34;&gt;(&lt;/span&gt;&lt;span class=&#34;n&#34;&gt;mDelegate&lt;/span&gt;&lt;span class=&#34;o&#34;&gt;.&lt;/span&gt;&lt;span class=&#34;na&#34;&gt;submit&lt;/span&gt;&lt;span class=&#34;o&#34;&gt;(&lt;/span&gt;&lt;span class=&#34;k&#34;&gt;this&lt;/span&gt;&lt;span class=&#34;o&#34;&gt;,&lt;/span&gt;&lt;span class=&#34;n&#34;&gt;value&lt;/span&gt;&lt;span class=&#34;o&#34;&gt;));&lt;/span&gt;
     &lt;span class=&#34;o&#34;&gt;}&lt;/span&gt;
 
     &lt;span class=&#34;cm&#34;&gt;/**
&lt;/span&gt;&lt;span class=&#34;cm&#34;&gt;      * @see Runnable#run()
&lt;/span&gt;&lt;span class=&#34;cm&#34;&gt;      *
&lt;/span&gt;&lt;span class=&#34;cm&#34;&gt;      * calls {@link ThrottledCompletionService#submitNext()} when the task is done.
&lt;/span&gt;&lt;span class=&#34;cm&#34;&gt;      */&lt;/span&gt;
     &lt;span class=&#34;kd&#34;&gt;public&lt;/span&gt; &lt;span class=&#34;kt&#34;&gt;void&lt;/span&gt; &lt;span class=&#34;nf&#34;&gt;run&lt;/span&gt;&lt;span class=&#34;o&#34;&gt;()&lt;/span&gt; &lt;span class=&#34;o&#34;&gt;{&lt;/span&gt;
       &lt;span class=&#34;k&#34;&gt;try&lt;/span&gt; &lt;span class=&#34;o&#34;&gt;{&lt;/span&gt;
         &lt;span class=&#34;n&#34;&gt;delegate&lt;/span&gt;&lt;span class=&#34;o&#34;&gt;.&lt;/span&gt;&lt;span class=&#34;na&#34;&gt;run&lt;/span&gt;&lt;span class=&#34;o&#34;&gt;();&lt;/span&gt;
       &lt;span class=&#34;o&#34;&gt;}&lt;/span&gt; &lt;span class=&#34;k&#34;&gt;finally&lt;/span&gt; &lt;span class=&#34;o&#34;&gt;{&lt;/span&gt;
         &lt;span class=&#34;n&#34;&gt;submitNext&lt;/span&gt;&lt;span class=&#34;o&#34;&gt;();&lt;/span&gt;
       &lt;span class=&#34;o&#34;&gt;}&lt;/span&gt;
     &lt;span class=&#34;o&#34;&gt;}&lt;/span&gt;
   &lt;span class=&#34;o&#34;&gt;}&lt;/span&gt;
 
   &lt;span class=&#34;cm&#34;&gt;/**
&lt;/span&gt;&lt;span class=&#34;cm&#34;&gt;    * An implementation of ThrottledTask for Callables.
&lt;/span&gt;&lt;span class=&#34;cm&#34;&gt;    */&lt;/span&gt;
   &lt;span class=&#34;kd&#34;&gt;private&lt;/span&gt; &lt;span class=&#34;kd&#34;&gt;class&lt;/span&gt; &lt;span class=&#34;nc&#34;&gt;ThrottledCallable&lt;/span&gt; &lt;span class=&#34;kd&#34;&gt;extends&lt;/span&gt; &lt;span class=&#34;n&#34;&gt;ThrottledTask&lt;/span&gt;&lt;span class=&#34;o&#34;&gt;&amp;lt;&lt;/span&gt;&lt;span class=&#34;n&#34;&gt;V&lt;/span&gt;&lt;span class=&#34;o&#34;&gt;&amp;gt;&lt;/span&gt; &lt;span class=&#34;kd&#34;&gt;implements&lt;/span&gt; &lt;span class=&#34;n&#34;&gt;Callable&lt;/span&gt;&lt;span class=&#34;o&#34;&gt;&amp;lt;&lt;/span&gt;&lt;span class=&#34;n&#34;&gt;V&lt;/span&gt;&lt;span class=&#34;o&#34;&gt;&amp;gt;&lt;/span&gt; &lt;span class=&#34;o&#34;&gt;{&lt;/span&gt;
     &lt;span class=&#34;kd&#34;&gt;private&lt;/span&gt; &lt;span class=&#34;n&#34;&gt;Callable&lt;/span&gt;&lt;span class=&#34;o&#34;&gt;&amp;lt;&lt;/span&gt;&lt;span class=&#34;n&#34;&gt;V&lt;/span&gt;&lt;span class=&#34;o&#34;&gt;&amp;gt;&lt;/span&gt; &lt;span class=&#34;n&#34;&gt;delegate&lt;/span&gt;&lt;span class=&#34;o&#34;&gt;;&lt;/span&gt;
 
     &lt;span class=&#34;cm&#34;&gt;/**
&lt;/span&gt;&lt;span class=&#34;cm&#34;&gt;      * Construct a ThrottledCallable.
&lt;/span&gt;&lt;span class=&#34;cm&#34;&gt;      *
&lt;/span&gt;&lt;span class=&#34;cm&#34;&gt;      * @param delegate the callable we will delegate to.
&lt;/span&gt;&lt;span class=&#34;cm&#34;&gt;      */&lt;/span&gt;
     &lt;span class=&#34;kd&#34;&gt;public&lt;/span&gt; &lt;span class=&#34;nf&#34;&gt;ThrottledCallable&lt;/span&gt;&lt;span class=&#34;o&#34;&gt;(&lt;/span&gt;&lt;span class=&#34;n&#34;&gt;Callable&lt;/span&gt;&lt;span class=&#34;o&#34;&gt;&amp;lt;&lt;/span&gt;&lt;span class=&#34;n&#34;&gt;V&lt;/span&gt;&lt;span class=&#34;o&#34;&gt;&amp;gt;&lt;/span&gt; &lt;span class=&#34;n&#34;&gt;delegate&lt;/span&gt;&lt;span class=&#34;o&#34;&gt;)&lt;/span&gt; &lt;span class=&#34;o&#34;&gt;{&lt;/span&gt;
       &lt;span class=&#34;k&#34;&gt;this&lt;/span&gt;&lt;span class=&#34;o&#34;&gt;.&lt;/span&gt;&lt;span class=&#34;na&#34;&gt;delegate&lt;/span&gt; &lt;span class=&#34;o&#34;&gt;=&lt;/span&gt; &lt;span class=&#34;n&#34;&gt;delegate&lt;/span&gt;&lt;span class=&#34;o&#34;&gt;;&lt;/span&gt;
     &lt;span class=&#34;o&#34;&gt;}&lt;/span&gt;
 
     &lt;span class=&#34;cm&#34;&gt;/**
&lt;/span&gt;&lt;span class=&#34;cm&#34;&gt;      * @see Callable#call()
&lt;/span&gt;&lt;span class=&#34;cm&#34;&gt;      *
&lt;/span&gt;&lt;span class=&#34;cm&#34;&gt;      * calls {@link ThrottledCompletionService#submitNext()} when the decorated
&lt;/span&gt;&lt;span class=&#34;cm&#34;&gt;      * task is complete.
&lt;/span&gt;&lt;span class=&#34;cm&#34;&gt;      *
&lt;/span&gt;&lt;span class=&#34;cm&#34;&gt;      * @return the return value of the callable.
&lt;/span&gt;&lt;span class=&#34;cm&#34;&gt;      *
&lt;/span&gt;&lt;span class=&#34;cm&#34;&gt;      * @throws java.lang.Exception an exception when something bad happens.
&lt;/span&gt;&lt;span class=&#34;cm&#34;&gt;      */&lt;/span&gt;
     &lt;span class=&#34;kd&#34;&gt;public&lt;/span&gt; &lt;span class=&#34;n&#34;&gt;V&lt;/span&gt; &lt;span class=&#34;nf&#34;&gt;call&lt;/span&gt;&lt;span class=&#34;o&#34;&gt;()&lt;/span&gt; &lt;span class=&#34;kd&#34;&gt;throws&lt;/span&gt; &lt;span class=&#34;n&#34;&gt;Exception&lt;/span&gt; &lt;span class=&#34;o&#34;&gt;{&lt;/span&gt;
       &lt;span class=&#34;k&#34;&gt;try&lt;/span&gt; &lt;span class=&#34;o&#34;&gt;{&lt;/span&gt;
         &lt;span class=&#34;k&#34;&gt;return&lt;/span&gt; &lt;span class=&#34;n&#34;&gt;delegate&lt;/span&gt;&lt;span class=&#34;o&#34;&gt;.&lt;/span&gt;&lt;span class=&#34;na&#34;&gt;call&lt;/span&gt;&lt;span class=&#34;o&#34;&gt;();&lt;/span&gt;
       &lt;span class=&#34;o&#34;&gt;}&lt;/span&gt; &lt;span class=&#34;k&#34;&gt;finally&lt;/span&gt; &lt;span class=&#34;o&#34;&gt;{&lt;/span&gt;
         &lt;span class=&#34;n&#34;&gt;submitNext&lt;/span&gt;&lt;span class=&#34;o&#34;&gt;();&lt;/span&gt;
       &lt;span class=&#34;o&#34;&gt;}&lt;/span&gt;
     &lt;span class=&#34;o&#34;&gt;}&lt;/span&gt;
 
     &lt;span class=&#34;cm&#34;&gt;/**
&lt;/span&gt;&lt;span class=&#34;cm&#34;&gt;      * @see ThrottledTask#submit()
&lt;/span&gt;&lt;span class=&#34;cm&#34;&gt;      */&lt;/span&gt;
     &lt;span class=&#34;kd&#34;&gt;public&lt;/span&gt; &lt;span class=&#34;kt&#34;&gt;void&lt;/span&gt; &lt;span class=&#34;nf&#34;&gt;submit&lt;/span&gt;&lt;span class=&#34;o&#34;&gt;()&lt;/span&gt; &lt;span class=&#34;o&#34;&gt;{&lt;/span&gt;
       &lt;span class=&#34;n&#34;&gt;setDelegateFuture&lt;/span&gt;&lt;span class=&#34;o&#34;&gt;(&lt;/span&gt;&lt;span class=&#34;n&#34;&gt;mDelegate&lt;/span&gt;&lt;span class=&#34;o&#34;&gt;.&lt;/span&gt;&lt;span class=&#34;na&#34;&gt;submit&lt;/span&gt;&lt;span class=&#34;o&#34;&gt;(&lt;/span&gt;&lt;span class=&#34;k&#34;&gt;this&lt;/span&gt;&lt;span class=&#34;o&#34;&gt;));&lt;/span&gt;
     &lt;span class=&#34;o&#34;&gt;}&lt;/span&gt;
   &lt;span class=&#34;o&#34;&gt;}&lt;/span&gt;
 
   &lt;span class=&#34;kd&#34;&gt;private&lt;/span&gt; &lt;span class=&#34;kt&#34;&gt;int&lt;/span&gt; &lt;span class=&#34;n&#34;&gt;mThrottle&lt;/span&gt; &lt;span class=&#34;o&#34;&gt;=&lt;/span&gt; &lt;span class=&#34;n&#34;&gt;1&lt;/span&gt;&lt;span class=&#34;o&#34;&gt;;&lt;/span&gt;
   &lt;span class=&#34;kd&#34;&gt;private&lt;/span&gt; &lt;span class=&#34;n&#34;&gt;CompletionService&lt;/span&gt;&lt;span class=&#34;o&#34;&gt;&amp;lt;&lt;/span&gt;&lt;span class=&#34;n&#34;&gt;V&lt;/span&gt;&lt;span class=&#34;o&#34;&gt;&amp;gt;&lt;/span&gt; &lt;span class=&#34;n&#34;&gt;mDelegate&lt;/span&gt;&lt;span class=&#34;o&#34;&gt;;&lt;/span&gt;
 
   &lt;span class=&#34;kd&#34;&gt;private&lt;/span&gt; &lt;span class=&#34;kt&#34;&gt;int&lt;/span&gt; &lt;span class=&#34;n&#34;&gt;mSubmitted&lt;/span&gt; &lt;span class=&#34;o&#34;&gt;=&lt;/span&gt; &lt;span class=&#34;n&#34;&gt;0&lt;/span&gt;&lt;span class=&#34;o&#34;&gt;;&lt;/span&gt;
   &lt;span class=&#34;kd&#34;&gt;private&lt;/span&gt; &lt;span class=&#34;n&#34;&gt;Queue&lt;/span&gt;&lt;span class=&#34;o&#34;&gt;&amp;lt;&lt;/span&gt;&lt;span class=&#34;n&#34;&gt;ThrottledTask&lt;/span&gt;&lt;span class=&#34;o&#34;&gt;&amp;lt;&lt;/span&gt;&lt;span class=&#34;n&#34;&gt;V&lt;/span&gt;&lt;span class=&#34;o&#34;&gt;&amp;gt;&amp;gt;&lt;/span&gt; &lt;span class=&#34;n&#34;&gt;mTaskQueue&lt;/span&gt; &lt;span class=&#34;o&#34;&gt;=&lt;/span&gt; &lt;span class=&#34;k&#34;&gt;new&lt;/span&gt; &lt;span class=&#34;n&#34;&gt;LinkedList&lt;/span&gt;&lt;span class=&#34;o&#34;&gt;();&lt;/span&gt;
 
   &lt;span class=&#34;cm&#34;&gt;/**
&lt;/span&gt;&lt;span class=&#34;cm&#34;&gt;    * Creates a new ThrottledCompletionService wrapping the given completion service
&lt;/span&gt;&lt;span class=&#34;cm&#34;&gt;    * as a delegate.
&lt;/span&gt;&lt;span class=&#34;cm&#34;&gt;    *
&lt;/span&gt;&lt;span class=&#34;cm&#34;&gt;    * @param delegate
&lt;/span&gt;&lt;span class=&#34;cm&#34;&gt;    */&lt;/span&gt;
   &lt;span class=&#34;kd&#34;&gt;public&lt;/span&gt; &lt;span class=&#34;nf&#34;&gt;ThrottledCompletionService&lt;/span&gt;&lt;span class=&#34;o&#34;&gt;(&lt;/span&gt;&lt;span class=&#34;n&#34;&gt;CompletionService&lt;/span&gt;&lt;span class=&#34;o&#34;&gt;&amp;lt;&lt;/span&gt;&lt;span class=&#34;n&#34;&gt;V&lt;/span&gt;&lt;span class=&#34;o&#34;&gt;&amp;gt;&lt;/span&gt; &lt;span class=&#34;n&#34;&gt;delegate&lt;/span&gt;&lt;span class=&#34;o&#34;&gt;)&lt;/span&gt; &lt;span class=&#34;o&#34;&gt;{&lt;/span&gt;
     &lt;span class=&#34;k&#34;&gt;this&lt;/span&gt;&lt;span class=&#34;o&#34;&gt;.&lt;/span&gt;&lt;span class=&#34;na&#34;&gt;mDelegate&lt;/span&gt; &lt;span class=&#34;o&#34;&gt;=&lt;/span&gt; &lt;span class=&#34;n&#34;&gt;delegate&lt;/span&gt;&lt;span class=&#34;o&#34;&gt;;&lt;/span&gt;
   &lt;span class=&#34;o&#34;&gt;}&lt;/span&gt;
 
   &lt;span class=&#34;cm&#34;&gt;/**
&lt;/span&gt;&lt;span class=&#34;cm&#34;&gt;    * Creates a new ThrottledCompletionServices wrapping a new ExecutorCompletionService
&lt;/span&gt;&lt;span class=&#34;cm&#34;&gt;    * that references the passed executor.
&lt;/span&gt;&lt;span class=&#34;cm&#34;&gt;    *
&lt;/span&gt;&lt;span class=&#34;cm&#34;&gt;    * @param executor the executor.
&lt;/span&gt;&lt;span class=&#34;cm&#34;&gt;    */&lt;/span&gt;
   &lt;span class=&#34;kd&#34;&gt;public&lt;/span&gt; &lt;span class=&#34;nf&#34;&gt;ThrottledCompletionService&lt;/span&gt;&lt;span class=&#34;o&#34;&gt;(&lt;/span&gt;&lt;span class=&#34;n&#34;&gt;Executor&lt;/span&gt; &lt;span class=&#34;n&#34;&gt;executor&lt;/span&gt;&lt;span class=&#34;o&#34;&gt;)&lt;/span&gt; &lt;span class=&#34;o&#34;&gt;{&lt;/span&gt;
     &lt;span class=&#34;k&#34;&gt;this&lt;/span&gt;&lt;span class=&#34;o&#34;&gt;.&lt;/span&gt;&lt;span class=&#34;na&#34;&gt;mDelegate&lt;/span&gt; &lt;span class=&#34;o&#34;&gt;=&lt;/span&gt; &lt;span class=&#34;k&#34;&gt;new&lt;/span&gt; &lt;span class=&#34;n&#34;&gt;ExecutorCompletionService&lt;/span&gt;&lt;span class=&#34;o&#34;&gt;&amp;lt;&lt;/span&gt;&lt;span class=&#34;n&#34;&gt;V&lt;/span&gt;&lt;span class=&#34;o&#34;&gt;&amp;gt;(&lt;/span&gt;&lt;span class=&#34;n&#34;&gt;executor&lt;/span&gt;&lt;span class=&#34;o&#34;&gt;);&lt;/span&gt;
   &lt;span class=&#34;o&#34;&gt;}&lt;/span&gt;
 
   &lt;span class=&#34;cm&#34;&gt;/**
&lt;/span&gt;&lt;span class=&#34;cm&#34;&gt;    * Creates a new ThrottledCompletionService wrapping the given completion service
&lt;/span&gt;&lt;span class=&#34;cm&#34;&gt;    * as a delegate.
&lt;/span&gt;&lt;span class=&#34;cm&#34;&gt;    *
&lt;/span&gt;&lt;span class=&#34;cm&#34;&gt;    * @param delegate
&lt;/span&gt;&lt;span class=&#34;cm&#34;&gt;    */&lt;/span&gt;
   &lt;span class=&#34;kd&#34;&gt;public&lt;/span&gt; &lt;span class=&#34;nf&#34;&gt;ThrottledCompletionService&lt;/span&gt;&lt;span class=&#34;o&#34;&gt;(&lt;/span&gt;&lt;span class=&#34;n&#34;&gt;CompletionService&lt;/span&gt;&lt;span class=&#34;o&#34;&gt;&amp;lt;&lt;/span&gt;&lt;span class=&#34;n&#34;&gt;V&lt;/span&gt;&lt;span class=&#34;o&#34;&gt;&amp;gt;&lt;/span&gt; &lt;span class=&#34;n&#34;&gt;delegate&lt;/span&gt;&lt;span class=&#34;o&#34;&gt;,&lt;/span&gt; &lt;span class=&#34;kd&#34;&gt;final&lt;/span&gt; &lt;span class=&#34;kt&#34;&gt;int&lt;/span&gt; &lt;span class=&#34;n&#34;&gt;throttle&lt;/span&gt;&lt;span class=&#34;o&#34;&gt;)&lt;/span&gt; &lt;span class=&#34;o&#34;&gt;{&lt;/span&gt;
     &lt;span class=&#34;k&#34;&gt;this&lt;/span&gt;&lt;span class=&#34;o&#34;&gt;.&lt;/span&gt;&lt;span class=&#34;na&#34;&gt;mDelegate&lt;/span&gt; &lt;span class=&#34;o&#34;&gt;=&lt;/span&gt; &lt;span class=&#34;n&#34;&gt;delegate&lt;/span&gt;&lt;span class=&#34;o&#34;&gt;;&lt;/span&gt;
     &lt;span class=&#34;k&#34;&gt;this&lt;/span&gt;&lt;span class=&#34;o&#34;&gt;.&lt;/span&gt;&lt;span class=&#34;na&#34;&gt;mThrottle&lt;/span&gt; &lt;span class=&#34;o&#34;&gt;=&lt;/span&gt; &lt;span class=&#34;n&#34;&gt;throttle&lt;/span&gt;&lt;span class=&#34;o&#34;&gt;;&lt;/span&gt;
   &lt;span class=&#34;o&#34;&gt;}&lt;/span&gt;
 
   &lt;span class=&#34;cm&#34;&gt;/**
&lt;/span&gt;&lt;span class=&#34;cm&#34;&gt;    * Creates a new ThrottledCompletionServices wrapping a new ExecutorCompletionService
&lt;/span&gt;&lt;span class=&#34;cm&#34;&gt;    * that references the passed executor.
&lt;/span&gt;&lt;span class=&#34;cm&#34;&gt;    *
&lt;/span&gt;&lt;span class=&#34;cm&#34;&gt;    * @param executor the executor.
&lt;/span&gt;&lt;span class=&#34;cm&#34;&gt;    */&lt;/span&gt;
   &lt;span class=&#34;kd&#34;&gt;public&lt;/span&gt; &lt;span class=&#34;nf&#34;&gt;ThrottledCompletionService&lt;/span&gt;&lt;span class=&#34;o&#34;&gt;(&lt;/span&gt;&lt;span class=&#34;n&#34;&gt;Executor&lt;/span&gt; &lt;span class=&#34;n&#34;&gt;executor&lt;/span&gt;&lt;span class=&#34;o&#34;&gt;,&lt;/span&gt; &lt;span class=&#34;kd&#34;&gt;final&lt;/span&gt; &lt;span class=&#34;kt&#34;&gt;int&lt;/span&gt; &lt;span class=&#34;n&#34;&gt;throttle&lt;/span&gt;&lt;span class=&#34;o&#34;&gt;)&lt;/span&gt; &lt;span class=&#34;o&#34;&gt;{&lt;/span&gt;
     &lt;span class=&#34;k&#34;&gt;this&lt;/span&gt;&lt;span class=&#34;o&#34;&gt;.&lt;/span&gt;&lt;span class=&#34;na&#34;&gt;mDelegate&lt;/span&gt; &lt;span class=&#34;o&#34;&gt;=&lt;/span&gt; &lt;span class=&#34;k&#34;&gt;new&lt;/span&gt; &lt;span class=&#34;n&#34;&gt;ExecutorCompletionService&lt;/span&gt;&lt;span class=&#34;o&#34;&gt;&amp;lt;&lt;/span&gt;&lt;span class=&#34;n&#34;&gt;V&lt;/span&gt;&lt;span class=&#34;o&#34;&gt;&amp;gt;(&lt;/span&gt;&lt;span class=&#34;n&#34;&gt;executor&lt;/span&gt;&lt;span class=&#34;o&#34;&gt;);&lt;/span&gt;
     &lt;span class=&#34;k&#34;&gt;this&lt;/span&gt;&lt;span class=&#34;o&#34;&gt;.&lt;/span&gt;&lt;span class=&#34;na&#34;&gt;mThrottle&lt;/span&gt; &lt;span class=&#34;o&#34;&gt;=&lt;/span&gt; &lt;span class=&#34;n&#34;&gt;throttle&lt;/span&gt;&lt;span class=&#34;o&#34;&gt;;&lt;/span&gt;
   &lt;span class=&#34;o&#34;&gt;}&lt;/span&gt;
 
   &lt;span class=&#34;cm&#34;&gt;/**
&lt;/span&gt;&lt;span class=&#34;cm&#34;&gt;    * Decrements the submitted count, attempts to submit the next task.  Callled
&lt;/span&gt;&lt;span class=&#34;cm&#34;&gt;    * when a submitted task completes.  If there are no tasks to submit, simply
&lt;/span&gt;&lt;span class=&#34;cm&#34;&gt;    * return.
&lt;/span&gt;&lt;span class=&#34;cm&#34;&gt;    */&lt;/span&gt;
   &lt;span class=&#34;kd&#34;&gt;private&lt;/span&gt; &lt;span class=&#34;kd&#34;&gt;synchronized&lt;/span&gt; &lt;span class=&#34;kt&#34;&gt;void&lt;/span&gt; &lt;span class=&#34;nf&#34;&gt;submitNext&lt;/span&gt;&lt;span class=&#34;o&#34;&gt;()&lt;/span&gt; &lt;span class=&#34;o&#34;&gt;{&lt;/span&gt;
     &lt;span class=&#34;n&#34;&gt;mSubmitted&lt;/span&gt; &lt;span class=&#34;o&#34;&gt;-=&lt;/span&gt; &lt;span class=&#34;n&#34;&gt;1&lt;/span&gt;&lt;span class=&#34;o&#34;&gt;;&lt;/span&gt;
     &lt;span class=&#34;k&#34;&gt;if&lt;/span&gt; &lt;span class=&#34;o&#34;&gt;(&lt;/span&gt; &lt;span class=&#34;n&#34;&gt;mSubmitted&lt;/span&gt; &lt;span class=&#34;o&#34;&gt;&amp;lt;&lt;/span&gt; &lt;span class=&#34;n&#34;&gt;mThrottle&lt;/span&gt; &lt;span class=&#34;o&#34;&gt;)&lt;/span&gt; &lt;span class=&#34;o&#34;&gt;{&lt;/span&gt;
       &lt;span class=&#34;k&#34;&gt;while&lt;/span&gt;&lt;span class=&#34;o&#34;&gt;(&lt;/span&gt;&lt;span class=&#34;kc&#34;&gt;true&lt;/span&gt;&lt;span class=&#34;o&#34;&gt;)&lt;/span&gt; &lt;span class=&#34;o&#34;&gt;{&lt;/span&gt;
         &lt;span class=&#34;n&#34;&gt;ThrottledTask&lt;/span&gt;&lt;span class=&#34;o&#34;&gt;&amp;lt;&lt;/span&gt;&lt;span class=&#34;n&#34;&gt;V&lt;/span&gt;&lt;span class=&#34;o&#34;&gt;&amp;gt;&lt;/span&gt; &lt;span class=&#34;n&#34;&gt;task&lt;/span&gt; &lt;span class=&#34;o&#34;&gt;=&lt;/span&gt; &lt;span class=&#34;n&#34;&gt;mTaskQueue&lt;/span&gt;&lt;span class=&#34;o&#34;&gt;.&lt;/span&gt;&lt;span class=&#34;na&#34;&gt;poll&lt;/span&gt;&lt;span class=&#34;o&#34;&gt;();&lt;/span&gt;
         &lt;span class=&#34;k&#34;&gt;if&lt;/span&gt; &lt;span class=&#34;o&#34;&gt;(&lt;/span&gt; &lt;span class=&#34;n&#34;&gt;task&lt;/span&gt; &lt;span class=&#34;o&#34;&gt;!=&lt;/span&gt; &lt;span class=&#34;kc&#34;&gt;null&lt;/span&gt; &lt;span class=&#34;o&#34;&gt;)&lt;/span&gt; &lt;span class=&#34;o&#34;&gt;{&lt;/span&gt;
           &lt;span class=&#34;c1&#34;&gt;// skip any tasks that were cancelled before we submitted them.
&lt;/span&gt;&lt;span class=&#34;c1&#34;&gt;&lt;/span&gt;           &lt;span class=&#34;k&#34;&gt;if&lt;/span&gt; &lt;span class=&#34;o&#34;&gt;(&lt;/span&gt;&lt;span class=&#34;n&#34;&gt;task&lt;/span&gt;&lt;span class=&#34;o&#34;&gt;.&lt;/span&gt;&lt;span class=&#34;na&#34;&gt;isCancelled&lt;/span&gt;&lt;span class=&#34;o&#34;&gt;())&lt;/span&gt; &lt;span class=&#34;o&#34;&gt;{&lt;/span&gt;
             &lt;span class=&#34;k&#34;&gt;continue&lt;/span&gt;&lt;span class=&#34;o&#34;&gt;;&lt;/span&gt;
           &lt;span class=&#34;o&#34;&gt;}&lt;/span&gt;
           &lt;span class=&#34;n&#34;&gt;task&lt;/span&gt;&lt;span class=&#34;o&#34;&gt;.&lt;/span&gt;&lt;span class=&#34;na&#34;&gt;submit&lt;/span&gt;&lt;span class=&#34;o&#34;&gt;();&lt;/span&gt;
           &lt;span class=&#34;n&#34;&gt;mSubmitted&lt;/span&gt; &lt;span class=&#34;o&#34;&gt;+=&lt;/span&gt; &lt;span class=&#34;n&#34;&gt;1&lt;/span&gt;&lt;span class=&#34;o&#34;&gt;;&lt;/span&gt;
         &lt;span class=&#34;o&#34;&gt;}&lt;/span&gt;
         &lt;span class=&#34;k&#34;&gt;break&lt;/span&gt;&lt;span class=&#34;o&#34;&gt;;&lt;/span&gt;
       &lt;span class=&#34;o&#34;&gt;}&lt;/span&gt;
     &lt;span class=&#34;o&#34;&gt;}&lt;/span&gt;
   &lt;span class=&#34;o&#34;&gt;}&lt;/span&gt;
 
   &lt;span class=&#34;cm&#34;&gt;/**
&lt;/span&gt;&lt;span class=&#34;cm&#34;&gt;    * @see CompletionService#submit(java.util.concurrent.Callable)
&lt;/span&gt;&lt;span class=&#34;cm&#34;&gt;    *
&lt;/span&gt;&lt;span class=&#34;cm&#34;&gt;    * @param task the task to submit
&lt;/span&gt;&lt;span class=&#34;cm&#34;&gt;    *
&lt;/span&gt;&lt;span class=&#34;cm&#34;&gt;    * @return a future for
&lt;/span&gt;&lt;span class=&#34;cm&#34;&gt;    */&lt;/span&gt;
   &lt;span class=&#34;kd&#34;&gt;public&lt;/span&gt; &lt;span class=&#34;kd&#34;&gt;synchronized&lt;/span&gt; &lt;span class=&#34;n&#34;&gt;Future&lt;/span&gt;&lt;span class=&#34;o&#34;&gt;&amp;lt;&lt;/span&gt;&lt;span class=&#34;n&#34;&gt;V&lt;/span&gt;&lt;span class=&#34;o&#34;&gt;&amp;gt;&lt;/span&gt; &lt;span class=&#34;nf&#34;&gt;submit&lt;/span&gt;&lt;span class=&#34;o&#34;&gt;(&lt;/span&gt;&lt;span class=&#34;n&#34;&gt;Callable&lt;/span&gt;&lt;span class=&#34;o&#34;&gt;&amp;lt;&lt;/span&gt;&lt;span class=&#34;n&#34;&gt;V&lt;/span&gt;&lt;span class=&#34;o&#34;&gt;&amp;gt;&lt;/span&gt; &lt;span class=&#34;n&#34;&gt;task&lt;/span&gt;&lt;span class=&#34;o&#34;&gt;)&lt;/span&gt; &lt;span class=&#34;o&#34;&gt;{&lt;/span&gt;
     &lt;span class=&#34;n&#34;&gt;ThrottledCallable&lt;/span&gt; &lt;span class=&#34;n&#34;&gt;ttask&lt;/span&gt; &lt;span class=&#34;o&#34;&gt;=&lt;/span&gt; &lt;span class=&#34;k&#34;&gt;new&lt;/span&gt; &lt;span class=&#34;n&#34;&gt;ThrottledCallable&lt;/span&gt;&lt;span class=&#34;o&#34;&gt;(&lt;/span&gt;&lt;span class=&#34;n&#34;&gt;task&lt;/span&gt;&lt;span class=&#34;o&#34;&gt;);&lt;/span&gt;
     &lt;span class=&#34;k&#34;&gt;if&lt;/span&gt; &lt;span class=&#34;o&#34;&gt;(&lt;/span&gt; &lt;span class=&#34;n&#34;&gt;mSubmitted&lt;/span&gt; &lt;span class=&#34;o&#34;&gt;&amp;lt;&lt;/span&gt; &lt;span class=&#34;n&#34;&gt;mThrottle&lt;/span&gt; &lt;span class=&#34;o&#34;&gt;)&lt;/span&gt; &lt;span class=&#34;o&#34;&gt;{&lt;/span&gt;
       &lt;span class=&#34;n&#34;&gt;mSubmitted&lt;/span&gt; &lt;span class=&#34;o&#34;&gt;+=&lt;/span&gt; &lt;span class=&#34;n&#34;&gt;1&lt;/span&gt;&lt;span class=&#34;o&#34;&gt;;&lt;/span&gt;
       &lt;span class=&#34;k&#34;&gt;return&lt;/span&gt; &lt;span class=&#34;n&#34;&gt;mDelegate&lt;/span&gt;&lt;span class=&#34;o&#34;&gt;.&lt;/span&gt;&lt;span class=&#34;na&#34;&gt;submit&lt;/span&gt;&lt;span class=&#34;o&#34;&gt;(&lt;/span&gt;&lt;span class=&#34;n&#34;&gt;ttask&lt;/span&gt;&lt;span class=&#34;o&#34;&gt;);&lt;/span&gt;
     &lt;span class=&#34;o&#34;&gt;}&lt;/span&gt; &lt;span class=&#34;k&#34;&gt;else&lt;/span&gt; &lt;span class=&#34;o&#34;&gt;{&lt;/span&gt;
       &lt;span class=&#34;n&#34;&gt;mTaskQueue&lt;/span&gt;&lt;span class=&#34;o&#34;&gt;.&lt;/span&gt;&lt;span class=&#34;na&#34;&gt;offer&lt;/span&gt;&lt;span class=&#34;o&#34;&gt;(&lt;/span&gt;&lt;span class=&#34;n&#34;&gt;ttask&lt;/span&gt;&lt;span class=&#34;o&#34;&gt;);&lt;/span&gt;
       &lt;span class=&#34;k&#34;&gt;return&lt;/span&gt; &lt;span class=&#34;n&#34;&gt;ttask&lt;/span&gt;&lt;span class=&#34;o&#34;&gt;;&lt;/span&gt;
     &lt;span class=&#34;o&#34;&gt;}&lt;/span&gt;
   &lt;span class=&#34;o&#34;&gt;}&lt;/span&gt;
 
   &lt;span class=&#34;cm&#34;&gt;/**
&lt;/span&gt;&lt;span class=&#34;cm&#34;&gt;    * @see CompletionService#submit(java.lang.Runnable, java.lang.Object)
&lt;/span&gt;&lt;span class=&#34;cm&#34;&gt;    *
&lt;/span&gt;&lt;span class=&#34;cm&#34;&gt;    * @param task the task to be run.
&lt;/span&gt;&lt;span class=&#34;cm&#34;&gt;    * @param result the result to return from the Future&amp;lt;V&amp;gt; object.
&lt;/span&gt;&lt;span class=&#34;cm&#34;&gt;    * @return a future object that can be used to access the result of the submitted task.
&lt;/span&gt;&lt;span class=&#34;cm&#34;&gt;    */&lt;/span&gt;
   &lt;span class=&#34;kd&#34;&gt;public&lt;/span&gt; &lt;span class=&#34;kd&#34;&gt;synchronized&lt;/span&gt; &lt;span class=&#34;n&#34;&gt;Future&lt;/span&gt;&lt;span class=&#34;o&#34;&gt;&amp;lt;&lt;/span&gt;&lt;span class=&#34;n&#34;&gt;V&lt;/span&gt;&lt;span class=&#34;o&#34;&gt;&amp;gt;&lt;/span&gt; &lt;span class=&#34;nf&#34;&gt;submit&lt;/span&gt;&lt;span class=&#34;o&#34;&gt;(&lt;/span&gt;&lt;span class=&#34;n&#34;&gt;Runnable&lt;/span&gt; &lt;span class=&#34;n&#34;&gt;task&lt;/span&gt;&lt;span class=&#34;o&#34;&gt;,&lt;/span&gt; &lt;span class=&#34;n&#34;&gt;V&lt;/span&gt; &lt;span class=&#34;n&#34;&gt;result&lt;/span&gt;&lt;span class=&#34;o&#34;&gt;)&lt;/span&gt; &lt;span class=&#34;o&#34;&gt;{&lt;/span&gt;
     &lt;span class=&#34;n&#34;&gt;ThrottledRunnable&lt;/span&gt; &lt;span class=&#34;n&#34;&gt;ttask&lt;/span&gt; &lt;span class=&#34;o&#34;&gt;=&lt;/span&gt; &lt;span class=&#34;k&#34;&gt;new&lt;/span&gt; &lt;span class=&#34;n&#34;&gt;ThrottledRunnable&lt;/span&gt;&lt;span class=&#34;o&#34;&gt;(&lt;/span&gt;&lt;span class=&#34;n&#34;&gt;task&lt;/span&gt;&lt;span class=&#34;o&#34;&gt;,&lt;/span&gt;&lt;span class=&#34;n&#34;&gt;result&lt;/span&gt;&lt;span class=&#34;o&#34;&gt;);&lt;/span&gt;
     &lt;span class=&#34;k&#34;&gt;if&lt;/span&gt; &lt;span class=&#34;o&#34;&gt;(&lt;/span&gt; &lt;span class=&#34;n&#34;&gt;mSubmitted&lt;/span&gt; &lt;span class=&#34;o&#34;&gt;&amp;lt;&lt;/span&gt; &lt;span class=&#34;n&#34;&gt;mThrottle&lt;/span&gt; &lt;span class=&#34;o&#34;&gt;)&lt;/span&gt; &lt;span class=&#34;o&#34;&gt;{&lt;/span&gt;
       &lt;span class=&#34;n&#34;&gt;mSubmitted&lt;/span&gt; &lt;span class=&#34;o&#34;&gt;+=&lt;/span&gt; &lt;span class=&#34;n&#34;&gt;1&lt;/span&gt;&lt;span class=&#34;o&#34;&gt;;&lt;/span&gt;
       &lt;span class=&#34;k&#34;&gt;return&lt;/span&gt; &lt;span class=&#34;n&#34;&gt;mDelegate&lt;/span&gt;&lt;span class=&#34;o&#34;&gt;.&lt;/span&gt;&lt;span class=&#34;na&#34;&gt;submit&lt;/span&gt;&lt;span class=&#34;o&#34;&gt;(&lt;/span&gt;&lt;span class=&#34;n&#34;&gt;ttask&lt;/span&gt;&lt;span class=&#34;o&#34;&gt;,&lt;/span&gt;&lt;span class=&#34;n&#34;&gt;result&lt;/span&gt;&lt;span class=&#34;o&#34;&gt;);&lt;/span&gt;
     &lt;span class=&#34;o&#34;&gt;}&lt;/span&gt; &lt;span class=&#34;k&#34;&gt;else&lt;/span&gt; &lt;span class=&#34;o&#34;&gt;{&lt;/span&gt;
       &lt;span class=&#34;n&#34;&gt;mTaskQueue&lt;/span&gt;&lt;span class=&#34;o&#34;&gt;.&lt;/span&gt;&lt;span class=&#34;na&#34;&gt;offer&lt;/span&gt;&lt;span class=&#34;o&#34;&gt;(&lt;/span&gt;&lt;span class=&#34;n&#34;&gt;ttask&lt;/span&gt;&lt;span class=&#34;o&#34;&gt;);&lt;/span&gt;
       &lt;span class=&#34;k&#34;&gt;return&lt;/span&gt; &lt;span class=&#34;n&#34;&gt;ttask&lt;/span&gt;&lt;span class=&#34;o&#34;&gt;;&lt;/span&gt;
     &lt;span class=&#34;o&#34;&gt;}&lt;/span&gt;
   &lt;span class=&#34;o&#34;&gt;}&lt;/span&gt;
 
   &lt;span class=&#34;cm&#34;&gt;/**
&lt;/span&gt;&lt;span class=&#34;cm&#34;&gt;    * @see CompletionService#take()
&lt;/span&gt;&lt;span class=&#34;cm&#34;&gt;    */&lt;/span&gt;
   &lt;span class=&#34;kd&#34;&gt;public&lt;/span&gt; &lt;span class=&#34;n&#34;&gt;Future&lt;/span&gt;&lt;span class=&#34;o&#34;&gt;&amp;lt;&lt;/span&gt;&lt;span class=&#34;n&#34;&gt;V&lt;/span&gt;&lt;span class=&#34;o&#34;&gt;&amp;gt;&lt;/span&gt; &lt;span class=&#34;nf&#34;&gt;take&lt;/span&gt;&lt;span class=&#34;o&#34;&gt;()&lt;/span&gt; &lt;span class=&#34;kd&#34;&gt;throws&lt;/span&gt; &lt;span class=&#34;n&#34;&gt;InterruptedException&lt;/span&gt; &lt;span class=&#34;o&#34;&gt;{&lt;/span&gt;
     &lt;span class=&#34;k&#34;&gt;return&lt;/span&gt; &lt;span class=&#34;n&#34;&gt;mDelegate&lt;/span&gt;&lt;span class=&#34;o&#34;&gt;.&lt;/span&gt;&lt;span class=&#34;na&#34;&gt;take&lt;/span&gt;&lt;span class=&#34;o&#34;&gt;();&lt;/span&gt;
   &lt;span class=&#34;o&#34;&gt;}&lt;/span&gt;
 
   &lt;span class=&#34;cm&#34;&gt;/**
&lt;/span&gt;&lt;span class=&#34;cm&#34;&gt;    * @see CompletionService#poll(long, java.util.concurrent.TimeUnit)
&lt;/span&gt;&lt;span class=&#34;cm&#34;&gt;    */&lt;/span&gt;
   &lt;span class=&#34;kd&#34;&gt;public&lt;/span&gt; &lt;span class=&#34;n&#34;&gt;Future&lt;/span&gt;&lt;span class=&#34;o&#34;&gt;&amp;lt;&lt;/span&gt;&lt;span class=&#34;n&#34;&gt;V&lt;/span&gt;&lt;span class=&#34;o&#34;&gt;&amp;gt;&lt;/span&gt; &lt;span class=&#34;nf&#34;&gt;poll&lt;/span&gt;&lt;span class=&#34;o&#34;&gt;(&lt;/span&gt;&lt;span class=&#34;kt&#34;&gt;long&lt;/span&gt; &lt;span class=&#34;n&#34;&gt;timeout&lt;/span&gt;&lt;span class=&#34;o&#34;&gt;,&lt;/span&gt; &lt;span class=&#34;n&#34;&gt;TimeUnit&lt;/span&gt; &lt;span class=&#34;n&#34;&gt;unit&lt;/span&gt;&lt;span class=&#34;o&#34;&gt;)&lt;/span&gt; &lt;span class=&#34;kd&#34;&gt;throws&lt;/span&gt; &lt;span class=&#34;n&#34;&gt;InterruptedException&lt;/span&gt; &lt;span class=&#34;o&#34;&gt;{&lt;/span&gt;
     &lt;span class=&#34;k&#34;&gt;return&lt;/span&gt; &lt;span class=&#34;n&#34;&gt;mDelegate&lt;/span&gt;&lt;span class=&#34;o&#34;&gt;.&lt;/span&gt;&lt;span class=&#34;na&#34;&gt;poll&lt;/span&gt;&lt;span class=&#34;o&#34;&gt;(&lt;/span&gt;&lt;span class=&#34;n&#34;&gt;timeout&lt;/span&gt;&lt;span class=&#34;o&#34;&gt;,&lt;/span&gt; &lt;span class=&#34;n&#34;&gt;unit&lt;/span&gt;&lt;span class=&#34;o&#34;&gt;);&lt;/span&gt;
   &lt;span class=&#34;o&#34;&gt;}&lt;/span&gt;
 
   &lt;span class=&#34;cm&#34;&gt;/**
&lt;/span&gt;&lt;span class=&#34;cm&#34;&gt;    * @see CompletionService#poll&amp;lt;span class=&amp;#34;javaComment&amp;#34;&amp;gt;()
&lt;/span&gt;&lt;span class=&#34;cm&#34;&gt;    */&lt;/span&gt;
   &lt;span class=&#34;kd&#34;&gt;public&lt;/span&gt; &lt;span class=&#34;n&#34;&gt;Future&lt;/span&gt;&lt;span class=&#34;o&#34;&gt;&amp;lt;&lt;/span&gt;&lt;span class=&#34;n&#34;&gt;V&lt;/span&gt;&lt;span class=&#34;o&#34;&gt;&amp;gt;&lt;/span&gt; &lt;span class=&#34;nf&#34;&gt;poll&lt;/span&gt;&lt;span class=&#34;o&#34;&gt;()&lt;/span&gt; &lt;span class=&#34;o&#34;&gt;{&lt;/span&gt;
     &lt;span class=&#34;k&#34;&gt;return&lt;/span&gt; &lt;span class=&#34;n&#34;&gt;mDelegate&lt;/span&gt;&lt;span class=&#34;o&#34;&gt;.&lt;/span&gt;&lt;span class=&#34;na&#34;&gt;poll&lt;/span&gt;&lt;span class=&#34;o&#34;&gt;();&lt;/span&gt;
   &lt;span class=&#34;o&#34;&gt;}&lt;/span&gt;
 &lt;span class=&#34;o&#34;&gt;}&lt;/span&gt;
 
 &lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;</description>
    </item>
    
    <item>
      <title>Will Apple Announce a New iPhone at WWDC?</title>
      <link>http://dhptech.com/article/2009/06/08/will-apple-announce-a-new-iphone-at-wwdc/</link>
      <pubDate>Mon, 08 Jun 2009 00:00:00 +0000</pubDate>
      <author>danap@dhptech.com (Dana H. P&#39;Simer)</author>
      <guid>http://dhptech.com/article/2009/06/08/will-apple-announce-a-new-iphone-at-wwdc/</guid>
      <description>&lt;p&gt;The author of &lt;a href=&#34;http://topnews.us/content/25497-apple-likely-flaunt-new-iphone-monday-s-conference&#34;&gt;this article&lt;/a&gt; seems to think so.  There is also &lt;a href=&#34;http://www.google.com/hostednews/afp/article/ALeqM5hk8BHpQQXR-ac6pD07FljJGrC-6Q&#34;&gt;this article&lt;/a&gt; that seems to be reporting the same thing.  Rumors are flying around what Apple, who always keeps its announcements well under wraps, will be announcing at the keynote for its World Wide Developer Conference next week.  I am looking forward to hearing what Jobs and Crew have in store for us next week.

  There is also talk of them making an announcement about &amp;ldquo;Snow Leopard&amp;rdquo;.&lt;/p&gt;</description>
    </item>
    
    <item>
      <title>PHP File Upload Size Issues</title>
      <link>http://dhptech.com/article/2008/06/21/php-file-upload-size-issues/</link>
      <pubDate>Sat, 21 Jun 2008 00:00:00 +0000</pubDate>
      <author>danap@dhptech.com (Dana H. P&#39;Simer)</author>
      <guid>http://dhptech.com/article/2008/06/21/php-file-upload-size-issues/</guid>
      <description>&lt;p&gt;Ran into a problem when I was maintaining a customer&amp;rsquo;s site today.  They wanted to upload 10 - 20 MB movies as attachments to their Drupal blog posts.  The standard limit set in Drupal is 2MB.  I changed the setting to no avail.  There was a note at the bottom stating that my PHP settings limited the upload to 4MB.  So I did a search and come up with &lt;a href=&#34;http://drupal.org/node/217292&#34;&gt;this post&lt;/a&gt;.  So I changed my upload_max_filesize setting to &amp;ldquo;20M&amp;rdquo; this still did not work.  The problem is that PHP also limits the post size and my default config limited post size to 8MB.

  So to increase the PHP upload limit one must check both the upload_max_filesize and the post_max_size settings are setup to allow the size of uploads they want to do.&lt;/p&gt;

&lt;p&gt;So my new settings became:&lt;/p&gt;

&lt;div class=&#34;highlight&#34;&gt;&lt;pre class=&#34;chroma&#34;&gt;&lt;code class=&#34;language-ini&#34; data-lang=&#34;ini&#34;&gt;  &lt;span class=&#34;na&#34;&gt;post_max_size&lt;/span&gt; &lt;span class=&#34;o&#34;&gt;=&lt;/span&gt; &lt;span class=&#34;s&#34;&gt;20M&lt;/span&gt;

  &lt;span class=&#34;na&#34;&gt;...&lt;/span&gt;

  &lt;span class=&#34;na&#34;&gt;upload_max_filesize&lt;/span&gt; &lt;span class=&#34;o&#34;&gt;=&lt;/span&gt; &lt;span class=&#34;s&#34;&gt;20M&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;</description>
    </item>
    
    <item>
      <title>Resin and Session Clustering</title>
      <link>http://dhptech.com/article/2008/04/30/resin-and-session-clustering/</link>
      <pubDate>Wed, 30 Apr 2008 00:00:00 +0000</pubDate>
      <author>danap@dhptech.com (Dana H. P&#39;Simer)</author>
      <guid>http://dhptech.com/article/2008/04/30/resin-and-session-clustering/</guid>
      <description>&lt;p&gt;In a world where AJAX is becoming the norm instead of the exception we need technology platforms that allow us to scale these applications.  I have been working on an application for a major hotel chain that is used by their call center agents to book reservations at their hotels.  The application uses AJAX techniques to run several queries simultaneously and presents the data in a very dynamic interface that closely resembles a traditional desktop application.

  There are multiple tabs in many areas of the application that load data in the background so that it is available when the user wants to see it.&lt;/p&gt;

&lt;p&gt;The application is deployed on &lt;a href=&#34;http://www.caucho.com&#34;&gt;Resin Pro v3.1.2&lt;/a&gt; and we are attempting to use Resin&amp;rsquo;s &lt;a href=&#34;http://caucho.com/resin/doc/resin-clustering.xtp&#34;&gt;session clustering technology&lt;/a&gt;.  It seems that our sessions are too large and that Resin&amp;rsquo;s session clustering does not take into account the possibility that two requests could be accessing and even modifying the session at the same time.  However, this is the nature of AJAX applications.&lt;/p&gt;

&lt;p&gt;So we are looking for solutions.  The problem with highly concurrent systems that require replication of changing data is that the less granular the replication capabilities of a clustering technology the more chance you have for conflicts.  Take, for example a problem from the 90&amp;rsquo;s of database replication.  Some of the first replication technologies worked at the record level.  Changes to a record were replicated with the entire record so when the replicated change arrived at its destination, the entire record was either applied or not depending on conflict resolution policies.  In a system that I worked on, we chose to use field level replication.  In doing so, we were able to avoid most conflicts.&lt;/p&gt;

&lt;p&gt;What we need is a finely granulated replication technology that will only replicate the changes to the object graphs rooted at the session.  Resin&amp;rsquo;s session clustering technology serializes the session and writes it to disk and sends it over the network to the backup server.  Once the serialized session reaches it&amp;rsquo;s destination, it replaces the session that may already be there based on conflict resolution policies.&lt;/p&gt;

&lt;p&gt;We could put in our own session replication mechanism that increases granularity by replicating at the attribute level.  However, since some of our objects contain significant amounts of data this may not be granular enough.&lt;/p&gt;

&lt;p&gt;Another option that we are exploring is &lt;a href=&#34;http://www.terracotta.org&#34;&gt;Terracotta&lt;/a&gt;.  This is very interesting technology.  It instruments the byte code as it is loaded into the JVM altering the behavior of PUTFIELD and GETFIELD opcodes.  The &lt;a href=&#34;http://www.terracotta.org&#34;&gt;Terracotta&lt;/a&gt; system uses a back-end server to hold the distributed shared object (DSO) state.  On PUTFIELD, changes are replicated back to the back-end server and on GETFIELD, the referenced object is &amp;ldquo;Faulted In&amp;rdquo; if it is not yet present in the current JVM.&lt;/p&gt;

&lt;p&gt;There are a number of things that &lt;a href=&#34;http://www.terracotta.org&#34;&gt;Terracotta&lt;/a&gt; has to do to get this working.
&lt;ol&gt;
  &lt;li&gt;Each &lt;a href=&#34;http://java.sun.com/j2se/1.5.0/docs/api/java/lang/ClassLoader.html&#34;&gt;ClassLoader&lt;/a&gt; needs to have a unique and predictable name that will match the corresponding &lt;a href=&#34;http://java.sun.com/j2se/1.5.0/docs/api/java/lang/ClassLoader.html&#34;&gt;ClassLoader&lt;/a&gt; in all the nodes of the cluster.&lt;/li&gt;
  &lt;li&gt;There are certain classes that cannot be replciated, like any of the java.lang.ref Reference classes.  There is a &lt;a href=&#34;http://www.terracotta.org/confluence/display/docs1/Non-portable+Classes&#34;&gt;list&lt;/a&gt; on Terracotta&amp;rsquo;s website.  Most of these are quite obvious, like Thread&lt;/li&gt;
  &lt;li&gt;For performance reason, we should not be instrumenting every class.  Therefore Terracotta gives a way to include/exclude classes from instrumentation&lt;/li&gt;
  &lt;li&gt;For session clustering, a Servlet Filter (&lt;a href=&#34;http://java.sun.com/j2ee/1.4/docs/api/javax/servlet/Filter.html&#34;&gt;javax.servlet.Filter&lt;/a&gt;) must be injected into the beginning of the filter chain so that the session can be watched and new attributes can be added to the cluster and removed attributes can be removed from the cluster.&lt;/li&gt;
&lt;/ol&gt;&lt;/p&gt;

&lt;p&gt;To accomplish these tasks, &lt;a href=&#34;http://www.terracotta.org&#34;&gt;Terracotta&lt;/a&gt; uses &lt;a href=&#34;http://www.terracotta.org/confluence/display/integrations/Terracotta+Integration+Module+Manual&#34;&gt;Terracotta Integration Modules&lt;/a&gt; ( TIMs ).  These are modules that are configured using a subset of the &lt;a href=&#34;http://www.osgi.org/Main/HomePage&#34;&gt;OSGi&lt;/a&gt; standard and what they do is implement &lt;a href=&#34;http://asm.objectweb.org/&#34;&gt;ASM&lt;/a&gt; ClassAdapters that will instrument classes in the container to inject the ClassLoader naming logic and the &lt;a href=&#34;http://java.sun.com/j2ee/1.4/docs/api/javax/servlet/Filter.html&#34;&gt;Filter&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;Currently there is no Resin integration module that is fully functional.  There is a &lt;a href=&#34;http://www.terracotta.org/confluence/display/labs/Resin+Support&#34;&gt;project&lt;/a&gt; on terracotta forge.  It is somewhat incomplete since it does not name all the &lt;a href=&#34;http://java.sun.com/j2se/1.5.0/docs/api/java/lang/ClassLoader.html&#34;&gt;ClassLoader&lt;/a&gt;s that need names and it does not inject the session filter.&lt;/p&gt;

&lt;p&gt;Since we have not decided to go ahead with &lt;a href=&#34;http://www.terracotta.org&#34;&gt;Terracotta&lt;/a&gt; for our sessions, we have not continued to work on this.  I did, however, get a rudimentary application working with &lt;a href=&#34;http://www.terracotta.org&#34;&gt;Terracotta&lt;/a&gt; session clustering.  I ran into issues, that I knew I would run into, when I attempted to call our in house SDK to retrieve Hotel information and put that in the session.  No go, but I know why that is and it is the subject of another blog article.&lt;/p&gt;</description>
    </item>
    
    <item>
      <title>iPhone SDK and OCUnit</title>
      <link>http://dhptech.com/article/2008/03/09/iphone-sdk-and-ocunit/</link>
      <pubDate>Sun, 09 Mar 2008 00:00:00 +0000</pubDate>
      <author>danap@dhptech.com (Dana H. P&#39;Simer)</author>
      <guid>http://dhptech.com/article/2008/03/09/iphone-sdk-and-ocunit/</guid>
      <description>&lt;p&gt;I have started fooling around with the iPhone SDK.  I am planning to release a product soon but the plans are quite preliminary so mums the word on exactly what is coming.  However, I ran into a little problem right off the bat.&lt;/p&gt;

&lt;p&gt;
&lt;!--break--&gt;
I am a Java Developer.  I am trying to add iPhone/Mac OS X development to my skill set.  But given my strong Java background I have an absolute commitment to unit testing.  It is extremely important that you construct unit tests for your code.  As such, I immediately went looking for tools to help me do just that.&lt;/p&gt;

&lt;p&gt;It seems that the iPhone SDK projects are not setup to be compatible with OCUnit out of the box.  In this, &lt;a href=&#34;http://developer.apple.com/tools/unittest.html&#34;&gt;Test Driving Your Code with OCUnit&lt;/a&gt;, article at developer.apple.com you are told to simply:&lt;/p&gt;

&lt;ol&gt;
  &lt;li&gt;create a new &#34;Cocoa &amp;gt; Test Framework&#34; target. Actually, under the newest XCode it is called &#34;Cocoa &amp;gt; Unit Test Bundle&#34;&lt;/li&gt;
  &lt;li&gt;Add the &#34;SenTestingKit&#34; Framework to that target.  You will need to look for this in &#34;/Developer/Library/Frameworks&#34; (assuming you installed XCode into /Developer) instead of the default &#34;/System/Library/Frameworks&#34;.&lt;/li&gt;
  &lt;li&gt;Create a group for test cases&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;I did these things and it still did not work.  The first error I got was in regards to the &amp;ldquo;Cocoa.h&amp;rdquo; not compiling.  This is because the target I created used the project&amp;rsquo;s &amp;ldquo;Base SDK&amp;rdquo; which is the &amp;ldquo;Device - Aspen 1.2&amp;rdquo; so I changed it to &amp;ldquo;Mac OS X 10.5&amp;rdquo;.  As such, you cannot compile source that includes &amp;ldquo;UIKit.h&amp;rdquo; with this SDK.  So, for now, I guess unit testing will have to be confined to classes that do not depend directly on UIKit.&lt;/p&gt;

&lt;p&gt;The next error I got was because the default compiler dialect is set to C99,  This should be changed to GNU99.  I found this answer in this article: &lt;a href=&#34;http://brethorsting.com/blog/2006/02/stupid-issue-with-ocunit.html&#34;&gt;Stupid Issue with OCUnit&lt;/a&gt;.&lt;/p&gt;</description>
    </item>
    
    <item>
      <title>Setting Environment Variables for Mac OS X Programs</title>
      <link>http://dhptech.com/article/2007/02/09/setting-environment-variables-for-mac-osx-programs/</link>
      <pubDate>Fri, 09 Feb 2007 00:00:00 +0000</pubDate>
      <author>danap@dhptech.com (Dana H. P&#39;Simer)</author>
      <guid>http://dhptech.com/article/2007/02/09/setting-environment-variables-for-mac-osx-programs/</guid>
      <description>&lt;p&gt;For the most part, Mac OS X programs do not use environment variables or the PATH.  They behave in a very different way from other Unix environments on this score.  However, as Java developer I use several tools that require that other command line programs be available on the system PATH.  In Windows and Unix there are well known places to put this kind of information but in Mac OS X the location for these changes is obscure. &lt;/p&gt;

&lt;p&gt;
&lt;!--break--&gt;
&lt;p&gt;Adding the variables to the /etc/profile, /etc/bashrc, ~/.profile, or ~/.bashrc  files does not accomplish the task since these files are not used to setup the environment of the WindowServer process, the parent of all Mac OS X programs.  I did, eventually, find some information on the subject.&lt;/p&gt;
&lt;p&gt;There are these articles: &lt;a href=&#34;http://developer.apple.com/documentation/MacOSX/Conceptual/BPRuntimeConfig/index.html&#34;&gt;Environment Variables&lt;/a&gt;, &lt;a href=&#34;http://developer.apple.com/qa/qa2001/qa1255.html&#34;&gt;QA1255&lt;/a&gt; and &lt;a href=&#34;http://developer.apple.com/qa/qa2001/qa1067.html&#34;&gt;QA1068&lt;/a&gt;.  &lt;/p&gt;
&lt;p&gt;These articles were really hard for me to find, I think, because they were written mostly for folks wanting to port Unix applications to Mac OS X.  In my case, I am attempting to use Java applications like &lt;a href=&#34;http://www.eclipse.org&#34;&gt;Eclipse&lt;/a&gt; and &lt;a href=&#34;http://www.netbeans.org&#34;&gt;Netbeans&lt;/a&gt;.  Specifically, they needed the subversion commands on the path and they were installed into /usr/local/bin instead of /usr/bin.  A good policy but not on the default PATH variable.&lt;/p&gt;
&lt;p&gt;NOTE: I forgot to mention, you have to logout for these changes to have any effect.&lt;/p&gt;&lt;/p&gt;</description>
    </item>
    
    <item>
      <title>Acegi Filter Does Not Work in WebSphere 6.1.0.3</title>
      <link>http://dhptech.com/article/2007/02/06/acegi-filter-does-not-work-in-websphere-six-one-zero-three/</link>
      <pubDate>Tue, 06 Feb 2007 00:00:00 +0000</pubDate>
      <author>danap@dhptech.com (Dana H. P&#39;Simer)</author>
      <guid>http://dhptech.com/article/2007/02/06/acegi-filter-does-not-work-in-websphere-six-one-zero-three/</guid>
      <description>&lt;p&gt;It seems there is a bug in WAS that was introduced with 6.1.0.3.  I found this forum &lt;a href=&#34;http://forum.springframework.org/showthread.php?t=34106&#34;&gt;post&lt;/a&gt; on the subject.&lt;/p&gt;
&lt;p&gt;Apparently, WAS looks for a resource in the WAR that matches the URL before allowing the servlet filters a chance to process the URL.  Despite the fact that the design of the Servlet Filter mechanism is to allow web applications more control over their URLs and how they are accessed.&lt;/p&gt;


&lt;p&gt;This affects all servlet filters not just Acegi&#39;s.  IBM has had similar issues in the past like this &lt;a href=&#34;http://www-1.ibm.com/support/docview.wss?rs=180&amp;uid=swg1PK27620&#34;&gt;one&lt;/a&gt; and this &lt;a href=&#34;http://www-1.ibm.com/support/docview.wss?rs=180&amp;context=SSEQTP&amp;q1=invokefilterscompatibility&amp;uid=swg1PK33090&amp;loc=en_US&amp;cs=utf-8&amp;lang=en&#34;&gt;one&lt;/a&gt;.    You&#39;d think they could get it right after a few tries.&lt;/p&gt;
&lt;p&gt;Some of the wording in these bug reports and the reply from IBM posted on that Springframework thread appear to indicate that IBM sees nothing wrong with this behavior.  I disagree.  The servlet specification does not place any restrictions on how a Servlet filter can transform a request URL so it stands to reason that no check for the existence of the referenced resource should be performed until the filter are processed.&lt;/p&gt;</description>
    </item>
    
    <item>
      <title>IE Rendering Problems Solved</title>
      <link>http://dhptech.com/article/2006/11/29/ie-rendering-problems-solved/</link>
      <pubDate>Wed, 29 Nov 2006 00:00:00 +0000</pubDate>
      <author>danap@dhptech.com (Dana H. P&#39;Simer)</author>
      <guid>http://dhptech.com/article/2006/11/29/ie-rendering-problems-solved/</guid>
      <description>&lt;p&gt;Well I figured out what was causing my IE Rendering problems.  I was using a &#34;code&#34; tag and that seemed to throw off the floating of the right hand navigation elements.  Weird but it looked great in Firefox.  This is not new but, damn I wish IE would just implement the standards.  Perhaps a meta tag could be created that tells IE to use a standards compliant interpretation of CSS and HTML.  That way, a standards compliant web site can just add a meta tag and IE will render it correctly without all the weirdnesses that are left in for &#34;backwards compatibility&#34;.&lt;/p&gt;



&lt;p&gt;For a great site on the power of CSS check out the &lt;a href=&#34;http://www.csszengarden.com&#34; target=&#34;_new&#34;&gt;CSS Zen Garden&lt;/a&gt;.&lt;/p&gt;</description>
    </item>
    
  </channel>
</rss>
