示例#1
0
 private void publishDirect(Object obj, boolean block) throws InsufficientCapacityException {
   final long id;
   if (block) {
     id = _buffer.next();
   } else {
     id = _buffer.tryNext(1);
   }
   final MutableObject m = _buffer.get(id);
   m.setObject(obj);
   _buffer.publish(id);
 }
示例#2
0
 public void publish(Object obj, boolean block) throws InsufficientCapacityException {
   if (consumerStartedFlag) {
     final long id;
     if (block) {
       id = _buffer.next();
     } else {
       id = _buffer.tryNext(1);
     }
     final MutableObject m = _buffer.get(id);
     m.setObject(obj);
     _buffer.publish(id);
   } else {
     _cache.add(obj);
     if (consumerStartedFlag) flushCache();
   }
 }