spiceJ/core/src/main/java/at/borkowski/spicej/streams/RateHelper.java
public void takeOne() {
      while (true) {
         int stored = spent.get();
         if (stored >= thingsPerTick)
            sleep();
         else if (spent.compareAndSet(stored, stored + 1))
            break;
      }
   }
public void takeOne() {
      while (true) {
         int stored = spent.get();
         if (stored >= thingsPerTick)
            sleep();
         else if (spent.compareAndSet(stored, stored + 1))
            break;
      }
   }
public void takeOne ( ) { while ( true ) { int stored = spent . get ( ) ; if ( stored >= thingsPerTick ) sleep ( ) ; else if ( spent . compareAndSet ( stored , stored + 1 ) ) break ; } }
Takes one thing (eg. byte). This method blocks until one thing can be used
according to the current rate and prescaling settings.
Takes one thing ( eg . byte ) . This method blocks until one thing can be used according to the current rate and prescaling settings .