-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.html
646 lines (299 loc) · 19.9 KB
/
index.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
<!DOCTYPE html>
<!--[if IEMobile 7 ]><html class="no-js iem7"><![endif]-->
<!--[if lt IE 9]><html class="no-js lte-ie8"><![endif]-->
<!--[if (gt IE 8)|(gt IEMobile 7)|!(IEMobile)|!(IE)]><!--><html class="no-js" lang="en"><!--<![endif]-->
<head>
<meta charset="utf-8">
<title>Ghost in the JVM</title>
<meta name="author" content="Doug Ly">
<meta name="description" content="I have been playing with RedHat OpenShift platform for several days. So far the experience has been very good. Several nuances encountered but I was …">
<!-- http://t.co/dKP3o1e -->
<meta name="HandheldFriendly" content="True">
<meta name="MobileOptimized" content="320">
<meta name="viewport" content="width=device-width, initial-scale=1">
<link rel="canonical" href="http://dmly.github.io">
<link href="/favicon.png" rel="icon">
<link href="/stylesheets/screen.css" media="screen, projection" rel="stylesheet" type="text/css">
<link href="/atom.xml" rel="alternate" title="Ghost in the JVM" type="application/atom+xml">
<script src="/javascripts/modernizr-2.0.js"></script>
<script src="//ajax.googleapis.com/ajax/libs/jquery/1.9.1/jquery.min.js"></script>
<script>!window.jQuery && document.write(unescape('%3Cscript src="./javascripts/lib/jquery.min.js"%3E%3C/script%3E'))</script>
<script src="/javascripts/octopress.js" type="text/javascript"></script>
<!--Fonts from Google"s Web font directory at http://google.com/webfonts -->
<link href="http://fonts.googleapis.com/css?family=PT+Serif:regular,italic,bold,bolditalic" rel="stylesheet" type="text/css">
<link href="http://fonts.googleapis.com/css?family=PT+Sans:regular,italic,bold,bolditalic" rel="stylesheet" type="text/css">
<script type="text/javascript">
var _gaq = _gaq || [];
_gaq.push(['_setAccount', 'UA-40640060-1']);
_gaq.push(['_setDomainName','github.io']);
_gaq.push(['_trackPageview']);
(function() {
var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true;
ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js';
var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s);
})();
</script>
</head>
<body >
<header role="banner"><hgroup>
<h1><a href="/">Ghost in the JVM</a></h1>
<h2>An adventure in the JVM land</h2>
</hgroup>
</header>
<nav role="navigation"><ul class="subscription" data-subscription="rss">
<li><a href="/atom.xml" rel="subscribe-rss" title="subscribe via RSS">RSS</a></li>
</ul>
<form action="http://google.com/search" method="get">
<fieldset role="search">
<input type="hidden" name="q" value="site:dmly.github.io" />
<input class="search" type="text" name="q" results="0" placeholder="Search"/>
</fieldset>
</form>
<ul class="main-navigation">
<li><a href="/">Blog</a></li>
<li><a href="/blog/archives">Archives</a></li>
</ul>
</nav>
<div id="main">
<div id="content">
<div class="blog-index">
<article>
<header>
<h1 class="entry-title"><a href="/blog/2013/05/01/diy-java-app-server-on-openshift-so-far-so-good/">DIY Java App Server on OpenShift: So Far So Good</a></h1>
<p class="meta">
<time datetime="2013-05-01T14:36:00+00:00" pubdate data-updated="true">May 1<span>st</span>, 2013</time>
</p>
</header>
<div class="entry-content"><p>I have been playing with <a href="https://www.openshift.com/">RedHat OpenShift</a> platform for several days. So far the experience has been very good. Several nuances encountered but I was able to get my java server application
running in less than an hour. My application is not using any preconfigured OpenShift’s cartridge or application server as I know.
My application is a simple Gomoku game with WebSocket support. I use DropWizard as the light-weight server to bootstrap an embedded version of Jetty. Most of the issues I encounter were just
network interface permission, build, deploy and starting the app.</p>
</div>
<footer>
<a rel="full-article" href="/blog/2013/05/01/diy-java-app-server-on-openshift-so-far-so-good/">Read on →</a>
</footer>
</article>
<article>
<header>
<h1 class="entry-title"><a href="/blog/2013/04/28/java-proxy-chaining-aspect-on-the-cheap/">Java Proxy Chaining - Aspect on the Cheap</a></h1>
<p class="meta">
<time datetime="2013-04-28T21:01:00+00:00" pubdate data-updated="true">Apr 28<span>th</span>, 2013</time>
</p>
</header>
<div class="entry-content"><p>How many of you have written a caching solution for one of your expensive method calls? Or how about retry logic for your service calls?
Living in such a connected world no single application is its own island. For every applications I have worked for, there always external dependencies, either other service APIs or
databases that we need to rely upon. And we can’t make the assumption that they are reliable 100% either.</p>
<p>Some service calls are expensive and the underlying data don’t change so often. We tend to cache the results. A naive approach would be to find such methods and refactor them
so that cache can be used before the call to the services are made. The better way is to use AOP where you intercept those calls with ‘aspects’. The in those aspects you can make the decision to whether get the results from the cache or to make the expensive service calls.
Another common scenario is retry when you encounter exceptions in your service calls: transient network issues (latency, timed out, spillover in load balancer…) or database hiccups.
Normally, you should at least retry the calls for several times before giving up. Like noted previously, a naive approach would be to go every methods and apply the retry logic. Or you could use AOP.</p>
<p>In this post, I’m going to talk about how to use aspect oriented way to ease the refactoring effort. I will not talk about the full blown bytecode level AOP solution which uses AspectJ
with bytecode weaving. Instead, I will talk about a lighter weight of aspect programming using the Java’s dynamic proxy and its reflection mechanism. I think it’s pretty similar to the way Spring
AOP works. The only difference is that my code will assume every method calls implement interfaces. Thus, it will not have to use cglib to generate the proxies. Also, I think programming to interface
is a much cleaner and prefer way for your service calls Data access objects (DAO).</p>
<p>At the end you could decorate your method with annotations/aspects like this:</p>
<figure class='code'><figcaption><span>Example</span></figcaption><div class="highlight"><table><tr><td class="gutter"><pre class="line-numbers"><span class='line-number'>1</span>
<span class='line-number'>2</span>
<span class='line-number'>3</span>
<span class='line-number'>4</span>
<span class='line-number'>5</span>
<span class='line-number'>6</span>
<span class='line-number'>7</span>
</pre></td><td class='code'><pre><code class='java'><span class='line'><span class="nd">@Timeit</span>
</span><span class='line'><span class="nd">@Retry</span><span class="o">(</span><span class="n">times</span><span class="o">=</span><span class="mi">3</span><span class="o">)</span>
</span><span class='line'><span class="nd">@Cache</span><span class="o">(</span><span class="n">timeToLiveInSeconds</span><span class="o">=</span><span class="mi">3600</span><span class="o">)</span>
</span><span class='line'><span class="kd">public</span> <span class="kt">void</span> <span class="nf">goGetMyData</span><span class="o">(</span><span class="n">String</span> <span class="n">someParam</span><span class="o">,</span> <span class="kt">int</span> <span class="n">anotherOne</span><span class="o">)</span>
</span><span class='line'><span class="o">{</span>
</span><span class='line'> <span class="c1">// do something</span>
</span><span class='line'><span class="o">}</span>
</span></code></pre></td></tr></table></div></figure>
</div>
<footer>
<a rel="full-article" href="/blog/2013/04/28/java-proxy-chaining-aspect-on-the-cheap/">Read on →</a>
</footer>
</article>
<article>
<header>
<h1 class="entry-title"><a href="/blog/2010/09/14/building-database-full-text-index-with-lucene/">Building Database Full Text Index With Lucene</a></h1>
<p class="meta">
<time datetime="2010-09-14T14:15:00+00:00" pubdate data-updated="true">Sep 14<span>th</span>, 2010</time>
</p>
</header>
<div class="entry-content"><p>I have this client table in Oracle having more than 3 million rows. One of the column is the client name in which our users want to have full text search support.
Originally, Oracle context search feature was choosen by a group of consultants. May be we were maintaining the domain index correctly but its performance sucks.</p>
</div>
<footer>
<a rel="full-article" href="/blog/2010/09/14/building-database-full-text-index-with-lucene/">Read on →</a>
</footer>
</article>
<article>
<header>
<h1 class="entry-title"><a href="/blog/2010/08/27/asynchronous-calls-in-c-number/">Asynchronous Calls in C#</a></h1>
<p class="meta">
<time datetime="2010-08-27T14:19:00+00:00" pubdate data-updated="true">Aug 27<span>th</span>, 2010</time>
</p>
</header>
<div class="entry-content"><p>Last December I started leading a team develop a Outlook addin for the firm.
I admit that I am no C# developer. The last time I used C# was when I attended college years ago. But the group of consultants
were let go and we have to jump in and take ownership of the project.</p>
<p>I also have to admit that C# has a lot of language features that I really wish Java does too. Among them is the concept of delegate
and function pointer used for asynchronous method calls. I know I can get the same thing with Groovy or Scala.</p>
</div>
<footer>
<a rel="full-article" href="/blog/2010/08/27/asynchronous-calls-in-c-number/">Read on →</a>
</footer>
</article>
<article>
<header>
<h1 class="entry-title"><a href="/blog/2009/07/15/concurrent-amf-request-for-blazeds/">Concurrent AMF Request for BlazeDS</a></h1>
<p class="meta">
<time datetime="2009-07-15T14:12:00+00:00" pubdate data-updated="true">Jul 15<span>th</span>, 2009</time>
</p>
</header>
<div class="entry-content"><p>Requirement: AMF data service comes with BlazeDS servlet is asynchronous. One of the services provided is RemoteObject. RemoteObject calls are faster than WebServices and HTTPServices because the information is exchanged in binary.
But RemoteObject itself has a not-too-well-known behavior. While it is true that RemoteObject services are asynchronous, they are not parallel.</p>
</div>
<footer>
<a rel="full-article" href="/blog/2009/07/15/concurrent-amf-request-for-blazeds/">Read on →</a>
</footer>
</article>
<article>
<header>
<h1 class="entry-title"><a href="/blog/2009/07/02/query-templating-for-hibernate-native-query/">Query Templating for Hibernate Native Query</a></h1>
<p class="meta">
<time datetime="2009-07-02T14:09:00+00:00" pubdate data-updated="true">Jul 2<span>nd</span>, 2009</time>
</p>
</header>
<div class="entry-content"><p>I recently encounter this kind of problematic requirement: making a native SQL in hibernate dynamic. The query should be written as a template. And based on the user selection, a concrete SQl statement is derived.
It’s pointless to have this conversation if we use HQL’s query criteria of course. But with native SQL code, I admit there is no easy/legitimate way around but hack.</p>
</div>
<footer>
<a rel="full-article" href="/blog/2009/07/02/query-templating-for-hibernate-native-query/">Read on →</a>
</footer>
</article>
<article>
<header>
<h1 class="entry-title"><a href="/blog/2009/03/15/ria-portlet-made-possible-with-flex-remoting/">RIA Portlet Made Possible With Flex Remoting</a></h1>
<p class="meta">
<time datetime="2009-03-15T13:50:00+00:00" pubdate data-updated="true">Mar 15<span>th</span>, 2009</time>
</p>
</header>
<div class="entry-content"><p>Even though portlet development standard has been in existence for a while its popularity and advanced functionality hasn’t got a lot of changes comparing to traditional web application development. Up until now, the <em>only</em> way to develop a portlet application is to use the dated (but obviously dominant) JSP technology. I know there have have been several attempts to bring advanced view engines into JSR-168/JSP-286 such as JSF prolet bridge or even the Wicket Portlet bridge the lanscape overall is pretty naive and dificult to comprehense. I can refer to <a href="http://today.java.net/pub/a/today/2009/01/20/jsr-286-portlet-irrelevance.html">this artical</a> when it comes to the reasons why portlet has not become dominant as if it should be by now.</p>
</div>
<footer>
<a rel="full-article" href="/blog/2009/03/15/ria-portlet-made-possible-with-flex-remoting/">Read on →</a>
</footer>
</article>
<article>
<header>
<h1 class="entry-title"><a href="/blog/2009/03/13/dbunit-flatxmldataset-export-using-groovy-builder/">DBUnit FlatXmlDataSet Export Using Groovy Builder</a></h1>
<p class="meta">
<time datetime="2009-03-13T20:35:00+00:00" pubdate data-updated="true">Mar 13<span>th</span>, 2009</time>
</p>
</header>
<div class="entry-content"><p>Recently I have been using [DBUnit][1] to run my DAOs unit test with Spring and HSQL in memory database. One of the biggest challenge in testing the DAO layer is generating data to test with.
Of course you could export data in your development database in style of insert statement files and import them into the test database before executing the test. But I think doing so still requires a lot of manual work
for a busy developer. One nice thing about DbUnit is that you can export your test data into a single XML file and while setting up the unit test, you tell DbUnit to execute the import based on the XML data file.</p>
</div>
<footer>
<a rel="full-article" href="/blog/2009/03/13/dbunit-flatxmldataset-export-using-groovy-builder/">Read on →</a>
</footer>
</article>
<article>
<header>
<h1 class="entry-title"><a href="/blog/2009/01/14/state-of-wsrp-development-openportal-verus-apache-wsrp4j/">State of WSRP Development: OpenPortal Verus Apache Wsrp4j</a></h1>
<p class="meta">
<time datetime="2009-01-14T20:27:00+00:00" pubdate data-updated="true">Jan 14<span>th</span>, 2009</time>
</p>
</header>
<div class="entry-content"><p>with wsrp4j project has become more and more dormant, I am seeking for another wsrp framework.
To the best of my knowledge, beside the commercial framework out there from BEA Portal and IBM Websphere, Apache’s wsrp4j used to be the
only open source solution until Sun steps in and sponsors java.net’s OpenPortal.
My intention is to only replace the wsrp producer, but it is not a trivial task to just simply swap one producer and use it with the existing portlet container implementation.
So go with OpenPortal container and its wsrp I am right now.</p>
</div>
<footer>
<a rel="full-article" href="/blog/2009/01/14/state-of-wsrp-development-openportal-verus-apache-wsrp4j/">Read on →</a>
</footer>
</article>
<article>
<header>
<h1 class="entry-title"><a href="/blog/2008/10/23/autonomous-game-agent/">Autonomous Game Agent</a></h1>
<p class="meta">
<time datetime="2008-10-23T18:57:00+00:00" pubdate data-updated="true">Oct 23<span>rd</span>, 2008</time>
</p>
</header>
<div class="entry-content"><p>I am always interested in game AI programming, specially autonomous game agents which move around and act on their own will but based on a set of pre-defined rules of course.
After reading the first chapter of <a href="http://www.amazon.com/Programming-Game-Example-Mat-Buckland/dp/1556220782/ref=sr_1_5?ie=UTF8&s=books&qid=1224810375&sr=8-5">Programming Game AI by Example</a> by Matt Buckland, I can understand the magic behind those intelligent behaviors. I am very impressed to know how simple it is to create those behaviors. But it’s definitely not simple if one is not familiar with trigonometry and geometric algebra.</p>
<p>The code presented in this book is all C++. And I have a hard time to make those code built in Visual C++ 2008. It is guaranteed to work with Visual C++ 2005 only!
So I rolled up my sleeves and wrote my own code in Java. And I think this is the best way to test how much I understand the book.</p>
</div>
<footer>
<a rel="full-article" href="/blog/2008/10/23/autonomous-game-agent/">Read on →</a>
</footer>
</article>
<div class="pagination">
<a class="prev" href="/blog/page/2/">← Older</a>
<a href="/blog/archives">Blog Archives</a>
</div>
</div>
<aside class="sidebar">
<section>
<h1>About</h1>
<p><strong>Doug Ly</strong> is a software developer loving to tinker with anything related to programming.</p>
<p>He is living in Seattle, WA.</p>
</section><section>
<h1>Recent Posts</h1>
<ul id="recent_posts">
<li class="post">
<a href="/blog/2013/05/01/diy-java-app-server-on-openshift-so-far-so-good/">DIY Java App Server on OpenShift: So Far So Good</a>
</li>
<li class="post">
<a href="/blog/2013/04/28/java-proxy-chaining-aspect-on-the-cheap/">Java Proxy Chaining - Aspect on the Cheap</a>
</li>
<li class="post">
<a href="/blog/2010/09/14/building-database-full-text-index-with-lucene/">Building Database Full Text Index with Lucene</a>
</li>
<li class="post">
<a href="/blog/2010/08/27/asynchronous-calls-in-c-number/">Asynchronous Calls in C#</a>
</li>
<li class="post">
<a href="/blog/2009/07/15/concurrent-amf-request-for-blazeds/">Concurrent AMF Request for BlazeDS</a>
</li>
</ul>
</section>
</aside>
</div>
</div>
<footer role="contentinfo"><p>
Copyright © 2014 - Doug Ly -
<span class="credit">Powered by <a href="http://octopress.org">Octopress</a></span>
</p>
</footer>
<script type="text/javascript">
var disqus_shortname = 'jvmisking';
var disqus_script = 'count.js';
(function () {
var dsq = document.createElement('script'); dsq.type = 'text/javascript'; dsq.async = true;
dsq.src = 'http://' + disqus_shortname + '.disqus.com/' + disqus_script;
(document.getElementsByTagName('head')[0] || document.getElementsByTagName('body')[0]).appendChild(dsq);
}());
</script>
<script type="text/javascript">
(function() {
var script = document.createElement('script'); script.type = 'text/javascript'; script.async = true;
script.src = 'https://apis.google.com/js/plusone.js';
var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(script, s);
})();
</script>
<script type="text/javascript">
(function(){
var twitterWidgets = document.createElement('script');
twitterWidgets.type = 'text/javascript';
twitterWidgets.async = true;
twitterWidgets.src = 'http://platform.twitter.com/widgets.js';
document.getElementsByTagName('head')[0].appendChild(twitterWidgets);
})();
</script>
</body>
</html>