Elffuss BraidHub

kikocis/java-driver public

Add methods to check if a cluster/session instance if closed

JAVA-114 #fixes
Changesetb8c8c820ec5e477e5c4724e83a7903f03f40a7615c9be53f2c072b4a2c405cf6
AuthorSylvain Lebresne <sylvain@datastax.com> · 2014-03-03 17:44 +01:00
CommitterSylvain Lebresne <sylvain@datastax.com> · 2014-03-03 17:44 +01:00
Parents4f5170099e87

Browse the files at this changeset

4 files changed

modified driver-core/CHANGELOG.rst +5 −0
@@ -1,6 +1,11 @@
11 CHANGELOG
22 =========
33
4+1.0.7:
5+------
6+
7+- [new] Add method to check if a Cluster/Session instance has been closed already (JAVA-114)
8+
49 1.0.6:
510 ------
611
modified driver-core/src/main/java/com/datastax/driver/core/Cluster.java +10 −0
@@ -305,6 +305,16 @@
305305 }
306306 }
307307
308+ /**
309+ * Whether shutdown has been called on this Cluster instance.
310+ *
311+ * @return {@code true} if {@code shutdown} has been called on this instance,
312+ * {@code false} otherwise.
313+ */
314+ public boolean isShutdown() {
315+ return manager.isShutdown.get();
316+ }
317+
308318 /**
309319 * Initializer for {@link Cluster} instances.
310320 * <p>
modified driver-core/src/main/java/com/datastax/driver/core/Session.java +7 −0
@@ -228,6 +228,13 @@
228228 */
229229 public boolean shutdown(long timeout, TimeUnit unit);
230230
231+ /**
232+ * Whether shutdown has been called on this Session instance.
233+ *
234+ * @return {@code true} if this instance is shut down, {@code false} otherwise.
235+ */
236+ public boolean isShutdown();
237+
231238 /**
232239 * Returns the {@code Cluster} object this session is part of.
233240 *
modified driver-core/src/main/java/com/datastax/driver/core/SessionManager.java +4 −0
@@ -155,6 +155,10 @@
155155 }
156156 }
157157
158+ public boolean isShutdown() {
159+ return isShutdown.get();
160+ }
161+
158162 public Cluster getCluster() {
159163 return cluster;
160164 }