Jump to content

Java/j2Ee Discussions


lolliman

Recommended Posts

[quote name='HAPPYNESS' timestamp='1372777441' post='1303910943']
Portal CMS ante front end....mostly documents upload...Scan chesina docs Images....Save chese repository CMS....okko user ki okko portal untadi....
location ekkada?? mostly Insurance client untadi anukuntunna
[/quote]
location constraint undakudadhu anta.. sSa_j@il[size=4] location cheppaledhu[/size]

Link to comment
Share on other sites

[quote name='Sinnababu_SillyPulka' timestamp='1372777453' post='1303910945']
Jailer mama, oka question...
I have a method, but on few scenarios it is taking more than 60 seconds to complete. I would like to stop the method execution after 45 seconds and display a message to the user, Please wait or try again.
How do I set the timer?
[/quote]
u sholud use Threads and synchronous req and response..

give me details..i will give the sample code....

no need for total business logic just remove the important once and give the out lines

Link to comment
Share on other sites

[quote name='Sinnababu_SillyPulka' timestamp='1372777453' post='1303910945']
Jailer mama, oka question...
I have a method, but on few scenarios it is taking more than 60 seconds to complete. I would like to stop the method execution after 45 seconds and display a message to the user, Please wait or try again.
How do I set the timer?
[/quote]
java batches tho cheyyochu mama.. last project lo ilantidhe chesa nenu <)&[size=4] [/size]

Link to comment
Share on other sites

naaku aa timer set chydaaniki java batches use cheyochu ani thelusu.. nenu java class rasevadni.. kaani dhanni batch job laga run cheydaniki oka tool use chesevallam.. a tool ki access ma TL gaadike undedhi.. sSa_j@il[size=4] [/size]

Link to comment
Share on other sites

