diff --git a/activemq-osgi/pom.xml b/activemq-osgi/pom.xml
index 03d29cd7a0..7b99b34119 100644
--- a/activemq-osgi/pom.xml
+++ b/activemq-osgi/pom.xml
@@ -68,10 +68,6 @@
${project.groupId}
activemq-http
-
- ${project.groupId}
- activemq-partition
-
@@ -187,7 +183,6 @@
org.codehaus.jettison*;resolution:=optional,
org.jasypt*;resolution:=optional,
org.eclipse.jetty*;resolution:=optional;version="[9.0,10)",
- org.apache.zookeeper*;resolution:=optional,
org.fusesource.hawtjni*;resolution:=optional,
org.springframework.jms*;version="[4,6)";resolution:=optional,
org.springframework.transaction*;version="[4,6)";resolution:=optional,
diff --git a/activemq-partition/pom.xml b/activemq-partition/pom.xml
deleted file mode 100644
index 901c869d3a..0000000000
--- a/activemq-partition/pom.xml
+++ /dev/null
@@ -1,149 +0,0 @@
-
-
-
-
- 4.0.0
-
-
- org.apache.activemq
- activemq-parent
- 5.19.0-SNAPSHOT
-
-
- activemq-partition
- jar
-
- ActiveMQ :: Partition Management
- Used to partition clients over a cluster of brokers
-
-
-
- org.apache.activemq
- activemq-broker
- provided
-
-
-
- org.slf4j
- slf4j-api
- compile
-
-
-
- org.linkedin
- org.linkedin.zookeeper-impl
-
-
- org.linkedin
- org.linkedin.util-core
-
-
- org.apache.zookeeper
- zookeeper
-
-
-
-
- com.fasterxml.jackson.core
- jackson-core
-
-
- com.fasterxml.jackson.core
- jackson-annotations
-
-
- com.fasterxml.jackson.core
- jackson-databind
-
-
-
-
- org.apache.logging.log4j
- log4j-core
- test
-
-
- org.apache.logging.log4j
- log4j-slf4j2-impl
- test
-
-
-
- org.apache.activemq
- activemq-broker
- test-jar
- test
-
-
-
- junit
- junit
- test
-
-
-
-
-
-
-
-
-
- activemq.tests-sanity
-
-
- activemq.tests
- smoke
-
-
-
-
-
- maven-surefire-plugin
-
-
- **/PartitionBrokerTest.*
-
-
-
-
-
-
-
- activemq.tests-autoTransport
-
-
- activemq.tests
- autoTransport
-
-
-
-
-
- maven-surefire-plugin
-
-
- **
-
-
-
-
-
-
-
-
-
diff --git a/activemq-partition/src/main/java/org/apache/activemq/partition/PartitionBroker.java b/activemq-partition/src/main/java/org/apache/activemq/partition/PartitionBroker.java
deleted file mode 100644
index 9362e64b26..0000000000
--- a/activemq-partition/src/main/java/org/apache/activemq/partition/PartitionBroker.java
+++ /dev/null
@@ -1,367 +0,0 @@
-/**
- * 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
- *
- * 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.activemq.partition;
-
-import java.net.InetSocketAddress;
-import java.net.Socket;
-import java.net.SocketAddress;
-import java.util.Arrays;
-import java.util.Collections;
-import java.util.HashMap;
-import java.util.HashSet;
-import java.util.Map;
-import java.util.concurrent.ConcurrentHashMap;
-import java.util.concurrent.ConcurrentMap;
-
-import org.apache.activemq.broker.Broker;
-import org.apache.activemq.broker.BrokerFilter;
-import org.apache.activemq.broker.ConnectionContext;
-import org.apache.activemq.broker.ProducerBrokerExchange;
-import org.apache.activemq.broker.TransportConnection;
-import org.apache.activemq.command.ActiveMQDestination;
-import org.apache.activemq.command.ConnectionControl;
-import org.apache.activemq.command.ConnectionId;
-import org.apache.activemq.command.ConnectionInfo;
-import org.apache.activemq.command.Message;
-import org.apache.activemq.partition.dto.Partitioning;
-import org.apache.activemq.partition.dto.Target;
-import org.apache.activemq.state.ConsumerState;
-import org.apache.activemq.state.SessionState;
-import org.apache.activemq.transport.Transport;
-import org.apache.activemq.util.LRUCache;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-/**
- * A BrokerFilter which partitions client connections over a cluster of brokers.
- *
- * It can use a client identifier like client id, authenticated user name, source ip
- * address or even destination being used by the connection to figure out which
- * is the best broker in the cluster that the connection should be using and then
- * redirects failover clients to that broker.
- */
-public class PartitionBroker extends BrokerFilter {
-
- protected static final Logger LOG = LoggerFactory.getLogger(PartitionBroker.class);
- protected final PartitionBrokerPlugin plugin;
- protected boolean reloadConfigOnPoll = true;
-
- public PartitionBroker(Broker broker, PartitionBrokerPlugin plugin) {
- super(broker);
- this.plugin = plugin;
- }
-
- @Override
- public void start() throws Exception {
- super.start();
- getExecutor().execute(new Runnable() {
- @Override
- public void run() {
- Thread.currentThread().setName("Partition Monitor");
- onMonitorStart();
- try {
- runPartitionMonitor();
- } catch (Exception e) {
- onMonitorStop();
- }
- }
- });
- }
-
- protected void onMonitorStart() {
- }
- protected void onMonitorStop() {
- }
-
- protected void runPartitionMonitor() {
- while( !isStopped() ) {
- try {
- monitorWait();
- } catch (InterruptedException e) {
- break;
- }
-
- if(reloadConfigOnPoll) {
- try {
- reloadConfiguration();
- } catch (Exception e) {
- continue;
- }
- }
-
- for( ConnectionMonitor monitor: monitors.values()) {
- checkTarget(monitor);
- }
- }
- }
-
- protected void monitorWait() throws InterruptedException {
- synchronized (this) {
- this.wait(1000);
- }
- }
-
- protected void monitorWakeup() {
- synchronized (this) {
- this.notifyAll();
- }
- }
-
- protected void reloadConfiguration() throws Exception {
- }
-
- protected void checkTarget(ConnectionMonitor monitor) {
-
- // can we find a preferred target for the connection?
- Target targetDTO = pickBestBroker(monitor);
- if( targetDTO == null || targetDTO.ids==null) {
- LOG.debug("No partition target found for connection: "+monitor.context.getConnectionId());
- return;
- }
-
- // Are we one the the targets?
- if( targetDTO.ids.contains(getBrokerName()) ) {
- LOG.debug("We are a partition target for connection: "+monitor.context.getConnectionId());
- return;
- }
-
- // Then we need to move the connection over.
- String connectionString = getConnectionString(targetDTO.ids);
- if( connectionString==null ) {
- LOG.debug("Could not convert to partition targets to connection string: " + targetDTO.ids);
- return;
- }
-
- LOG.info("Redirecting connection to: " + connectionString);
- TransportConnection connection = (TransportConnection)monitor.context.getConnection();
- ConnectionControl cc = new ConnectionControl();
- cc.setConnectedBrokers(connectionString);
- cc.setRebalanceConnection(true);
- connection.dispatchAsync(cc);
- }
-
- protected String getConnectionString(HashSet ids) {
- StringBuilder rc = new StringBuilder();
- for (String id : ids) {
- String url = plugin.getBrokerURL(this, id);
- if( url!=null ) {
- if( rc.length()!=0 ) {
- rc.append(',');
- }
- rc.append(url);
- }
- }
- if( rc.length()==0 )
- return null;
- return rc.toString();
- }
-
- static private class Score {
- int value;
- }
-
- protected Target pickBestBroker(ConnectionMonitor monitor) {
-
- if( getConfig() ==null )
- return null;
-
- if( getConfig().bySourceIp !=null && !getConfig().bySourceIp.isEmpty() ) {
- TransportConnection connection = (TransportConnection)monitor.context.getConnection();
- Transport transport = connection.getTransport();
- Socket socket = transport.narrow(Socket.class);
- if( socket !=null ) {
- SocketAddress address = socket.getRemoteSocketAddress();
- if( address instanceof InetSocketAddress) {
- String ip = ((InetSocketAddress) address).getAddress().getHostAddress();
- Target targetDTO = getConfig().bySourceIp.get(ip);
- if( targetDTO!=null ) {
- return targetDTO;
- }
- }
- }
- }
-
- if( getConfig().byUserName !=null && !getConfig().byUserName.isEmpty() ) {
- String userName = monitor.context.getUserName();
- if( userName !=null ) {
- Target targetDTO = getConfig().byUserName.get(userName);
- if( targetDTO!=null ) {
- return targetDTO;
- }
- }
- }
-
- if( getConfig().byClientId !=null && !getConfig().byClientId.isEmpty() ) {
- String clientId = monitor.context.getClientId();
- if( clientId!=null ) {
- Target targetDTO = getConfig().byClientId.get(clientId);
- if( targetDTO!=null ) {
- return targetDTO;
- }
- }
- }
-
- if(
- (getConfig().byQueue !=null && !getConfig().byQueue.isEmpty())
- || (getConfig().byTopic !=null && !getConfig().byTopic.isEmpty())
- ) {
-
- // Collect the destinations the connection is consuming from...
- HashSet dests = new HashSet();
- for (SessionState session : monitor.context.getConnectionState().getSessionStates()) {
- for (ConsumerState consumer : session.getConsumerStates()) {
- ActiveMQDestination destination = consumer.getInfo().getDestination();
- if( destination.isComposite() ) {
- dests.addAll(Arrays.asList(destination.getCompositeDestinations()));
- } else {
- dests.addAll(Collections.singletonList(destination));
- }
- }
- }
-
- // Group them by the partitioning target for the destinations and score them..
- HashMap targetScores = new HashMap();
- for (ActiveMQDestination dest : dests) {
- Target target = getTarget(dest);
- if( target!=null ) {
- Score score = targetScores.get(target);
- if( score == null ) {
- score = new Score();
- targetScores.put(target, score);
- }
- score.value++;
- }
- }
-
- // The target with largest score wins..
- if (!targetScores.isEmpty()) {
- Target bestTarget = null;
- int bestScore = 0;
- for (Map.Entry entry : targetScores.entrySet()) {
- if (entry.getValue().value > bestScore) {
- bestTarget = entry.getKey();
- bestScore = entry.getValue().value;
- }
- }
- return bestTarget;
- }
-
- // If we get here is because there were no consumers, or the destinations for those
- // consumers did not have an assigned destination.. So partition based on producer
- // usage.
- Target best = monitor.findBestProducerTarget(this);
- if( best!=null ) {
- return best;
- }
- }
- return null;
- }
-
- protected Target getTarget(ActiveMQDestination dest) {
- Partitioning config = getConfig();
- if( dest.isQueue() && config.byQueue !=null && !config.byQueue.isEmpty() ) {
- return config.byQueue.get(dest.getPhysicalName());
- } else if( dest.isTopic() && config.byTopic !=null && !config.byTopic.isEmpty() ) {
- return config.byTopic.get(dest.getPhysicalName());
- }
- return null;
- }
-
- protected final ConcurrentMap monitors = new ConcurrentHashMap();
-
- @Override
- public void addConnection(ConnectionContext context, ConnectionInfo info) throws Exception {
- if( info.isFaultTolerant() ) {
- ConnectionMonitor monitor = new ConnectionMonitor(context);
- monitors.put(info.getConnectionId(), monitor);
- super.addConnection(context, info);
- checkTarget(monitor);
- } else {
- super.addConnection(context, info);
- }
- }
-
- @Override
- public void removeConnection(ConnectionContext context, ConnectionInfo info, Throwable error) throws Exception {
- super.removeConnection(context, info, error);
- if( info.isFaultTolerant() ) {
- monitors.remove(info.getConnectionId());
- }
- }
-
- @Override
- public void send(ProducerBrokerExchange producerExchange, Message messageSend) throws Exception {
- ConnectionMonitor monitor = monitors.get(producerExchange.getConnectionContext().getConnectionId());
- if( monitor!=null ) {
- monitor.onSend(producerExchange, messageSend);
- }
- }
-
- protected Partitioning getConfig() {
- return plugin.getConfig();
- }
-
-
- static class Traffic {
- long messages;
- long bytes;
- }
-
- static class ConnectionMonitor {
-
- final ConnectionContext context;
- LRUCache trafficPerDestination = new LRUCache();
-
- public ConnectionMonitor(ConnectionContext context) {
- this.context = context;
- }
-
- synchronized public Target findBestProducerTarget(PartitionBroker broker) {
- Target best = null;
- long bestSize = 0 ;
- for (Map.Entry entry : trafficPerDestination.entrySet()) {
- Traffic t = entry.getValue();
- // Once we get enough messages...
- if( t.messages < broker.plugin.getMinTransferCount()) {
- continue;
- }
- if( t.bytes > bestSize) {
- bestSize = t.bytes;
- Target target = broker.getTarget(entry.getKey());
- if( target!=null ) {
- best = target;
- }
- }
- }
- return best;
- }
-
- synchronized public void onSend(ProducerBrokerExchange producerExchange, Message message) {
- ActiveMQDestination dest = message.getDestination();
- Traffic traffic = trafficPerDestination.get(dest);
- if( traffic == null ) {
- traffic = new Traffic();
- trafficPerDestination.put(dest, traffic);
- }
- traffic.messages += 1;
- traffic.bytes += message.getSize();
- }
-
-
- }
-
-}
diff --git a/activemq-partition/src/main/java/org/apache/activemq/partition/PartitionBrokerPlugin.java b/activemq-partition/src/main/java/org/apache/activemq/partition/PartitionBrokerPlugin.java
deleted file mode 100644
index 418f564cab..0000000000
--- a/activemq-partition/src/main/java/org/apache/activemq/partition/PartitionBrokerPlugin.java
+++ /dev/null
@@ -1,66 +0,0 @@
-/**
- * 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
- *
- * 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.activemq.partition;
-
-import org.apache.activemq.broker.Broker;
-import org.apache.activemq.broker.BrokerPlugin;
-import org.apache.activemq.partition.dto.Partitioning;
-
-import java.io.IOException;
-
-/**
- * A BrokerPlugin which partitions client connections over a cluster of brokers.
- *
- * @org.apache.xbean.XBean element="partitionBrokerPlugin"
- */
-public class PartitionBrokerPlugin implements BrokerPlugin {
-
- protected int minTransferCount;
- protected Partitioning config;
-
- @Override
- public Broker installPlugin(Broker broker) throws Exception {
- return new PartitionBroker(broker, this);
- }
-
- public int getMinTransferCount() {
- return minTransferCount;
- }
-
- public void setMinTransferCount(int minTransferCount) {
- this.minTransferCount = minTransferCount;
- }
-
- public Partitioning getConfig() {
- return config;
- }
-
- public void setConfig(Partitioning config) {
- this.config = config;
- }
-
- public void setConfigAsJson(String config) throws IOException {
- this.config = Partitioning.MAPPER.readValue(config, Partitioning.class);
- }
-
- public String getBrokerURL(PartitionBroker partitionBroker, String id) {
- if( config!=null && config.brokers!=null ) {
- return config.brokers.get(id);
- }
- return null;
- }
-}
diff --git a/activemq-partition/src/main/java/org/apache/activemq/partition/ZKClient.java b/activemq-partition/src/main/java/org/apache/activemq/partition/ZKClient.java
deleted file mode 100644
index 2baec62762..0000000000
--- a/activemq-partition/src/main/java/org/apache/activemq/partition/ZKClient.java
+++ /dev/null
@@ -1,596 +0,0 @@
-/**
- * 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
- *
- * 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.activemq.partition;
-
-import org.apache.zookeeper.*;
-import org.apache.zookeeper.data.ACL;
-import org.apache.zookeeper.data.Id;
-import org.apache.zookeeper.data.Stat;
-import org.linkedin.util.clock.Clock;
-import org.linkedin.util.clock.SystemClock;
-import org.linkedin.util.clock.Timespan;
-import org.linkedin.util.concurrent.ConcurrentUtils;
-import org.linkedin.util.io.PathUtils;
-import org.linkedin.zookeeper.client.*;
-import org.slf4j.Logger;
-
-import java.io.UnsupportedEncodingException;
-import java.lang.reflect.Field;
-import java.lang.reflect.Method;
-import java.util.*;
-import java.util.concurrent.BlockingQueue;
-import java.util.concurrent.CopyOnWriteArrayList;
-import java.util.concurrent.LinkedBlockingQueue;
-import java.util.concurrent.TimeoutException;
-import java.util.concurrent.atomic.AtomicBoolean;
-
-public class ZKClient extends org.linkedin.zookeeper.client.AbstractZKClient implements Watcher {
-
- private static final Logger LOG = org.slf4j.LoggerFactory.getLogger(ZKClient.class);
-
- private Map acls;
- private String password;
-
- public void start() throws Exception {
- // Grab the lock to make sure that the registration of the ManagedService
- // won't be updated immediately but that the initial update will happen first
- synchronized (_lock) {
- _stateChangeDispatcher.setDaemon(true);
- _stateChangeDispatcher.start();
- doStart();
- }
- }
-
- public void setACLs(Map acls) {
- this.acls = acls;
- }
-
- public void setPassword(String password) {
- this.password = password;
- }
-
- protected void doStart() throws UnsupportedEncodingException {
- connect();
- }
-
- @Override
- public void close() {
- if (_stateChangeDispatcher != null) {
- _stateChangeDispatcher.end();
- try {
- _stateChangeDispatcher.join(1000);
- } catch (Exception e) {
- LOG.debug("ignored exception", e);
- }
- }
- synchronized(_lock) {
- if (_zk != null) {
- try {
- changeState(State.NONE);
- _zk.close();
- Thread th = getSendThread();
- if (th != null) {
- th.join(1000);
- }
- _zk = null;
- } catch (Exception e) {
- LOG.debug("ignored exception", e);
- }
- }
- }
- }
-
- protected Thread getSendThread() {
- try {
- return (Thread) getField(_zk, "_zk", "cnxn", "sendThread");
- } catch (Throwable e) {
- return null;
- }
- }
-
- protected Object getField(Object obj, String... names) throws Exception {
- for (String name : names) {
- obj = getField(obj, name);
- }
- return obj;
- }
-
- protected Object getField(Object obj, String name) throws Exception {
- Class clazz = obj.getClass();
- while (clazz != null) {
- for (Field f : clazz.getDeclaredFields()) {
- if (f.getName().equals(name)) {
- f.setAccessible(true);
- return f.get(obj);
- }
- }
- }
- throw new NoSuchFieldError(name);
- }
-
- protected void changeState(State newState) {
- synchronized (_lock) {
- State oldState = _state;
- if (oldState != newState) {
- _stateChangeDispatcher.addEvent(oldState, newState);
- _state = newState;
- _lock.notifyAll();
- }
- }
- }
-
- public void testGenerateConnectionLoss() throws Exception {
- waitForConnected();
- Object clientCnxnSocket = getField(_zk, "_zk", "cnxn", "sendThread", "clientCnxnSocket");
- callMethod(clientCnxnSocket, "testableCloseSocket");
- }
-
- protected Object callMethod(Object obj, String name, Object... args) throws Exception {
- Class clazz = obj.getClass();
- while (clazz != null) {
- for (Method m : clazz.getDeclaredMethods()) {
- if (m.getName().equals(name)) {
- m.setAccessible(true);
- return m.invoke(obj, args);
- }
- }
- }
- throw new NoSuchMethodError(name);
- }
-
- protected void tryConnect() {
- synchronized (_lock) {
- try {
- connect();
- } catch (Throwable e) {
- LOG.warn("Error while restarting:", e);
- if (_expiredSessionRecovery == null) {
- _expiredSessionRecovery = new ExpiredSessionRecovery();
- _expiredSessionRecovery.setDaemon(true);
- _expiredSessionRecovery.start();
- }
- }
- }
- }
-
- public void connect() throws UnsupportedEncodingException {
- synchronized (_lock) {
- changeState(State.CONNECTING);
- _zk = _factory.createZooKeeper(this);
- if (password != null) {
- _zk.addAuthInfo("digest", ("fabric:" + password).getBytes("UTF-8"));
- }
- }
- }
-
- public void process(WatchedEvent event) {
- if (event.getState() != null) {
- LOG.debug("event: {}", event.getState());
- synchronized (_lock) {
- switch(event.getState()) {
- case SyncConnected:
- changeState(State.CONNECTED);
- break;
- case Disconnected:
- if (_state != State.NONE) {
- changeState(State.RECONNECTING);
- }
- break;
- case Expired:
- // when expired, the zookeeper object is invalid and we need to recreate a new one
- _zk = null;
- LOG.warn("Expiration detected: trying to restart...");
- tryConnect();
- break;
- default:
- LOG.warn("Unsupported event state: {}", event.getState());
- }
- }
- }
- }
-
- @Override
- protected IZooKeeper getZk() {
- State state = _state;
- if (state == State.NONE) {
- throw new IllegalStateException("ZooKeeper client has not been configured yet. You need to either create an ensemble or join one.");
- } else if (state != State.CONNECTING) {
- try {
- waitForConnected();
- } catch (Exception e) {
- throw new IllegalStateException("Error waiting for ZooKeeper connection", e);
- }
- }
- IZooKeeper zk = _zk;
- if (zk == null) {
- throw new IllegalStateException("No ZooKeeper connection available");
- }
- return zk;
- }
-
- public void waitForConnected(Timespan timeout) throws InterruptedException, TimeoutException {
- waitForState(State.CONNECTED, timeout);
- }
-
- public void waitForConnected() throws InterruptedException, TimeoutException {
- waitForConnected(null);
- }
-
- public void waitForState(State state, Timespan timeout) throws TimeoutException, InterruptedException {
- long endTime = (timeout == null ? sessionTimeout : timeout).futureTimeMillis(_clock);
- if (_state != state) {
- synchronized (_lock) {
- while (_state != state) {
- ConcurrentUtils.awaitUntil(_clock, _lock, endTime);
- }
- }
- }
- }
-
- @Override
- public void registerListener(LifecycleListener listener) {
- if (listener == null) {
- throw new IllegalStateException("listener is null");
- }
- if (!_listeners.contains(listener)) {
- _listeners.add(listener);
- }
- if (_state == State.CONNECTED) {
- listener.onConnected();
- //_stateChangeDispatcher.addEvent(null, State.CONNECTED);
- }
- }
-
- @Override
- public void removeListener(LifecycleListener listener) {
- if (listener == null) {
- throw new IllegalStateException("listener is null");
- }
- _listeners.remove(listener);
- }
-
- @Override
- public org.linkedin.zookeeper.client.IZKClient chroot(String path) {
- return new ChrootedZKClient(this, adjustPath(path));
- }
-
- @Override
- public boolean isConnected() {
- return _state == State.CONNECTED;
- }
-
- public boolean isConfigured() {
- return _state != State.NONE;
- }
-
- @Override
- public String getConnectString() {
- return _factory.getConnectString();
- }
-
- public static enum State {
- NONE,
- CONNECTING,
- CONNECTED,
- RECONNECTING
- }
-
- private final static String CHARSET = "UTF-8";
-
- private final Clock _clock = SystemClock.instance();
- private final List _listeners = new CopyOnWriteArrayList<>();
-
- protected final Object _lock = new Object();
- protected volatile State _state = State.NONE;
-
- private final StateChangeDispatcher _stateChangeDispatcher = new StateChangeDispatcher();
-
- protected IZooKeeperFactory _factory;
- protected IZooKeeper _zk;
- protected Timespan _reconnectTimeout = Timespan.parse("20s");
- protected Timespan sessionTimeout = new Timespan(30, Timespan.TimeUnit.SECOND);
-
- private ExpiredSessionRecovery _expiredSessionRecovery = null;
-
- private class StateChangeDispatcher extends Thread {
- private final AtomicBoolean _running = new AtomicBoolean(true);
- private final BlockingQueue _events = new LinkedBlockingQueue<>();
-
- private StateChangeDispatcher() {
- super("ZooKeeper state change dispatcher thread");
- }
-
- @Override
- public void run() {
- Map
-
- org.linkedin
- org.linkedin.zookeeper-impl
- provided
-
-
- org.linkedin
- org.linkedin.util-core
- provided
-
-
- org.apache.zookeeper
- zookeeper
- provided
-
org.osgi
osgi.core
@@ -202,7 +187,6 @@
${basedir}/../activemq-kahadb-store/src/main/java
${basedir}/../activemq-mqtt/src/main/java
${basedir}/../activemq-stomp/src/main/java
- ${basedir}/../activemq-partition/src/main/java
${basedir}/../activemq-runtime-config/src/main/java
false
diff --git a/activemq-unit-tests/pom.xml b/activemq-unit-tests/pom.xml
index bbe633cab0..6184efbb3e 100644
--- a/activemq-unit-tests/pom.xml
+++ b/activemq-unit-tests/pom.xml
@@ -58,10 +58,6 @@
org.apache.activemq
activemq-stomp
-
- org.apache.activemq
- activemq-partition
-
org.apache.activemq
activemq-runtime-config
diff --git a/activemq-unit-tests/src/test/java/org/apache/activemq/broker/partition/SpringPartitionBrokerTest.java b/activemq-unit-tests/src/test/java/org/apache/activemq/broker/partition/SpringPartitionBrokerTest.java
deleted file mode 100644
index dcf4e69e5f..0000000000
--- a/activemq-unit-tests/src/test/java/org/apache/activemq/broker/partition/SpringPartitionBrokerTest.java
+++ /dev/null
@@ -1,53 +0,0 @@
-/**
- * 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
- *
- * 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.activemq.broker.partition;
-
-import junit.framework.TestCase;
-import org.apache.activemq.broker.BrokerFactory;
-import org.apache.activemq.broker.BrokerService;
-import org.apache.activemq.partition.PartitionBrokerPlugin;
-import org.apache.activemq.partition.dto.Partitioning;
-
-/**
- */
-public class SpringPartitionBrokerTest extends TestCase {
-
- public void testCreatePartitionBroker() throws Exception {
-
- BrokerService broker = BrokerFactory.createBroker("xbean:activemq-partition.xml");
- assertEquals(1, broker.getPlugins().length);
- PartitionBrokerPlugin plugin = (PartitionBrokerPlugin)broker.getPlugins()[0];
- Partitioning config = plugin.getConfig();
- assertEquals(2, config.getBrokers().size());
-
- Object o;
- String json = "{\n" +
- " \"by_client_id\":{\n" +
- " \"client1\":{\"ids\":[\"broker1\"]},\n" +
- " \"client2\":{\"ids\":[\"broker1\",\"broker2\"]}\n" +
- " },\n" +
- " \"brokers\":{\n" +
- " \"broker1\":\"tcp://localhost:61616\",\n" +
- " \"broker2\":\"tcp://localhost:61616\"\n" +
- " }\n" +
- "}";
- Partitioning expected = Partitioning.MAPPER.readValue(json, Partitioning.class);
- assertEquals(expected.toString(), config.toString());
-
- }
-
-}
diff --git a/activemq-unit-tests/src/test/resources/activemq-partition.xml b/activemq-unit-tests/src/test/resources/activemq-partition.xml
deleted file mode 100644
index 4bb96f22a9..0000000000
--- a/activemq-unit-tests/src/test/resources/activemq-partition.xml
+++ /dev/null
@@ -1,58 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
diff --git a/assembly/pom.xml b/assembly/pom.xml
index a5d2b0cdb8..d1d30d44f9 100644
--- a/assembly/pom.xml
+++ b/assembly/pom.xml
@@ -54,10 +54,6 @@
activemq-unit-tests
test-jar
-
- ${project.groupId}
- activemq-partition
-
org.apache.activemq.tooling
activemq-junit
@@ -68,19 +64,6 @@
hawtdispatch-transport
${hawtdispatch-version}
-
- org.linkedin
- org.linkedin.zookeeper-impl
-
-
- org.linkedin
- org.linkedin.util-core
- ${linkedin-zookeeper-version}
-
-
- org.apache.zookeeper
- zookeeper
-
org.osgi
diff --git a/assembly/src/main/descriptors/common-bin.xml b/assembly/src/main/descriptors/common-bin.xml
index f77fa1c7d2..ff9c509459 100644
--- a/assembly/src/main/descriptors/common-bin.xml
+++ b/assembly/src/main/descriptors/common-bin.xml
@@ -182,7 +182,6 @@
${pom.groupId}:activemq-log4j-appender
${pom.groupId}:activemq-jms-pool
${pom.groupId}:activemq-pool
- ${pom.groupId}:activemq-partition
${pom.groupId}:activemq-shiro
commons-beanutils:commons-beanutils
commons-collections:commons-collections
diff --git a/pom.xml b/pom.xml
index 325985d291..4d02cf94c2 100644
--- a/pom.xml
+++ b/pom.xml
@@ -90,8 +90,6 @@
1.16
10.15.2.0
6.0.0
- 1.4.0
- 3.4.14
0.33.10
1.6.0
4.1.75.Final
@@ -229,7 +227,6 @@
activemq-runtime-config
activemq-tooling
activemq-web
- activemq-partition
activemq-osgi
activemq-blueprint
activemq-web-demo
@@ -315,11 +312,6 @@
activemq-all
${project.version}
-
- org.apache.activemq
- activemq-partition
- ${project.version}
-
org.apache.activemq.tooling
activemq-junit
@@ -585,65 +577,6 @@
${pax-logging-version}
-
- org.apache.hadoop.zookeeper
- zookeeper
- ${zookeeper-version}
-
-
- io.netty
- netty
-
-
- org.slf4j
- slf4j-log4j12
-
-
- log4j
- log4j
-
-
-
-
- org.apache.zookeeper
- zookeeper
- ${zookeeper-version}
-
-
- io.netty
- netty
-
-
- org.slf4j
- slf4j-log4j12
-
-
- log4j
- log4j
-
-
-
-
- org.linkedin
- org.linkedin.zookeeper-impl
- ${linkedin-zookeeper-version}
-
-
- org.json
- json
-
-
- log4j
- log4j
-
-
-
-
- org.linkedin
- org.linkedin.util-core
- ${linkedin-zookeeper-version}
-
-
org.jmdns