SchedulerNotifyOutputStreampublic class SchedulerNotifyOutputStream extends OutputStream This will reset the scheduler each time a certain amount of data has
been transfered. This allows us to keep the timeout settings low, while
not timing out during large data transfers. |
Fields Summary |
---|
OutputStream | outThe output stream wrapped by this method | org.apache.avalon.cornerstone.services.scheduler.TimeScheduler | schedulerThe scheduler used by this class to timeout | String | triggerNameThe name of the trigger | int | lengthResetThe number of bytes that need to be written before the counter is reset. | int | writtenCounterThe number of bytes written since the counter was last reset |
Methods Summary |
---|
public void | close()Close the stream
out.close();
| public void | flush()Flush the stream
out.flush();
| public void | write(byte[] b, int off, int len)Write an array of bytes to the stream
out.write(b, off, len);
writtenCounter += len;
if (writtenCounter > lengthReset) {
writtenCounter -= lengthReset;
scheduler.resetTrigger(triggerName);
}
| public void | write(int b)Write a byte to the stream
out.write(b);
writtenCounter++;
if (writtenCounter > lengthReset) {
writtenCounter -= lengthReset;
scheduler.resetTrigger(triggerName);
}
|
|