Skip to content

Commit 82d3a3d

Browse files
committed
event bus
1 parent 4912069 commit 82d3a3d

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

41 files changed

+794
-35
lines changed

build.xml

+17-7
Original file line numberDiff line numberDiff line change
@@ -28,16 +28,17 @@
2828
<property name="dist-build" value="${dist-build-base}/vert.x-${version-number}"/>
2929
<property name="core-src" value="src/main/java"/>
3030
<property name="core-target" value="${target}/core/classes"/>
31+
<property name="conf-dir" value="conf"/>
32+
<property name="lib-dir" value="lib"/>
33+
<property name="core-lib" value="${lib-dir}/core"/>
34+
<property name="opt-lib" value="${lib-dir}/opt"/>
3135

32-
<property name="resources-dir" value="src/main/resources"/>
33-
<property name="core-lib" value="${resources-dir}/jars"/>
34-
35-
<property name="test-lib" value="src/tests/resources/jars"/>
36+
<property name="test-lib" value="${lib-dir}/tests"/>
3637
<property name="tests-target" value="${target}/tests/classes"/>
3738
<property name="tests-src" value="src/tests/java"/>
3839

3940
<property name="test-apps-target" value="${target}/test-apps/classes"/>
40-
<property name="java-test-apps-src" value="src/tests/resources/testapps/java"/>
41+
<property name="java-test-apps-src" value="src/tests/testapps/java"/>
4142

4243
<property name="javadoc-dir" value="docs/java/api"/>
4344
<property name="rubydoc-dir" value="docs/ruby/api"/>
@@ -46,6 +47,9 @@
4647
<fileset dir="${core-lib}">
4748
<include name="*.jar"/>
4849
</fileset>
50+
<fileset dir="${opt-lib}">
51+
<include name="*.jar"/>
52+
</fileset>
4953
</path>
5054

5155
<path id="test-classpath">
@@ -95,7 +99,7 @@
9599
<target name="java-tests" depends="compile-tests, compile-test-apps">
96100
<testng classpathref="test-classpath">
97101
<!-- <testng classpathref="test-classpath" methods="org.vertx.tests.core.net.NetTest.*"> -->
98-
<sysproperty key="java.util.logging.config.file" value="${resources-dir}/logging.properties"/>
102+
<sysproperty key="java.util.logging.config.file" value="${conf-dir}/logging.properties"/>
99103
<classfileset dir="${tests-target}" includes="**/*Test.class" excludes="**/redis/*.class"/>
100104
<!-- <classfileset dir="${tests-target}" includes="**/RedisReconnectTest.class"/> -->
101105
</testng>
@@ -140,7 +144,7 @@
140144

141145
<copy file="${target}/${jar-file}" todir="${dist-build}/lib/java"/>
142146

143-
<copy file="${resources-dir}/logging.properties" todir="${dist-build}"/>
147+
<copy file="conf/logging.properties" todir="${dist-build}"/>
144148

145149
<copy todir="${dist-build}/lib/java">
146150
<fileset dir="${core-lib}">
@@ -150,6 +154,12 @@
150154
<include name="js.jar"/>
151155
<include name="groovy-all-1.8.1.jar"/>
152156
</fileset>
157+
<fileset dir="${opt-lib}">
158+
<!-- <include name="jruby.jar"/> -->
159+
<include name="js.jar"/>
160+
<include name="groovy-all-1.8.1.jar"/>
161+
<include name="hazelcast-all-1.9.4.4.jar"/>
162+
</fileset>
153163
</copy>
154164

155165
<copy todir="${dist-build}/lib/ruby">

conf/hazelcast.xml

