<?xml version="1.0" encoding="utf-8"?>
<rss version="2.0" xml:base="http://quest.windwards.net"  xmlns:dc="http://purl.org/dc/elements/1.1/">
<channel>
 <title>Quest for improvement - java-programming</title>
 <link>http://quest.windwards.net/tags/java-programming</link>
 <description></description>
 <language>en</language>
<item>
 <title>asynchrmi 1.2 released</title>
 <link>http://quest.windwards.net/content/asynchrmi-12-released</link>
 <description>&lt;div class=&quot;field field-name-body field-type-text-with-summary field-label-hidden&quot;&gt;&lt;div class=&quot;field-items&quot;&gt;&lt;div class=&quot;field-item even&quot; property=&quot;content:encoded&quot;&gt;&lt;p&gt;&lt;a href=&quot;https://bitbucket.org/quest/asynchrmi&quot;&gt;asynchrmi&lt;/a&gt; goes to version 1.2. This is the first production-ready release. Its core features seems to serve us well.&lt;/p&gt;
&lt;p&gt;For those who used earlier snapshots, note that there is an interface change in the ChainBuilder. It now uses a common object called a ChainResult. In traditional Promise programming, each group of tasks typically feed the next step. When using asynchrmi we foung that we needed to gradually build up a data by successive layers of relation lookups. Only at the end do we have enough data to produce the actual result (i.e. a web page).&lt;/p&gt;
&lt;p&gt;Maven dependency looks thus:&lt;/p&gt;
&lt;pre&gt;
   &lt;span class=&quot;nt&quot;&gt;&amp;lt;dependency&amp;gt;&lt;/span&gt;
     &lt;span class=&quot;nt&quot;&gt;&amp;lt;groupId&amp;gt;&lt;/span&gt;net.windwards&lt;span class=&quot;nt&quot;&gt;&amp;lt;/groupId&amp;gt;&lt;/span&gt;
     &lt;span class=&quot;nt&quot;&gt;&amp;lt;artifactId&amp;gt;&lt;/span&gt;asynchrmi&lt;span class=&quot;nt&quot;&gt;&amp;lt;/artifactId&amp;gt;&lt;/span&gt;
     &lt;span class=&quot;nt&quot;&gt;&amp;lt;version&amp;gt;&lt;/span&gt;1.3-SNAPSHOT&lt;span class=&quot;nt&quot;&gt;&amp;lt;/version&amp;gt;&lt;/span&gt;
   &lt;span class=&quot;nt&quot;&gt;&amp;lt;/dependency&amp;gt;&lt;/span&gt;
&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;&lt;/div&gt;&lt;div class=&quot;field field-name-field-tags field-type-taxonomy-term-reference field-label-above&quot;&gt;&lt;div class=&quot;field-label&quot;&gt;Tags:&amp;nbsp;&lt;/div&gt;&lt;div class=&quot;field-items&quot;&gt;&lt;div class=&quot;field-item even&quot; rel=&quot;dc:subject&quot;&gt;&lt;a href=&quot;/tags/quest-blog&quot; typeof=&quot;skos:Concept&quot; property=&quot;rdfs:label skos:prefLabel&quot; datatype=&quot;&quot;&gt;quest-blog&lt;/a&gt;&lt;/div&gt;&lt;div class=&quot;field-item odd&quot; rel=&quot;dc:subject&quot;&gt;&lt;a href=&quot;/tags/java-programming&quot; typeof=&quot;skos:Concept&quot; property=&quot;rdfs:label skos:prefLabel&quot; datatype=&quot;&quot;&gt;java-programming&lt;/a&gt;&lt;/div&gt;&lt;div class=&quot;field-item even&quot; rel=&quot;dc:subject&quot;&gt;&lt;a href=&quot;/tags/jboss&quot; typeof=&quot;skos:Concept&quot; property=&quot;rdfs:label skos:prefLabel&quot; datatype=&quot;&quot;&gt;jboss&lt;/a&gt;&lt;/div&gt;&lt;div class=&quot;field-item odd&quot; rel=&quot;dc:subject&quot;&gt;&lt;a href=&quot;/tags/asynchrmi&quot; typeof=&quot;skos:Concept&quot; property=&quot;rdfs:label skos:prefLabel&quot; datatype=&quot;&quot;&gt;asynchrmi&lt;/a&gt;&lt;/div&gt;&lt;/div&gt;&lt;/div&gt;</description>
 <pubDate>Thu, 02 Jul 2015 13:33:43 +0000</pubDate>
 <dc:creator>quest</dc:creator>
 <guid isPermaLink="false">38 at http://quest.windwards.net</guid>
 <comments>http://quest.windwards.net/content/asynchrmi-12-released#comments</comments>
