<?xml version='1.0' encoding='UTF-8'?><?xml-stylesheet href="http://www.blogger.com/styles/atom.css" type="text/css"?><feed xmlns='http://www.w3.org/2005/Atom' xmlns:openSearch='http://a9.com/-/spec/opensearchrss/1.0/'><id>tag:blogger.com,1999:blog-30950679.post116267887988716872..comments</id><updated>2007-05-14T15:16:23.736-07:00</updated><category term='resumes'/><category term='cvs'/><category term='continuous integration'/><category term='sql'/><category term='java'/><category term='spring'/><category term='tips'/><category term='bamboo'/><category term='security'/><category term='programming'/><category term='passwords'/><category term='oql'/><category term='interviews'/><category term='rants'/><category term='source control'/><category term='gwt'/><category term='ideas'/><category term='svn'/><category term='hiring'/><title type='text'>Comments on Regular Expressions: Java Retry Framework</title><link rel='http://schemas.google.com/g/2005#feed' type='application/atom+xml' href='http://idcmp.linuxstuff.org/feeds/116267887988716872/comments/default'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/30950679/116267887988716872/comments/default'/><link rel='alternate' type='text/html' href='http://idcmp.linuxstuff.org/2006/11/java-retry-framework.html'/><author><name>Idcmp</name><uri>http://www.blogger.com/profile/03829017208885409542</uri><email>noreply@blogger.com</email><gd:image xmlns:gd='http://schemas.google.com/g/2005' rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><generator version='7.00' uri='http://www.blogger.com'>Blogger</generator><openSearch:totalResults>4</openSearch:totalResults><openSearch:startIndex>1</openSearch:startIndex><openSearch:itemsPerPage>25</openSearch:itemsPerPage><entry><id>tag:blogger.com,1999:blog-30950679.post-8209947753779629433</id><published>2007-05-14T15:16:00.000-07:00</published><updated>2007-05-14T15:16:00.000-07:00</updated><title type='text'>I'm currently working on a project with a few jbos...</title><content type='html'>I'm currently working on a project with a few jboss clusters and tangosol caches on the server side, and a swing client for the users.&lt;BR/&gt;&lt;BR/&gt;To handle connection issues and other remote explosions I decided to place all tasks that interact with a remote resource within a Callable object, and pass this object to a task service.&lt;BR/&gt;&lt;BR/&gt;The components:&lt;BR/&gt;&lt;BR/&gt;Manager&lt;BR/&gt; * facade to control access to remote resources&lt;BR/&gt;&lt;BR/&gt;ManagerTaskService &lt;BR/&gt; * uses backing ExecutorService for async tasks&lt;BR/&gt;&lt;BR/&gt;TaskFailedHandler &lt;BR/&gt; * controls reconnect/retry logic&lt;BR/&gt;&lt;BR/&gt;ManagerConnection&lt;BR/&gt; * Maintains connection state safely in concurrent environments. Uses notify/wait for responsiveness, and immutable state objects.&lt;BR/&gt;&lt;BR/&gt;Synchronous tasks are executed using ManagerTaskService.invokeAndWait, which handles waiting for the manager to be ready, deciding whether a failed task should be retried, and whether the manager needs to reconnect.&lt;BR/&gt;&lt;BR/&gt;Asynchronous tasks are wrapped by a Callable that runs invokeAndWait, and then added to the ExecutorService.&lt;BR/&gt;&lt;BR/&gt;Here's the code I used for invokeAndWait:&lt;BR/&gt;&lt;BR/&gt;&lt;BR/&gt;public &amp;lt;CVal&amp;gt; CVal invokeAndWait(final String name, final Callable&amp;lt;CVal&amp;gt; task) {&lt;BR/&gt;        TaskFailedHandler failureHandler = failureHandlerFactory.newInstance();&lt;BR/&gt;        &lt;BR/&gt;        for (;;) {&lt;BR/&gt;            try {&lt;BR/&gt;                manager.waitFor();&lt;BR/&gt;                return task.call();&lt;BR/&gt;            }&lt;BR/&gt;            catch (Exception ex) {&lt;BR/&gt;                failureHandler.exceptionThrown(ex);&lt;BR/&gt;                if (failureHandler.shouldReconnect(ex)) {&lt;BR/&gt;                    manager.requestReconnect();&lt;BR/&gt;                }&lt;BR/&gt;                if (false == failureHandler.shouldRetry(ex)) {&lt;BR/&gt;                    log.error("invokeAndWait - not retrying due to TaskFailureHandler policy - " + name);&lt;BR/&gt;                    return null;&lt;BR/&gt;                }&lt;BR/&gt;            }&lt;BR/&gt;        }&lt;BR/&gt;    }</content><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/30950679/116267887988716872/comments/default/8209947753779629433'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/30950679/116267887988716872/comments/default/8209947753779629433'/><link rel='alternate' type='text/html' href='http://idcmp.linuxstuff.org/2006/11/java-retry-framework.html?showComment=1179180960000#c8209947753779629433' title=''/><author><name>Christopher</name><uri>http://www.blogger.com/profile/03497492166066392039</uri><email>noreply@blogger.com</email><gd:image xmlns:gd='http://schemas.google.com/g/2005' rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:in-reply-to xmlns:thr='http://purl.org/syndication/thread/1.0' href='http://idcmp.linuxstuff.org/2006/11/java-retry-framework.html' ref='tag:blogger.com,1999:blog-30950679.post-116267887988716872' source='http://www.blogger.com/feeds/30950679/posts/default/116267887988716872' type='text/html'/><gd:extendedProperty xmlns:gd='http://schemas.google.com/g/2005' name='blogger.itemClass' value='pid-1784961250'/></entry><entry><id>tag:blogger.com,1999:blog-30950679.post-7555449061813099286</id><published>2007-01-13T01:53:00.000-08:00</published><updated>2007-01-13T01:53:00.000-08:00</updated><title type='text'>There isn't a defacto way of doing something later...</title><content type='html'>There isn't a defacto way of doing something later - you're right - but there's a few common sense ways, like Runnables, and a stab at a retry framework could promote a common way of writing logic that a developer wants to keep attempting until success...</content><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/30950679/116267887988716872/comments/default/7555449061813099286'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/30950679/116267887988716872/comments/default/7555449061813099286'/><link rel='alternate' type='text/html' href='http://idcmp.linuxstuff.org/2006/11/java-retry-framework.html?showComment=1168681980000#c7555449061813099286' title=''/><author><name>idcmp</name><uri>http://www.blogger.com/profile/10737882461734024589</uri><email>noreply@blogger.com</email><gd:image xmlns:gd='http://schemas.google.com/g/2005' rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:in-reply-to xmlns:thr='http://purl.org/syndication/thread/1.0' href='http://idcmp.linuxstuff.org/2006/11/java-retry-framework.html' ref='tag:blogger.com,1999:blog-30950679.post-116267887988716872' source='http://www.blogger.com/feeds/30950679/posts/default/116267887988716872' type='text/html'/><gd:extendedProperty xmlns:gd='http://schemas.google.com/g/2005' name='blogger.itemClass' value='pid-1149126955'/></entry><entry><id>tag:blogger.com,1999:blog-30950679.post-116308702000950413</id><published>2006-11-09T07:43:00.000-08:00</published><updated>2006-11-09T07:43:00.000-08:00</updated><title type='text'>... as an afterthought&lt;br&gt;&lt;br&gt;JMX Timers are J2SE ...</title><content type='html'>... as an afterthought&lt;BR/&gt;&lt;BR/&gt;JMX Timers are J2SE based, and if you could find a sensible way to persist them such that they survived a JVM restart then a retry framework is only a day's coding away.</content><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/30950679/116267887988716872/comments/default/116308702000950413'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/30950679/116267887988716872/comments/default/116308702000950413'/><link rel='alternate' type='text/html' href='http://idcmp.linuxstuff.org/2006/11/java-retry-framework.html?showComment=1163086980000#c116308702000950413' title=''/><author><name>straun</name><uri>http://www.blogger.com/profile/14373214755999922270</uri><email>noreply@blogger.com</email><gd:image xmlns:gd='http://schemas.google.com/g/2005' rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:in-reply-to xmlns:thr='http://purl.org/syndication/thread/1.0' href='http://idcmp.linuxstuff.org/2006/11/java-retry-framework.html' ref='tag:blogger.com,1999:blog-30950679.post-116267887988716872' source='http://www.blogger.com/feeds/30950679/posts/default/116267887988716872' type='text/html'/><gd:extendedProperty xmlns:gd='http://schemas.google.com/g/2005' name='blogger.itemClass' value='pid-1445407825'/></entry><entry><id>tag:blogger.com,1999:blog-30950679.post-116308646519494099</id><published>2006-11-09T07:34:00.000-08:00</published><updated>2006-11-09T07:34:00.000-08:00</updated><title type='text'>The problem with a retry framework is that there i...</title><content type='html'>The problem with a retry framework is that there is no real de facto technique for 'doing something later' in Java yet.&lt;BR/&gt;&lt;BR/&gt;If you had such a technique, then writing a retry framework would be a sensible step.&lt;BR/&gt;&lt;BR/&gt;Candidates for the technique to do something later are:&lt;BR/&gt;&lt;BR/&gt;  Quartz Jobs&lt;BR/&gt;  Weblogic 'send later' JMS messages&lt;BR/&gt;  ...and other persistent events</content><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/30950679/116267887988716872/comments/default/116308646519494099'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/30950679/116267887988716872/comments/default/116308646519494099'/><link rel='alternate' type='text/html' href='http://idcmp.linuxstuff.org/2006/11/java-retry-framework.html?showComment=1163086440000#c116308646519494099' title=''/><author><name>straun</name><uri>http://www.blogger.com/profile/14373214755999922270</uri><email>noreply@blogger.com</email><gd:image xmlns:gd='http://schemas.google.com/g/2005' rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:in-reply-to xmlns:thr='http://purl.org/syndication/thread/1.0' href='http://idcmp.linuxstuff.org/2006/11/java-retry-framework.html' ref='tag:blogger.com,1999:blog-30950679.post-116267887988716872' source='http://www.blogger.com/feeds/30950679/posts/default/116267887988716872' type='text/html'/><gd:extendedProperty xmlns:gd='http://schemas.google.com/g/2005' name='blogger.itemClass' value='pid-1445407825'/></entry></feed>
