stratos-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Pradeep Fernando <pradee...@gmail.com>
Subject Re: Exceptions are thrown in Cartridge agent thread
Date Thu, 09 Jan 2014 09:34:55 GMT
Then agent should gracefully fail... :)

for an example printing a message and exiting.(?) I dont know the full
context...

just a thought.

--Pradeep


On Thu, Jan 9, 2014 at 2:58 PM, Nirmal Fernando <nirmal070125@gmail.com>wrote:

> Yes, we should throw exceptions carefully. However, we should analyse this
> particular code segment.
>
> Looking at the code Lahiru sent, I tend to agree with the original author.
> Cause, I don't think without the presence of those properties Cartridge
> Agent could survive. wdyt?
>
>
> On Thu, Jan 9, 2014 at 2:47 PM, Pradeep Fernando <pradeepfn@gmail.com>wrote:
>
>> The original author has opted for Runtime exceptions.
>>
>> - It is somewhat controversial to use runtime exceptions in your code.
>> - if you really mean it, we should not log it IMO.
>> - Those get handled by the JVM at the end of the day. (like nullpointers)
>>
>> I think we should use checked exceptions here..
>>
>>
>> On Thu, Jan 9, 2014 at 2:21 PM, Lahiru Sandaruwan <lahirus@wso2.com>wrote:
>>
>>> Hi,
>>>
>>> $subject. I think the correct way is to log without throwing...
>>>
>>>
>>>
>>>         String jndiPropertiesDir =
>>> System.getProperty(CartridgeAgentConstants.JNDI_PROPERTIES_DIR);
>>>         if(StringUtils.isBlank(jndiPropertiesDir)) {
>>>             throw new RuntimeException(String.format("System property
>>> not found: %s", CartridgeAgentConstants.JNDI_PROPERTIES_DIR));
>>>         }
>>>
>>>         String payloadPath =
>>> System.getProperty(CartridgeAgentConstants.PARAM_FILE_PATH);
>>>         if(StringUtils.isBlank(payloadPath)) {
>>>             throw new RuntimeException(String.format("System property
>>> not found: %s", CartridgeAgentConstants.PARAM_FILE_PATH));
>>>         }
>>>
>>>         String extensionsDir =
>>> System.getProperty(CartridgeAgentConstants.EXTENSIONS_DIR);
>>>         if(StringUtils.isBlank(extensionsDir)) {
>>>             throw new RuntimeException(String.format("System property
>>> not found: %s", CartridgeAgentConstants.EXTENSIONS_DIR));
>>>         }
>>>
>>> Thanks.
>>> --
>>> --
>>> Lahiru Sandaruwan
>>> Software Engineer,
>>> Platform Technologies,
>>> WSO2 Inc., http://wso2.com
>>> lean.enterprise.middleware
>>>
>>> email: lahirus@wso2.com cell: (+94) 773 325 954
>>> blog: http://lahiruwrites.blogspot.com/
>>> twitter: http://twitter.com/lahirus
>>> linked-in: http://lk.linkedin.com/pub/lahiru-sandaruwan/16/153/146
>>>
>>>
>>
>>
>> --
>> Pradeep Fernando.
>> http://pradeepfernando.blogspot.com/
>>
>
>
>
> --
> Best Regards,
> Nirmal
>
> Nirmal Fernando.
> PPMC Member & Committer of Apache Stratos,
> Senior Software Engineer, WSO2 Inc.
>
> Blog: http://nirmalfdo.blogspot.com/
>



-- 
Pradeep Fernando.
http://pradeepfernando.blogspot.com/

Mime
View raw message