Hi Trustin
My sample code looks like
ExecutorService executorService =
Executors.newFixedThreadPool(1);
Future<String> future = executorService.submit(new
Task(requestPayload, papSession));
String responsePayload = null;
long messageTimeout =
NumberUtils.toLong(serverProperties.getProperty("messageTimeOut"));
try {
responsePayload = future.get(messageTimeout,
TimeUnit.MILLISECONDS);
} catch (TimeoutException toe) {
logger.warn(toe);
handleTimedOutMessage(requestPayload);
executorService.shutdownNow();
} finally {
executorService.shutdown();
}
There is no purge method in the "executorService".
Arul Kumaran
Senior Java/J2EE developer/designer
Woolworths Limited
P 02 8885 7528
E [EMAIL PROTECTED]
1 Woolworths Way Bella Vista, NSW 2153
PO Box 8000 Baulkham Hills, NSW 2153
P PLEASE CONSIDER THE ENVIRONMENT BEFORE YOU PRINT THIS E-MAIL
-----Original Message-----
From: Trustin Lee [mailto:[EMAIL PROTECTED]
Sent: Wednesday, 31 October 2007 3:07 PM
To: [email protected]
Subject: Re: TIMEOUT on messageReceieved
On 10/31/07, Kumaran Arul <[EMAIL PROTECTED]> wrote:
> Hi
>
> Trustin said:
>
> "You have to purge them manually"
>
> Does this mean that I need to call "executorService.shutdownNow();"
> In a finally {} block. Will this free up memory consumed by the task?
No. There's a method called purge():
http://dbs.mathematik.uni-marburg.de/docs/public/java/jdk15beta/docs/api
/java/util/concurrent/ThreadPoolExecutor.html#purge()
HTH,
Trustin
--
what we call human nature is actually human habit
--
http://gleamynode.net/
--
PGP Key ID: 0x0255ECA6
***********************************************************
CAUTION: This email and files included in its transmission
are solely intended for the use of the addressee(s) and may
contain information that is confidential and privileged.
If you receive this email in error, please advise us
immediately and delete it without copying the contents
contained within. Woolworths Limited (including its group
of companies) do not accept liability for the views
expressed within or the consequences of any computer
viruses that may be transmitted with this email. The
contents are also subject to copyright. No part of it
should be reproduced, adapted or transmitted without the
written consent of the copyright owner.
***********************************************************