1 package com.github.davidmoten.rx.internal.operators; 2 3 /** 4 * <p> 5 * A queue with associated underlying resources that can be freed, or closed 6 * (via {@code unsubscribe}). 7 * 8 * <p> 9 * An example of freeing resources would be to close all open file system 10 * resources (like file descriptor handles) associated with the queue and reopen 11 * them on next poll/offer that needs to access the file system. This would 12 * avoid running out of file descriptors in some situations. 13 * 14 * @param <T> 15 * type of item on queue 16 */ 17 interface QueueWithResources<T> extends QueueWithSubscription<T> { 18 19 /** 20 * <p> 21 * Frees resources associated with this queue. This is not for closing a 22 * queue but rather in the situation where the queue is not used for a 23 * period of time then it may be desirable to reduce its resource usage 24 * (without compromising its content). 25 * 26 * <p> 27 * An example of freeing resources would be to close all open file system 28 * resources (like file descriptor handles) associated with the queue and 29 * reopen them on next poll/offer that needs to access the file system. This 30 * would avoid running out of file descriptors in some situations. 31 */ 32 void freeResources(); 33 34 long resourcesSize(); 35 }