</item>
<item>
 <title>asynchrmi helps writing JBoss RMI clients</title>
 <link>http://quest.windwards.net/content/asynchrmi-helps-writing-jboss-rmi-clients</link>
 <description>&lt;div class=&quot;field field-name-body field-type-text-with-summary field-label-hidden&quot;&gt;&lt;div class=&quot;field-items&quot;&gt;&lt;div class=&quot;field-item even&quot; property=&quot;content:encoded&quot;&gt;&lt;p&gt;I have started a new project called &lt;a href=&quot;https://bitbucket.org/quest/asynchrmi&quot;&gt;asynchrmi&lt;/a&gt;. The purpose of this lib is to make it simpler to write serious applications that calls a JBoss application server.&lt;/p&gt;
&lt;p&gt;We were in the process of writing a modern web frontend to our car-sharing system when we concluded that: 1) making many parallel calls to JBoss as different users didn&#039;t work, and 2) that because of the heavily relational datamodel (a typical Hibernate model) you needed to make several calls to get all the data you wanted - calls that could be parallelized.&lt;/p&gt;
&lt;p&gt;In order to encourage the building of a vocabulary, I wrote a simple library called asynchrmi that enables threadpool-mediated, Future- and/or callback-driven client JNP operations that will be safely threaded.&lt;/p&gt;
&lt;p&gt;The project is still in early stages, but has proved useful and robust.&lt;/p&gt;
&lt;p&gt;The big missing piece is the ability to inject RMI endpoints on RMITask objects so that all the tedious lookups can be compressed (and ideally performed in parallel).&lt;/p&gt;
&lt;p&gt;Please note that this is a large hammer. You can easily sink your application server, either via lock-death or through load-death. Proceed with caution.&lt;/p&gt;
&lt;/div&gt;&lt;/div&gt;&lt;/div&gt;&lt;div class=&quot;field field-name-field-tags field-type-taxonomy-term-reference field-label-above&quot;&gt;&lt;div class=&quot;field-label&quot;&gt;Tags:&amp;nbsp;&lt;/div&gt;&lt;div class=&quot;field-items&quot;&gt;&lt;div class=&quot;field-item even&quot; rel=&quot;dc:subject&quot;&gt;&lt;a href=&quot;/tags/quest-blog&quot; typeof=&quot;skos:Concept&quot; property=&quot;rdfs:label skos:prefLabel&quot; datatype=&quot;&quot;&gt;quest-blog&lt;/a&gt;&lt;/div&gt;&lt;div class=&quot;field-item odd&quot; rel=&quot;dc:subject&quot;&gt;&lt;a href=&quot;/tags/java-programming&quot; typeof=&quot;skos:Concept&quot; property=&quot;rdfs:label skos:prefLabel&quot; datatype=&quot;&quot;&gt;java-programming&lt;/a&gt;&lt;/div&gt;&lt;div class=&quot;field-item even&quot; rel=&quot;dc:subject&quot;&gt;&lt;a href=&quot;/tags/jboss&quot; typeof=&quot;skos:Concept&quot; property=&quot;rdfs:label skos:prefLabel&quot; datatype=&quot;&quot;&gt;jboss&lt;/a&gt;&lt;/div&gt;&lt;div class=&quot;field-item odd&quot; rel=&quot;dc:subject&quot;&gt;&lt;a href=&quot;/tags/asynchrmi&quot; typeof=&quot;skos:Concept&quot; property=&quot;rdfs:label skos:prefLabel&quot; datatype=&quot;&quot;&gt;asynchrmi&lt;/a&gt;&lt;/div&gt;&lt;/div&gt;&lt;/div&gt;</description>
 <pubDate>Fri, 15 Aug 2014 09:33:01 +0000</pubDate>
 <dc:creator>quest</dc:creator>
 <guid isPermaLink="false">37 at http://quest.windwards.net</guid>
 <comments>http://quest.windwards.net/content/asynchrmi-helps-writing-jboss-rmi-clients#comments</comments>
