mirror of
https://github.com/Alfresco/alfresco-community-repo.git
synced 2025-08-07 17:49:17 +00:00
Fix some merge errors: removing clustering references not valid in community.
git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/HEAD/root@48571 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
@@ -1,192 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<hazelcast xsi:schemaLocation="http://www.hazelcast.com/schema/config hazelcast-basic.xsd"
|
||||
xmlns="http://www.hazelcast.com/schema/config"
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
|
||||
<group>
|
||||
<name>dev</name>
|
||||
<password>dev-pass</password>
|
||||
</group>
|
||||
<network>
|
||||
<port auto-increment="true">5701</port>
|
||||
<join>
|
||||
<multicast enabled="true">
|
||||
<multicast-group>224.2.2.3</multicast-group>
|
||||
<multicast-port>54327</multicast-port>
|
||||
</multicast>
|
||||
<tcp-ip enabled="false">
|
||||
<interface>127.0.0.1</interface>
|
||||
</tcp-ip>
|
||||
</join>
|
||||
<interfaces enabled="true">
|
||||
<interface>192.168.56.1</interface>
|
||||
</interfaces>
|
||||
<symmetric-encryption enabled="false">
|
||||
<!--
|
||||
encryption algorithm such as
|
||||
DES/ECB/PKCS5Padding,
|
||||
PBEWithMD5AndDES,
|
||||
AES/CBC/PKCS5Padding,
|
||||
Blowfish,
|
||||
DESede
|
||||
-->
|
||||
<algorithm>PBEWithMD5AndDES</algorithm>
|
||||
<!-- salt value to use when generating the secret key -->
|
||||
<salt>thesalt</salt>
|
||||
<!-- pass phrase to use when generating the secret key -->
|
||||
<password>thepass</password>
|
||||
<!-- iteration count to use when generating the secret key -->
|
||||
<iteration-count>19</iteration-count>
|
||||
</symmetric-encryption>
|
||||
<asymmetric-encryption enabled="false">
|
||||
<!-- encryption algorithm -->
|
||||
<algorithm>RSA/NONE/PKCS1PADDING</algorithm>
|
||||
<!-- private key password -->
|
||||
<keyPassword>thekeypass</keyPassword>
|
||||
<!-- private key alias -->
|
||||
<keyAlias>local</keyAlias>
|
||||
<!-- key store type -->
|
||||
<storeType>JKS</storeType>
|
||||
<!-- key store password -->
|
||||
<storePassword>thestorepass</storePassword>
|
||||
<!-- path to the key store -->
|
||||
<storePath>keystore</storePath>
|
||||
</asymmetric-encryption>
|
||||
</network>
|
||||
<executor-service>
|
||||
<core-pool-size>16</core-pool-size>
|
||||
<max-pool-size>64</max-pool-size>
|
||||
<keep-alive-seconds>60</keep-alive-seconds>
|
||||
</executor-service>
|
||||
<queue name="default">
|
||||
<!--
|
||||
Maximum size of the queue. When a JVM's local queue size reaches the maximum,
|
||||
all put/offer operations will get blocked until the queue size
|
||||
of the JVM goes down below the maximum.
|
||||
Any integer between 0 and Integer.MAX_VALUE. 0 means
|
||||
Integer.MAX_VALUE. Default is 0.
|
||||
-->
|
||||
<max-size-per-jvm>0</max-size-per-jvm>
|
||||
<!--
|
||||
Maximum number of seconds for each item to stay in the queue. Items that are
|
||||
not consumed in <time-to-live-seconds> will automatically
|
||||
get evicted from the queue.
|
||||
Any integer between 0 and Integer.MAX_VALUE. 0 means
|
||||
infinite. Default is 0.
|
||||
-->
|
||||
<time-to-live-seconds>0</time-to-live-seconds>
|
||||
</queue>
|
||||
<map name="default">
|
||||
<!--
|
||||
Number of backups. If 1 is set as the backup-count for example,
|
||||
then all entries of the map will be copied to another JVM for
|
||||
fail-safety. Valid numbers are 0 (no backup), 1, 2, 3.
|
||||
-->
|
||||
<backup-count>1</backup-count>
|
||||
<!--
|
||||
Valid values are:
|
||||
NONE (no eviction),
|
||||
LRU (Least Recently Used),
|
||||
LFU (Least Frequently Used).
|
||||
NONE is the default.
|
||||
-->
|
||||
<eviction-policy>NONE</eviction-policy>
|
||||
<!--
|
||||
Maximum size of the map. When max size is reached,
|
||||
map is evicted based on the policy defined.
|
||||
Any integer between 0 and Integer.MAX_VALUE. 0 means
|
||||
Integer.MAX_VALUE. Default is 0.
|
||||
-->
|
||||
<max-size>0</max-size>
|
||||
<!--
|
||||
When max. size is reached, specified percentage of
|
||||
the map will be evicted. Any integer between 0 and 100.
|
||||
If 25 is set for example, 25% of the entries will
|
||||
get evicted.
|
||||
-->
|
||||
<eviction-percentage>25</eviction-percentage>
|
||||
|
||||
<!--
|
||||
While recovering from split-brain (network partitioning),
|
||||
map entries in the small cluster will merge into the bigger cluster
|
||||
based on the policy set here. When an entry merge into the
|
||||
cluster, there might an existing entry with the same key already.
|
||||
Values of these entries might be different for that same key.
|
||||
Which value should be set for the key? Conflict is resolved by
|
||||
the policy set here. Default policy is hz.ADD_NEW_ENTRY
|
||||
|
||||
There are built-in merge policies such as
|
||||
hz.NO_MERGE ; no entry will merge.
|
||||
hz.ADD_NEW_ENTRY ; entry will be added if the merging entry's key
|
||||
doesn't exist in the cluster.
|
||||
hz.HIGHER_HITS ; entry with the higher hits wins.
|
||||
hz.LATEST_UPDATE ; entry with the latest update wins.
|
||||
-->
|
||||
<merge-policy>hz.ADD_NEW_ENTRY</merge-policy>
|
||||
</map>
|
||||
<!-- Add your own map merge policy implementations here:
|
||||
<merge-policies>
|
||||
<map-merge-policy name="MY_MERGE_POLICY">
|
||||
<class-name>com.acme.MyOwnMergePolicy</class-name>
|
||||
</map-merge-policy>
|
||||
</merge-policies>
|
||||
-->
|
||||
|
||||
<map name="AlfrescoFilesysCache">
|
||||
<!--
|
||||
Number of backups. If 1 is set as the backup-count for example,
|
||||
then all entries of the map will be copied to another JVM for
|
||||
fail-safety. Valid numbers are 0 (no backup), 1, 2, 3.
|
||||
-->
|
||||
<backup-count>1</backup-count>
|
||||
<!--
|
||||
Valid values are:
|
||||
NONE (no eviction),
|
||||
LRU (Least Recently Used),
|
||||
LFU (Least Frequently Used).
|
||||
NONE is the default.
|
||||
-->
|
||||
<eviction-policy>NONE</eviction-policy>
|
||||
<!--
|
||||
Maximum size of the map. When max size is reached,
|
||||
map is evicted based on the policy defined.
|
||||
Any integer between 0 and Integer.MAX_VALUE. 0 means
|
||||
Integer.MAX_VALUE. Default is 0.
|
||||
-->
|
||||
<max-size>0</max-size>
|
||||
<!--
|
||||
When max. size is reached, specified percentage of
|
||||
the map will be evicted. Any integer between 0 and 100.
|
||||
If 25 is set for example, 25% of the entries will
|
||||
get evicted.
|
||||
-->
|
||||
<eviction-percentage>25</eviction-percentage>
|
||||
|
||||
<!--
|
||||
While recovering from split-brain (network partitioning),
|
||||
map entries in the small cluster will merge into the bigger cluster
|
||||
based on the policy set here. When an entry merge into the
|
||||
cluster, there might an existing entry with the same key already.
|
||||
Values of these entries might be different for that same key.
|
||||
Which value should be set for the key? Conflict is resolved by
|
||||
the policy set here. Default policy is hz.ADD_NEW_ENTRY
|
||||
|
||||
There are built-in merge policies such as
|
||||
hz.NO_MERGE ; no entry will merge.
|
||||
hz.ADD_NEW_ENTRY ; entry will be added if the merging entry's key
|
||||
doesn't exist in the cluster.
|
||||
hz.HIGHER_HITS ; entry with the higher hits wins.
|
||||
hz.LATEST_UPDATE ; entry with the latest update wins.
|
||||
-->
|
||||
<merge-policy>hz.ADD_NEW_ENTRY</merge-policy>
|
||||
<!--
|
||||
<near-cache>
|
||||
<time-to-live-seconds>5</time-to-live-seconds>
|
||||
<max-idle-seconds>60</max-idle-seconds>
|
||||
<eviction-policy>LRU</eviction-policy>
|
||||
<max-size>1000</max-size>
|
||||
<invalidate-on-change>true</invalidate-on-change>
|
||||
</near-cache>
|
||||
-->
|
||||
</map>
|
||||
|
||||
</hazelcast>
|
@@ -1,183 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<hazelcast xsi:schemaLocation="http://www.hazelcast.com/schema/config hazelcast-basic.xsd"
|
||||
xmlns="http://www.hazelcast.com/schema/config"
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
|
||||
<group>
|
||||
<name>${alfresco.cluster.name}</name>
|
||||
<password>${alfresco.hazelcast.password}</password>
|
||||
</group>
|
||||
<network>
|
||||
<port auto-increment="true">5701</port>
|
||||
<join>
|
||||
<multicast enabled="false">
|
||||
<multicast-group>224.2.2.3</multicast-group>
|
||||
<multicast-port>54327</multicast-port>
|
||||
</multicast>
|
||||
<tcp-ip enabled="false">
|
||||
<interface>127.0.0.1</interface>
|
||||
</tcp-ip>
|
||||
<aws enabled="true">
|
||||
<access-key>${alfresco.hazelcast.ec2.accesskey}</access-key>
|
||||
<secret-key>${alfresco.hazelcast.ec2.secretkey}</secret-key>
|
||||
<!--optional, default is us-east-1 -->
|
||||
<region>${alfresco.hazelcast.ec2.region}</region>
|
||||
<!-- optional, only instances belonging to this group will be discovered, default will try all running instances -->
|
||||
<security-group-name>${alfresco.hazelcast.ec2.securitygroup}</security-group-name>
|
||||
<tag-key>${alfresco.hazelcast.ec2.tagkey}</tag-key>
|
||||
<tag-value>${alfresco.hazelcast.ec2.tagvalue}</tag-value>
|
||||
</aws>
|
||||
</join>
|
||||
<interfaces enabled="false">
|
||||
<interface>10.10.1.*</interface>
|
||||
</interfaces>
|
||||
<symmetric-encryption enabled="false">
|
||||
<!--
|
||||
encryption algorithm such as
|
||||
DES/ECB/PKCS5Padding,
|
||||
PBEWithMD5AndDES,
|
||||
AES/CBC/PKCS5Padding,
|
||||
Blowfish,
|
||||
DESede
|
||||
-->
|
||||
<algorithm>PBEWithMD5AndDES</algorithm>
|
||||
<!-- salt value to use when generating the secret key -->
|
||||
<salt>thesalt</salt>
|
||||
<!-- pass phrase to use when generating the secret key -->
|
||||
<password>thepass</password>
|
||||
<!-- iteration count to use when generating the secret key -->
|
||||
<iteration-count>19</iteration-count>
|
||||
</symmetric-encryption>
|
||||
<asymmetric-encryption enabled="false">
|
||||
<!-- encryption algorithm -->
|
||||
<algorithm>RSA/NONE/PKCS1PADDING</algorithm>
|
||||
<!-- private key password -->
|
||||
<keyPassword>thekeypass</keyPassword>
|
||||
<!-- private key alias -->
|
||||
<keyAlias>local</keyAlias>
|
||||
<!-- key store type -->
|
||||
<storeType>JKS</storeType>
|
||||
<!-- key store password -->
|
||||
<storePassword>thestorepass</storePassword>
|
||||
<!-- path to the key store -->
|
||||
<storePath>keystore</storePath>
|
||||
</asymmetric-encryption>
|
||||
</network>
|
||||
<executor-service>
|
||||
<core-pool-size>16</core-pool-size>
|
||||
<max-pool-size>64</max-pool-size>
|
||||
<keep-alive-seconds>60</keep-alive-seconds>
|
||||
</executor-service>
|
||||
<queue name="default">
|
||||
<!--
|
||||
Maximum size of the queue. When a JVM's local queue size reaches the maximum,
|
||||
all put/offer operations will get blocked until the queue size
|
||||
of the JVM goes down below the maximum.
|
||||
Any integer between 0 and Integer.MAX_VALUE. 0 means
|
||||
Integer.MAX_VALUE. Default is 0.
|
||||
-->
|
||||
<max-size-per-jvm>0</max-size-per-jvm>
|
||||
<!--
|
||||
Name of the map configuration that will be used for the backing distributed
|
||||
map for this queue.
|
||||
-->
|
||||
<backing-map-ref>default</backing-map-ref>
|
||||
</queue>
|
||||
<map name="default">
|
||||
<!--
|
||||
Number of backups. If 1 is set as the backup-count for example,
|
||||
then all entries of the map will be copied to another JVM for
|
||||
fail-safety. 0 means no backup.
|
||||
-->
|
||||
<backup-count>1</backup-count>
|
||||
<!--
|
||||
Maximum number of seconds for each entry to stay in the map. Entries that are
|
||||
older than <time-to-live-seconds> and not updated for <time-to-live-seconds>
|
||||
will get automatically evicted from the map.
|
||||
Any integer between 0 and Integer.MAX_VALUE. 0 means infinite. Default is 0.
|
||||
-->
|
||||
<time-to-live-seconds>0</time-to-live-seconds>
|
||||
<!--
|
||||
Maximum number of seconds for each entry to stay idle in the map. Entries that are
|
||||
idle(not touched) for more than <max-idle-seconds> will get
|
||||
automatically evicted from the map. Entry is touched if get, put or containsKey is called.
|
||||
Any integer between 0 and Integer.MAX_VALUE. 0 means infinite. Default is 0.
|
||||
-->
|
||||
<max-idle-seconds>0</max-idle-seconds>
|
||||
<!--
|
||||
Valid values are:
|
||||
NONE (no eviction),
|
||||
LRU (Least Recently Used),
|
||||
LFU (Least Frequently Used).
|
||||
NONE is the default.
|
||||
-->
|
||||
<eviction-policy>NONE</eviction-policy>
|
||||
<!--
|
||||
Maximum size of the map. When max size is reached,
|
||||
map is evicted based on the policy defined.
|
||||
Any integer between 0 and Integer.MAX_VALUE. 0 means
|
||||
Integer.MAX_VALUE. Default is 0.
|
||||
-->
|
||||
<max-size policy="cluster_wide_map_size">0</max-size>
|
||||
<!--
|
||||
When max. size is reached, specified percentage of
|
||||
the map will be evicted. Any integer between 0 and 100.
|
||||
If 25 is set for example, 25% of the entries will
|
||||
get evicted.
|
||||
-->
|
||||
<eviction-percentage>25</eviction-percentage>
|
||||
<!--
|
||||
While recovering from split-brain (network partitioning),
|
||||
map entries in the small cluster will merge into the bigger cluster
|
||||
based on the policy set here. When an entry merge into the
|
||||
cluster, there might an existing entry with the same key already.
|
||||
Values of these entries might be different for that same key.
|
||||
Which value should be set for the key? Conflict is resolved by
|
||||
the policy set here. Default policy is hz.ADD_NEW_ENTRY
|
||||
|
||||
There are built-in merge policies such as
|
||||
hz.NO_MERGE ; no entry will merge.
|
||||
hz.ADD_NEW_ENTRY ; entry will be added if the merging entry's key
|
||||
doesn't exist in the cluster.
|
||||
hz.HIGHER_HITS ; entry with the higher hits wins.
|
||||
hz.LATEST_UPDATE ; entry with the latest update wins.
|
||||
-->
|
||||
<merge-policy>hz.ADD_NEW_ENTRY</merge-policy>
|
||||
</map>
|
||||
|
||||
<!-- Concurrent user tracking maps -->
|
||||
<map name="org.alfresco.module.org_alfresco_module_cloud.metrics.ConcurrentUsers.*">
|
||||
<backup-count>1</backup-count>
|
||||
<time-to-live-seconds>${alfresco.hazelcast.conccurrentuser.timeToLive}</time-to-live-seconds>
|
||||
<max-idle-seconds>0</max-idle-seconds>
|
||||
<eviction-policy>LRU</eviction-policy>
|
||||
<max-size policy="cluster_wide_map_size">0</max-size>
|
||||
<eviction-percentage>25</eviction-percentage>
|
||||
<merge-policy>hz.ADD_NEW_ENTRY</merge-policy>
|
||||
<eviction-delay-seconds>15</eviction-delay-seconds>
|
||||
</map>
|
||||
|
||||
<!-- Add your own semaphore configurations here:
|
||||
<semaphore name="default">
|
||||
<initial-permits>10</initial-permits>
|
||||
<semaphore-factory enabled="true">
|
||||
<class-name>com.acme.MySemaphoreFactory</class-name>
|
||||
</semaphore-factory>
|
||||
</semaphore>
|
||||
-->
|
||||
|
||||
<!-- Add your own map merge policy implementations here:
|
||||
<merge-policies>
|
||||
<map-merge-policy name="MY_MERGE_POLICY">
|
||||
<class-name>com.acme.MyOwnMergePolicy</class-name>
|
||||
</map-merge-policy>
|
||||
</merge-policies>
|
||||
-->
|
||||
|
||||
<properties>
|
||||
<property name="hazelcast.logging.type">log4j</property>
|
||||
<property name="hazelcast.mancenter.enabled">false</property>
|
||||
<property name="hazelcast.memcache.enabled">false</property>
|
||||
<property name="hazelcast.rest.enabled">false</property>
|
||||
</properties>
|
||||
|
||||
</hazelcast>
|
@@ -1,180 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<hazelcast xsi:schemaLocation="http://www.hazelcast.com/schema/config hazelcast-basic.xsd"
|
||||
xmlns="http://www.hazelcast.com/schema/config"
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
|
||||
<group>
|
||||
<name>${alfresco.cluster.name}</name>
|
||||
<password>${alfresco.hazelcast.password}</password>
|
||||
</group>
|
||||
<network>
|
||||
<port auto-increment="true">5701</port>
|
||||
<join>
|
||||
<multicast enabled="false">
|
||||
<multicast-group>224.2.2.3</multicast-group>
|
||||
<multicast-port>54327</multicast-port>
|
||||
</multicast>
|
||||
<tcp-ip enabled="true">
|
||||
${alfresco.hazelcast.tcp.config}
|
||||
<interface>127.0.0.1</interface>
|
||||
</tcp-ip>
|
||||
<aws enabled="false">
|
||||
<access-key>my-access-key</access-key>
|
||||
<secret-key>my-secret-key</secret-key>
|
||||
<!--optional, default is us-east-1 -->
|
||||
<region>us-west-1</region>
|
||||
<!-- optional, only instances belonging to this group will be discovered, default will try all running instances -->
|
||||
<security-group-name>hazelcast-sg</security-group-name>
|
||||
<tag-key>type</tag-key>
|
||||
<tag-value>hz-nodes</tag-value>
|
||||
</aws>
|
||||
</join>
|
||||
<interfaces enabled="false">
|
||||
<interface>10.10.1.*</interface>
|
||||
</interfaces>
|
||||
<symmetric-encryption enabled="false">
|
||||
<!--
|
||||
encryption algorithm such as
|
||||
DES/ECB/PKCS5Padding,
|
||||
PBEWithMD5AndDES,
|
||||
AES/CBC/PKCS5Padding,
|
||||
Blowfish,
|
||||
DESede
|
||||
-->
|
||||
<algorithm>PBEWithMD5AndDES</algorithm>
|
||||
<!-- salt value to use when generating the secret key -->
|
||||
<salt>thesalt</salt>
|
||||
<!-- pass phrase to use when generating the secret key -->
|
||||
<password>thepass</password>
|
||||
<!-- iteration count to use when generating the secret key -->
|
||||
<iteration-count>19</iteration-count>
|
||||
</symmetric-encryption>
|
||||
<asymmetric-encryption enabled="false">
|
||||
<!-- encryption algorithm -->
|
||||
<algorithm>RSA/NONE/PKCS1PADDING</algorithm>
|
||||
<!-- private key password -->
|
||||
<keyPassword>thekeypass</keyPassword>
|
||||
<!-- private key alias -->
|
||||
<keyAlias>local</keyAlias>
|
||||
<!-- key store type -->
|
||||
<storeType>JKS</storeType>
|
||||
<!-- key store password -->
|
||||
<storePassword>thestorepass</storePassword>
|
||||
<!-- path to the key store -->
|
||||
<storePath>keystore</storePath>
|
||||
</asymmetric-encryption>
|
||||
</network>
|
||||
<executor-service>
|
||||
<core-pool-size>16</core-pool-size>
|
||||
<max-pool-size>64</max-pool-size>
|
||||
<keep-alive-seconds>60</keep-alive-seconds>
|
||||
</executor-service>
|
||||
<queue name="default">
|
||||
<!--
|
||||
Maximum size of the queue. When a JVM's local queue size reaches the maximum,
|
||||
all put/offer operations will get blocked until the queue size
|
||||
of the JVM goes down below the maximum.
|
||||
Any integer between 0 and Integer.MAX_VALUE. 0 means
|
||||
Integer.MAX_VALUE. Default is 0.
|
||||
-->
|
||||
<max-size-per-jvm>0</max-size-per-jvm>
|
||||
<!--
|
||||
Name of the map configuration that will be used for the backing distributed
|
||||
map for this queue.
|
||||
-->
|
||||
<backing-map-ref>default</backing-map-ref>
|
||||
</queue>
|
||||
<map name="default">
|
||||
<!--
|
||||
Number of backups. If 1 is set as the backup-count for example,
|
||||
then all entries of the map will be copied to another JVM for
|
||||
fail-safety. 0 means no backup.
|
||||
-->
|
||||
<backup-count>1</backup-count>
|
||||
<!--
|
||||
Maximum number of seconds for each entry to stay in the map. Entries that are
|
||||
older than <time-to-live-seconds> and not updated for <time-to-live-seconds>
|
||||
will get automatically evicted from the map.
|
||||
Any integer between 0 and Integer.MAX_VALUE. 0 means infinite. Default is 0.
|
||||
-->
|
||||
<time-to-live-seconds>0</time-to-live-seconds>
|
||||
<!--
|
||||
Maximum number of seconds for each entry to stay idle in the map. Entries that are
|
||||
idle(not touched) for more than <max-idle-seconds> will get
|
||||
automatically evicted from the map. Entry is touched if get, put or containsKey is called.
|
||||
Any integer between 0 and Integer.MAX_VALUE. 0 means infinite. Default is 0.
|
||||
-->
|
||||
<max-idle-seconds>0</max-idle-seconds>
|
||||
<!--
|
||||
Valid values are:
|
||||
NONE (no eviction),
|
||||
LRU (Least Recently Used),
|
||||
LFU (Least Frequently Used).
|
||||
NONE is the default.
|
||||
-->
|
||||
<eviction-policy>NONE</eviction-policy>
|
||||
<!--
|
||||
Maximum size of the map. When max size is reached,
|
||||
map is evicted based on the policy defined.
|
||||
Any integer between 0 and Integer.MAX_VALUE. 0 means
|
||||
Integer.MAX_VALUE. Default is 0.
|
||||
-->
|
||||
<max-size policy="cluster_wide_map_size">0</max-size>
|
||||
<!--
|
||||
When max. size is reached, specified percentage of
|
||||
the map will be evicted. Any integer between 0 and 100.
|
||||
If 25 is set for example, 25% of the entries will
|
||||
get evicted.
|
||||
-->
|
||||
<eviction-percentage>25</eviction-percentage>
|
||||
<!--
|
||||
While recovering from split-brain (network partitioning),
|
||||
map entries in the small cluster will merge into the bigger cluster
|
||||
based on the policy set here. When an entry merge into the
|
||||
cluster, there might an existing entry with the same key already.
|
||||
Values of these entries might be different for that same key.
|
||||
Which value should be set for the key? Conflict is resolved by
|
||||
the policy set here. Default policy is hz.ADD_NEW_ENTRY
|
||||
|
||||
There are built-in merge policies such as
|
||||
hz.NO_MERGE ; no entry will merge.
|
||||
hz.ADD_NEW_ENTRY ; entry will be added if the merging entry's key
|
||||
doesn't exist in the cluster.
|
||||
hz.HIGHER_HITS ; entry with the higher hits wins.
|
||||
hz.LATEST_UPDATE ; entry with the latest update wins.
|
||||
-->
|
||||
<merge-policy>hz.ADD_NEW_ENTRY</merge-policy>
|
||||
</map>
|
||||
|
||||
<!-- Concurrent user tracking maps -->
|
||||
<map name="org.alfresco.module.org_alfresco_module_cloud.metrics.ConcurrentUsers.*">
|
||||
<backup-count>1</backup-count>
|
||||
<time-to-live-seconds>${alfresco.hazelcast.conccurrentuser.timeToLive}</time-to-live-seconds>
|
||||
<max-idle-seconds>0</max-idle-seconds>
|
||||
<eviction-policy>LRU</eviction-policy>
|
||||
<max-size policy="cluster_wide_map_size">0</max-size>
|
||||
<eviction-percentage>25</eviction-percentage>
|
||||
<merge-policy>hz.ADD_NEW_ENTRY</merge-policy>
|
||||
<eviction-delay-seconds>15</eviction-delay-seconds>
|
||||
</map>
|
||||
|
||||
<!-- Add your own semaphore configurations here:
|
||||
<semaphore name="default">
|
||||
<initial-permits>10</initial-permits>
|
||||
<semaphore-factory enabled="true">
|
||||
<class-name>com.acme.MySemaphoreFactory</class-name>
|
||||
</semaphore-factory>
|
||||
</semaphore>
|
||||
-->
|
||||
|
||||
<!-- Add your own map merge policy implementations here:
|
||||
<merge-policies>
|
||||
<map-merge-policy name="MY_MERGE_POLICY">
|
||||
<class-name>com.acme.MyOwnMergePolicy</class-name>
|
||||
</map-merge-policy>
|
||||
</merge-policies>
|
||||
-->
|
||||
|
||||
<properties>
|
||||
<property name="hazelcast.logging.type">log4j</property>
|
||||
</properties>
|
||||
</hazelcast>
|
@@ -1,179 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<hazelcast xsi:schemaLocation="http://www.hazelcast.com/schema/config hazelcast-basic.xsd"
|
||||
xmlns="http://www.hazelcast.com/schema/config"
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
|
||||
<group>
|
||||
<name>${alfresco.cluster.name}</name>
|
||||
<password>${alfresco.hazelcast.password}</password>
|
||||
</group>
|
||||
<network>
|
||||
<port auto-increment="true">5701</port>
|
||||
<join>
|
||||
<multicast enabled="true">
|
||||
<multicast-group>224.2.2.3</multicast-group>
|
||||
<multicast-port>54327</multicast-port>
|
||||
</multicast>
|
||||
<tcp-ip enabled="false">
|
||||
<interface>127.0.0.1</interface>
|
||||
</tcp-ip>
|
||||
<aws enabled="false">
|
||||
<access-key>my-access-key</access-key>
|
||||
<secret-key>my-secret-key</secret-key>
|
||||
<!--optional, default is us-east-1 -->
|
||||
<region>us-west-1</region>
|
||||
<!-- optional, only instances belonging to this group will be discovered, default will try all running instances -->
|
||||
<security-group-name>hazelcast-sg</security-group-name>
|
||||
<tag-key>type</tag-key>
|
||||
<tag-value>hz-nodes</tag-value>
|
||||
</aws>
|
||||
</join>
|
||||
<interfaces enabled="false">
|
||||
<interface>10.10.1.*</interface>
|
||||
</interfaces>
|
||||
<symmetric-encryption enabled="false">
|
||||
<!--
|
||||
encryption algorithm such as
|
||||
DES/ECB/PKCS5Padding,
|
||||
PBEWithMD5AndDES,
|
||||
AES/CBC/PKCS5Padding,
|
||||
Blowfish,
|
||||
DESede
|
||||
-->
|
||||
<algorithm>PBEWithMD5AndDES</algorithm>
|
||||
<!-- salt value to use when generating the secret key -->
|
||||
<salt>thesalt</salt>
|
||||
<!-- pass phrase to use when generating the secret key -->
|
||||
<password>thepass</password>
|
||||
<!-- iteration count to use when generating the secret key -->
|
||||
<iteration-count>19</iteration-count>
|
||||
</symmetric-encryption>
|
||||
<asymmetric-encryption enabled="false">
|
||||
<!-- encryption algorithm -->
|
||||
<algorithm>RSA/NONE/PKCS1PADDING</algorithm>
|
||||
<!-- private key password -->
|
||||
<keyPassword>thekeypass</keyPassword>
|
||||
<!-- private key alias -->
|
||||
<keyAlias>local</keyAlias>
|
||||
<!-- key store type -->
|
||||
<storeType>JKS</storeType>
|
||||
<!-- key store password -->
|
||||
<storePassword>thestorepass</storePassword>
|
||||
<!-- path to the key store -->
|
||||
<storePath>keystore</storePath>
|
||||
</asymmetric-encryption>
|
||||
</network>
|
||||
<executor-service>
|
||||
<core-pool-size>16</core-pool-size>
|
||||
<max-pool-size>64</max-pool-size>
|
||||
<keep-alive-seconds>60</keep-alive-seconds>
|
||||
</executor-service>
|
||||
<queue name="default">
|
||||
<!--
|
||||
Maximum size of the queue. When a JVM's local queue size reaches the maximum,
|
||||
all put/offer operations will get blocked until the queue size
|
||||
of the JVM goes down below the maximum.
|
||||
Any integer between 0 and Integer.MAX_VALUE. 0 means
|
||||
Integer.MAX_VALUE. Default is 0.
|
||||
-->
|
||||
<max-size-per-jvm>0</max-size-per-jvm>
|
||||
<!--
|
||||
Name of the map configuration that will be used for the backing distributed
|
||||
map for this queue.
|
||||
-->
|
||||
<backing-map-ref>default</backing-map-ref>
|
||||
</queue>
|
||||
<map name="default">
|
||||
<!--
|
||||
Number of backups. If 1 is set as the backup-count for example,
|
||||
then all entries of the map will be copied to another JVM for
|
||||
fail-safety. 0 means no backup.
|
||||
-->
|
||||
<backup-count>1</backup-count>
|
||||
<!--
|
||||
Maximum number of seconds for each entry to stay in the map. Entries that are
|
||||
older than <time-to-live-seconds> and not updated for <time-to-live-seconds>
|
||||
will get automatically evicted from the map.
|
||||
Any integer between 0 and Integer.MAX_VALUE. 0 means infinite. Default is 0.
|
||||
-->
|
||||
<time-to-live-seconds>0</time-to-live-seconds>
|
||||
<!--
|
||||
Maximum number of seconds for each entry to stay idle in the map. Entries that are
|
||||
idle(not touched) for more than <max-idle-seconds> will get
|
||||
automatically evicted from the map. Entry is touched if get, put or containsKey is called.
|
||||
Any integer between 0 and Integer.MAX_VALUE. 0 means infinite. Default is 0.
|
||||
-->
|
||||
<max-idle-seconds>0</max-idle-seconds>
|
||||
<!--
|
||||
Valid values are:
|
||||
NONE (no eviction),
|
||||
LRU (Least Recently Used),
|
||||
LFU (Least Frequently Used).
|
||||
NONE is the default.
|
||||
-->
|
||||
<eviction-policy>NONE</eviction-policy>
|
||||
<!--
|
||||
Maximum size of the map. When max size is reached,
|
||||
map is evicted based on the policy defined.
|
||||
Any integer between 0 and Integer.MAX_VALUE. 0 means
|
||||
Integer.MAX_VALUE. Default is 0.
|
||||
-->
|
||||
<max-size policy="cluster_wide_map_size">0</max-size>
|
||||
<!--
|
||||
When max. size is reached, specified percentage of
|
||||
the map will be evicted. Any integer between 0 and 100.
|
||||
If 25 is set for example, 25% of the entries will
|
||||
get evicted.
|
||||
-->
|
||||
<eviction-percentage>25</eviction-percentage>
|
||||
<!--
|
||||
While recovering from split-brain (network partitioning),
|
||||
map entries in the small cluster will merge into the bigger cluster
|
||||
based on the policy set here. When an entry merge into the
|
||||
cluster, there might an existing entry with the same key already.
|
||||
Values of these entries might be different for that same key.
|
||||
Which value should be set for the key? Conflict is resolved by
|
||||
the policy set here. Default policy is hz.ADD_NEW_ENTRY
|
||||
|
||||
There are built-in merge policies such as
|
||||
hz.NO_MERGE ; no entry will merge.
|
||||
hz.ADD_NEW_ENTRY ; entry will be added if the merging entry's key
|
||||
doesn't exist in the cluster.
|
||||
hz.HIGHER_HITS ; entry with the higher hits wins.
|
||||
hz.LATEST_UPDATE ; entry with the latest update wins.
|
||||
-->
|
||||
<merge-policy>hz.ADD_NEW_ENTRY</merge-policy>
|
||||
</map>
|
||||
|
||||
<!-- Concurrent user tracking maps -->
|
||||
<map name="org.alfresco.module.org_alfresco_module_cloud.metrics.ConcurrentUsers.*">
|
||||
<backup-count>1</backup-count>
|
||||
<time-to-live-seconds>${alfresco.hazelcast.conccurrentuser.timeToLive}</time-to-live-seconds>
|
||||
<max-idle-seconds>0</max-idle-seconds>
|
||||
<eviction-policy>LRU</eviction-policy>
|
||||
<max-size policy="cluster_wide_map_size">0</max-size>
|
||||
<eviction-percentage>25</eviction-percentage>
|
||||
<merge-policy>hz.ADD_NEW_ENTRY</merge-policy>
|
||||
<eviction-delay-seconds>15</eviction-delay-seconds>
|
||||
</map>
|
||||
|
||||
<!-- Add your own semaphore configurations here:
|
||||
<semaphore name="default">
|
||||
<initial-permits>10</initial-permits>
|
||||
<semaphore-factory enabled="true">
|
||||
<class-name>com.acme.MySemaphoreFactory</class-name>
|
||||
</semaphore-factory>
|
||||
</semaphore>
|
||||
-->
|
||||
|
||||
<!-- Add your own map merge policy implementations here:
|
||||
<merge-policies>
|
||||
<map-merge-policy name="MY_MERGE_POLICY">
|
||||
<class-name>com.acme.MyOwnMergePolicy</class-name>
|
||||
</map-merge-policy>
|
||||
</merge-policies>
|
||||
-->
|
||||
|
||||
<properties>
|
||||
<property name="hazelcast.logging.type">log4j</property>
|
||||
</properties>
|
||||
</hazelcast>
|
@@ -141,25 +141,6 @@ index.reindexMissingContent.cronExpression=* * * * * ? 2099
|
||||
system.bootstrap.config_check.strict=true
|
||||
|
||||
|
||||
# Hazelcast clustering configuration
|
||||
# Password to join the cluster
|
||||
alfresco.hazelcast.password=alfrescocluster
|
||||
# Protocol used for member discovery (tcp, ec2, udp)
|
||||
alfresco.hazelcast.protocol=tcp
|
||||
# Location of the Hazelcast configuration file
|
||||
alfresco.hazelcast.configLocation=classpath:alfresco/hazelcast/hazelcast-${alfresco.hazelcast.protocol}.xml
|
||||
# XML elements to incorporate into Hazelcast config, in particular
|
||||
# hostnames to use for membership discovery
|
||||
alfresco.hazelcast.tcp.config=<hostname>localhost</hostname>
|
||||
# Amazon Web Services - EC2 discovery
|
||||
alfresco.hazelcast.ec2.accesskey=my-access-key
|
||||
alfresco.hazelcast.ec2.secretkey=my-secret-key
|
||||
alfresco.hazelcast.ec2.region=us-east-1
|
||||
# Only instances belonging to this group will be discovered, default will try all running instances
|
||||
alfresco.hazelcast.ec2.securitygroup=
|
||||
alfresco.hazelcast.ec2.tagkey=type
|
||||
alfresco.hazelcast.ec2.tagvalue=hz-nodes
|
||||
|
||||
# Time to live for concurrent user credentials
|
||||
alfresco.conccurrentusers.timeToLive=300
|
||||
|
||||
|
@@ -25,38 +25,7 @@
|
||||
<property name="activitiesEnabled" value="${system.webdav.activities.enabled}"/>
|
||||
</bean>
|
||||
|
||||
<bean id="webdavLockStoreFactory" class="org.alfresco.repo.webdav.LockStoreFactoryImpl">
|
||||
<property name="clusterName" value="${alfresco.cluster.name}"/>
|
||||
<property name="hazelcastInstanceFactory" ref="hazelcastInstanceFactory"/>
|
||||
</bean>
|
||||
|
||||
<bean id="hazelcastConfig" class="org.alfresco.repo.cluster.HazelcastConfigFactoryBean">
|
||||
<property name="configFile" value="${alfresco.hazelcast.configLocation}"/>
|
||||
<property name="properties">
|
||||
<props>
|
||||
<!-- Common options -->
|
||||
<prop key="alfresco.cluster.name">${alfresco.cluster.name}</prop>
|
||||
<prop key="alfresco.hazelcast.password">${alfresco.hazelcast.password}</prop>
|
||||
<prop key="alfresco.hazelcast.specify.interface">${alfresco.hazelcast.specify.interface}</prop>
|
||||
<prop key="alfresco.hazelcast.bind.interface">${alfresco.hazelcast.bind.interface}</prop>
|
||||
<!-- TCP/IP discovery options -->
|
||||
<prop key="alfresco.hazelcast.tcp.config">${alfresco.hazelcast.tcp.config}</prop>
|
||||
<!-- AWS discovery options -->
|
||||
<prop key="alfresco.hazelcast.ec2.accesskey">${alfresco.hazelcast.ec2.accesskey}</prop>
|
||||
<prop key="alfresco.hazelcast.ec2.secretkey">${alfresco.hazelcast.ec2.secretkey}</prop>
|
||||
<prop key="alfresco.hazelcast.ec2.region">${alfresco.hazelcast.ec2.region}</prop>
|
||||
<prop key="alfresco.hazelcast.ec2.securitygroup">${alfresco.hazelcast.ec2.securitygroup}</prop>
|
||||
<prop key="alfresco.hazelcast.ec2.tagkey">${alfresco.hazelcast.ec2.tagkey}</prop>
|
||||
<prop key="alfresco.hazelcast.ec2.tagvalue">${alfresco.hazelcast.ec2.tagvalue}</prop>
|
||||
<!-- Map specific options -->
|
||||
<prop key="alfresco.hazelcast.conccurrentuser.timeToLive">${alfresco.conccurrentusers.timeToLive}</prop>
|
||||
</props>
|
||||
</property>
|
||||
</bean>
|
||||
|
||||
<bean id="hazelcastInstanceFactory" class="org.alfresco.repo.cluster.HazelcastInstanceFactory">
|
||||
<property name="config" ref="hazelcastConfig"/>
|
||||
</bean>
|
||||
<bean id="webdavLockStoreFactory" class="org.alfresco.repo.webdav.SimpleLockStoreFactory"/>
|
||||
|
||||
<!-- Configure remote-api source related beans in remote-api-context.xml to ensure no dependency problems -->
|
||||
</beans>
|
@@ -1,172 +0,0 @@
|
||||
/*
|
||||
* Copyright (C) 2005-2012 Alfresco Software Limited.
|
||||
*
|
||||
* This file is part of Alfresco
|
||||
*
|
||||
* Alfresco is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Lesser General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* Alfresco 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 Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public License
|
||||
* along with Alfresco. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package org.alfresco.repo.cluster;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
import java.io.StringWriter;
|
||||
import java.util.Properties;
|
||||
import java.util.regex.Pattern;
|
||||
|
||||
import org.apache.commons.io.IOUtils;
|
||||
import org.springframework.beans.factory.FactoryBean;
|
||||
import org.springframework.beans.factory.InitializingBean;
|
||||
import org.springframework.core.io.Resource;
|
||||
|
||||
import com.hazelcast.config.Config;
|
||||
import com.hazelcast.config.InMemoryXmlConfig;
|
||||
|
||||
/**
|
||||
* FactoryBean used to create Hazelcast {@link Config} objects. A configuration file is supplied
|
||||
* in the form of a Spring {@link Resource} and a set of {@link Properties} can also be provided. The
|
||||
* XML file is processed so that property placeholders of the form ${property.name} are substitued for
|
||||
* the corresponding property value before the XML is parsed into the Hazelcast configuration object.
|
||||
*
|
||||
* @author Matt Ward
|
||||
*/
|
||||
public class HazelcastConfigFactoryBean implements InitializingBean, FactoryBean<Config>
|
||||
{
|
||||
private static final String PLACEHOLDER_END = "}";
|
||||
private static final String PLACEHOLDER_START = "${";
|
||||
private Resource configFile;
|
||||
private Config config;
|
||||
private Properties properties;
|
||||
|
||||
|
||||
/**
|
||||
* Set the Hazelcast XML configuration file to use. This will be merged with the supplied
|
||||
* Properties and parsed to produce a final {@link Config} object.
|
||||
* @param configFile the configFile to set
|
||||
*/
|
||||
public void setConfigFile(Resource configFile)
|
||||
{
|
||||
this.configFile = configFile;
|
||||
}
|
||||
|
||||
/**
|
||||
* Used to supply the set of Properties that the configuration file can reference.
|
||||
*
|
||||
* @param properties the properties to set
|
||||
*/
|
||||
public void setProperties(Properties properties)
|
||||
{
|
||||
this.properties = properties;
|
||||
}
|
||||
|
||||
/**
|
||||
* Spring {@link InitializingBean} lifecycle method. Substitutes property placeholders for their
|
||||
* corresponding values and creates a {@link Config Hazelcast configuration} with the post-processed
|
||||
* XML file - ready for the {@link #getObject()} factory method to be used to retrieve it.
|
||||
*/
|
||||
@Override
|
||||
public void afterPropertiesSet() throws Exception
|
||||
{
|
||||
if (configFile == null)
|
||||
{
|
||||
throw new IllegalArgumentException("No configuration file specified.");
|
||||
}
|
||||
if (properties == null)
|
||||
{
|
||||
properties = new Properties();
|
||||
}
|
||||
|
||||
// These configXML strings will be large and are therefore intended
|
||||
// to be thrown away. We only want to keep the final Config object.
|
||||
String rawConfigXML = getConfigFileContents();
|
||||
String configXML = substituteProperties(rawConfigXML);
|
||||
config = new InMemoryXmlConfig(configXML);
|
||||
}
|
||||
|
||||
/**
|
||||
* For the method parameter <code>text</code>, replaces all occurrences of placeholders having
|
||||
* the form ${property.name} with the value of the property having the key "property.name". The
|
||||
* properties are supplied using {@link #setProperties(Properties)}.
|
||||
*
|
||||
* @param text The String to apply property substitutions to.
|
||||
* @return String after substitutions have been applied.
|
||||
*/
|
||||
private String substituteProperties(String text)
|
||||
{
|
||||
for (String propName : properties.stringPropertyNames())
|
||||
{
|
||||
String propValue = properties.getProperty(propName);
|
||||
String quotedPropName = Pattern.quote(PLACEHOLDER_START + propName + PLACEHOLDER_END);
|
||||
text = text.replaceAll(quotedPropName, propValue);
|
||||
}
|
||||
|
||||
return text;
|
||||
}
|
||||
|
||||
/**
|
||||
* Opens the configFile {@link Resource} and reads the contents into a String.
|
||||
*
|
||||
* @return the contents of the configFile resource.
|
||||
*/
|
||||
private String getConfigFileContents()
|
||||
{
|
||||
StringWriter writer = new StringWriter();
|
||||
InputStream inputStream = null;
|
||||
try
|
||||
{
|
||||
inputStream = configFile.getInputStream();
|
||||
IOUtils.copy(inputStream, writer, "UTF-8");
|
||||
return writer.toString();
|
||||
}
|
||||
catch (IOException e)
|
||||
{
|
||||
throw new RuntimeException("Couldn't read configuration: " + configFile, e);
|
||||
}
|
||||
finally
|
||||
{
|
||||
try
|
||||
{
|
||||
if (inputStream != null)
|
||||
{
|
||||
inputStream.close();
|
||||
}
|
||||
}
|
||||
catch (IOException e)
|
||||
{
|
||||
throw new RuntimeException("Couldn't close stream", e);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* FactoryBean's factory method. Returns the config with the property key/value
|
||||
* substitutions in place.
|
||||
*/
|
||||
@Override
|
||||
public Config getObject() throws Exception
|
||||
{
|
||||
return config;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Class<?> getObjectType()
|
||||
{
|
||||
return Config.class;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isSingleton()
|
||||
{
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
@@ -1,69 +0,0 @@
|
||||
/*
|
||||
* Copyright (C) 2005-2012 Alfresco Software Limited.
|
||||
*
|
||||
* This file is part of Alfresco
|
||||
*
|
||||
* Alfresco is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Lesser General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* Alfresco 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 Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public License
|
||||
* along with Alfresco. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package org.alfresco.repo.cluster;
|
||||
|
||||
import static org.junit.Assert.assertEquals;
|
||||
|
||||
import java.util.Properties;
|
||||
|
||||
import org.junit.Before;
|
||||
import org.junit.Test;
|
||||
import org.springframework.core.io.ClassPathResource;
|
||||
import org.springframework.core.io.Resource;
|
||||
|
||||
import com.hazelcast.config.Config;
|
||||
|
||||
/**
|
||||
* Tests for the HazelcastConfigFactoryBean class.
|
||||
*
|
||||
* @author Matt Ward
|
||||
*/
|
||||
public class HazelcastConfigFactoryBeanTest
|
||||
{
|
||||
private HazelcastConfigFactoryBean configFactory;
|
||||
private Resource resource;
|
||||
private Properties properties;
|
||||
|
||||
@Before
|
||||
public void setUp() throws Exception
|
||||
{
|
||||
configFactory = new HazelcastConfigFactoryBean();
|
||||
resource = new ClassPathResource("cluster-test/placeholder-test.xml");
|
||||
configFactory.setConfigFile(resource);
|
||||
|
||||
properties = new Properties();
|
||||
properties.setProperty("alfresco.hazelcast.password", "let-me-in");
|
||||
properties.setProperty("alfresco.cluster.name", "cluster-name");
|
||||
configFactory.setProperties(properties);
|
||||
|
||||
// Trigger the spring post-bean creation lifecycle method
|
||||
configFactory.afterPropertiesSet();
|
||||
}
|
||||
|
||||
|
||||
@Test
|
||||
public void testConfigHasNewPropertyValues() throws Exception
|
||||
{
|
||||
// Invoke the factory method.
|
||||
Config config = configFactory.getObject();
|
||||
|
||||
assertEquals("let-me-in", config.getGroupConfig().getPassword());
|
||||
assertEquals("cluster-name", config.getGroupConfig().getName());
|
||||
}
|
||||
}
|
||||
|
@@ -1,139 +0,0 @@
|
||||
/*
|
||||
* Copyright (C) 2005-2013 Alfresco Software Limited.
|
||||
*
|
||||
* This file is part of Alfresco
|
||||
*
|
||||
* Alfresco is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Lesser General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* Alfresco 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 Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public License
|
||||
* along with Alfresco. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package org.alfresco.repo.cluster;
|
||||
|
||||
import java.util.concurrent.locks.ReentrantReadWriteLock;
|
||||
|
||||
import org.alfresco.util.PropertyCheck;
|
||||
|
||||
import com.hazelcast.config.Config;
|
||||
import com.hazelcast.core.Hazelcast;
|
||||
import com.hazelcast.core.HazelcastInstance;
|
||||
|
||||
/**
|
||||
* Provides a way of lazily creating HazelcastInstances for a given configuration.
|
||||
* The HazelcastInstance will not be created until {@link #getInstance()} is called.
|
||||
* <p>
|
||||
* An intermediary class such as this is required in order to avoid starting
|
||||
* Hazelcast instances when clustering is not configured/required. Otherwise
|
||||
* simply by defining a HazelcastInstance bean clustering would spring into life.
|
||||
* <p>
|
||||
* Please note this class provides non-static access deliberately, and should be
|
||||
* injected into any clients that require its services.
|
||||
*
|
||||
* @author Matt Ward
|
||||
*/
|
||||
public class HazelcastInstanceFactory
|
||||
{
|
||||
private Config config;
|
||||
private HazelcastInstance hazelcastInstance;
|
||||
/** Guards {@link #config} and {@link #hazelcastInstance} */
|
||||
private ReentrantReadWriteLock rwLock = new ReentrantReadWriteLock();
|
||||
|
||||
public HazelcastInstance getInstance()
|
||||
{
|
||||
rwLock.readLock().lock();
|
||||
try
|
||||
{
|
||||
if (hazelcastInstance != null)
|
||||
{
|
||||
return hazelcastInstance;
|
||||
}
|
||||
}
|
||||
finally
|
||||
{
|
||||
rwLock.readLock().unlock();
|
||||
}
|
||||
|
||||
// hazelcastInstance is null, so create it.
|
||||
rwLock.writeLock().lock();
|
||||
try
|
||||
{
|
||||
// Double check condition hasn't changed in between locks.
|
||||
if (hazelcastInstance == null)
|
||||
{
|
||||
hazelcastInstance = Hazelcast.newHazelcastInstance(config);
|
||||
}
|
||||
return hazelcastInstance;
|
||||
}
|
||||
finally
|
||||
{
|
||||
rwLock.writeLock().unlock();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks whether hazelcast has been given a valid cluster name. If so,
|
||||
* then clustering is considered enabled. This condition should be checked
|
||||
* before calling {@link #getInstance()}.
|
||||
*
|
||||
* @return true if clustering is enabled, false otherwise.
|
||||
*/
|
||||
public boolean isClusteringEnabled()
|
||||
{
|
||||
rwLock.readLock().lock();
|
||||
try
|
||||
{
|
||||
String clusterName = config.getGroupConfig().getName();
|
||||
return (PropertyCheck.isValidPropertyString(clusterName));
|
||||
}
|
||||
finally
|
||||
{
|
||||
rwLock.readLock().unlock();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Retrieve the name of the cluster for the configuration used by this factory.
|
||||
*
|
||||
* @return String - the cluster name.
|
||||
*/
|
||||
public String getClusterName()
|
||||
{
|
||||
rwLock.readLock().lock();
|
||||
try
|
||||
{
|
||||
String clusterName = config.getGroupConfig().getName();
|
||||
return clusterName;
|
||||
}
|
||||
finally
|
||||
{
|
||||
rwLock.readLock().unlock();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the Hazelcast configuration that will be used by this factory when
|
||||
* creating the HazelcastInstance.
|
||||
*
|
||||
* @param config Hazelcast configuration
|
||||
*/
|
||||
public void setConfig(Config config)
|
||||
{
|
||||
rwLock.writeLock().lock();
|
||||
try
|
||||
{
|
||||
this.config = config;
|
||||
}
|
||||
finally
|
||||
{
|
||||
rwLock.writeLock().unlock();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@@ -1,79 +0,0 @@
|
||||
/*
|
||||
* Copyright (C) 2005-2013 Alfresco Software Limited.
|
||||
*
|
||||
* This file is part of Alfresco
|
||||
*
|
||||
* Alfresco is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Lesser General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* Alfresco 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 Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public License
|
||||
* along with Alfresco. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package org.alfresco.repo.webdav;
|
||||
|
||||
import java.util.concurrent.ConcurrentMap;
|
||||
|
||||
import org.alfresco.repo.cluster.HazelcastInstanceFactory;
|
||||
import org.alfresco.service.cmr.repository.NodeRef;
|
||||
import org.alfresco.util.PropertyCheck;
|
||||
|
||||
import com.hazelcast.core.HazelcastInstance;
|
||||
|
||||
|
||||
/**
|
||||
* Default implementation of the {@link LockStoreFactory} interface. Creates {@link LockStore}s
|
||||
* backed by a Hazelcast distributed Map if the clusterName property is set,
|
||||
* otherwise it creates a non-clustered {@link SimpleLockStore}.
|
||||
*
|
||||
* @see LockStoreFactory
|
||||
* @see LockStoreImpl
|
||||
* @author Matt Ward
|
||||
*/
|
||||
public class LockStoreFactoryImpl implements LockStoreFactory
|
||||
{
|
||||
private static final String HAZELCAST_MAP_NAME = "webdav-locks";
|
||||
private HazelcastInstanceFactory hazelcastInstanceFactory;
|
||||
private String clusterName;
|
||||
|
||||
/**
|
||||
* This method should be used sparingly and the created {@link LockStore}s should be
|
||||
* retained (this factory does not cache instances of them).
|
||||
*/
|
||||
@Override
|
||||
public synchronized LockStore createLockStore()
|
||||
{
|
||||
if (!PropertyCheck.isValidPropertyString(clusterName))
|
||||
{
|
||||
return new SimpleLockStore();
|
||||
}
|
||||
else
|
||||
{
|
||||
HazelcastInstance instance = hazelcastInstanceFactory.getInstance();
|
||||
ConcurrentMap<NodeRef, LockInfo> map = instance.getMap(HAZELCAST_MAP_NAME);
|
||||
return new LockStoreImpl(map);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @param hazelcastInstanceFactory the factory that will create a HazelcastInstance if required.
|
||||
*/
|
||||
public synchronized void setHazelcastInstanceFactory(HazelcastInstanceFactory hazelcastInstanceFactory)
|
||||
{
|
||||
this.hazelcastInstanceFactory = hazelcastInstanceFactory;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param clusterName the clusterName to set
|
||||
*/
|
||||
public synchronized void setClusterName(String clusterName)
|
||||
{
|
||||
this.clusterName = clusterName;
|
||||
}
|
||||
}
|
||||
|
@@ -1,166 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!--
|
||||
This configuration is used to test the functionality of the HazelcastConfigFactoryBean.
|
||||
-->
|
||||
<hazelcast xsi:schemaLocation="http://www.hazelcast.com/schema/config hazelcast-basic.xsd"
|
||||
xmlns="http://www.hazelcast.com/schema/config"
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
|
||||
<group>
|
||||
<name>${alfresco.cluster.name}</name>
|
||||
<password>${alfresco.hazelcast.password}</password>
|
||||
</group>
|
||||
<network>
|
||||
<port auto-increment="true">5701</port>
|
||||
<join>
|
||||
<multicast enabled="true">
|
||||
<multicast-group>224.2.2.3</multicast-group>
|
||||
<multicast-port>54327</multicast-port>
|
||||
</multicast>
|
||||
<tcp-ip enabled="false">
|
||||
<interface>127.0.0.1</interface>
|
||||
</tcp-ip>
|
||||
<aws enabled="false">
|
||||
<access-key>my-access-key</access-key>
|
||||
<secret-key>my-secret-key</secret-key>
|
||||
<!--optional, default is us-east-1 -->
|
||||
<region>us-west-1</region>
|
||||
<!-- optional, only instances belonging to this group will be discovered, default will try all running instances -->
|
||||
<security-group-name>hazelcast-sg</security-group-name>
|
||||
<tag-key>type</tag-key>
|
||||
<tag-value>hz-nodes</tag-value>
|
||||
</aws>
|
||||
</join>
|
||||
<interfaces enabled="false">
|
||||
<interface>10.10.1.*</interface>
|
||||
</interfaces>
|
||||
<symmetric-encryption enabled="false">
|
||||
<!--
|
||||
encryption algorithm such as
|
||||
DES/ECB/PKCS5Padding,
|
||||
PBEWithMD5AndDES,
|
||||
AES/CBC/PKCS5Padding,
|
||||
Blowfish,
|
||||
DESede
|
||||
-->
|
||||
<algorithm>PBEWithMD5AndDES</algorithm>
|
||||
<!-- salt value to use when generating the secret key -->
|
||||
<salt>thesalt</salt>
|
||||
<!-- pass phrase to use when generating the secret key -->
|
||||
<password>thepass</password>
|
||||
<!-- iteration count to use when generating the secret key -->
|
||||
<iteration-count>19</iteration-count>
|
||||
</symmetric-encryption>
|
||||
<asymmetric-encryption enabled="false">
|
||||
<!-- encryption algorithm -->
|
||||
<algorithm>RSA/NONE/PKCS1PADDING</algorithm>
|
||||
<!-- private key password -->
|
||||
<keyPassword>thekeypass</keyPassword>
|
||||
<!-- private key alias -->
|
||||
<keyAlias>local</keyAlias>
|
||||
<!-- key store type -->
|
||||
<storeType>JKS</storeType>
|
||||
<!-- key store password -->
|
||||
<storePassword>thestorepass</storePassword>
|
||||
<!-- path to the key store -->
|
||||
<storePath>keystore</storePath>
|
||||
</asymmetric-encryption>
|
||||
</network>
|
||||
<executor-service>
|
||||
<core-pool-size>16</core-pool-size>
|
||||
<max-pool-size>64</max-pool-size>
|
||||
<keep-alive-seconds>60</keep-alive-seconds>
|
||||
</executor-service>
|
||||
<queue name="default">
|
||||
<!--
|
||||
Maximum size of the queue. When a JVM's local queue size reaches the maximum,
|
||||
all put/offer operations will get blocked until the queue size
|
||||
of the JVM goes down below the maximum.
|
||||
Any integer between 0 and Integer.MAX_VALUE. 0 means
|
||||
Integer.MAX_VALUE. Default is 0.
|
||||
-->
|
||||
<max-size-per-jvm>0</max-size-per-jvm>
|
||||
<!--
|
||||
Name of the map configuration that will be used for the backing distributed
|
||||
map for this queue.
|
||||
-->
|
||||
<backing-map-ref>default</backing-map-ref>
|
||||
</queue>
|
||||
<map name="default">
|
||||
<!--
|
||||
Number of backups. If 1 is set as the backup-count for example,
|
||||
then all entries of the map will be copied to another JVM for
|
||||
fail-safety. 0 means no backup.
|
||||
-->
|
||||
<backup-count>1</backup-count>
|
||||
<!--
|
||||
Maximum number of seconds for each entry to stay in the map. Entries that are
|
||||
older than <time-to-live-seconds> and not updated for <time-to-live-seconds>
|
||||
will get automatically evicted from the map.
|
||||
Any integer between 0 and Integer.MAX_VALUE. 0 means infinite. Default is 0.
|
||||
-->
|
||||
<time-to-live-seconds>0</time-to-live-seconds>
|
||||
<!--
|
||||
Maximum number of seconds for each entry to stay idle in the map. Entries that are
|
||||
idle(not touched) for more than <max-idle-seconds> will get
|
||||
automatically evicted from the map. Entry is touched if get, put or containsKey is called.
|
||||
Any integer between 0 and Integer.MAX_VALUE. 0 means infinite. Default is 0.
|
||||
-->
|
||||
<max-idle-seconds>0</max-idle-seconds>
|
||||
<!--
|
||||
Valid values are:
|
||||
NONE (no eviction),
|
||||
LRU (Least Recently Used),
|
||||
LFU (Least Frequently Used).
|
||||
NONE is the default.
|
||||
-->
|
||||
<eviction-policy>NONE</eviction-policy>
|
||||
<!--
|
||||
Maximum size of the map. When max size is reached,
|
||||
map is evicted based on the policy defined.
|
||||
Any integer between 0 and Integer.MAX_VALUE. 0 means
|
||||
Integer.MAX_VALUE. Default is 0.
|
||||
-->
|
||||
<max-size policy="cluster_wide_map_size">0</max-size>
|
||||
<!--
|
||||
When max. size is reached, specified percentage of
|
||||
the map will be evicted. Any integer between 0 and 100.
|
||||
If 25 is set for example, 25% of the entries will
|
||||
get evicted.
|
||||
-->
|
||||
<eviction-percentage>25</eviction-percentage>
|
||||
<!--
|
||||
While recovering from split-brain (network partitioning),
|
||||
map entries in the small cluster will merge into the bigger cluster
|
||||
based on the policy set here. When an entry merge into the
|
||||
cluster, there might an existing entry with the same key already.
|
||||
Values of these entries might be different for that same key.
|
||||
Which value should be set for the key? Conflict is resolved by
|
||||
the policy set here. Default policy is hz.ADD_NEW_ENTRY
|
||||
|
||||
There are built-in merge policies such as
|
||||
hz.NO_MERGE ; no entry will merge.
|
||||
hz.ADD_NEW_ENTRY ; entry will be added if the merging entry's key
|
||||
doesn't exist in the cluster.
|
||||
hz.HIGHER_HITS ; entry with the higher hits wins.
|
||||
hz.LATEST_UPDATE ; entry with the latest update wins.
|
||||
-->
|
||||
<merge-policy>hz.ADD_NEW_ENTRY</merge-policy>
|
||||
</map>
|
||||
<!-- Add your own semaphore configurations here:
|
||||
<semaphore name="default">
|
||||
<initial-permits>10</initial-permits>
|
||||
<semaphore-factory enabled="true">
|
||||
<class-name>com.acme.MySemaphoreFactory</class-name>
|
||||
</semaphore-factory>
|
||||
</semaphore>
|
||||
-->
|
||||
|
||||
<!-- Add your own map merge policy implementations here:
|
||||
<merge-policies>
|
||||
<map-merge-policy name="MY_MERGE_POLICY">
|
||||
<class-name>com.acme.MyOwnMergePolicy</class-name>
|
||||
</map-merge-policy>
|
||||
</merge-policies>
|
||||
-->
|
||||
|
||||
</hazelcast>
|
Reference in New Issue
Block a user