1

I have a Java swing application that can uploads files to a server. It uses all the available upload bandwidth and that's okay when I'm at home. But it uses up a massive amount of upload bandwidth when I'm at work and so I wish to have some setting to limit bandwidth usage. How do I do it?

It's a multithreaded application so overriding the read method and adding extra logic would make the code more complex.

Is there a simple JVM setting for that? Or is there some java method like SomeJREClass.setMaximumAllowedBandwidth(int); ?

Thanks in advance

Vigneshwaran
  • 3,265
  • 6
  • 23
  • 36
  • I think your looking for something like this: http://stackoverflow.com/questions/3947621/how-can-i-limit-bandwidth-in-java – Lostsoul Mar 29 '12 at 06:16
  • As you can see, changing all the read/write statements to monitor how much bandwidth they are using is a complex subject, which is why its not part of the IO library because most people don't need it. – Peter Lawrey Mar 29 '12 at 06:55

1 Answers1

3

There is an open source library token-bucket which implements token bucket algorithm in Java. Maybe it can solve your problem.

user1802604
  • 396
  • 3
  • 14