river-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Peter Firmstone <j...@zeus.net.au>
Subject Re: OutriggerImpl starts thread in constructor
Date Sun, 17 Mar 2013 10:12:37 GMT
Provided it's used via com.sun.jini.start.ActivateWrapper it'll be ok.

NonActivatableServiceDescriptor also had to be modified to call the Starter.

Cheers,

Peter.

Dennis Reedy wrote:
> Gregg,
>
> You may be right. I'm curious, does anyone actually ever uses activation?
>
> Dennis
>
>
> On Mar 16, 2013, at 541PM, Gregg Wonderly wrote:
>
>   
>> I don't think this will work with activation because the proxy is not what is returned
in that case.  It may be necessary to look at doing something in Phoenix as well, if we keep
activation around.
>>
>> Gregg
>>
>> On Mar 16, 2013, at 4:22 AM, Peter Firmstone <jini@zeus.net.au> wrote:
>>
>>     
>>> 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 <code>ServiceDescriptor[]</code>
>>>  *  argument.
>>>  * @param descs The <code>ServiceDescriptor[]</code> that contains
>>>  *              the descriptors for the services to start.
>>>  * @param config The associated <code>Configuration</code> object
>>>  *               used to customize the service creation process.
>>>  * @return Returns a <code>Result[]</code> that is the same length
as
>>>  *         <code>descs</code>, 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.
>>>>>
>>>>>           
>>>>         
>
>
>   


Mime
View raw message