Project icon

com.io7m.jmulticlose

Build status Maven Central Codacy Codecov

The jmulticlose package implements a simple extension to the Java try-with-resources statement that allows for closing many resources at once - without nested or compound statements - in a type-safe manner.

Five-second Tutorial

Create a CloseableCollection to track resources. Add resources to it. The resources will be closed when the collection is closed. All resources will be closed even if any of the individual resources raises an exception.

  final Resource r0;
  final Resource r1;
  final Resource r2;

  try (CloseableCollectionType<ClosingResourceFailedException> c = CloseableCollection.create()) {
    r0 = c.add(new Resource(0));
    r1 = c.add(new Resource(1));
    r2 = c.add(new Resource(2));
  }
     

Contents

Features

  • Close multiple resources at once without nested scopes and without a loss of type-safety.
  • OSGi-ready
  • JPMS-ready
  • ISC license
  • 100% automated unit test coverage.

Releases

The current release is 0.0.1.

Source code and binaries are available from the repository.

Documentation

Documentation for the 0.0.1 release is available for reading online.

Documentation for current and older releases is archived in the repository.

User documentation

No user documentation is currently available.

Maven

The following is a complete list of the project's modules expressed as Maven dependencies:

<dependency>
  <groupId>com.io7m.jmulticlose</groupId>
  <artifactId>com.io7m.jmulticlose</artifactId>
  <version>0.0.1</version>
</dependency>

<dependency>
  <groupId>com.io7m.jmulticlose</groupId>
  <artifactId>com.io7m.jmulticlose.core</artifactId>
  <version>0.0.1</version>
</dependency>

<dependency>
  <groupId>com.io7m.jmulticlose</groupId>
  <artifactId>com.io7m.jmulticlose.tests</artifactId>
  <version>0.0.1</version>
</dependency>

Each release of the project is made available on Maven Central within ten minutes of the release announcement.

Changes

Subscribe to the releases atom feed.

2018-07-07 Release: com.io7m.jmulticlose 0.0.1
2018-07-07 Change: Initial release

Sources

This project uses Git to manage source code.

Repository: https://github.com/io7m/jmulticlose

$ git clone https://github.com/io7m/jmulticlose

License

Copyright ⓒ 2018 Mark Raynsford <code@io7m.com> http://io7m.com

Permission to use, copy, modify, and/or distribute this software for
any purpose with or without fee is hereby granted, provided that the
above copyright notice and this permission notice appear in all copies.

THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL
WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED
WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR
BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES
OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
SOFTWARE.

Bug Tracker

The project uses GitHub Issues to track issues.