[concurrency-interest] SingleThreadExecutor

Ernst, Matthias matthias.ernst@coremedia.com
Sat, 24 Jan 2004 19:41:41 +0100


This is a multi-part message in MIME format.

------_=_NextPart_001_01C3E2A9.B4F8C501
Content-Type: text/plain;
	charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable

Well, you did pick a timeout for cachedThreadPool ...=20
I would suggest accordingly:
=20
    public static ExecutorService newSingleThreadExecutor() {
        return new DelegatedExecutorService
            (new ThreadPoolExecutor(0, 1,
                                    60, TimeUnit.SECONDS,
                                    new =
LinkedBlockingQueue<Runnable>()));
    }

=20
Matthias
--=20
Matthias Ernst
CoreMedia - The Content Technology Experts


------_=_NextPart_001_01C3E2A9.B4F8C501
Content-Type: text/html;
	charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable

<META HTTP-EQUIV=3D"Content-Type" CONTENT=3D"text/html; =
charset=3Diso-8859-1">=0A=
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2//EN">=0A=
<HTML>=0A=
<HEAD>=0A=
=0A=
<META NAME=3D"Generator" CONTENT=3D"MS Exchange Server version =
6.5.6944.0">=0A=
<TITLE>Re: [concurrency-interest] SingleThreadExecutor</TITLE>=0A=
</HEAD>=0A=
<BODY>=0A=
<DIV id=3DidOWAReplyText66279 dir=3Dltr>=0A=
<DIV dir=3Dltr><FONT face=3D"Courier New" color=3D#000000 size=3D2>Well, =
you did pick a =0A=
timeout for cachedThreadPool ... </FONT></DIV>=0A=
<DIV dir=3Dltr><FONT face=3D"Courier New" size=3D2>I would suggest =0A=
accordingly:</FONT></DIV>=0A=
<DIV dir=3Dltr><FONT face=3D"Courier New" size=3D2></FONT>&nbsp;</DIV>=0A=
<DIV dir=3Dltr><FONT face=3D"Courier New" size=3D2>&nbsp;&nbsp;&nbsp; =
public static =0A=
ExecutorService newSingleThreadExecutor() =0A=
{<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; return new =0A=
DelegatedExecutorService<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nb=
sp;&nbsp;&nbsp;&nbsp; =0A=
(new ThreadPoolExecutor(0, =0A=
1,<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&=
nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&n=
bsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; =0A=
60, =0A=
TimeUnit.SECONDS,<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbs=
p;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp=
;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;=
&nbsp;&nbsp; =0A=
new LinkedBlockingQueue&lt;Runnable&gt;()));<BR>&nbsp;&nbsp;&nbsp; =0A=
}<BR></FONT></DIV>=0A=
<DIV dir=3Dltr><FONT face=3D"Courier New" size=3D2></FONT>&nbsp;</DIV>=0A=
<DIV dir=3Dltr><FONT face=3D"Courier New" size=3D2>Matthias</FONT></DIV>=0A=
<DIV dir=3Dltr><B><FONT face=3D"Courier New" color=3Dgray size=3D2><SPAN =
lang=3DEN-GB =0A=
style=3D"FONT-WEIGHT: bold; FONT-SIZE: 10pt; COLOR: gray; FONT-FAMILY: =
'Courier New'">-- =0A=
</SPAN></FONT></B></DIV></DIV>=0A=
<DIV id=3DidSignature33568 dir=3Dltr>=0A=
<DIV><B><FONT face=3D"Courier New" color=3Dgray size=3D2><SPAN =
lang=3DEN-GB =0A=
style=3D"FONT-WEIGHT: bold; FONT-SIZE: 10pt; COLOR: gray; FONT-FAMILY: =
'Courier New'">Matthias =0A=
Ernst<BR></SPAN></FONT></B><B><FONT face=3D"Courier New" color=3Dgray =
size=3D2><SPAN =0A=
lang=3DEN-GB =0A=
style=3D"FONT-WEIGHT: bold; FONT-SIZE: 10pt; COLOR: gray; FONT-FAMILY: =
'Courier New'">CoreMedia =0A=
- The Content Technology Experts<BR></SPAN></FONT></B></DIV></DIV>=0A=
=0A=
</BODY>=0A=
</HTML>
------_=_NextPart_001_01C3E2A9.B4F8C501--