Skip to content

Commit 20306ae

Browse files
authored
Merge pull request #55 from iitsoftware/vt
Vt
2 parents c82b258 + ccd10a9 commit 20306ae

File tree

830 files changed

+4012
-93954
lines changed

Some content is hidden

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

830 files changed

+4012
-93954
lines changed

pom.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77

88
<groupId>com.swiftmq</groupId>
99
<artifactId>swiftmq-client</artifactId>
10-
<version>12.5.4</version>
10+
<version>13.0.0</version>
1111

1212
<name>SwiftMQ Client</name>
1313
<description>Client for SwiftMQ Messaging System with JMS, AMQP 1.0 and file transfer over JMS.</description>

src/main/java/com/swiftmq/admin/cli/CLI.java

Lines changed: 213 additions & 243 deletions
Large diffs are not rendered by default.

src/main/java/com/swiftmq/admin/cli/v400/RequestProcessor.java

Lines changed: 0 additions & 59 deletions
This file was deleted.

src/main/java/com/swiftmq/admin/mgmt/EndpointFactory.java

Lines changed: 11 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@
1717

1818
package com.swiftmq.admin.mgmt;
1919

20+
import com.swiftmq.admin.mgmt.v750.EndpointImpl;
2021
import com.swiftmq.jms.BytesMessageImpl;
2122
import com.swiftmq.jms.MessageImpl;
2223
import com.swiftmq.jms.QueueImpl;
@@ -103,29 +104,19 @@ public Endpoint create(RequestServiceFactory rsf, boolean createInternalCommands
103104

104105
Endpoint endpoint = null;
105106
try {
106-
switch (MGMT_PROTOCOL_VERSION) {
107-
case 750: {
108-
ProtocolReply pr = (ProtocolReply) request(new ProtocolRequest(750));
109-
if (pr.isOk()) {
110-
endpoint = new com.swiftmq.admin.mgmt.v750.EndpointImpl(connection, senderSession, sender, receiverSession, receiver, replyQueue, rsf.createRequestService(750), createInternalCommands);
111-
endpoint.setSubscriptionFilterEnabled(true);
112-
} else {
113-
pr = (ProtocolReply) request(new ProtocolRequest(400));
114-
if (!pr.isOk())
115-
throw pr.getException();
116-
endpoint = new com.swiftmq.admin.mgmt.v400.EndpointImpl(connection, senderSession, sender, receiverSession, receiver, replyQueue, rsf.createRequestService(400), createInternalCommands);
117-
}
118-
}
119-
break;
120-
case 400: {
121-
ProtocolReply pr = (ProtocolReply) request(new ProtocolRequest(400));
107+
if (MGMT_PROTOCOL_VERSION == 750) {
108+
ProtocolReply pr = (ProtocolReply) request(new ProtocolRequest(750));
109+
if (pr.isOk()) {
110+
endpoint = new EndpointImpl(connection, senderSession, sender, receiverSession, receiver, replyQueue, rsf.createRequestService(750), createInternalCommands);
111+
endpoint.setSubscriptionFilterEnabled(true);
112+
} else {
113+
pr = (ProtocolReply) request(new ProtocolRequest(400));
122114
if (!pr.isOk())
123115
throw pr.getException();
124-
endpoint = new com.swiftmq.admin.mgmt.v400.EndpointImpl(connection, senderSession, sender, receiverSession, receiver, replyQueue, rsf.createRequestService(400), createInternalCommands);
116+
endpoint = new com.swiftmq.admin.mgmt.v750.EndpointImpl(connection, senderSession, sender, receiverSession, receiver, replyQueue, rsf.createRequestService(400), createInternalCommands);
125117
}
126-
break;
127-
default:
128-
throw new Exception("Invalid management protocol version (set via swiftmq.mgmt.protocol.version): " + MGMT_PROTOCOL_VERSION);
118+
} else {
119+
throw new Exception("Invalid management protocol version (set via swiftmq.mgmt.protocol.version): " + MGMT_PROTOCOL_VERSION);
129120
}
130121
} catch (Exception e) {
131122
cleanup();

src/main/java/com/swiftmq/admin/mgmt/EndpointRegistry.java

Lines changed: 10 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -17,41 +17,36 @@
1717

1818
package com.swiftmq.admin.mgmt;
1919

20-
import java.util.HashMap;
21-
import java.util.Iterator;
2220
import java.util.Map;
21+
import java.util.concurrent.ConcurrentHashMap;
2322

2423
public class EndpointRegistry {
25-
Map endpoints = new HashMap();
26-
boolean closed = false;
24+
private final Map<String, Endpoint> endpoints = new ConcurrentHashMap<>();
25+
private volatile boolean closed = false;
2726

2827
public EndpointRegistry() {
2928
}
3029

31-
public synchronized void put(String routerName, Endpoint endpoint) throws EndpointRegistryClosedException {
30+
public void put(String routerName, Endpoint endpoint) throws EndpointRegistryClosedException {
3231
if (closed)
3332
throw new EndpointRegistryClosedException("EndpointRegistry already closed!");
3433
endpoints.put(routerName, endpoint);
3534
}
3635

37-
public synchronized Endpoint get(String routerName) {
36+
public Endpoint get(String routerName) {
3837
return (Endpoint) endpoints.get(routerName);
3938
}
4039

41-
public synchronized Endpoint remove(String routerName) {
40+
public Endpoint remove(String routerName) {
4241
return (Endpoint) endpoints.remove(routerName);
4342
}
4443

4544
public void close() {
46-
Map map;
47-
synchronized (this) {
48-
map = (Map) ((HashMap) endpoints).clone();
49-
endpoints.clear();
50-
closed = true;
51-
}
52-
for (Iterator iter = map.entrySet().iterator(); iter.hasNext(); ) {
53-
Endpoint endpoint = (Endpoint) ((Map.Entry) iter.next()).getValue();
45+
for (Map.Entry<String, Endpoint> o : endpoints.entrySet()) {
46+
Endpoint endpoint = o.getValue();
5447
endpoint.close();
5548
}
49+
endpoints.clear();
50+
closed = true;
5651
}
5752
}

0 commit comments

Comments
 (0)