+120
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,120 @@
1+
<hazelcast xsi:schemaLocation="http://www.hazelcast.com/schema/config hazelcast-basic.xsd"
2+
xmlns="http://www.hazelcast.com/schema/config"
3+
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
4+
<group>
5+
<name>dev</name>
6+
<password>dev-pass</password>
7+
</group>
8+
<network>
9+
<port auto-increment="true">5701</port>
10+
<join>
11+
<multicast enabled="true">
12+
<multicast-group>224.2.2.3</multicast-group>
13+
<multicast-port>54327</multicast-port>
14+
</multicast>
15+
<tcp-ip enabled="false">
16+
<interface>127.0.0.1</interface>
17+
</tcp-ip>
18+
<aws enabled="false">
19+
<access-key>my-access-key</access-key>
20+
<secret-key>my-secret-key</secret-key>
21+
<region>us-east-1</region>
22+
</aws>
23+
</join>
24+
<interfaces enabled="false">
25+
<interface>10.10.1.*</interface>
26+
</interfaces>
27+
<symmetric-encryption enabled="false">
28+
<!--
29+
encryption algorithm such as DES/ECB/PKCS5Padding, PBEWithMD5AndDES,
30+
AES/CBC/PKCS5Padding, Blowfish, DESede
31+
-->
32+
<algorithm>PBEWithMD5AndDES</algorithm>
33+
<!-- salt value to use when generating the secret key -->
34+
<salt>thesalt</salt>
35+
<!-- pass phrase to use when generating the secret key -->
36+
<password>thepass</password>
37+
<!-- iteration count to use when generating the secret key -->
38+
<iteration-count>19</iteration-count>
39+
</symmetric-encryption>
40+
<asymmetric-encryption enabled="false">
41+
<!-- encryption algorithm -->
42+
<algorithm>RSA/NONE/PKCS1PADDING</algorithm>
43+
<!-- private key password -->
44+
<keyPassword>thekeypass</keyPassword>
45+
<!-- private key alias -->
46+
<keyAlias>local</keyAlias>
47+
<!-- key store type -->
48+
<storeType>JKS</storeType>
49+
<!-- key store password -->
50+
<storePassword>thestorepass</storePassword>
51+
<!-- path to the key store -->
52+
<storePath>keystore</storePath>
53+
</asymmetric-encryption>
54+
</network>
55+
<executor-service>
56+
<core-pool-size>16</core-pool-size>
57+
<max-pool-size>64</max-pool-size>
58+
<keep-alive-seconds>60</keep-alive-seconds>
59+
</executor-service>
60+
<map name="subs">
61+
<!--
62+
Number of backups. If 1 is set as the backup-count for example, then all entries of
63+
the map will be copied to another JVM for fail-safety. 0 means no backup.
64+
-->
65+
<backup-count>0</backup-count>
66+
<!--
67+
Maximum number of seconds for each entry to stay in the map. Entries that are
68+
older than <time-to-live-seconds> and not updated for <time-to-live-seconds>
69+
will get automatically evicted from the map.
70+
Any integer between 0 and Integer.MAX_VALUE. 0 means infinite. Default is 0.
71+
-->
72+
<time-to-live-seconds>0</time-to-live-seconds>
73+
<!--
74+
Maximum number of seconds for each entry to stay idle in the map. Entries that are
75+
idle(not touched) for more than <max-idle-seconds> will get
76+
automatically evicted from the map. Entry is touched if get, put or containsKey is called.
77+
Any integer between 0 and Integer.MAX_VALUE. 0 means infinite. Default is 0.
78+
-->
79+
<max-idle-seconds>0</max-idle-seconds>
80+
<!--
81+
Valid values are:
82+
NONE (no eviction),
83+
LRU (Least Recently Used),
84+
LFU (Least Frequently Used).
85+
NONE is the default.
86+
-->
87+
<eviction-policy>NONE</eviction-policy>
88+
<!--
89+
Maximum size of the map. When max size is reached,
90+
map is evicted based on the policy defined.
91+
Any integer between 0 and Integer.MAX_VALUE. 0 means
92+
Integer.MAX_VALUE. Default is 0.
93+
-->
94+
<max-size policy="cluster_wide_map_size">0</max-size>
95+
<!--
96+
When max. size is reached, specified percentage of
97+
the map will be evicted. Any integer between 0 and 100.
98+
If 25 is set for example, 25% of the entries will
99+
get evicted.
100+
-->
101+
<eviction-percentage>25</eviction-percentage>
102+
<!--
103+
While recovering from split-brain (network partitioning),
104+
map entries in the small cluster will merge into the bigger cluster
105+
based on the policy set here. When an entry merge into the
106+
cluster, there might an existing entry with the same key already.
107+
Values of these entries might be different for that same key.
108+
Which value should be set for the key? Conflict is resolved by
109+
the policy set here. Default policy is hz.ADD_NEW_ENTRY
110+
111+
There are built-in merge policies such as
112+
hz.NO_MERGE ; no entry will merge.
113+
hz.ADD_NEW_ENTRY ; entry will be added if the merging entry's key
114+
doesn't exist in the cluster.
115+
hz.HIGHER_HITS ; entry with the higher hits wins.
116+
hz.LATEST_UPDATE ; entry with the latest update wins.
117+
-->
118+
<merge-policy>hz.ADD_NEW_ENTRY</merge-policy>
119+
</map>
120+
</hazelcast>
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.

lib/opt/hazelcast-all-1.9.4.4.jar

1.61 MB
Binary file not shown.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
package org.vertx.java.core.cluster;
2+
3+
import org.jboss.netty.util.CharsetUtil;
4+
import org.vertx.java.core.buffer.Buffer;
5+
import org.vertx.java.core.net.NetSocket;
6+
7+
/**
8+
* @author <a href="http://tfox.org">Tim Fox</a>
9+
*/
10+
public class Ack extends Sendable {
11+
12+
final String messageID;
13+
14+
Ack(String messageID) {
15+
this.messageID = messageID;
16+
}
17+
18+
Ack(Buffer readBuff) {
19+
int messageIDLength = readBuff.getInt(0);
20+
byte[] messageIDBytes = readBuff.getBytes(4, 4 + messageIDLength);
21+
messageID = new String(messageIDBytes, CharsetUtil.UTF_8);
22+
}
23+
24+
void write(NetSocket socket) {
25+
int length = 1 + 4 + messageID.length();
26+
Buffer totBuff = Buffer.create(length);
27+
totBuff.appendInt(0);
28+
totBuff.appendByte(Sendable.TYPE_ACK);
29+
writeString(totBuff, messageID);
30+
}
31+
32+
byte type() {
33+
return Sendable.TYPE_ACK;
34+
}
35+
}

0 commit comments

Comments
 (0)