http://git-wip-us.apache.org/repos/asf/cassandra/blob/5a090cc5/src/java/org/apache/cassandra/io/util/FileUtils.java ---------------------------------------------------------------------- diff --cc src/java/org/apache/cassandra/io/util/FileUtils.java index 3552ca9,3be7c99..9f5193b --- a/src/java/org/apache/cassandra/io/util/FileUtils.java +++ b/src/java/org/apache/cassandra/io/util/FileUtils.java @@@ -24,6 -33,6 +24,7 @@@ import java.nio.file.* import java.text.DecimalFormat; import java.util.Arrays; ++import org.apache.cassandra.config.Config; import sun.nio.ch.DirectBuffer; import org.slf4j.Logger;
http://git-wip-us.apache.org/repos/asf/cassandra/blob/5a090cc5/src/java/org/apache/cassandra/io/util/SegmentedFile.java ---------------------------------------------------------------------- diff --cc src/java/org/apache/cassandra/io/util/SegmentedFile.java index edbd742,c65ecbf..66898c6 --- a/src/java/org/apache/cassandra/io/util/SegmentedFile.java +++ b/src/java/org/apache/cassandra/io/util/SegmentedFile.java @@@ -175,12 -165,17 +175,21 @@@ public abstract class SegmentedFile ext public SegmentedFile complete(String path) { - return complete(getChannel(path), -1); - return complete(path, -1, true); - } - - public SegmentedFile complete(String path, boolean isFinal) - { - return complete(path, -1, isFinal); ++ return complete(path, -1L); } public SegmentedFile complete(String path, long overrideLength) { - return complete(getChannel(path), overrideLength); - return complete(path, overrideLength, false); ++ ChannelProxy channelCopy = getChannel(path); ++ try ++ { ++ return complete(channelCopy, overrideLength); ++ } ++ catch (Throwable t) ++ { ++ channelCopy.close(); ++ throw t; ++ } } public void serializeBounds(DataOutput out) throws IOException http://git-wip-us.apache.org/repos/asf/cassandra/blob/5a090cc5/src/java/org/apache/cassandra/service/CassandraDaemon.java ---------------------------------------------------------------------- diff --cc src/java/org/apache/cassandra/service/CassandraDaemon.java index 167d6b9,949ea4c..8388138 --- a/src/java/org/apache/cassandra/service/CassandraDaemon.java +++ b/src/java/org/apache/cassandra/service/CassandraDaemon.java @@@ -122,21 -125,16 +122,23 @@@ public class CassandraDaemo private static final CassandraDaemon instance = new CassandraDaemon(); - /** - * The earliest legit timestamp a casandra instance could have ever launched. - * Date roughly taken from http://perspectives.mvdirona.com/2008/07/12/FacebookReleasesCassandraAsOpenSource.aspx - * We use this to ensure the system clock is at least somewhat correct at startup. - */ - private static final long EARLIEST_LAUNCH_DATE = 1215820800000L; - public Server thriftServer; public Server nativeServer; - private boolean setupCompleted = false; + + private final boolean runManaged; + protected final StartupChecks startupChecks; ++ private boolean setupCompleted; + + public CassandraDaemon() { + this(false); + } + + public CassandraDaemon(boolean runManaged) { + this.runManaged = runManaged; + this.startupChecks = new StartupChecks().withDefaultTests(); ++ this.setupCompleted = false; + } + /** * This is a hook for concrete daemons to initialize themselves suitably. * @@@ -335,31 -425,15 +337,38 @@@ InetAddress nativeAddr = DatabaseDescriptor.getRpcAddress(); int nativePort = DatabaseDescriptor.getNativeTransportPort(); nativeServer = new org.apache.cassandra.transport.Server(nativeAddr, nativePort); + + setupCompleted = true; + } + + public boolean setupCompleted() + { + return setupCompleted; } + private void logSystemInfo() + { + if (logger.isInfoEnabled()) + { + try + { + logger.info("Hostname: {}", InetAddress.getLocalHost().getHostName()); + } + catch (UnknownHostException e1) + { + logger.info("Could not resolve local host"); + } + + logger.info("JVM vendor/version: {}/{}", System.getProperty("java.vm.name"), System.getProperty("java.version")); + logger.info("Heap size: {}/{}", Runtime.getRuntime().totalMemory(), Runtime.getRuntime().maxMemory()); + + for(MemoryPoolMXBean pool: ManagementFactory.getMemoryPoolMXBeans()) + logger.info("{} {}: {}", pool.getName(), pool.getType(), pool.getPeakUsage()); + + logger.info("Classpath: {}", System.getProperty("java.class.path")); + } + } + /** * Initialize the Cassandra Daemon based on the given <a * href="http://commons.apache.org/daemon/jsvc.html">Commons http://git-wip-us.apache.org/repos/asf/cassandra/blob/5a090cc5/src/java/org/apache/cassandra/service/StorageService.java ----------------------------------------------------------------------