Skip to content

Commit

Permalink
Merge pull request #531 from heshengbang/master
Browse files Browse the repository at this point in the history
Easy to use try-with-resources
  • Loading branch information
majst01 authored Oct 9, 2018
2 parents 4590d18 + f653e62 commit 2f4c594
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 1 deletion.
9 changes: 9 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -151,6 +151,15 @@ influxDB.dropRetentionPolicy(rpName, dbName);
influxDB.deleteDatabase(dbName);
```

#### Try-with-resources
Try-with-resources is a new feature in JDK7, InfluxDB support this feature, you can use it just like the following example:

```java
try (InfluxDB influxDB = InfluxDBFactory.connect("http://172.17.0.2:8086", "root", "root")) {
// Read or Write, do any thing you want
}
```

### Advanced Usage

#### Gzip's support (version 2.5+ required)
Expand Down
2 changes: 1 addition & 1 deletion src/main/java/org/influxdb/InfluxDB.java
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
* @author stefan.majer [at] gmail.com
*
*/
public interface InfluxDB {
public interface InfluxDB extends AutoCloseable {

/**
* The system property key to set the http logging level across the JVM.
Expand Down

0 comments on commit 2f4c594

Please sign in to comment.