public ABCOutputProperties getData() throws CSLException {
ABCOutputProperties abcOutputProperties = new ABCOutputProperties();
try {
logger.info(" Making Web Service Call :: " + inputProperties.getMemName());

[color=#ff0000][b] abcOutputProperties= abc*****.abcProcessWS(inputProperties);[/b][/color]

} catch (Exception e) {
logger.info(" WS Exception :: " + e.getMessage());
logger.error(" WS Exception", e);
throw e;
}
}

Highlighted method is taking more than 60 seconds for some bad data request. Exactly after 45 seconds, I want to throw a custom exception to display the appropriate custom message to the user.

Link to comment
Share on other sites

[quote name='Sinnababu_SillyPulka' timestamp='1372777930' post='1303910970']
public ABCOutputProperties getData() throws CSLException {
ABCOutputProperties abcOutputProperties = new ABCOutputProperties();
try {
logger.info(" Making Web Service Call :: " + inputProperties.getMemName());

[color=#ff0000][b] abcOutputProperties= abc*****.abcProcessWS(inputProperties);[/b][/color]

} catch (Exception e) {
logger.info(" WS Exception :: " + e.getMessage());
logger.error(" WS Exception", e);
throw e;
}
}

Highlighted method is taking more than 60 seconds for some bad data request. Exactly after 45 seconds, I want to throw a custom exception to display the appropriate custom message to the user.
[/quote]
emo bye1[size=4] [/size]

Link to comment
Share on other sites

[quote name='Sinnababu_SillyPulka' timestamp='1372777453' post='1303910945']
Jailer mama, oka question...
I have a method, but on few scenarios it is taking more than 60 seconds to complete. I would like to stop the method execution after 45 seconds and display a message to the user, Please wait or try again.
How do I set the timer?
[/quote]

Lifted from stackoverflow: [url="http://stackoverflow.com/questions/4044726/how-to-set-a-timer-in-java"]http://stackoverflow.com/questions/4044726/how-to-set-a-timer-in-java[/url]
[color=#000000][font=Arial,]
[b]Setting a timer[/b][/font][/color][color=#000000][font=Arial,]
First you need to create a Timer:[/font][/color]
[color=#2B91AF][background=transparent]Timer[/background][/color][background=transparent] timer [/background][background=transparent]=[/background][background=transparent] [/background][color=#00008B][background=transparent]new[/background][/color][background=transparent] [/background][color=#2B91AF][background=transparent]Timer[/background][/color][background=transparent]();[/background][color=#000000][font=Arial,]
To run the task once you would do:[/font][/color]
[background=transparent]timer[/background][background=transparent].[/background][background=transparent]schedule[/background][background=transparent]([/background][color=#00008B][background=transparent]new[/background][/color][background=transparent] [/background][color=#2B91AF][background=transparent]TimerTask[/background][/color][background=transparent]()[/background][background=transparent] [/background][background=transparent]{[/background][background=transparent]
[/background][color=#800000][background=transparent]@Override[/background][/color][background=transparent]
[/background][color=#00008B][background=transparent]public[/background][/color][background=transparent] [/background][color=#00008B][background=transparent]void[/background][/color][background=transparent] run[/background][background=transparent]()[/background][background=transparent] [/background][background=transparent]{[/background][background=transparent]
[/background][color=gray][background=transparent]// Your method code here[/background][/color][background=transparent]
[/background][background=transparent]}[/background][background=transparent]
[/background][background=transparent]},[/background][background=transparent] [/background][color=#800000][background=transparent]2[/background][/color][background=transparent]*[/background][color=#800000][background=transparent]60[/background][/color][background=transparent]*[/background][color=#800000][background=transparent]1000[/background][/color][background=transparent]);[/background]

Link to comment
Share on other sites

[quote name='cherlapalli_jailer' timestamp='1372777813' post='1303910966']
be back @ 100PM ...meeting and then lunch
[/quote]
[img]http://stream1.gifsoup.com/view6/4751671/brahrajender-o.gif[/img]

Link to comment
Share on other sites

nuvvu call chesedhi Web Service ...... nee web Service stub class pi .setTimeOut() aneee method untadhi .... use that and set time to 45000 (45 sec) , after 45 sec no response then u r stub class throw exception , there create your custome exception and throw it back to presentation layer ..... ..... thats it man



[quote name='Sinnababu_SillyPulka' timestamp='1372777930' post='1303910970']
public ABCOutputProperties getData() throws CSLException {
ABCOutputProperties abcOutputProperties = new ABCOutputProperties();
try {
logger.info(" Making Web Service Call :: " + inputProperties.getMemName());

[color=#ff0000][b] abcOutputProperties= abc*****.abcProcessWS(inputProperties);[/b][/color]

} catch (Exception e) {
logger.info(" WS Exception :: " + e.getMessage());
logger.error(" WS Exception", e);
throw e;
}
}

Highlighted method is taking more than 60 seconds for some bad data request. Exactly after 45 seconds, I want to throw a custom exception to display the appropriate custom message to the user.
[/quote]

Link to comment
Share on other sites

Thingaroda ... WS calls by default syncronus .... manam WS time tho mana timer class ni mix chesi kodithy ....output dhimma thirigela vosthadi emo :)

[quote name='Thingarodu' timestamp='1372778270' post='1303910987']

Lifted from stackoverflow: [url="http://stackoverflow.com/questions/4044726/how-to-set-a-timer-in-java"]http://stackoverflow...a-timer-in-java[/url]

[color=#000000][font=Arial,][b]Setting a timer[/b][/font][/color]
[color=#000000][font=Arial,]First you need to create a Timer:[/font][/color]
[color=#2B91AF][background=transparent]Timer[/background][/color][background=transparent] timer [/background][background=transparent]=[/background][background=transparent] [/background][color=#00008B][background=transparent]new[/background][/color][background=transparent] [/background][color=#2B91AF][background=transparent]Timer[/background][/color][background=transparent]();[/background]
[color=#000000][font=Arial,]To run the task once you would do:[/font][/color]
[background=transparent]timer[/background][background=transparent].[/background][background=transparent]schedule[/background][background=transparent]([/background][color=#00008B][background=transparent]new[/background][/color][background=transparent] [/background][color=#2B91AF][background=transparent]TimerTask[/background][/color][background=transparent]()[/background][background=transparent] [/background][background=transparent]{[/background]
[background=transparent] [/background][color=#800000][background=transparent]@Override[/background][/color]
[background=transparent] [/background][color=#00008B][background=transparent]public[/background][/color][background=transparent] [/background][color=#00008B][background=transparent]void[/background][/color][background=transparent] run[/background][background=transparent]()[/background][background=transparent] [/background][background=transparent]{[/background]
[background=transparent] [/background][color=gray][background=transparent]// Your method code here[/background][/color]
[background=transparent] [/background][background=transparent]}[/background]
[background=transparent]},[/background][background=transparent] [/background][color=#800000][background=transparent]2[/background][/color][background=transparent]*[/background][color=#800000][background=transparent]60[/background][/color][background=transparent]*[/background][color=#800000][background=transparent]1000[/background][/color][background=transparent]);[/background]
[/quote]

Link to comment
Share on other sites

[quote name='Java01' timestamp='1372778815' post='1303911026']
nuvvu call chesedhi Web Service ...... nee web Service stub class pi .setTimeOut() aneee method untadhi .... use that and set time to 45000 (45 sec) , after 45 sec no response then u r stub class throw exception , there create your custome exception and throw it back to presentation layer ..... ..... thats it man
[/quote]
gp

Link to comment
Share on other sites

[quote name='Java01' timestamp='1372778815' post='1303911026']
nuvvu call chesedhi Web Service ...... nee web Service stub class pi .setTimeOut() aneee method untadhi .... use that and set time to 45000 (45 sec) , after 45 sec no response then u r stub class throw exception , there create your custome exception and throw it back to presentation layer ..... ..... thats it man
[/quote]

I agree with you changing the stub class, I am not comfort touching auto generated stub classes.

Mama, for the time being...lets assume it is not a web service, but a complicated calculation....

Link to comment
Share on other sites

[quote name='Sinnababu_SillyPulka' timestamp='1372779536' post='1303911089']

I agree with you changing the stub class, I am not comfort touching auto generated stub classes.

Mama, for the time being...lets assume it is not a web service, but a complicated calculation....
[/quote]
web service kakapote function rasko....timer set cheyyadaniki methods em leva?

Link to comment
Share on other sites

AOP antee first thing it is deviation from regular object oriented programming model ..... simple words lo chepali anteee , you want to log in u r application each time when enter in to method and before exit the method just for debugging purpose ......

adding this code in all the methods in u r project take time , or if a project already implemented now u want to do this ... so you have to add this piece of code in all u r methods ...... now going to AOP

using AOP u can insert code dynamically at runtime ... where we can we insert ... that is jointcut (method starting or method ending) ... what you insert .... that is Advice ( like u r logger statements) ......

AOP tho best usage antee transaction menagment ..... instead of writing transaction code in our classses we simply config in XML or using annotations we can add transaction dynamically ( using @Transactional annotaions in Spring) ... and performance testing ( like u want to see the time of execution for each method) ..............


[quote name='HAPPYNESS' timestamp='1372717391' post='1303908842']
real time lo denni ela apply chestam mayyaa[list]
[*][b]Aspect oriented (AOP) :[/b] Spring supports Aspect oriented programming and enables cohesive development by separating application business logic from system services.
[/list]
[/quote]

Link to comment
Share on other sites

×
×
  • Create New...