stratos-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Imesh Gunaratne <im...@apache.org>
Subject Re: Exceptions are thrown in Cartridge agent thread
Date Tue, 14 Jan 2014 15:09:12 GMT
+1 for updating this logic to gracefully stop the Cartridge Agent after
logging the errors.

Thanks


On Thu, Jan 9, 2014 at 4:45 AM, Pradeep Fernando <pradeepfn@gmail.com>wrote:

>
>
>
> On Thu, Jan 9, 2014 at 3:08 PM, Lahiru Sandaruwan <lahirus@wso2.com>wrote:
>
>>
>>
>>
>> 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.
>>>
>>
>> yeah. that is the point to consider...
>>
>> I think the first two are mandatory,
>>
> Then fail gracefully after logging the exception scenario. We don't have
> to proceed further.
>
> third we can proceed without having.
>>
>>
>>  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/
>>>
>>
>>
>>
>> --
>> --
>> 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/
>

Mime
View raw message