1. Shouldn't be that way that you don't know what likely can happen. That is not good. But if we were to talk about such scenario for any reasons, then you can specify most general exception type, which is Exception in the catch block, that means catch block will take control for any occurred exception.Vinoth Sankar wrote:Not sure what kind of exception i may get in the exception block. Can i call the method which will move the file in exception black ??
Idea is clear. So my described approach could work.I need to right the code for this scenario. Please let me know if you need any more information.
Dave Tolls wrote:When you talk about "the process fails", what do you mean?
Is this the app that fails?
Are you able to change the app?
I'm trying to get an idea of what it is you can change, and what it is you can't.
Liutauras Vilda wrote:Log whatever you want to log in the read() method's catch block and then re-throw exception so you could handle it one level above, where you'd move the file and afterwards would call read() method again by supplying other file as an input.
Liutauras Vilda wrote:An example:
Liutauras Vilda wrote:You need to go back to basics. I'll copy your topic to Beginning Java. I hope you're fine with that. All this app is about the loop and handling exception when it occurs. There (in Beginning Java forum) you'll get more responses probably.
Vinoth Sankar wrote:I hope we are not in the same page.
Vinoth Sankar wrote:
Sorry i forgot to post the reply for your comment. I have executed with your code. It is not throwing any exception , at the same time it is not processing the next file too.
Junilu Lacar wrote:
Vinoth Sankar wrote:I hope we are not in the same page.
That's not a good thing; usually people hope for the opposite.
To "be on the same page" means that you and whoever you are talking to have the same understanding. If you and the other person(s) are not on the same page, then that means that there is still some confusion/disagreement/misunderstanding between parties.
Henry Wong wrote:
Vinoth Sankar wrote:
Sorry i forgot to post the reply for your comment. I have executed with your code. It is not throwing any exception , at the same time it is not processing the next file too.
Yeah, considering that Liutauras mentioned "example" in the response, that you never told us what the processing is, that the code provided is really short, and that the whole extent of the processing of the file is this line ...
I think that it is safe to say that the code, was an example as part of a discussion. And even perhaps, some cut-n-paste-able, that you can add to your program. Did you really run it to see if it would process your file?
Henry
.Vinoth Sankar wrote:
Henry Wong wrote:
Vinoth Sankar wrote:
Sorry i forgot to post the reply for your comment. I have executed with your code. It is not throwing any exception , at the same time it is not processing the next file too.
Yeah, considering that Liutauras mentioned "example" in the response, that you never told us what the processing is, that the code provided is really short, and that the whole extent of the processing of the file is this line ...
I think that it is safe to say that the code, was an example as part of a discussion. And even perhaps, some cut-n-paste-able, that you can add to your program. Did you really run it to see if it would process your file?
Henry
File will be proceed every row (content validation ) then i will insert into DB.
Vinoth Sankar wrote:please let me know if you need any more information.
Vinoth Sankar wrote:... my question is how to move a file from one location to another location ...
Liutauras Vilda wrote:... 3. Read the files one by one
Carey Brown wrote:
Liutauras Vilda wrote:... 3. Read the files one by one
I don't see a list or array of files nor a loop to process them one by one. Is this list/loop inside the execute()?
Carey Brown wrote:I would have expected something more like this
Why 3 minutes? How you know that method run finishes in 3 minutes?Vinoth Sankar wrote:This method will be called every 3 mins in Unix server
Are these two the same or different methods? (here and above mentioned) One is called every 3 minutes, other every 2 minutes..Vinoth Sankar wrote:i am calling the java thread (file process method ) from unix server for ever 2 mins
Once you read file once successfully, what happens with a file in location x? The next time method read is called, how will it know the file was read already and don't need to read it again, or need to read again?Vinoth Sankar wrote:when ever we exception arise at any where i need to move that file in another location in Unix server itself and proceed with the next file processing.
Did you see how Paul cut 87% off of his electric heat bill with 82 watts of micro heaters? |