• Post Reply Bookmark Topic Watch Topic
  • New Topic

How to implement Stock System?  RSS feed

 
Andres Gorzelany
Greenhorn
Posts: 13
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello guys! I have been reading this forum for a lot of time, and now finally registered I hope we can share knowledge,

ok this is the situation:

I am developing a system (SWT, JDBC) for a commercial store, two computers each one has one system, same database, one system is for adding Stock and the other is for reducing stock of a particular item.

The thing is what would you guys do if you want to keep one system updated if the other makes changes to the database ?

I thought this two:

- A thread that constantly checks for changes in database
- Use Networking so a system sends a message to the other system when necessary

I started with the second one, but i found that it is a little complicated to work with SWT at the same time (i am doing something wrong that's for sure)

And last question, wich is the appropiate way to stop a thread from executing ?

Thanks all you guys
 
Ulf Dittmer
Rancher
Posts: 42972
73
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Checking whether a value has changed in the database only takes time in the order of milliseconds (assuming we're talking about machines on the same network). Is it unfeasible to check the database before you use a value?
 
Andres Gorzelany
Greenhorn
Posts: 13
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Yes, i can use that, but that option will not lead me to a % of error on the data displayed? the thing is this:

I have a swt table with items and quantities,

Shoes 20

If on the other system the quantity reduces to 18 i will not be able to notice that until i check the database and re-populate the swt Table, what if the person using the system made some decision based on the outdated value ?

What would you do ? Thanks for the response
 
Stan James
(instanceof Sidekick)
Ranch Hand
Posts: 8791
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
This isn't exactly your situation, but Google for "java distributed cache" and you will find people solving memory synchronization problems. I'd expect to see something using JMS that lines up with your network notification option.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!