Kris Reid

Ranch Hand
+ Follow
since Jan 05, 2005
Cows and Likes
Cows
Total received
0
In last 30 days
0
Total given
0
Likes
Total received
0
Received in last 30 days
0
Total given
0
Given in last 30 days
0
Forums and Threads
Scavenger Hunt
expand Ranch Hand Scavenger Hunt
expand Greenhorn Scavenger Hunt

Recent posts by Kris Reid

thanks for the info Cyrille.
11 years ago
Check it - my online mafia game is coming along!

Mob Warrior starting to get quite the following and be a pretty cool game I think.

11 years ago
Never event crossed my mine to do the calculations in SQL. Test show its at least 500% faster!
cheers
Believe it in not....seems the problem isn't with quartz and was my config, SHOCK!

Tomcat was loading my application twice so QuartzInitializerServlet was loading twice and and so on.
Check out context in your server.xml if you have a problem
Cheers mate!

I've changed it to calc the users score every time they finish an action and just do the ranking every 10 minutes and seems to be working a lot fast.
I'm not much of an SQL guy but I'll try and figure out how to do the calculation in SQL and see how that goes too

Any ideas??
Seems to be a common problem but can't find a documented solution
3 years later.....still can't find a decent example
Did you ever post one?
11 years ago
I redesigned the process to wrap a transaction around each users calculation and then another transaction to rank the users.

This has doubled the time it takes to complete. And it'll just keep taking longer.
Any ideas would be greatly appreciated

Hi

I'm building a game www.mobwarrior.com and am having a wee problem with transactions and I'm not sure about the best way to do it.

I've got a session filter on the servlets which starts a transaction and comits it at the end of a user action which works fine.
I also have a back ground process that every 10 minutes grabs all the users, calculates their scores and ranks them. Sometimes this process is not able to commit the transaction.



I'm guessing this is because the user has logged in and done something as it was updating all the users rank.
I'm not sure how else to do this with out starting and commiting a heap of transcations. The other way I was thinking is starting transaction, calc user score, commit, repeat for all users.
Then start transaction, rank all users, commit.
Is this the best way to do it? Are starting that many transactions expensive?

Any ideas would be great, Thanks

Hey

There is a few posts of this around the net but no one seemed to post there solution.

I'm using quatz to schedule jobs.
The problem is when it is time to fire the job it fires it twice.
I know it is firing twice and not logging twice as the job emails me. I get 2 emails

Anyone run into this?

Web.xml
<servlet>
<servlet-name>QuartzInitializer</servlet-name>
<display-name>Quartz Initializer Servlet</display-name>
<servlet-class> org.quartz.ee.servlet.QuartzInitializerServlet</servlet-class>
<load-on-startup>1</load-on-startup>
</servlet>

Jobs in quartz-jobs.xml - fire every 2 minutes
<cron-expression>0 0/2 * ? * *</cron-expression>

My Quartz.properties

org.quartz.scheduler.instanceName = QuartzScheduler
org.quartz.scheduler.instanceId = AUTO

org.quartz.threadPool.class = org.quartz.simpl.SimpleThreadPool
org.quartz.threadPool.threadCount = 5
org.quartz.threadPool.threadPriority = 5

org.quartz.jobStore.misfireThreshold = 60000
org.quartz.jobStore.class = org.quartz.simpl.RAMJobStore

org.quartz.plugin.jobInitializer.class = org.quartz.plugins.xml.JobInitializationPlugin
org.quartz.plugin.jobInitializer.fileName = quartz-jobs.xml
org.quartz.plugin.jobInitializer.overWriteExistingJobs = false
org.quartz.plugin.jobInitializer.failOnFileNotFound = true
4 hours later here is lesson to keep damn logic out of JSP






As this update is being called explicitly how can I find out what is making it fire?
I have several actions just like this. They all look the same but this is the only one doing a update

Because I'm using struts there are two methods

The first is the action which determines which set to get



And then the one called from the JSP to display the results of that set.
The println is just there to show me that the right stuff is in the set




Both println print the same set. Which is what is in the database

OK this exception should speak for itself but.....

I'm using struts2 and hibernate together.
I've got in my JSP an iterator that calls the get method that returns a Set.

Before the Set is being returned I've tested what is in the Set and there are what I expect a unique set.
I don't even understand what is forcing the update. All the action is meant to do is display a Set of data from the database.

Any ideas??



OK I'm a gumby

You were right it is the "X-Forwarded-For"
request.getHeader("X-Forwarded-For")

Cheers
11 years ago