View Javadoc
1   /*
2    * #%L
3    * ClosableIterator.java - mongodb-async-driver - Allanbank Consulting, Inc.
4    * %%
5    * Copyright (C) 2011 - 2014 Allanbank Consulting, Inc.
6    * %%
7    * Licensed under the Apache License, Version 2.0 (the "License");
8    * you may not use this file except in compliance with the License.
9    * You may obtain a copy of the License at
10   * 
11   *      http://www.apache.org/licenses/LICENSE-2.0
12   * 
13   * Unless required by applicable law or agreed to in writing, software
14   * distributed under the License is distributed on an "AS IS" BASIS,
15   * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16   * See the License for the specific language governing permissions and
17   * limitations under the License.
18   * #L%
19   */
20  package com.allanbank.mongodb;
21  
22  import java.util.Iterator;
23  
24  /**
25   * ClosableIterator provides an interface for an iterator that can be closed.
26   * <p>
27   * In addition the batch size for the next request for documents from the cursor
28   * can be set.
29   * </p>
30   * 
31   * @param <T>
32   *            The type of elements being iterated over.
33   * 
34   * @deprecated Use the {@link MongoIterator} interface instead. This interface
35   *             will be removed after the 1.3.0 release.
36   * @api.yes This interface is part of the driver's API. Public and protected
37   *          members will be deprecated for at least 1 non-bugfix release
38   *          (version numbers are &lt;major&gt;.&lt;minor&gt;.&lt;bugfix&gt;)
39   *          before being removed or modified.
40   * @copyright 2012-2013, Allanbank Consulting, Inc., All Rights Reserved
41   */
42  @Deprecated
43  public interface ClosableIterator<T> extends Iterator<T>, Iterable<T> {
44  
45      /**
46       * Close the iterator and release any resources it is holding.
47       */
48      public void close();
49  
50      /**
51       * Returns the size for batches of documents that are requested.
52       * 
53       * @return The size of the batches of documents that are requested.
54       */
55      public int getBatchSize();
56  
57      /**
58       * Sets the size for future batch sizes.
59       * 
60       * @param batchSize
61       *            The size to request for future batch sizes.
62       */
63      public void setBatchSize(int batchSize);
64  }