Java 8 ClosedFileSystemException - top ranked examples from Open Source projects

These code examples were ranked by Codota’s semantic indexing as the best open source examples for Java 8 ClosedFileSystemException class.

This code example shows how to use the following methods:
     * @throws ClosedFileSystemException 
     */ 
    private void checkClosed() throws ClosedFileSystemException {
        // Check closed? 
        if (!this.isOpen()) {
            throw new ClosedFileSystemException();
        } 
    } 
 
    /** 
     * Obtains the underlying archive 
     */ 
    Archive<?> getArchive() { 
        return this.archive;
    } 
 
} 
3
CodeRank
This code example shows how to use the following methods:
  /** 
   * Checks that the file system is open, throwing {@link ClosedFileSystemException} if it is not. 
   */ 
  public void checkOpen() { 
    if (!open.get()) {
      throw new ClosedFileSystemException();
    } 
  } 
 
  /** 
   * Registers the given resource to be closed when the file system is closed. Should be called 
   * when the resource is opened. 
   */ 
  public <C extends Closeable> C register(C resource) {
    // Initial open check to avoid incrementing registering if we already know it's closed. 
    // This is to prevent any possibility of a weird pathalogical situation where the do/while 
    // loop in close() keeps looping as register() is called repeatedly from multiple threads. 
    checkOpen(); 
 
    registering.incrementAndGet();
3
CodeRank
See Code Examples for Java 8 ClosedFileSystemException Methods: