http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/8bf39571/geode-core/src/main/java/org/apache/geode/cache/DiskStoreFactory.java ---------------------------------------------------------------------- diff --git a/geode-core/src/main/java/org/apache/geode/cache/DiskStoreFactory.java b/geode-core/src/main/java/org/apache/geode/cache/DiskStoreFactory.java index 3956682..a21dd8a 100755 --- a/geode-core/src/main/java/org/apache/geode/cache/DiskStoreFactory.java +++ b/geode-core/src/main/java/org/apache/geode/cache/DiskStoreFactory.java @@ -1,18 +1,16 @@ /* - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at + * Licensed to the Apache Software Foundation (ASF) under one or more contributor license + * agreements. See the NOTICE file distributed with this work for additional information regarding + * copyright ownership. The ASF licenses this file to You under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance with the License. You may obtain a + * copy of the License at * - * http://www.apache.org/licenses/LICENSE-2.0 + * http://www.apache.org/licenses/LICENSE-2.0 * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * Unless required by applicable law or agreed to in writing, software distributed under the License + * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express + * or implied. See the License for the specific language governing permissions and limitations under + * the License. */ package org.apache.geode.cache; @@ -21,132 +19,151 @@ import org.apache.geode.distributed.internal.DistributionConfig; import java.io.File; /** - * Factory for creating instances of {@link DiskStore}. - * To get an instance of this factory call {@link Cache#createDiskStoreFactory}. - * If all you want to do is find an existing disk store see {@link Cache#findDiskStore}. + * Factory for creating instances of {@link DiskStore}. To get an instance of this factory call + * {@link Cache#createDiskStoreFactory}. If all you want to do is find an existing disk store see + * {@link Cache#findDiskStore}. * <P> - * To use this factory configure it with the <code>set</code> methods and then - * call {@link #create} to produce a disk store instance. + * To use this factory configure it with the <code>set</code> methods and then call {@link #create} + * to produce a disk store instance. * * @since GemFire 6.5 */ -public interface DiskStoreFactory -{ +public interface DiskStoreFactory { /** - * The name of the default disk store is "DEFAULT". - * This name can be used to redefine the default disk store. - * Regions that have not had their disk-store-name set will - * use this disk store. + * The name of the default disk store is "DEFAULT". This name can be used to redefine the default + * disk store. Regions that have not had their disk-store-name set will use this disk store. */ public static final String DEFAULT_DISK_STORE_NAME = "DEFAULT"; /** - * The default setting for auto compaction. - * <p>Current value: <code>true</code>. + * The default setting for auto compaction. + * <p> + * Current value: <code>true</code>. */ public static final boolean DEFAULT_AUTO_COMPACT = true; - + /** * The default compaction threshold. - * <p>Current value: <code>50</code>. + * <p> + * Current value: <code>50</code>. */ public static final int DEFAULT_COMPACTION_THRESHOLD = 50; /** * The default value of the allow force compaction attribute. - * <p>Current value: <code>false</code>. + * <p> + * Current value: <code>false</code>. */ public static final boolean DEFAULT_ALLOW_FORCE_COMPACTION = false; /** * The default maximum oplog file size in megabytes. - * <p>Current value: <code>1024</code> which is one gigabyte. + * <p> + * Current value: <code>1024</code> which is one gigabyte. */ - public static final long DEFAULT_MAX_OPLOG_SIZE = Long.getLong(DistributionConfig.GEMFIRE_PREFIX + "DEFAULT_MAX_OPLOG_SIZE", 1024L) - .longValue(); // 1024 == 1 GB; // sys prop used by dunit and junit + public static final long DEFAULT_MAX_OPLOG_SIZE = + Long.getLong(DistributionConfig.GEMFIRE_PREFIX + "DEFAULT_MAX_OPLOG_SIZE", 1024L).longValue(); // 1024 + // == + // 1 + // GB; + // // + // sys + // prop + // used + // by + // dunit + // and + // junit /** * The default time interval in milliseconds. - * <p>Current value: <code>1000</code>. + * <p> + * Current value: <code>1000</code>. */ public static final long DEFAULT_TIME_INTERVAL = 1000; // 1 sec; - + /** * The default write buffer size. - * <p>Current value: <code>32768</code>. + * <p> + * Current value: <code>32768</code>. */ public static final int DEFAULT_WRITE_BUFFER_SIZE = 32 * 1024; /** * The default maximum number of operations that can be asynchronously queued. - * <p>Current value: <code>0</code>. + * <p> + * Current value: <code>0</code>. */ public static final int DEFAULT_QUEUE_SIZE = 0; - + /** * The default disk directories. - * <p>Current value: <code>current directory</code>. + * <p> + * Current value: <code>current directory</code>. */ - public static final File[] DEFAULT_DISK_DIRS = new File[] { new File(".") }; - + public static final File[] DEFAULT_DISK_DIRS = new File[] {new File(".")}; + /** * The default disk directory size in megabytes. - * <p>Current value: <code>2,147,483,647</code> which is two petabytes. + * <p> + * Current value: <code>2,147,483,647</code> which is two petabytes. */ public static final int DEFAULT_DISK_DIR_SIZE = Integer.MAX_VALUE; // unlimited for bug 41863 - + /** * The default disk directory sizes. - * <p>Current value: {@link #DEFAULT_DISK_DIR_SIZE} which is two petabytes each. + * <p> + * Current value: {@link #DEFAULT_DISK_DIR_SIZE} which is two petabytes each. */ public static final int[] DEFAULT_DISK_DIR_SIZES = new int[] {DEFAULT_DISK_DIR_SIZE}; /** * The default disk usage warning percentage. - * <p>Current value: <code>90</code>. + * <p> + * Current value: <code>90</code>. */ public static final float DEFAULT_DISK_USAGE_WARNING_PERCENTAGE = 90; - + /** * The default disk usage critical percentage. - * <p>Current value: <code>99</code>. + * <p> + * Current value: <code>99</code>. */ public static final float DEFAULT_DISK_USAGE_CRITICAL_PERCENTAGE = 99; - - /** - * Set to <code>true</code> to cause the disk files to be automatically compacted. - * Set to <code>false</code> if no compaction is needed or manual compaction will be used. + + /** + * Set to <code>true</code> to cause the disk files to be automatically compacted. Set to + * <code>false</code> if no compaction is needed or manual compaction will be used. + * * @param isAutoCompact if true then use auto compaction * @return a reference to <code>this</code> */ public DiskStoreFactory setAutoCompact(boolean isAutoCompact); /** - * Sets the threshold at which an oplog will become compactable. Until it - * reaches this threshold the oplog will not be compacted. The threshold is a - * percentage in the range 0..100. When the amount of live data in an oplog - * becomes less than this percentage then when a compaction is done this - * garbage will be cleaned up freeing up disk space. Garbage is created by - * entry destroys, entry updates, and region destroys. + * Sets the threshold at which an oplog will become compactable. Until it reaches this threshold + * the oplog will not be compacted. The threshold is a percentage in the range 0..100. When the + * amount of live data in an oplog becomes less than this percentage then when a compaction is + * done this garbage will be cleaned up freeing up disk space. Garbage is created by entry + * destroys, entry updates, and region destroys. * - * @param compactionThreshold - * percentage of remaining live data in the oplog at which an oplog - * is compactable + * @param compactionThreshold percentage of remaining live data in the oplog at which an oplog is + * compactable * @return a reference to <code>this</code> */ public DiskStoreFactory setCompactionThreshold(int compactionThreshold); - /** - * Set to <code>true</code> to allow {@link DiskStore#forceCompaction} to be called - * on regions using this disk store. + /** + * Set to <code>true</code> to allow {@link DiskStore#forceCompaction} to be called on regions + * using this disk store. * * @param allowForceCompaction if true then allow force compaction. * @return a reference to <code>this</code> */ public DiskStoreFactory setAllowForceCompaction(boolean allowForceCompaction); - /** - * Sets the maximum size in megabytes a single oplog (operation log) is allowed to be. - * When an oplog is created this amount of file space will be immediately reserved. + /** + * Sets the maximum size in megabytes a single oplog (operation log) is allowed to be. When an + * oplog is created this amount of file space will be immediately reserved. * * @param maxOplogSize maximum size in megabytes for one single oplog file. * @return a reference to <code>this</code> @@ -154,12 +171,14 @@ public interface DiskStoreFactory public DiskStoreFactory setMaxOplogSize(long maxOplogSize); /** - * Sets the number of milliseconds that can elapse before - * data written asynchronously is flushed to disk. - * <p>For how to configure a region to be asynchronous see: {@link AttributesFactory#setDiskSynchronous}. + * Sets the number of milliseconds that can elapse before data written asynchronously is flushed + * to disk. + * <p> + * For how to configure a region to be asynchronous see: + * {@link AttributesFactory#setDiskSynchronous}. * - * @param timeInterval number of milliseconds that can elapse before - * async data is flushed to disk. + * @param timeInterval number of milliseconds that can elapse before async data is flushed to + * disk. * @return a reference to <code>this</code> */ public DiskStoreFactory setTimeInterval(long timeInterval); @@ -173,25 +192,23 @@ public interface DiskStoreFactory public DiskStoreFactory setWriteBufferSize(int writeBufferSize); /** - * Sets the maximum number of operations that can be asynchronously queued. - * Once this many pending async operations have been queued async ops will - * begin blocking until some of the queued ops have been flushed to disk. + * Sets the maximum number of operations that can be asynchronously queued. Once this many pending + * async operations have been queued async ops will begin blocking until some of the queued ops + * have been flushed to disk. * <p> * For how to configure a region to be asynchronous see: * {@link AttributesFactory#setDiskSynchronous}. * - * @param queueSize - * number of operations that can be asynchronously queued. If 0, the - * queue will be unlimited. + * @param queueSize number of operations that can be asynchronously queued. If 0, the queue will + * be unlimited. * @return a reference to <code>this</code> */ public DiskStoreFactory setQueueSize(int queueSize); /** - * Sets the directories to which this disk store's data is written. If multiple - * directories are used, GemFire will attempt to distribute the data evenly - * amongst them. - * The size of each directory will be set to the default of {@link #DEFAULT_DISK_DIR_SIZE}. + * Sets the directories to which this disk store's data is written. If multiple directories are + * used, GemFire will attempt to distribute the data evenly amongst them. The size of each + * directory will be set to the default of {@link #DEFAULT_DISK_DIR_SIZE}. * * @param diskDirs directories to put the oplog files. * @return a reference to <code>this</code> @@ -199,21 +216,20 @@ public interface DiskStoreFactory public DiskStoreFactory setDiskDirs(File[] diskDirs); /** - * Sets the directories to which this disk store's data is written - * and also set the sizes in megabytes of each directory. + * Sets the directories to which this disk store's data is written and also set the sizes in + * megabytes of each directory. * * @param diskDirs directories to put the oplog files. * @param diskDirSizes sizes of disk directories in megabytes * @return a reference to <code>this</code> * - * @throws IllegalArgumentException if length of the size array - * does not match to the length of the dir array + * @throws IllegalArgumentException if length of the size array does not match to the length of + * the dir array */ - public DiskStoreFactory setDiskDirsAndSizes(File[] diskDirs,int[] diskDirSizes); + public DiskStoreFactory setDiskDirsAndSizes(File[] diskDirs, int[] diskDirSizes); /** - * Sets the warning threshold for disk usage as a percentage of the total disk - * volume. + * Sets the warning threshold for disk usage as a percentage of the total disk volume. * * @param warningPercent warning percent of disk usage * @return a reference to <code>this</code> @@ -222,8 +238,7 @@ public interface DiskStoreFactory public DiskStoreFactory setDiskUsageWarningPercentage(float warningPercent); /** - * Sets the critical threshold for disk usage as a percentage of the total disk - * volume. + * Sets the critical threshold for disk usage as a percentage of the total disk volume. * * @param criticalPercent critical percent of disk usage * @return a reference to <code>this</code> @@ -237,8 +252,8 @@ public interface DiskStoreFactory * * @param name the name of the DiskStore * @return the newly created DiskStore. - * @throws IllegalStateException if a disk store with the given name already exists - * and its configuration is not consistent with this factory. + * @throws IllegalStateException if a disk store with the given name already exists and its + * configuration is not consistent with this factory. */ public DiskStore create(String name); }
http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/8bf39571/geode-core/src/main/java/org/apache/geode/cache/DiskWriteAttributes.java ---------------------------------------------------------------------- diff --git a/geode-core/src/main/java/org/apache/geode/cache/DiskWriteAttributes.java b/geode-core/src/main/java/org/apache/geode/cache/DiskWriteAttributes.java index bc42112..1040475 100644 --- a/geode-core/src/main/java/org/apache/geode/cache/DiskWriteAttributes.java +++ b/geode-core/src/main/java/org/apache/geode/cache/DiskWriteAttributes.java @@ -1,24 +1,22 @@ /* - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at + * Licensed to the Apache Software Foundation (ASF) under one or more contributor license + * agreements. See the NOTICE file distributed with this work for additional information regarding + * copyright ownership. The ASF licenses this file to You under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance with the License. You may obtain a + * copy of the License at * - * http://www.apache.org/licenses/LICENSE-2.0 + * http://www.apache.org/licenses/LICENSE-2.0 * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * Unless required by applicable law or agreed to in writing, software distributed under the License + * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express + * or implied. See the License for the specific language governing permissions and limitations under + * the License. */ package org.apache.geode.cache; /** - * Immutable parameter object for describing how {@linkplain - * Region.Entry region entries} should be written to disk. + * Immutable parameter object for describing how {@linkplain Region.Entry region entries} should be + * written to disk. * * @see DiskWriteAttributesFactory * @see AttributesFactory#setDiskWriteAttributes @@ -30,74 +28,66 @@ package org.apache.geode.cache; * @deprecated as of 6.5 use {@link DiskStore} instead */ @Deprecated -public interface DiskWriteAttributes - extends java.io.Serializable { +public interface DiskWriteAttributes extends java.io.Serializable { - ////////////////////// Instance Methods ////////////////////// + ////////////////////// Instance Methods ////////////////////// + - /** - * Returns true if this <code>DiskWriteAttributes</code> object - * configures synchronous writes. + * Returns true if this <code>DiskWriteAttributes</code> object configures synchronous writes. * * @return Returns true if writes to disk are synchronous and false otherwise * @deprecated as of 6.5 use {@link RegionAttributes#isDiskSynchronous} instead. */ @Deprecated public boolean isSynchronous(); - - - /** + + + /** * Returns true if the oplogs is to be rolled to a more condensed format (on disk) * * @return Returns true if the oplogs is to be rolled or false otherwise */ public boolean isRollOplogs(); - /** - * Get the maximum size in megabytes a single oplog (operation log) file should be + /** + * Get the maximum size in megabytes a single oplog (operation log) file should be * * @return the maximum size the operations log file can be - * @deprecated as of 6.5 use {@link DiskStore#getMaxOplogSize()} - * instead. + * @deprecated as of 6.5 use {@link DiskStore#getMaxOplogSize()} instead. */ @Deprecated public int getMaxOplogSize(); /** - * Returns the number of milliseconds that can elapse before - * unwritten data is written to disk. If this - * <code>DiskWriteAttributes</code> configures synchronous writing, - * then <code>timeInterval</code> has no meaning. + * Returns the number of milliseconds that can elapse before unwritten data is written to disk. If + * this <code>DiskWriteAttributes</code> configures synchronous writing, then + * <code>timeInterval</code> has no meaning. * * @return Returns the time interval in milliseconds that can elapse between two writes to disk - * @deprecated as of 6.5 use {@link DiskStore#getTimeInterval()} - * instead. + * @deprecated as of 6.5 use {@link DiskStore#getTimeInterval()} instead. */ @Deprecated public long getTimeInterval(); /** - * Returns the number of unwritten bytes of data that can be - * enqueued before being written to disk. If this - * <code>DiskWriteAttributes</code> configures synchronous writing, - * then <code>bytesThreshold</code> has no meaning. + * Returns the number of unwritten bytes of data that can be enqueued before being written to + * disk. If this <code>DiskWriteAttributes</code> configures synchronous writing, then + * <code>bytesThreshold</code> has no meaning. * * @return Returns the number of bytes that can be buffered before being written to disk - * @deprecated as of 6.5 use {@link DiskStore#getQueueSize()} - * instead. + * @deprecated as of 6.5 use {@link DiskStore#getQueueSize()} instead. */ @Deprecated public long getBytesThreshold(); /** - * Two <code>DiskWriteAttributes</code> are equal if the both - * specify the synchronous writes, or they both specify asynchronous - * writes with the same time interval, bytes threshold, maxOplogSize and - * compaction values + * Two <code>DiskWriteAttributes</code> are equal if the both specify the synchronous writes, or + * they both specify asynchronous writes with the same time interval, bytes threshold, + * maxOplogSize and compaction values * * @return true if o is equal else false */ http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/8bf39571/geode-core/src/main/java/org/apache/geode/cache/DiskWriteAttributesFactory.java ---------------------------------------------------------------------- diff --git a/geode-core/src/main/java/org/apache/geode/cache/DiskWriteAttributesFactory.java b/geode-core/src/main/java/org/apache/geode/cache/DiskWriteAttributesFactory.java index f56fc8d..c1f49c5 100755 --- a/geode-core/src/main/java/org/apache/geode/cache/DiskWriteAttributesFactory.java +++ b/geode-core/src/main/java/org/apache/geode/cache/DiskWriteAttributesFactory.java @@ -1,18 +1,16 @@ /* - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at + * Licensed to the Apache Software Foundation (ASF) under one or more contributor license + * agreements. See the NOTICE file distributed with this work for additional information regarding + * copyright ownership. The ASF licenses this file to You under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance with the License. You may obtain a + * copy of the License at * - * http://www.apache.org/licenses/LICENSE-2.0 + * http://www.apache.org/licenses/LICENSE-2.0 * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * Unless required by applicable law or agreed to in writing, software distributed under the License + * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express + * or implied. See the License for the specific language governing permissions and limitations under + * the License. */ package org.apache.geode.cache; @@ -29,8 +27,7 @@ import org.apache.geode.internal.cache.xmlcache.CacheXml; * @deprecated as of 6.5 use {@link DiskStoreFactory} instead */ @Deprecated -public final class DiskWriteAttributesFactory implements java.io.Serializable -{ +public final class DiskWriteAttributesFactory implements java.io.Serializable { private static final long serialVersionUID = -4077746249663727235L; private final Properties props = new Properties(); @@ -41,8 +38,7 @@ public final class DiskWriteAttributesFactory implements java.io.Serializable * * Creates a new instance of DiskWriteAttributesFactory ready to create a * <code>DiskWriteAttributes</code> with default settings. The default - * <code>DiskWriteAttributes</code> thus created will have following - * behaviour. + * <code>DiskWriteAttributes</code> thus created will have following behaviour. * <ul> * <li>synchronous = false * <li>auto-compact = true @@ -58,28 +54,23 @@ public final class DiskWriteAttributesFactory implements java.io.Serializable } /** - * Creates a new instance of DiskWriteAttributesFactory Factory ready to - * create a <code>DiskWriteAttributes</code> with the same settings as those - * in the specified <code>DiskWriteAttributes</code>. + * Creates a new instance of DiskWriteAttributesFactory Factory ready to create a + * <code>DiskWriteAttributes</code> with the same settings as those in the specified + * <code>DiskWriteAttributes</code>. * - * @param dwa - * the <code>DiskWriteAttributes</code> used to initialize this - * DiskWriteAttributesFactory + * @param dwa the <code>DiskWriteAttributes</code> used to initialize this + * DiskWriteAttributesFactory */ public DiskWriteAttributesFactory(DiskWriteAttributes dwa) { - this.props.setProperty(CacheXml.BYTES_THRESHOLD, - String.valueOf(dwa.getBytesThreshold())); + this.props.setProperty(CacheXml.BYTES_THRESHOLD, String.valueOf(dwa.getBytesThreshold())); long maxOplogSizeInBytes = convertToBytes(dwa.getMaxOplogSize()); - this.props.setProperty(CacheXml.MAX_OPLOG_SIZE, - String.valueOf(maxOplogSizeInBytes)); - this.props.setProperty(CacheXml.ROLL_OPLOG, - String.valueOf(dwa.isRollOplogs())); - this.props.setProperty(DiskWriteAttributesImpl.SYNCHRONOUS_PROPERTY, String - .valueOf(dwa.isSynchronous())); + this.props.setProperty(CacheXml.MAX_OPLOG_SIZE, String.valueOf(maxOplogSizeInBytes)); + this.props.setProperty(CacheXml.ROLL_OPLOG, String.valueOf(dwa.isRollOplogs())); + this.props.setProperty(DiskWriteAttributesImpl.SYNCHRONOUS_PROPERTY, + String.valueOf(dwa.isSynchronous())); if (dwa.getTimeInterval() > -1) { - this.props.setProperty(CacheXml.TIME_INTERVAL, - String.valueOf(dwa.getTimeInterval())); + this.props.setProperty(CacheXml.TIME_INTERVAL, String.valueOf(dwa.getTimeInterval())); } } @@ -87,174 +78,163 @@ public final class DiskWriteAttributesFactory implements java.io.Serializable /** * Sets whether or not the writing to the disk is synchronous. * - * @param isSynchronous - * boolean if true indicates synchronous writes + * @param isSynchronous boolean if true indicates synchronous writes * @deprecated as of 6.5 use {@link AttributesFactory#setDiskSynchronous} instead */ @Deprecated - public void setSynchronous(boolean isSynchronous) - { - this.props.setProperty(DiskWriteAttributesImpl.SYNCHRONOUS_PROPERTY, String - .valueOf(isSynchronous)); + public void setSynchronous(boolean isSynchronous) { + this.props.setProperty(DiskWriteAttributesImpl.SYNCHRONOUS_PROPERTY, + String.valueOf(isSynchronous)); } /** * Sets whether or not the rolling of Oplog is enabled . * - * @param rollingEnabled true if oplogs are to be compacted automatically; - * false if no compaction. + * @param rollingEnabled true if oplogs are to be compacted automatically; false if no compaction. * @deprecated as of 6.5 use {@link DiskStoreFactory#setAutoCompact} instead */ @Deprecated - public void setRollOplogs(boolean rollingEnabled) - { + public void setRollOplogs(boolean rollingEnabled) { this.props.setProperty(CacheXml.ROLL_OPLOG, String.valueOf(rollingEnabled)); } /** - * Sets the threshold at which an oplog will become compactable. While - * the percentage of live records in the oplog exceeds - * this threshold the oplog will not be compacted. - * Once the percentage of live is less than or equal to the threshold - * the oplog can be compacted. - * The lower the threshold the longer the compactor will wait before compacting an oplog. - * The threshold is a percentage in the range 0..100. - * The default is 50%. - * <P>Examples: - * A threshold of 100 causes any oplog that is no longer being written to - * to be compactable. - * A threshold of 0 causes only oplogs that have no live records to be compactable - * in which case the compact can simply remove the oplog file. - * A threshold of 50 causes an oplog to become compactable when half of its - * live records become dead. + * Sets the threshold at which an oplog will become compactable. While the percentage of live + * records in the oplog exceeds this threshold the oplog will not be compacted. Once the + * percentage of live is less than or equal to the threshold the oplog can be compacted. The lower + * the threshold the longer the compactor will wait before compacting an oplog. The threshold is a + * percentage in the range 0..100. The default is 50%. + * <P> + * Examples: A threshold of 100 causes any oplog that is no longer being written to to be + * compactable. A threshold of 0 causes only oplogs that have no live records to be compactable in + * which case the compact can simply remove the oplog file. A threshold of 50 causes an oplog to + * become compactable when half of its live records become dead. + * * @deprecated as of 6.5 use {@link DiskStoreFactory#setCompactionThreshold} instead */ @Deprecated public void setCompactionThreshold(int compactionThreshold) { if (compactionThreshold < 0) { - throw new IllegalArgumentException(LocalizedStrings.DiskWriteAttributesImpl_0_HAS_TO_BE_POSITIVE_NUMBER_AND_THE_VALUE_GIVEN_1_IS_NOT_ACCEPTABLE.toLocalizedString(new Object[] {CacheXml.COMPACTION_THRESHOLD, Integer.valueOf(compactionThreshold)})); + throw new IllegalArgumentException( + LocalizedStrings.DiskWriteAttributesImpl_0_HAS_TO_BE_POSITIVE_NUMBER_AND_THE_VALUE_GIVEN_1_IS_NOT_ACCEPTABLE + .toLocalizedString(new Object[] {CacheXml.COMPACTION_THRESHOLD, + Integer.valueOf(compactionThreshold)})); } else if (compactionThreshold > 100) { - throw new IllegalArgumentException(LocalizedStrings.DiskWriteAttributesImpl_0_HAS_TO_BE_LESS_THAN_2_BUT_WAS_1.toLocalizedString(new Object[] {CacheXml.COMPACTION_THRESHOLD, Integer.valueOf(compactionThreshold), Integer.valueOf(100)})); + throw new IllegalArgumentException( + LocalizedStrings.DiskWriteAttributesImpl_0_HAS_TO_BE_LESS_THAN_2_BUT_WAS_1 + .toLocalizedString(new Object[] {CacheXml.COMPACTION_THRESHOLD, + Integer.valueOf(compactionThreshold), Integer.valueOf(100)})); } - this.props.setProperty(CacheXml.COMPACTION_THRESHOLD, - String.valueOf(compactionThreshold)); + this.props.setProperty(CacheXml.COMPACTION_THRESHOLD, String.valueOf(compactionThreshold)); } - + /** - * Sets the maximum oplog size in bytes. When the active oplog size hits - * the maximum a new oplog will be created. - * <P>Note that this method sets the same attribute as {@link #setMaxOplogSize}. - * The last set of the attribute determines its value. + * Sets the maximum oplog size in bytes. When the active oplog size hits the maximum a new oplog + * will be created. + * <P> + * Note that this method sets the same attribute as {@link #setMaxOplogSize}. The last set of the + * attribute determines its value. + * * @param maxOplogSize the maximum size of the oplog in bytes. - * @throws IllegalArgumentException - * if the value specified is a negative number + * @throws IllegalArgumentException if the value specified is a negative number * @deprecated as of 6.5 use {@link DiskStoreFactory#setMaxOplogSize} instead */ @Deprecated - public void setMaxOplogSizeInBytes(long maxOplogSize) - { - + public void setMaxOplogSizeInBytes(long maxOplogSize) { + if (maxOplogSize < 0) { - throw new IllegalArgumentException(LocalizedStrings.DiskWriteAttributesFactory_MAXIMUM_OPLOG_SIZE_SPECIFIED_HAS_TO_BE_A_NONNEGATIVE_NUMBER_AND_THE_VALUE_GIVEN_0_IS_NOT_ACCEPTABLE.toLocalizedString(Long.valueOf(maxOplogSize))); + throw new IllegalArgumentException( + LocalizedStrings.DiskWriteAttributesFactory_MAXIMUM_OPLOG_SIZE_SPECIFIED_HAS_TO_BE_A_NONNEGATIVE_NUMBER_AND_THE_VALUE_GIVEN_0_IS_NOT_ACCEPTABLE + .toLocalizedString(Long.valueOf(maxOplogSize))); } - this.props.setProperty(CacheXml.MAX_OPLOG_SIZE, - String.valueOf(maxOplogSize)); + this.props.setProperty(CacheXml.MAX_OPLOG_SIZE, String.valueOf(maxOplogSize)); } /** - * Sets the maximum oplog size in megabytes. When the active oplog size hits - * the maximum a new oplog will be created. - * <P>Note that this method sets the same attribute as {@link #setMaxOplogSizeInBytes}. - * The last set of the attribute determines its value. + * Sets the maximum oplog size in megabytes. When the active oplog size hits the maximum a new + * oplog will be created. + * <P> + * Note that this method sets the same attribute as {@link #setMaxOplogSizeInBytes}. The last set + * of the attribute determines its value. + * * @param maxOplogSize the maximum size of the oplog in megabytes. - * @throws IllegalArgumentException - * if the value specified is a negative number + * @throws IllegalArgumentException if the value specified is a negative number * @deprecated as of 6.5 use {@link DiskStoreFactory#setMaxOplogSize} instead */ @Deprecated - public void setMaxOplogSize(int maxOplogSize) - { + public void setMaxOplogSize(int maxOplogSize) { if (maxOplogSize < 0) { - throw new IllegalArgumentException(LocalizedStrings.DiskWriteAttributesFactory_MAXIMUM_OPLOG_SIZE_SPECIFIED_HAS_TO_BE_A_NONNEGATIVE_NUMBER_AND_THE_VALUE_GIVEN_0_IS_NOT_ACCEPTABLE.toLocalizedString(Integer.valueOf(maxOplogSize))); + throw new IllegalArgumentException( + LocalizedStrings.DiskWriteAttributesFactory_MAXIMUM_OPLOG_SIZE_SPECIFIED_HAS_TO_BE_A_NONNEGATIVE_NUMBER_AND_THE_VALUE_GIVEN_0_IS_NOT_ACCEPTABLE + .toLocalizedString(Integer.valueOf(maxOplogSize))); } long maxOplogSizeInBytes = convertToBytes(maxOplogSize); - this.props.setProperty(CacheXml.MAX_OPLOG_SIZE, String - .valueOf(maxOplogSizeInBytes)); + this.props.setProperty(CacheXml.MAX_OPLOG_SIZE, String.valueOf(maxOplogSizeInBytes)); } /** - * Takes an int which is supposed to be in megabytes - * and converts it to a long. This conversion takes into - * account that multiplication can lead to Integer.MAX_VALUE being - * exceeded + * Takes an int which is supposed to be in megabytes and converts it to a long. This conversion + * takes into account that multiplication can lead to Integer.MAX_VALUE being exceeded + * * @param megaBytes * @return the converted value */ - private long convertToBytes(int megaBytes) - { + private long convertToBytes(int megaBytes) { long bytes = megaBytes; bytes = bytes * 1024 * 1024; return bytes; } - + /** - * Sets the number of milliseconds that can elapse before unwritten data is - * written to disk. It has significance only in case of asynchronous mode of - * writing. + * Sets the number of milliseconds that can elapse before unwritten data is written to disk. It + * has significance only in case of asynchronous mode of writing. * - * @param timeInterval - * Time interval in milliseconds - * @throws IllegalArgumentException - * if the value specified is a negative number + * @param timeInterval Time interval in milliseconds + * @throws IllegalArgumentException if the value specified is a negative number * @deprecated as of 6.5 use {@link DiskStoreFactory#setTimeInterval} instead */ @Deprecated - public void setTimeInterval(long timeInterval) - { + public void setTimeInterval(long timeInterval) { if (timeInterval < 0) { - throw new IllegalArgumentException(LocalizedStrings.DiskWriteAttributesFactory_TIME_INTERVAL_SPECIFIED_HAS_TO_BE_A_NONNEGATIVE_NUMBER_AND_THE_VALUE_GIVEN_0_IS_NOT_ACCEPTABLE.toLocalizedString(Long.valueOf(timeInterval))); + throw new IllegalArgumentException( + LocalizedStrings.DiskWriteAttributesFactory_TIME_INTERVAL_SPECIFIED_HAS_TO_BE_A_NONNEGATIVE_NUMBER_AND_THE_VALUE_GIVEN_0_IS_NOT_ACCEPTABLE + .toLocalizedString(Long.valueOf(timeInterval))); } - this.props.setProperty(CacheXml.TIME_INTERVAL, - String.valueOf(timeInterval)); + this.props.setProperty(CacheXml.TIME_INTERVAL, String.valueOf(timeInterval)); } /** - * Sets the number of unwritten bytes of data that can be enqueued before - * being written to disk. It has significance only in case of asynchronous mode - * of writing. + * Sets the number of unwritten bytes of data that can be enqueued before being written to disk. + * It has significance only in case of asynchronous mode of writing. * - * @param bytesThreshold the maximum number of bytes to enqueue before async data - * is flushed. - * @throws IllegalArgumentException - * if the value specified is a negative number + * @param bytesThreshold the maximum number of bytes to enqueue before async data is flushed. + * @throws IllegalArgumentException if the value specified is a negative number * @deprecated as of 6.5 use {@link DiskStoreFactory#setQueueSize} instead */ @Deprecated - public void setBytesThreshold(long bytesThreshold) - { + public void setBytesThreshold(long bytesThreshold) { if (bytesThreshold < 0) { - throw new IllegalArgumentException(LocalizedStrings.DiskWriteAttributesFactory_QUEUE_SIZE_SPECIFIED_HAS_TO_BE_A_NONNEGATIVE_NUMBER_AND_THE_VALUE_GIVEN_0_IS_NOT_ACCEPTABLE.toLocalizedString(Long.valueOf(bytesThreshold))); + throw new IllegalArgumentException( + LocalizedStrings.DiskWriteAttributesFactory_QUEUE_SIZE_SPECIFIED_HAS_TO_BE_A_NONNEGATIVE_NUMBER_AND_THE_VALUE_GIVEN_0_IS_NOT_ACCEPTABLE + .toLocalizedString(Long.valueOf(bytesThreshold))); } - this.props.setProperty(CacheXml.BYTES_THRESHOLD, - String.valueOf(bytesThreshold)); + this.props.setProperty(CacheXml.BYTES_THRESHOLD, String.valueOf(bytesThreshold)); } /** * Creates a <code>DiskWriteAttributes</code> with the current settings. * * @return the newly created <code>DiskWriteAttributes</code> - * @throws IllegalStateException - * if the current settings has compaction enabled with maximum Oplog - * Size specified as infinite ( represented by 0 ) * + * @throws IllegalStateException if the current settings has compaction enabled with maximum Oplog + * Size specified as infinite ( represented by 0 ) * * @since GemFire 5.1 * @deprecated as of 6.5 use {@link DiskStoreFactory#create} instead */ @Deprecated - public DiskWriteAttributes create() - { + public DiskWriteAttributes create() { return new DiskWriteAttributesImpl(this.props); } http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/8bf39571/geode-core/src/main/java/org/apache/geode/cache/DuplicatePrimaryPartitionException.java ---------------------------------------------------------------------- diff --git a/geode-core/src/main/java/org/apache/geode/cache/DuplicatePrimaryPartitionException.java b/geode-core/src/main/java/org/apache/geode/cache/DuplicatePrimaryPartitionException.java index 74a1753..9da6b04 100644 --- a/geode-core/src/main/java/org/apache/geode/cache/DuplicatePrimaryPartitionException.java +++ b/geode-core/src/main/java/org/apache/geode/cache/DuplicatePrimaryPartitionException.java @@ -1,26 +1,23 @@ /* - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at + * Licensed to the Apache Software Foundation (ASF) under one or more contributor license + * agreements. See the NOTICE file distributed with this work for additional information regarding + * copyright ownership. The ASF licenses this file to You under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance with the License. You may obtain a + * copy of the License at * - * http://www.apache.org/licenses/LICENSE-2.0 + * http://www.apache.org/licenses/LICENSE-2.0 * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * Unless required by applicable law or agreed to in writing, software distributed under the License + * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express + * or implied. See the License for the specific language governing permissions and limitations under + * the License. */ package org.apache.geode.cache; import org.apache.geode.GemFireException; /** - * This exception is thrown when two nodes are defined with same primary - * partitions + * This exception is thrown when two nodes are defined with same primary partitions * * @since GemFire 6.6 */ @@ -29,8 +26,7 @@ public class DuplicatePrimaryPartitionException extends GemFireException { private static final long serialVersionUID = 1L; /** - * Creates a new <code>DuplicatePrimaryPartitionException</code> with no - * detailed message. + * Creates a new <code>DuplicatePrimaryPartitionException</code> with no detailed message. */ public DuplicatePrimaryPartitionException() { @@ -38,24 +34,23 @@ public class DuplicatePrimaryPartitionException extends GemFireException { } /** - * Creates a new <code>DuplicatePrimaryPartitionException</code> with the - * given detail message. + * Creates a new <code>DuplicatePrimaryPartitionException</code> with the given detail message. */ public DuplicatePrimaryPartitionException(String message) { super(message); } /** - * Creates a new <code>DuplicatePrimaryPartitionException</code> with the - * given cause and no detail message + * Creates a new <code>DuplicatePrimaryPartitionException</code> with the given cause and no + * detail message */ public DuplicatePrimaryPartitionException(Throwable cause) { super(cause); } /** - * Creates a new <code>DuplicatePrimaryPartitionException</code> with the - * given detail message and cause. + * Creates a new <code>DuplicatePrimaryPartitionException</code> with the given detail message and + * cause. */ public DuplicatePrimaryPartitionException(String message, Throwable cause) { super(message, cause);
