Example usage for java.io Closeable close

List of usage examples for java.io Closeable close

Introduction

In this page you can find the example usage for java.io Closeable close.

Prototype

public void close() throws IOException;

Source Link

Document

Closes this stream and releases any system resources associated with it.

Usage

From source file:ch.scythe.hsr.api.TimeTableAPI.java

private void safeCloseStream(Closeable stream) {
    if (stream != null) {
        try {/*from   www .  j  a va 2s  . com*/
            stream.close();
        } catch (IOException e) {
        }
    }
}

From source file:org.alfresco.maven.plugin.AbstractRefreshWebappMojo.java

/**
 * Close down communication objects without any messages
 *
 * @param closeable//ww w. ja va  2  s.  c  o  m
 */
private void closeQuietly(Closeable closeable) {
    try {
        closeable.close();
    } catch (Exception ex) {
        // swallow any exceptions
    }
}

From source file:com.scaleunlimited.cascading.DistCp.java

static boolean checkAndClose(java.io.Closeable io) {
    if (io != null) {
        try {/* w  w w. ja  v  a2s  .c o m*/
            io.close();
        } catch (IOException ioe) {
            LOG.warn(StringUtils.stringifyException(ioe));
            return false;
        }
    }
    return true;
}

From source file:org.apache.flink.runtime.blob.BlobCache.java

private void closeSilently(Closeable closeable) {
    if (closeable != null) {
        try {//  w ww .  j a  v a 2s  . c  o m
            closeable.close();
        } catch (Throwable t) {
            if (LOG.isDebugEnabled()) {
                LOG.debug("Error while closing resource after BLOB transfer.", t);
            }
        }
    }
}

From source file:com.microsoft.tfs.client.common.ui.protocolhandler.ProtocolHandlerWindowsRegistrationCommand.java

private void tryClose(final Closeable file) {
    if (file != null) {
        try {/* ww  w. j  a va 2 s . c  om*/
            file.close();
        } catch (final IOException e) {
            log.error(e);
        }
    }
}

From source file:org.springframework.cloud.stream.reactive.StreamEmitterAnnotationBeanPostProcessor.java

@Override
public void stop() {
    try {//  w  w w.j a  v  a  2  s. c  o  m
        this.lock.lock();
        if (this.running) {
            for (Closeable closeable : closeableFluxResources) {
                try {
                    closeable.close();
                } catch (IOException e) {
                    log.error("Error closing reactive source", e);
                }
            }
            this.running = false;
        }
    } finally {
        this.lock.unlock();
    }
}

From source file:org.jellycastle.maven.Maven.java

/**
 * Close stream or resource./*  w ww. jav  a2 s  . c o m*/
 * @param closeable
 */
private void close(Closeable closeable) {
    if (closeable != null) {
        try {
            closeable.close();
        } catch (Exception e) {
            log.trace("Error closing stream or resource", e);
        }
    }
}

From source file:org.apache.ace.agent.launcher.Launcher.java

private void close(Closeable resource) {
    if (resource != null) {
        try {/*from   www.  j  av a 2s  .c o  m*/
            resource.close();
        } catch (Exception exception) {
            // Ignore, nothing we can do about this...
        }
    }
}

From source file:com.sixsq.slipstream.DeploymentController.java

private void closeReliably(Closeable closeable) {
    if (closeable != null) {
        try {/*from www  .  j  ava2s.  c  o  m*/
            closeable.close();
        } catch (IOException consumed) {

        }
    }
}

From source file:org.apache.hadoop.hive.common.metrics.metrics2.CodahaleMetrics.java

public void close() throws Exception {
    if (reporters != null) {
        for (Closeable reporter : reporters) {
            reporter.close();
        }/*from ww  w  .jav  a  2s.com*/
    }
    for (Map.Entry<String, Metric> metric : metricRegistry.getMetrics().entrySet()) {
        metricRegistry.remove(metric.getKey());
    }
    timers.invalidateAll();
    counters.invalidateAll();
}