</item>
<item>
 <title>The case against dependency injection (in its common form)</title>
 <link>http://quest.windwards.net/content/case-against-dependency-injection-its-common-form</link>
 <description>&lt;div class=&quot;field field-name-body field-type-text-with-summary field-label-hidden&quot;&gt;&lt;div class=&quot;field-items&quot;&gt;&lt;div class=&quot;field-item even&quot; property=&quot;content:encoded&quot;&gt;&lt;p&gt;Dependency injection as it seems to be commonly used in Javaverse, is at the center of what I consider problematic (read sucks) with the philosophy behind JEE.&lt;/p&gt;
&lt;p&gt;To be clear: annotation-driven dependency injection is a reasonable software pattern. For example, it allows defining partial standards such as JAX-RS. However, dependency injection as the default mechanism (i.e. with one global namespace) for interconnecting beans makes sense only for small projects.&lt;/p&gt;
&lt;p&gt;Dependency injection is often sold with the argument that it solves the problem of constructors with long argument lists. The problem with this sales pitch is that having ten arguments to your constructor or having ten injections on your class both amount to an unsurveillable mess. Put differently, ten constructor arguments or ten injections make no difference to a unit test.&lt;/p&gt;
&lt;p&gt;Both JAX-RS and stateless beans are (more or less) instantiated per request. Given the low cost of instantiation this makes sense as an isolation mechanism, but since classes are just used to group responders that are related (operate on similar data, use shared helpers, et cetera) each responder method is likely to require a slightly different set of injections. The grouping class ends up with the union of all injections. The result is a chaotic network that is hard to create a mental map of. Where dependency injection has created such networks, isolating functional units for testing becomes much harder. Massive mocking ensues.My position is that in order to be comprehensible and unit testable, any large software project needs to be divided into subsystems. Each subsystem should be a namespace unto itself. Its interaction should be isolated properly, e.g. using a message passing pattern (a message queue in JMS terminology). A system thus subdivided will not suffer from unwieldy constructors. It could still use dependency injection internally for e.g. plugins.&lt;/p&gt;
&lt;div&gt;
	Expressed differently, dependency injection should be a tool in the hands of a systems architect to apply where relevant, rather than the default mechanism of a framework for interconnecting individual classes. Square Dagger is designed for this purpose and allows creating mini-frameworks focused on sensible injection.&lt;/div&gt;
&lt;/div&gt;&lt;/div&gt;&lt;/div&gt;&lt;div class=&quot;field field-name-field-tags field-type-taxonomy-term-reference field-label-above&quot;&gt;&lt;div class=&quot;field-label&quot;&gt;Tags:&amp;nbsp;&lt;/div&gt;&lt;div class=&quot;field-items&quot;&gt;&lt;div class=&quot;field-item even&quot; rel=&quot;dc:subject&quot;&gt;&lt;a href=&quot;/tags/quest-blog&quot; typeof=&quot;skos:Concept&quot; property=&quot;rdfs:label skos:prefLabel&quot; datatype=&quot;&quot;&gt;quest-blog&lt;/a&gt;&lt;/div&gt;&lt;div class=&quot;field-item odd&quot; rel=&quot;dc:subject&quot;&gt;&lt;a href=&quot;/tags/java-programming&quot; typeof=&quot;skos:Concept&quot; property=&quot;rdfs:label skos:prefLabel&quot; datatype=&quot;&quot;&gt;java-programming&lt;/a&gt;&lt;/div&gt;&lt;/div&gt;&lt;/div&gt;</description>
 <pubDate>Tue, 11 Jun 2013 21:51:27 +0000</pubDate>
 <dc:creator>quest</dc:creator>
 <guid isPermaLink="false">36 at http://quest.windwards.net</guid>
 <comments>http://quest.windwards.net/content/case-against-dependency-injection-its-common-form#comments</comments>
</item>
<item>
 <title>How to get a servlet to answer </title>
 <link>http://quest.windwards.net/content/how-get-servlet-answer</link>
 <description>&lt;div class=&quot;field field-name-body field-type-text-with-summary field-label-hidden&quot;&gt;&lt;div class=&quot;field-items&quot;&gt;&lt;div class=&quot;field-item even&quot; property=&quot;content:encoded&quot;&gt;&lt;p&gt;The basic problem, as illustrated by this somewhat aged &lt;a href=&quot;http://account.pacip.com/jetty/doc/PathMapping.html&quot;&gt;Jetty pathSpec documentation&lt;/a&gt;, is that &quot;/&quot; is treated as &quot;/*&quot; when giving a servlet path spec. Thus, if you want to have a servlet as &quot;front page&quot; in an embedded scenario:&lt;/p&gt;
&lt;pre class=&quot;brush: java&quot;&gt;
ServletContextHandler servlets = 
    new ServletContextHandler(ServletContextHandler.SESSIONS);
servlets.addServlet(MyServlet.class, &quot;/&quot;);&lt;/pre&gt;&lt;p&gt;... that servlet will get requests for the entire URL space and no other servlet in the context will get any requests. In particular, if you want to add a DefaultServlet to serve static web pages, images and CSS, that will be tricky.&lt;/p&gt;
&lt;p&gt;The solution is to stick each servlet in its own context handler. If you do this, you can control in what order they are asked to handle the HTTP request. Thus, you can make sure it asks all other servlets before asking the greedy &quot;/&quot; servlet. Something like this:&lt;/p&gt;
&lt;pre class=&quot;brush: java&quot;&gt;
ServletContextHandler html, servlets;
servlets = new ServletContextHandler(ServletContextHandler.SESSIONS);
servlets.addServlet(MyServlet.class, &quot;/&quot;);

html = new ServletContextHandler(ServletContextHandler.SESSIONS);
ServletHolder holder = html.addServlet(DefaultServlet.class, &quot;/html/*&quot;);
holder.setInitParameter(&quot;resourceBase&quot;, &quot;./&quot;);

ContextHandlerCollection collection = new ContextHandlerCollection();
// First, try the static stuff
collection.addHandler(html);
// Then ask the greedy servlet
collection.addHandler(servlets);

Server server = new Server(8080);
server.setHandler(collection);
server.start();
server.join();&lt;/pre&gt;&lt;p&gt;The reason this works is that a context will simply &quot;pass&quot; if it does not match a certain URL.&lt;/p&gt;
&lt;p&gt;While on the subject, it is fairly annoying when developing that the context won&#039;t print tracebacks. When developing, we would prefer the error web page to contain the stack trace. This can be achieved fairly easily:&lt;/p&gt;
&lt;pre class=&quot;brush: java&quot;&gt;
ErrorHandler errorHandler = new ErrorHandler();
errorHandler.setShowStacks(true);
server.addBean(errorHandler);
&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;&lt;/div&gt;&lt;div class=&quot;field field-name-field-tags field-type-taxonomy-term-reference field-label-above&quot;&gt;&lt;div class=&quot;field-label&quot;&gt;Tags:&amp;nbsp;&lt;/div&gt;&lt;div class=&quot;field-items&quot;&gt;&lt;div class=&quot;field-item even&quot; rel=&quot;dc:subject&quot;&gt;&lt;a href=&quot;/tags/quest-blog&quot; typeof=&quot;skos:Concept&quot; property=&quot;rdfs:label skos:prefLabel&quot; datatype=&quot;&quot;&gt;quest-blog&lt;/a&gt;&lt;/div&gt;&lt;div class=&quot;field-item odd&quot; rel=&quot;dc:subject&quot;&gt;&lt;a href=&quot;/tags/java-programming&quot; typeof=&quot;skos:Concept&quot; property=&quot;rdfs:label skos:prefLabel&quot; datatype=&quot;&quot;&gt;java-programming&lt;/a&gt;&lt;/div&gt;&lt;div class=&quot;field-item even&quot; rel=&quot;dc:subject&quot;&gt;&lt;a href=&quot;/tags/teaching&quot; typeof=&quot;skos:Concept&quot; property=&quot;rdfs:label skos:prefLabel&quot; datatype=&quot;&quot;&gt;teaching&lt;/a&gt;&lt;/div&gt;&lt;/div&gt;&lt;/div&gt;</description>
 <pubDate>Thu, 27 Dec 2012 11:06:05 +0000</pubDate>
 <dc:creator>quest</dc:creator>
 <guid isPermaLink="false">27 at http://quest.windwards.net</guid>
 <comments>http://quest.windwards.net/content/how-get-servlet-answer#comments</comments>
</item>
</channel>
</rss>
