forked from neo4j/neo4j
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Introduce cache.memory_ratio configuration for HPCache
New set-and-forget configuration that specifies cache size as a ratio of the old generation max size. Memory division across internal components of the cache is handled by fixed ratios. If any of the old config (now referred to as "advanced config") is set, it will override the memory_ratio configuration.
- Loading branch information
Showing
15 changed files
with
723 additions
and
69 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -18,3 +18,4 @@ out | |
.mailmap | ||
.java-version | ||
community/server/data | ||
enterprise/server-enterprise/data |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
46 changes: 46 additions & 0 deletions
46
community/kernel/src/main/java/org/neo4j/graphdb/config/InvalidSettingException.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
/** | ||
* Copyright (c) 2002-2014 "Neo Technology," | ||
* Network Engine for Objects in Lund AB [http://neotechnology.com] | ||
* | ||
* This file is part of Neo4j. | ||
* | ||
* Neo4j is free software: you can redistribute it and/or modify | ||
* it under the terms of the GNU General Public License as published by | ||
* the Free Software Foundation, either version 3 of the License, or | ||
* (at your option) any later version. | ||
* | ||
* This program is distributed in the hope that it will be useful, | ||
* but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
* GNU General Public License for more details. | ||
* | ||
* You should have received a copy of the GNU General Public License | ||
* along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
*/ | ||
package org.neo4j.graphdb.config; | ||
|
||
/** | ||
* Thrown when a configuration setting is, for one reason or another, invalid. | ||
*/ | ||
public class InvalidSettingException extends RuntimeException | ||
{ | ||
private final String name; | ||
|
||
public InvalidSettingException( String name, String value, String message ) | ||
{ | ||
super(String.format( "Bad value '%s' for setting '%s': %s", value, name, message )); | ||
this.name = name; | ||
} | ||
|
||
public InvalidSettingException( String name, String message ) | ||
{ | ||
super(message); | ||
this.name = name; | ||
} | ||
|
||
public String settingName() | ||
{ | ||
return name; | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
33 changes: 33 additions & 0 deletions
33
community/kernel/src/main/java/org/neo4j/kernel/impl/util/function/Optional.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
/** | ||
* Copyright (c) 2002-2014 "Neo Technology," | ||
* Network Engine for Objects in Lund AB [http://neotechnology.com] | ||
* | ||
* This file is part of Neo4j. | ||
* | ||
* Neo4j is free software: you can redistribute it and/or modify | ||
* it under the terms of the GNU General Public License as published by | ||
* the Free Software Foundation, either version 3 of the License, or | ||
* (at your option) any later version. | ||
* | ||
* This program is distributed in the hope that it will be useful, | ||
* but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
* GNU General Public License for more details. | ||
* | ||
* You should have received a copy of the GNU General Public License | ||
* along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
*/ | ||
package org.neo4j.kernel.impl.util.function; | ||
|
||
/** | ||
* Represents a value that may or may not exist. | ||
*/ | ||
public interface Optional<TYPE> | ||
{ | ||
TYPE get(); | ||
boolean isPresent(); | ||
|
||
Optional<TYPE> or(Optional<TYPE> secondChoice); | ||
Optional<TYPE> or(TYPE secondChoice); | ||
} | ||
|
119 changes: 119 additions & 0 deletions
119
community/kernel/src/main/java/org/neo4j/kernel/impl/util/function/Optionals.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,119 @@ | ||
/** | ||
* Copyright (c) 2002-2014 "Neo Technology," | ||
* Network Engine for Objects in Lund AB [http://neotechnology.com] | ||
* | ||
* This file is part of Neo4j. | ||
* | ||
* Neo4j is free software: you can redistribute it and/or modify | ||
* it under the terms of the GNU General Public License as published by | ||
* the Free Software Foundation, either version 3 of the License, or | ||
* (at your option) any later version. | ||
* | ||
* This program is distributed in the hope that it will be useful, | ||
* but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
* GNU General Public License for more details. | ||
* | ||
* You should have received a copy of the GNU General Public License | ||
* along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
*/ | ||
package org.neo4j.kernel.impl.util.function; | ||
|
||
public class Optionals | ||
{ | ||
public static final Optional NONE = new Optional(){ | ||
|
||
@Override | ||
public Object get() { | ||
throw new UnsupportedOperationException(); | ||
} | ||
|
||
@Override | ||
public boolean isPresent() { | ||
return false; | ||
} | ||
|
||
@Override | ||
public Optional or( Optional secondChoice ) { | ||
return secondChoice; | ||
} | ||
|
||
@Override | ||
public Optional or( Object secondChoice ) { | ||
return some( secondChoice ); | ||
} | ||
}; | ||
|
||
public static <TYPE> Optional<TYPE> none() | ||
{ | ||
return NONE; | ||
} | ||
|
||
public static <TYPE> Optional<TYPE> some( final TYPE obj ) | ||
{ | ||
return new Optional<TYPE>(){ | ||
|
||
@Override | ||
public TYPE get() { | ||
return obj; | ||
} | ||
|
||
@Override | ||
public boolean isPresent() { | ||
return true; | ||
} | ||
|
||
@Override | ||
public Optional<TYPE> or( Optional<TYPE> secondChoice ) { | ||
return this; | ||
} | ||
|
||
@Override | ||
public Optional<TYPE> or( TYPE secondChoice ) { | ||
return this; | ||
} | ||
}; | ||
} | ||
|
||
public static abstract class LazyOptional<TYPE> implements Optional<TYPE> | ||
{ | ||
private TYPE value; | ||
private boolean evaluated = false; | ||
|
||
protected abstract TYPE evaluate(); | ||
|
||
@Override | ||
public TYPE get() | ||
{ | ||
if(!isPresent()) | ||
{ | ||
throw new UnsupportedOperationException(); | ||
} | ||
return value(); | ||
} | ||
|
||
@Override | ||
public boolean isPresent() | ||
{ | ||
return value() != null; | ||
} | ||
|
||
@Override | ||
public Optional<TYPE> or( Optional<TYPE> secondChoice ) | ||
{ | ||
return isPresent() ? this : secondChoice; | ||
} | ||
|
||
@Override | ||
public Optional<TYPE> or( TYPE secondChoice ) | ||
{ | ||
return isPresent() ? this : some(secondChoice); | ||
} | ||
|
||
private TYPE value() | ||
{ | ||
if(!evaluated) value = evaluate(); | ||
return value; | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.