Return-Path: X-Original-To: apmail-river-dev-archive@www.apache.org Delivered-To: apmail-river-dev-archive@www.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id 72945D895 for ; Sat, 16 Mar 2013 09:33:58 +0000 (UTC) Received: (qmail 65814 invoked by uid 500); 16 Mar 2013 09:33:58 -0000 Delivered-To: apmail-river-dev-archive@river.apache.org Received: (qmail 65753 invoked by uid 500); 16 Mar 2013 09:33:58 -0000 Mailing-List: contact dev-help@river.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@river.apache.org Delivered-To: mailing list dev@river.apache.org Received: (qmail 65743 invoked by uid 99); 16 Mar 2013 09:33:58 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Sat, 16 Mar 2013 09:33:58 +0000 X-ASF-Spam-Status: No, hits=-0.0 required=5.0 tests=SPF_PASS X-Spam-Check-By: apache.org Received-SPF: pass (athena.apache.org: local policy) Received: from [207.57.65.70] (HELO zeus.net.au) (207.57.65.70) by apache.org (qpsmtpd/0.29) with ESMTP; Sat, 16 Mar 2013 09:33:52 +0000 Received: (qmail 40782 invoked by uid 16710); 16 Mar 2013 09:33:30 -0000 Received: from unknown (HELO [10.1.1.2]) ([61.9.223.241]) (envelope-sender ) by 207.57.65.70 (qmail-ldap-1.03) with SMTP for ; 16 Mar 2013 09:33:30 -0000 Message-ID: <514439C4.10709@zeus.net.au> Date: Sat, 16 Mar 2013 19:22:12 +1000 From: Peter Firmstone User-Agent: Thunderbird 2.0.0.14 (X11/20080531) MIME-Version: 1.0 To: dev@river.apache.org Subject: Re: OutriggerImpl starts thread in constructor References: <5143D670.8050809@zeus.net.au> <5143E673.40901@wonderly.org> In-Reply-To: <5143E673.40901@wonderly.org> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-Virus-Checked: Checked by ClamAV on apache.org I dunno, it just seems to fit so well here, I didn't even have to change the documentation. /** Generic service creation method that attempts to start the * services defined by the provided ServiceDescriptor[] * argument. * @param descs The ServiceDescriptor[] that contains * the descriptors for the services to start. * @param config The associated Configuration object * used to customize the service creation process. * @return Returns a Result[] that is the same length as * descs, which contains the details for each * service creation attempt. * @throws Exception If there was a problem creating the service. * @see Result * @see ServiceDescriptor * @see net.jini.config.Configuration */ private static Result[] create(final ServiceDescriptor[] descs, final Configuration config) throws Exception { logger.entering(ServiceStarter.class.getName(), "create", new Object[] {descs, config}); ArrayList proxies = new ArrayList(); Object result = null; Exception problem = null; ServiceDescriptor desc = null; for (int i=0; i < descs.length; i++) { desc = descs[i]; result = null; problem = null; try { if (desc != null) { result = desc.create(config); if (result instanceof Starter) ((Starter) result).start(); } } catch (Exception e) { problem = e; } finally { proxies.add(new Result(desc, result, problem)); } } logger.exiting(ServiceStarter.class.getName(), "create", proxies); return (Result[])proxies.toArray(new Result[proxies.size()]); } Gregg Wonderly wrote: > Looking around briefly, it seems that there is a not so great set of > returned values from ServiceDescriptor.create() with activation > returning the RMI GID. So a little more work to wrap everything into > something implementing an interface with lifecycle management in it > would be required. > > Gregg > > > On 3/15/2013 9:18 PM, Peter Firmstone wrote: >> I'd like to add a start() method to OutriggerImpl, so I can delay any >> threads from being started until after construction is complete. >> >> This is required for safe publication to comply with the JMM. >> >> Before doing so, I'd like to know how people are using Outrigger, so >> I can minimise unintended consequences / breakages. >> >> Comments, opinions and thoughts? >> >> Regards, >> >> Peter. >> > >