• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

How to implement Stock System?

 
Greenhorn
Posts: 13
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
 
Rancher
Posts: 43081
77
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
 
(instanceof Sidekick)
Posts: 8791
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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.
 
He repaced his skull with glass. So you can see his brain. Kinda like this tiny ad:
a bit of art, as a gift, that will fit in a stocking
https://gardener-gift.com
reply
    Bookmark Topic Watch Topic
  • New Topic