http://git-wip-us.apache.org/repos/asf/incubator-gossip/blob/298b1ae3/src/main/java/org/apache/gossip/manager/GossipMemberStateRefresher.java ---------------------------------------------------------------------- diff --git a/src/main/java/org/apache/gossip/manager/GossipMemberStateRefresher.java b/src/main/java/org/apache/gossip/manager/GossipMemberStateRefresher.java deleted file mode 100644 index 1836309..0000000 --- a/src/main/java/org/apache/gossip/manager/GossipMemberStateRefresher.java +++ /dev/null @@ -1,121 +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.gossip.manager; - -import org.apache.gossip.GossipSettings; -import org.apache.gossip.LocalMember; -import org.apache.gossip.event.GossipListener; -import org.apache.gossip.event.GossipState; -import org.apache.gossip.model.PerNodeDataMessage; -import org.apache.gossip.model.ShutdownMessage; -import org.apache.log4j.Logger; - -import java.util.Map; -import java.util.Map.Entry; -import java.util.concurrent.TimeUnit; -import java.util.function.BiFunction; - -public class GossipMemberStateRefresher implements Runnable { - public static final Logger LOGGER = Logger.getLogger(GossipMemberStateRefresher.class); - - private final Map<LocalMember, GossipState> members; - private final GossipSettings settings; - private final GossipListener listener; - private final Clock clock; - private final BiFunction<String, String, PerNodeDataMessage> findPerNodeGossipData; - - public GossipMemberStateRefresher(Map<LocalMember, GossipState> members, GossipSettings settings, - GossipListener listener, BiFunction<String, String, PerNodeDataMessage> findPerNodeGossipData) { - this.members = members; - this.settings = settings; - this.listener = listener; - this.findPerNodeGossipData = findPerNodeGossipData; - clock = new SystemClock(); - } - - public void run() { - try { - runOnce(); - } catch (RuntimeException ex) { - LOGGER.warn("scheduled state had exception", ex); - } - } - - public void runOnce() { - for (Entry<LocalMember, GossipState> entry : members.entrySet()) { - boolean userDown = processOptimisticShutdown(entry); - if (userDown) - continue; - - Double phiMeasure = entry.getKey().detect(clock.nanoTime()); - GossipState requiredState; - - if (phiMeasure != null) { - requiredState = calcRequiredState(phiMeasure); - } else { - requiredState = calcRequiredStateCleanupInterval(entry.getKey(), entry.getValue()); - } - - if (entry.getValue() != requiredState) { - members.put(entry.getKey(), requiredState); - listener.gossipEvent(entry.getKey(), requiredState); - } - } - } - - public GossipState calcRequiredState(Double phiMeasure) { - if (phiMeasure > settings.getConvictThreshold()) - return GossipState.DOWN; - else - return GossipState.UP; - } - - public GossipState calcRequiredStateCleanupInterval(LocalMember member, GossipState state) { - long now = clock.nanoTime(); - long nowInMillis = TimeUnit.MILLISECONDS.convert(now, TimeUnit.NANOSECONDS); - if (nowInMillis - settings.getCleanupInterval() > member.getHeartbeat()) { - return GossipState.DOWN; - } else { - return state; - } - } - - /** - * If we have a special key the per-node data that means that the node has sent us - * a pre-emptive shutdown message. We process this so node is seen down sooner - * - * @param l member to consider - * @return true if node forced down - */ - public boolean processOptimisticShutdown(Entry<LocalMember, GossipState> l) { - PerNodeDataMessage m = findPerNodeGossipData.apply(l.getKey().getId(), ShutdownMessage.PER_NODE_KEY); - if (m == null) { - return false; - } - ShutdownMessage s = (ShutdownMessage) m.getPayload(); - if (s.getShutdownAtNanos() > l.getKey().getHeartbeat()) { - members.put(l.getKey(), GossipState.DOWN); - if (l.getValue() == GossipState.UP) { - listener.gossipEvent(l.getKey(), GossipState.DOWN); - } - return true; - } - return false; - } -} \ No newline at end of file
http://git-wip-us.apache.org/repos/asf/incubator-gossip/blob/298b1ae3/src/main/java/org/apache/gossip/manager/PassiveGossipConstants.java ---------------------------------------------------------------------- diff --git a/src/main/java/org/apache/gossip/manager/PassiveGossipConstants.java b/src/main/java/org/apache/gossip/manager/PassiveGossipConstants.java deleted file mode 100644 index 3bcc344..0000000 --- a/src/main/java/org/apache/gossip/manager/PassiveGossipConstants.java +++ /dev/null @@ -1,23 +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.gossip.manager; - -public interface PassiveGossipConstants { - String SIGNED_MESSAGE = "gossip.passive.signed_message"; - String UNSIGNED_MESSAGE = "gossip.passive.unsigned_message"; -} http://git-wip-us.apache.org/repos/asf/incubator-gossip/blob/298b1ae3/src/main/java/org/apache/gossip/manager/PassiveGossipThread.java ---------------------------------------------------------------------- diff --git a/src/main/java/org/apache/gossip/manager/PassiveGossipThread.java b/src/main/java/org/apache/gossip/manager/PassiveGossipThread.java deleted file mode 100644 index ae28bf7..0000000 --- a/src/main/java/org/apache/gossip/manager/PassiveGossipThread.java +++ /dev/null @@ -1,114 +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.gossip.manager; - -import java.io.IOException; -import java.net.DatagramPacket; -import java.net.DatagramSocket; -import java.net.InetSocketAddress; -import java.net.SocketAddress; -import java.net.SocketException; -import java.util.concurrent.atomic.AtomicBoolean; - -import org.apache.gossip.model.Base; -import org.apache.gossip.model.SignedPayload; -import org.apache.log4j.Logger; - -import com.codahale.metrics.Meter; - -/** - * This class handles the passive cycle, - * where this client has received an incoming message. - */ -abstract public class PassiveGossipThread implements Runnable { - - public static final Logger LOGGER = Logger.getLogger(PassiveGossipThread.class); - - /** The socket used for the passive thread of the gossip service. */ - private final DatagramSocket server; - private final AtomicBoolean keepRunning; - private final GossipCore gossipCore; - private final GossipManager gossipManager; - private final Meter signed; - private final Meter unsigned; - - public PassiveGossipThread(GossipManager gossipManager, GossipCore gossipCore) { - this.gossipManager = gossipManager; - this.gossipCore = gossipCore; - if (gossipManager.getMyself().getClusterName() == null){ - throw new IllegalArgumentException("Cluster was null"); - } - try { - SocketAddress socketAddress = new InetSocketAddress(gossipManager.getMyself().getUri().getHost(), - gossipManager.getMyself().getUri().getPort()); - server = new DatagramSocket(socketAddress); - } catch (SocketException ex) { - LOGGER.warn(ex); - throw new RuntimeException(ex); - } - keepRunning = new AtomicBoolean(true); - signed = gossipManager.getRegistry().meter(PassiveGossipConstants.SIGNED_MESSAGE); - unsigned = gossipManager.getRegistry().meter(PassiveGossipConstants.UNSIGNED_MESSAGE); - } - - @Override - public void run() { - while (keepRunning.get()) { - try { - byte[] buf = new byte[server.getReceiveBufferSize()]; - DatagramPacket p = new DatagramPacket(buf, buf.length); - server.receive(p); - debug(p.getData()); - try { - Base activeGossipMessage = gossipManager.getObjectMapper().readValue(p.getData(), Base.class); - if (activeGossipMessage instanceof SignedPayload){ - SignedPayload s = (SignedPayload) activeGossipMessage; - Base nested = gossipManager.getObjectMapper().readValue(s.getData(), Base.class); - gossipCore.receive(nested); - signed.mark(); - } else { - gossipCore.receive(activeGossipMessage); - unsigned.mark(); - } - gossipManager.getMemberStateRefresher().run(); - } catch (RuntimeException ex) {//TODO trap json exception - LOGGER.error("Unable to process message", ex); - } - } catch (IOException e) { - LOGGER.error(e); - keepRunning.set(false); - } - } - shutdown(); - } - - private void debug(byte[] jsonBytes) { - if (LOGGER.isDebugEnabled()){ - String receivedMessage = new String(jsonBytes); - LOGGER.debug("Received message ( bytes): " + receivedMessage); - } - } - - public void shutdown() { - try { - server.close(); - } catch (RuntimeException ex) { - } - } - -} \ No newline at end of file http://git-wip-us.apache.org/repos/asf/incubator-gossip/blob/298b1ae3/src/main/java/org/apache/gossip/manager/RingStatePersister.java ---------------------------------------------------------------------- diff --git a/src/main/java/org/apache/gossip/manager/RingStatePersister.java b/src/main/java/org/apache/gossip/manager/RingStatePersister.java deleted file mode 100644 index 7e42562..0000000 --- a/src/main/java/org/apache/gossip/manager/RingStatePersister.java +++ /dev/null @@ -1,76 +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.gossip.manager; - -import java.io.File; -import java.io.FileInputStream; -import java.io.FileOutputStream; -import java.io.IOException; -import java.util.ArrayList; -import java.util.Collections; -import java.util.List; -import java.util.NavigableSet; - -import org.apache.gossip.LocalMember; -import org.apache.log4j.Logger; - -public class RingStatePersister implements Runnable { - - private static final Logger LOGGER = Logger.getLogger(RingStatePersister.class); - private GossipManager parent; - - public RingStatePersister(GossipManager parent){ - this.parent = parent; - } - - @Override - public void run() { - writeToDisk(); - } - - File computeTarget(){ - return new File(parent.getSettings().getPathToRingState(), "ringstate." + parent.getMyself().getClusterName() + "." - + parent.getMyself().getId() + ".json"); - } - - void writeToDisk(){ - if (!parent.getSettings().isPersistRingState()){ - return; - } - NavigableSet<LocalMember> i = parent.getMembers().keySet(); - try (FileOutputStream fos = new FileOutputStream(computeTarget())){ - parent.getObjectMapper().writeValue(fos, i); - } catch (IOException e) { - LOGGER.debug(e); - } - } - - @SuppressWarnings("unchecked") - List<LocalMember> readFromDisk(){ - if (!parent.getSettings().isPersistRingState()){ - return Collections.emptyList(); - } - try (FileInputStream fos = new FileInputStream(computeTarget())){ - return parent.getObjectMapper().readValue(fos, ArrayList.class); - } catch (IOException e) { - LOGGER.debug(e); - } - return Collections.emptyList(); - } - -} http://git-wip-us.apache.org/repos/asf/incubator-gossip/blob/298b1ae3/src/main/java/org/apache/gossip/manager/SimpleActiveGossipper.java ---------------------------------------------------------------------- diff --git a/src/main/java/org/apache/gossip/manager/SimpleActiveGossipper.java b/src/main/java/org/apache/gossip/manager/SimpleActiveGossipper.java deleted file mode 100644 index e47fe2a..0000000 --- a/src/main/java/org/apache/gossip/manager/SimpleActiveGossipper.java +++ /dev/null @@ -1,110 +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.gossip.manager; - -import java.util.List; -import java.util.concurrent.ArrayBlockingQueue; -import java.util.concurrent.BlockingQueue; -import java.util.concurrent.Executors; -import java.util.concurrent.ScheduledExecutorService; -import java.util.concurrent.ThreadPoolExecutor; -import java.util.concurrent.TimeUnit; - -import org.apache.gossip.LocalMember; - -import com.codahale.metrics.MetricRegistry; - -/** - * Base implementation gossips randomly to live nodes periodically gossips to dead ones - * - */ -public class SimpleActiveGossipper extends AbstractActiveGossiper { - - private ScheduledExecutorService scheduledExecutorService; - private final BlockingQueue<Runnable> workQueue; - private ThreadPoolExecutor threadService; - - public SimpleActiveGossipper(GossipManager gossipManager, GossipCore gossipCore, - MetricRegistry registry) { - super(gossipManager, gossipCore, registry); - scheduledExecutorService = Executors.newScheduledThreadPool(2); - workQueue = new ArrayBlockingQueue<Runnable>(1024); - threadService = new ThreadPoolExecutor(1, 30, 1, TimeUnit.SECONDS, workQueue, - new ThreadPoolExecutor.DiscardOldestPolicy()); - } - - @Override - public void init() { - super.init(); - scheduledExecutorService.scheduleAtFixedRate(() -> { - threadService.execute(() -> { - sendToALiveMember(); - }); - }, 0, gossipManager.getSettings().getGossipInterval(), TimeUnit.MILLISECONDS); - scheduledExecutorService.scheduleAtFixedRate(() -> { - sendToDeadMember(); - }, 0, gossipManager.getSettings().getGossipInterval(), TimeUnit.MILLISECONDS); - scheduledExecutorService.scheduleAtFixedRate( - () -> sendPerNodeData(gossipManager.getMyself(), - selectPartner(gossipManager.getLiveMembers())), - 0, gossipManager.getSettings().getGossipInterval(), TimeUnit.MILLISECONDS); - scheduledExecutorService.scheduleAtFixedRate( - () -> sendSharedData(gossipManager.getMyself(), - selectPartner(gossipManager.getLiveMembers())), - 0, gossipManager.getSettings().getGossipInterval(), TimeUnit.MILLISECONDS); - } - - @Override - public void shutdown() { - super.shutdown(); - scheduledExecutorService.shutdown(); - try { - scheduledExecutorService.awaitTermination(5, TimeUnit.SECONDS); - } catch (InterruptedException e) { - LOGGER.debug("Issue during shutdown", e); - } - sendShutdownMessage(); - threadService.shutdown(); - try { - threadService.awaitTermination(5, TimeUnit.SECONDS); - } catch (InterruptedException e) { - LOGGER.debug("Issue during shutdown", e); - } - } - - protected void sendToALiveMember(){ - LocalMember member = selectPartner(gossipManager.getLiveMembers()); - sendMembershipList(gossipManager.getMyself(), member); - } - - protected void sendToDeadMember(){ - LocalMember member = selectPartner(gossipManager.getDeadMembers()); - sendMembershipList(gossipManager.getMyself(), member); - } - - /** - * sends an optimistic shutdown message to several clusters nodes - */ - protected void sendShutdownMessage(){ - List<LocalMember> l = gossipManager.getLiveMembers(); - int sendTo = l.size() < 3 ? 1 : l.size() / 2; - for (int i = 0; i < sendTo; i++) { - threadService.execute(() -> sendShutdownMessage(gossipManager.getMyself(), selectPartner(l))); - } - } -} http://git-wip-us.apache.org/repos/asf/incubator-gossip/blob/298b1ae3/src/main/java/org/apache/gossip/manager/SystemClock.java ---------------------------------------------------------------------- diff --git a/src/main/java/org/apache/gossip/manager/SystemClock.java b/src/main/java/org/apache/gossip/manager/SystemClock.java deleted file mode 100644 index 04a7080..0000000 --- a/src/main/java/org/apache/gossip/manager/SystemClock.java +++ /dev/null @@ -1,32 +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.gossip.manager; - -public class SystemClock implements Clock { - - @Override - public long currentTimeMillis() { - return System.currentTimeMillis(); - } - - @Override - public long nanoTime() { - return System.nanoTime(); - } - -} http://git-wip-us.apache.org/repos/asf/incubator-gossip/blob/298b1ae3/src/main/java/org/apache/gossip/manager/UserDataPersister.java ---------------------------------------------------------------------- diff --git a/src/main/java/org/apache/gossip/manager/UserDataPersister.java b/src/main/java/org/apache/gossip/manager/UserDataPersister.java deleted file mode 100644 index 3b9eafa..0000000 --- a/src/main/java/org/apache/gossip/manager/UserDataPersister.java +++ /dev/null @@ -1,107 +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.gossip.manager; - -import java.io.File; -import java.io.FileInputStream; -import java.io.FileOutputStream; -import java.io.IOException; -import java.util.concurrent.ConcurrentHashMap; - -import org.apache.gossip.model.PerNodeDataMessage; -import org.apache.gossip.model.SharedDataMessage; -import org.apache.log4j.Logger; - -public class UserDataPersister implements Runnable { - - private static final Logger LOGGER = Logger.getLogger(UserDataPersister.class); - private final GossipManager parent; - private final GossipCore gossipCore; - - UserDataPersister(GossipManager parent, GossipCore gossipCore){ - this.parent = parent; - this.gossipCore = gossipCore; - } - - File computeSharedTarget(){ - return new File(parent.getSettings().getPathToDataState(), "shareddata." - + parent.getMyself().getClusterName() + "." + parent.getMyself().getId() + ".json"); - } - - File computePerNodeTarget() { - return new File(parent.getSettings().getPathToDataState(), "pernodedata." - + parent.getMyself().getClusterName() + "." + parent.getMyself().getId() + ".json"); - } - - @SuppressWarnings("unchecked") - ConcurrentHashMap<String, ConcurrentHashMap<String, PerNodeDataMessage>> readPerNodeFromDisk(){ - if (!parent.getSettings().isPersistDataState()){ - return new ConcurrentHashMap<String, ConcurrentHashMap<String, PerNodeDataMessage>>(); - } - try (FileInputStream fos = new FileInputStream(computePerNodeTarget())){ - return parent.getObjectMapper().readValue(fos, ConcurrentHashMap.class); - } catch (IOException e) { - LOGGER.debug(e); - } - return new ConcurrentHashMap<String, ConcurrentHashMap<String, PerNodeDataMessage>>(); - } - - void writePerNodeToDisk(){ - if (!parent.getSettings().isPersistDataState()){ - return; - } - try (FileOutputStream fos = new FileOutputStream(computePerNodeTarget())){ - parent.getObjectMapper().writeValue(fos, gossipCore.getPerNodeData()); - } catch (IOException e) { - LOGGER.warn(e); - } - } - - void writeSharedToDisk(){ - if (!parent.getSettings().isPersistDataState()){ - return; - } - try (FileOutputStream fos = new FileOutputStream(computeSharedTarget())){ - parent.getObjectMapper().writeValue(fos, gossipCore.getSharedData()); - } catch (IOException e) { - LOGGER.warn(e); - } - } - - @SuppressWarnings("unchecked") - ConcurrentHashMap<String, SharedDataMessage> readSharedDataFromDisk(){ - if (!parent.getSettings().isPersistRingState()){ - return new ConcurrentHashMap<String, SharedDataMessage>(); - } - try (FileInputStream fos = new FileInputStream(computeSharedTarget())){ - return parent.getObjectMapper().readValue(fos, ConcurrentHashMap.class); - } catch (IOException e) { - LOGGER.debug(e); - } - return new ConcurrentHashMap<String, SharedDataMessage>(); - } - - /** - * Writes all pernode and shared data to disk - */ - @Override - public void run() { - writePerNodeToDisk(); - writeSharedToDisk(); - } -} http://git-wip-us.apache.org/repos/asf/incubator-gossip/blob/298b1ae3/src/main/java/org/apache/gossip/manager/handlers/ActiveGossipMessageHandler.java ---------------------------------------------------------------------- diff --git a/src/main/java/org/apache/gossip/manager/handlers/ActiveGossipMessageHandler.java b/src/main/java/org/apache/gossip/manager/handlers/ActiveGossipMessageHandler.java deleted file mode 100644 index f5e568e..0000000 --- a/src/main/java/org/apache/gossip/manager/handlers/ActiveGossipMessageHandler.java +++ /dev/null @@ -1,74 +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.gossip.manager.handlers; - -import org.apache.gossip.Member; -import org.apache.gossip.RemoteMember; -import org.apache.gossip.manager.GossipCore; -import org.apache.gossip.manager.GossipManager; -import org.apache.gossip.model.Base; -import org.apache.gossip.udp.UdpActiveGossipMessage; -import org.apache.gossip.udp.UdpActiveGossipOk; -import org.apache.gossip.udp.UdpNotAMemberFault; - -import java.net.URI; -import java.net.URISyntaxException; -import java.util.ArrayList; -import java.util.List; - -public class ActiveGossipMessageHandler implements MessageHandler { - @Override - public void invoke(GossipCore gossipCore, GossipManager gossipManager, Base base) { - List<Member> remoteGossipMembers = new ArrayList<>(); - RemoteMember senderMember = null; - UdpActiveGossipMessage activeGossipMessage = (UdpActiveGossipMessage) base; - for (int i = 0; i < activeGossipMessage.getMembers().size(); i++) { - URI u; - try { - u = new URI(activeGossipMessage.getMembers().get(i).getUri()); - } catch (URISyntaxException e) { - GossipCore.LOGGER.debug("Gossip message with faulty URI", e); - continue; - } - RemoteMember member = new RemoteMember( - activeGossipMessage.getMembers().get(i).getCluster(), - u, - activeGossipMessage.getMembers().get(i).getId(), - activeGossipMessage.getMembers().get(i).getHeartbeat(), - activeGossipMessage.getMembers().get(i).getProperties()); - if (i == 0) { - senderMember = member; - } - if (!(member.getClusterName().equals(gossipManager.getMyself().getClusterName()))) { - UdpNotAMemberFault f = new UdpNotAMemberFault(); - f.setException("Not a member of this cluster " + i); - f.setUriFrom(activeGossipMessage.getUriFrom()); - f.setUuid(activeGossipMessage.getUuid()); - GossipCore.LOGGER.warn(f); - gossipCore.sendOneWay(f, member.getUri()); - continue; - } - remoteGossipMembers.add(member); - } - UdpActiveGossipOk o = new UdpActiveGossipOk(); - o.setUriFrom(activeGossipMessage.getUriFrom()); - o.setUuid(activeGossipMessage.getUuid()); - gossipCore.sendOneWay(o, senderMember.getUri()); - gossipCore.mergeLists(gossipManager, senderMember, remoteGossipMembers); - } -} http://git-wip-us.apache.org/repos/asf/incubator-gossip/blob/298b1ae3/src/main/java/org/apache/gossip/manager/handlers/DefaultMessageInvoker.java ---------------------------------------------------------------------- diff --git a/src/main/java/org/apache/gossip/manager/handlers/DefaultMessageInvoker.java b/src/main/java/org/apache/gossip/manager/handlers/DefaultMessageInvoker.java deleted file mode 100644 index 5b78ce3..0000000 --- a/src/main/java/org/apache/gossip/manager/handlers/DefaultMessageInvoker.java +++ /dev/null @@ -1,40 +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.gossip.manager.handlers; - -import org.apache.gossip.manager.GossipCore; -import org.apache.gossip.manager.GossipManager; -import org.apache.gossip.model.*; - -public class DefaultMessageInvoker implements MessageInvoker { - private final MessageInvokerCombiner mic; - - public DefaultMessageInvoker() { - mic = new MessageInvokerCombiner(); - mic.add(new SimpleMessageInvoker(Response.class, new ResponseHandler())); - mic.add(new SimpleMessageInvoker(ShutdownMessage.class, new ShutdownMessageHandler())); - mic.add(new SimpleMessageInvoker(PerNodeDataMessage.class, new PerNodeDataMessageHandler())); - mic.add(new SimpleMessageInvoker(SharedDataMessage.class, new SharedDataMessageHandler())); - mic.add(new SimpleMessageInvoker(ActiveGossipMessage.class, new ActiveGossipMessageHandler())); - } - - public boolean invoke(GossipCore gossipCore, GossipManager gossipManager, Base base) { - return mic.invoke(gossipCore, gossipManager, base); - } -} http://git-wip-us.apache.org/repos/asf/incubator-gossip/blob/298b1ae3/src/main/java/org/apache/gossip/manager/handlers/MessageHandler.java ---------------------------------------------------------------------- diff --git a/src/main/java/org/apache/gossip/manager/handlers/MessageHandler.java b/src/main/java/org/apache/gossip/manager/handlers/MessageHandler.java deleted file mode 100644 index 4b5d49d..0000000 --- a/src/main/java/org/apache/gossip/manager/handlers/MessageHandler.java +++ /dev/null @@ -1,26 +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.gossip.manager.handlers; - -import org.apache.gossip.manager.GossipCore; -import org.apache.gossip.manager.GossipManager; -import org.apache.gossip.model.Base; - -public interface MessageHandler { - void invoke(GossipCore gossipCore, GossipManager gossipManager, Base base); -} \ No newline at end of file http://git-wip-us.apache.org/repos/asf/incubator-gossip/blob/298b1ae3/src/main/java/org/apache/gossip/manager/handlers/MessageInvoker.java ---------------------------------------------------------------------- diff --git a/src/main/java/org/apache/gossip/manager/handlers/MessageInvoker.java b/src/main/java/org/apache/gossip/manager/handlers/MessageInvoker.java deleted file mode 100644 index 70be408..0000000 --- a/src/main/java/org/apache/gossip/manager/handlers/MessageInvoker.java +++ /dev/null @@ -1,33 +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.gossip.manager.handlers; - -import org.apache.gossip.manager.GossipCore; -import org.apache.gossip.manager.GossipManager; -import org.apache.gossip.model.Base; - -public interface MessageInvoker { - /** - * - * @param gossipCore - * @param gossipManager - * @param base - * @return true if the invoker processed the message type - */ - boolean invoke(GossipCore gossipCore, GossipManager gossipManager, Base base); -} http://git-wip-us.apache.org/repos/asf/incubator-gossip/blob/298b1ae3/src/main/java/org/apache/gossip/manager/handlers/MessageInvokerCombiner.java ---------------------------------------------------------------------- diff --git a/src/main/java/org/apache/gossip/manager/handlers/MessageInvokerCombiner.java b/src/main/java/org/apache/gossip/manager/handlers/MessageInvokerCombiner.java deleted file mode 100644 index 5faf6a5..0000000 --- a/src/main/java/org/apache/gossip/manager/handlers/MessageInvokerCombiner.java +++ /dev/null @@ -1,48 +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.gossip.manager.handlers; - -import org.apache.gossip.manager.GossipCore; -import org.apache.gossip.manager.GossipManager; -import org.apache.gossip.model.Base; - -import java.util.List; -import java.util.concurrent.CopyOnWriteArrayList; - -public class MessageInvokerCombiner implements MessageInvoker { - private final List<MessageInvoker> invokers = new CopyOnWriteArrayList<>(); - - public MessageInvokerCombiner() { - } - - public boolean invoke(GossipCore gossipCore, GossipManager gossipManager, Base base) { - return invokers.stream().filter((mi) -> mi.invoke(gossipCore, gossipManager, base)).count() > 0; - } - - public void clear() { - invokers.clear(); - } - - public void add(MessageInvoker mi) { - if (mi == null) { - throw new NullPointerException(); - } - invokers.add(mi); - } -} http://git-wip-us.apache.org/repos/asf/incubator-gossip/blob/298b1ae3/src/main/java/org/apache/gossip/manager/handlers/PerNodeDataMessageHandler.java ---------------------------------------------------------------------- diff --git a/src/main/java/org/apache/gossip/manager/handlers/PerNodeDataMessageHandler.java b/src/main/java/org/apache/gossip/manager/handlers/PerNodeDataMessageHandler.java deleted file mode 100644 index b3a785e..0000000 --- a/src/main/java/org/apache/gossip/manager/handlers/PerNodeDataMessageHandler.java +++ /dev/null @@ -1,31 +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.gossip.manager.handlers; - -import org.apache.gossip.manager.GossipCore; -import org.apache.gossip.manager.GossipManager; -import org.apache.gossip.model.Base; -import org.apache.gossip.udp.UdpPerNodeDataMessage; - -public class PerNodeDataMessageHandler implements MessageHandler { - @Override - public void invoke(GossipCore gossipCore, GossipManager gossipManager, Base base) { - UdpPerNodeDataMessage message = (UdpPerNodeDataMessage) base; - gossipCore.addPerNodeData(message); - } -} http://git-wip-us.apache.org/repos/asf/incubator-gossip/blob/298b1ae3/src/main/java/org/apache/gossip/manager/handlers/ResponseHandler.java ---------------------------------------------------------------------- diff --git a/src/main/java/org/apache/gossip/manager/handlers/ResponseHandler.java b/src/main/java/org/apache/gossip/manager/handlers/ResponseHandler.java deleted file mode 100644 index 2f33b01..0000000 --- a/src/main/java/org/apache/gossip/manager/handlers/ResponseHandler.java +++ /dev/null @@ -1,33 +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.gossip.manager.handlers; - -import org.apache.gossip.manager.GossipCore; -import org.apache.gossip.manager.GossipManager; -import org.apache.gossip.model.Base; -import org.apache.gossip.udp.Trackable; - -public class ResponseHandler implements MessageHandler { - @Override - public void invoke(GossipCore gossipCore, GossipManager gossipManager, Base base) { - if (base instanceof Trackable) { - Trackable t = (Trackable) base; - gossipCore.handleResponse(t.getUuid() + "/" + t.getUriFrom(), (Base) t); - } - } -} http://git-wip-us.apache.org/repos/asf/incubator-gossip/blob/298b1ae3/src/main/java/org/apache/gossip/manager/handlers/SharedDataMessageHandler.java ---------------------------------------------------------------------- diff --git a/src/main/java/org/apache/gossip/manager/handlers/SharedDataMessageHandler.java b/src/main/java/org/apache/gossip/manager/handlers/SharedDataMessageHandler.java deleted file mode 100644 index 89ca4a0..0000000 --- a/src/main/java/org/apache/gossip/manager/handlers/SharedDataMessageHandler.java +++ /dev/null @@ -1,31 +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.gossip.manager.handlers; - -import org.apache.gossip.manager.GossipCore; -import org.apache.gossip.manager.GossipManager; -import org.apache.gossip.model.Base; -import org.apache.gossip.udp.UdpSharedDataMessage; - -public class SharedDataMessageHandler implements MessageHandler{ - @Override - public void invoke(GossipCore gossipCore, GossipManager gossipManager, Base base) { - UdpSharedDataMessage message = (UdpSharedDataMessage) base; - gossipCore.addSharedData(message); - } -} http://git-wip-us.apache.org/repos/asf/incubator-gossip/blob/298b1ae3/src/main/java/org/apache/gossip/manager/handlers/ShutdownMessageHandler.java ---------------------------------------------------------------------- diff --git a/src/main/java/org/apache/gossip/manager/handlers/ShutdownMessageHandler.java b/src/main/java/org/apache/gossip/manager/handlers/ShutdownMessageHandler.java deleted file mode 100644 index a40c7a1..0000000 --- a/src/main/java/org/apache/gossip/manager/handlers/ShutdownMessageHandler.java +++ /dev/null @@ -1,38 +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.gossip.manager.handlers; - -import org.apache.gossip.manager.GossipCore; -import org.apache.gossip.manager.GossipManager; -import org.apache.gossip.model.Base; -import org.apache.gossip.model.PerNodeDataMessage; -import org.apache.gossip.model.ShutdownMessage; - -public class ShutdownMessageHandler implements MessageHandler { - @Override - public void invoke(GossipCore gossipCore, GossipManager gossipManager, Base base) { - ShutdownMessage s = (ShutdownMessage) base; - PerNodeDataMessage m = new PerNodeDataMessage(); - m.setKey(ShutdownMessage.PER_NODE_KEY); - m.setNodeId(s.getNodeId()); - m.setPayload(base); - m.setTimestamp(System.currentTimeMillis()); - m.setExpireAt(System.currentTimeMillis() + 30L * 1000L); - gossipCore.addPerNodeData(m); - } -} http://git-wip-us.apache.org/repos/asf/incubator-gossip/blob/298b1ae3/src/main/java/org/apache/gossip/manager/handlers/SimpleMessageInvoker.java ---------------------------------------------------------------------- diff --git a/src/main/java/org/apache/gossip/manager/handlers/SimpleMessageInvoker.java b/src/main/java/org/apache/gossip/manager/handlers/SimpleMessageInvoker.java deleted file mode 100644 index 0f410d2..0000000 --- a/src/main/java/org/apache/gossip/manager/handlers/SimpleMessageInvoker.java +++ /dev/null @@ -1,45 +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.gossip.manager.handlers; - -import org.apache.gossip.manager.GossipCore; -import org.apache.gossip.manager.GossipManager; -import org.apache.gossip.model.Base; - -public class SimpleMessageInvoker implements MessageInvoker { - final private Class<?> messageClass; - final private MessageHandler messageHandler; - - public SimpleMessageInvoker(Class<?> messageClass, MessageHandler messageHandler) { - if (messageClass == null || messageHandler == null) { - throw new NullPointerException(); - } - this.messageClass = messageClass; - this.messageHandler = messageHandler; - } - - @Override - public boolean invoke(GossipCore gossipCore, GossipManager gossipManager, Base base) { - if (messageClass.isAssignableFrom(base.getClass())) { - messageHandler.invoke(gossipCore, gossipManager, base); - return true; - } else { - return false; - } - } -} http://git-wip-us.apache.org/repos/asf/incubator-gossip/blob/298b1ae3/src/main/java/org/apache/gossip/manager/impl/OnlyProcessReceivedPassiveGossipThread.java ---------------------------------------------------------------------- diff --git a/src/main/java/org/apache/gossip/manager/impl/OnlyProcessReceivedPassiveGossipThread.java b/src/main/java/org/apache/gossip/manager/impl/OnlyProcessReceivedPassiveGossipThread.java deleted file mode 100644 index dff5056..0000000 --- a/src/main/java/org/apache/gossip/manager/impl/OnlyProcessReceivedPassiveGossipThread.java +++ /dev/null @@ -1,33 +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.gossip.manager.impl; - -import org.apache.gossip.manager.GossipCore; -import org.apache.gossip.manager.GossipManager; -import org.apache.gossip.manager.PassiveGossipThread; -import org.apache.log4j.Logger; - -public class OnlyProcessReceivedPassiveGossipThread extends PassiveGossipThread { - - public static final Logger LOGGER = Logger.getLogger(OnlyProcessReceivedPassiveGossipThread.class); - - public OnlyProcessReceivedPassiveGossipThread(GossipManager gossipManager, GossipCore gossipCore) { - super(gossipManager, gossipCore); - } - -} http://git-wip-us.apache.org/repos/asf/incubator-gossip/blob/298b1ae3/src/main/java/org/apache/gossip/model/ActiveGossipMessage.java ---------------------------------------------------------------------- diff --git a/src/main/java/org/apache/gossip/model/ActiveGossipMessage.java b/src/main/java/org/apache/gossip/model/ActiveGossipMessage.java deleted file mode 100644 index a3c45b8..0000000 --- a/src/main/java/org/apache/gossip/model/ActiveGossipMessage.java +++ /dev/null @@ -1,39 +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.gossip.model; - -import java.util.ArrayList; -import java.util.List; - -public class ActiveGossipMessage extends Base { - - private List<Member> members = new ArrayList<>(); - - public ActiveGossipMessage(){ - - } - - public List<Member> getMembers() { - return members; - } - - public void setMembers(List<Member> members) { - this.members = members; - } - -} http://git-wip-us.apache.org/repos/asf/incubator-gossip/blob/298b1ae3/src/main/java/org/apache/gossip/model/ActiveGossipOk.java ---------------------------------------------------------------------- diff --git a/src/main/java/org/apache/gossip/model/ActiveGossipOk.java b/src/main/java/org/apache/gossip/model/ActiveGossipOk.java deleted file mode 100644 index b54bf9a..0000000 --- a/src/main/java/org/apache/gossip/model/ActiveGossipOk.java +++ /dev/null @@ -1,22 +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.gossip.model; - -public class ActiveGossipOk extends Response { - -} http://git-wip-us.apache.org/repos/asf/incubator-gossip/blob/298b1ae3/src/main/java/org/apache/gossip/model/Base.java ---------------------------------------------------------------------- diff --git a/src/main/java/org/apache/gossip/model/Base.java b/src/main/java/org/apache/gossip/model/Base.java deleted file mode 100644 index 1b66310..0000000 --- a/src/main/java/org/apache/gossip/model/Base.java +++ /dev/null @@ -1,49 +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.gossip.model; - -import org.apache.gossip.udp.UdpActiveGossipMessage; -import org.apache.gossip.udp.UdpActiveGossipOk; -import org.apache.gossip.udp.UdpPerNodeDataMessage; -import org.apache.gossip.udp.UdpNotAMemberFault; -import org.apache.gossip.udp.UdpSharedDataMessage; - -import com.fasterxml.jackson.annotation.JsonTypeInfo; -import com.fasterxml.jackson.annotation.JsonSubTypes; -import com.fasterxml.jackson.annotation.JsonSubTypes.Type; - - -@JsonTypeInfo( - use = JsonTypeInfo.Id.CLASS, - include = JsonTypeInfo.As.PROPERTY, - property = "type") -@JsonSubTypes({ - @Type(value = ActiveGossipMessage.class, name = "ActiveGossipMessage"), - @Type(value = Fault.class, name = "Fault"), - @Type(value = ActiveGossipOk.class, name = "ActiveGossipOk"), - @Type(value = UdpActiveGossipOk.class, name = "UdpActiveGossipOk"), - @Type(value = UdpActiveGossipMessage.class, name = "UdpActiveGossipMessage"), - @Type(value = UdpNotAMemberFault.class, name = "UdpNotAMemberFault"), - @Type(value = PerNodeDataMessage.class, name = "PerNodeDataMessage"), - @Type(value = UdpPerNodeDataMessage.class, name = "UdpPerNodeDataMessage"), - @Type(value = SharedDataMessage.class, name = "SharedDataMessage"), - @Type(value = UdpSharedDataMessage.class, name = "UdpSharedDataMessage") - }) -public class Base { - -} http://git-wip-us.apache.org/repos/asf/incubator-gossip/blob/298b1ae3/src/main/java/org/apache/gossip/model/Fault.java ---------------------------------------------------------------------- diff --git a/src/main/java/org/apache/gossip/model/Fault.java b/src/main/java/org/apache/gossip/model/Fault.java deleted file mode 100644 index 3ba2508..0000000 --- a/src/main/java/org/apache/gossip/model/Fault.java +++ /dev/null @@ -1,40 +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.gossip.model; - -public abstract class Fault extends Response { - - private String exception; - - public Fault(){} - - public String getException() { - return exception; - } - - public void setException(String exception) { - this.exception = exception; - } - - @Override - public String toString() { - return "Fault [exception=" + exception + "]"; - } - -} - http://git-wip-us.apache.org/repos/asf/incubator-gossip/blob/298b1ae3/src/main/java/org/apache/gossip/model/Member.java ---------------------------------------------------------------------- diff --git a/src/main/java/org/apache/gossip/model/Member.java b/src/main/java/org/apache/gossip/model/Member.java deleted file mode 100644 index d86aad8..0000000 --- a/src/main/java/org/apache/gossip/model/Member.java +++ /dev/null @@ -1,87 +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.gossip.model; - -import java.util.Map; - -public class Member { - - private String cluster; - private String uri; - private String id; - private Long heartbeat; - private Map<String,String> properties; - - public Member(){ - - } - - public Member(String cluster, String uri, String id, Long heartbeat){ - this.cluster = cluster; - this.uri = uri; - this.id = id; - this.heartbeat = heartbeat; - } - - public String getCluster() { - return cluster; - } - - public void setCluster(String cluster) { - this.cluster = cluster; - } - - public String getUri() { - return uri; - } - - public void setUri(String uri) { - this.uri = uri; - } - - public String getId() { - return id; - } - - public void setId(String id) { - this.id = id; - } - - public Long getHeartbeat() { - return heartbeat; - } - - public void setHeartbeat(Long heartbeat) { - this.heartbeat = heartbeat; - } - - public Map<String, String> getProperties() { - return properties; - } - - public void setProperties(Map<String, String> properties) { - this.properties = properties; - } - - @Override - public String toString() { - return "Member [cluster=" + cluster + ", uri=" + uri + ", id=" + id + ", heartbeat=" - + heartbeat + ", properties=" + properties + "]"; - } - -} http://git-wip-us.apache.org/repos/asf/incubator-gossip/blob/298b1ae3/src/main/java/org/apache/gossip/model/Message.java ---------------------------------------------------------------------- diff --git a/src/main/java/org/apache/gossip/model/Message.java b/src/main/java/org/apache/gossip/model/Message.java deleted file mode 100644 index f6ed813..0000000 --- a/src/main/java/org/apache/gossip/model/Message.java +++ /dev/null @@ -1,22 +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.gossip.model; - -public class Message extends Base { - -} http://git-wip-us.apache.org/repos/asf/incubator-gossip/blob/298b1ae3/src/main/java/org/apache/gossip/model/NotAMemberFault.java ---------------------------------------------------------------------- diff --git a/src/main/java/org/apache/gossip/model/NotAMemberFault.java b/src/main/java/org/apache/gossip/model/NotAMemberFault.java deleted file mode 100644 index 21ffb07..0000000 --- a/src/main/java/org/apache/gossip/model/NotAMemberFault.java +++ /dev/null @@ -1,29 +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.gossip.model; - -public class NotAMemberFault extends Fault { - - public NotAMemberFault(){ - - } - - public NotAMemberFault(String message){ - this.setException(message); - } -} http://git-wip-us.apache.org/repos/asf/incubator-gossip/blob/298b1ae3/src/main/java/org/apache/gossip/model/PerNodeDataMessage.java ---------------------------------------------------------------------- diff --git a/src/main/java/org/apache/gossip/model/PerNodeDataMessage.java b/src/main/java/org/apache/gossip/model/PerNodeDataMessage.java deleted file mode 100644 index 2d1cdef..0000000 --- a/src/main/java/org/apache/gossip/model/PerNodeDataMessage.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.gossip.model; - -public class PerNodeDataMessage extends Base { - - private String nodeId; - private String key; - private Object payload; - private Long timestamp; - private Long expireAt; - - public String getNodeId() { - return nodeId; - } - public void setNodeId(String nodeId) { - this.nodeId = nodeId; - } - public String getKey() { - return key; - } - public void setKey(String key) { - this.key = key; - } - public Object getPayload() { - return payload; - } - public void setPayload(Object payload) { - this.payload = payload; - } - public Long getTimestamp() { - return timestamp; - } - public void setTimestamp(Long timestamp) { - this.timestamp = timestamp; - } - public Long getExpireAt() { - return expireAt; - } - public void setExpireAt(Long expireAt) { - this.expireAt = expireAt; - } - @Override - public String toString() { - return "GossipDataMessage [nodeId=" + nodeId + ", key=" + key + ", payload=" + payload - + ", timestamp=" + timestamp + ", expireAt=" + expireAt + "]"; - } - - - -} http://git-wip-us.apache.org/repos/asf/incubator-gossip/blob/298b1ae3/src/main/java/org/apache/gossip/model/Response.java ---------------------------------------------------------------------- diff --git a/src/main/java/org/apache/gossip/model/Response.java b/src/main/java/org/apache/gossip/model/Response.java deleted file mode 100644 index b3eef77..0000000 --- a/src/main/java/org/apache/gossip/model/Response.java +++ /dev/null @@ -1,22 +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.gossip.model; - -public abstract class Response extends Base { - -} http://git-wip-us.apache.org/repos/asf/incubator-gossip/blob/298b1ae3/src/main/java/org/apache/gossip/model/SharedDataMessage.java ---------------------------------------------------------------------- diff --git a/src/main/java/org/apache/gossip/model/SharedDataMessage.java b/src/main/java/org/apache/gossip/model/SharedDataMessage.java deleted file mode 100644 index e423be8..0000000 --- a/src/main/java/org/apache/gossip/model/SharedDataMessage.java +++ /dev/null @@ -1,64 +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.gossip.model; - -public class SharedDataMessage extends Base { - - private String nodeId; - private String key; - private Object payload; - private Long timestamp; - private Long expireAt; - - public String getNodeId() { - return nodeId; - } - public void setNodeId(String nodeId) { - this.nodeId = nodeId; - } - public String getKey() { - return key; - } - public void setKey(String key) { - this.key = key; - } - public Object getPayload() { - return payload; - } - public void setPayload(Object payload) { - this.payload = payload; - } - public Long getTimestamp() { - return timestamp; - } - public void setTimestamp(Long timestamp) { - this.timestamp = timestamp; - } - public Long getExpireAt() { - return expireAt; - } - public void setExpireAt(Long expireAt) { - this.expireAt = expireAt; - } - @Override - public String toString() { - return "SharedGossipDataMessage [nodeId=" + nodeId + ", key=" + key + ", payload=" + payload - + ", timestamp=" + timestamp + ", expireAt=" + expireAt + "]"; - } -} - http://git-wip-us.apache.org/repos/asf/incubator-gossip/blob/298b1ae3/src/main/java/org/apache/gossip/model/ShutdownMessage.java ---------------------------------------------------------------------- diff --git a/src/main/java/org/apache/gossip/model/ShutdownMessage.java b/src/main/java/org/apache/gossip/model/ShutdownMessage.java deleted file mode 100644 index 4bca508..0000000 --- a/src/main/java/org/apache/gossip/model/ShutdownMessage.java +++ /dev/null @@ -1,51 +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.gossip.model; - -public class ShutdownMessage extends Message { - - public static final String PER_NODE_KEY = "gossipcore.shutdowmessage"; - private long shutdownAtNanos; - private String nodeId; - - public ShutdownMessage(){ - - } - - public String getNodeId() { - return nodeId; - } - - public void setNodeId(String nodeId) { - this.nodeId = nodeId; - } - - public long getShutdownAtNanos() { - return shutdownAtNanos; - } - - public void setShutdownAtNanos(long shutdownAtNanos) { - this.shutdownAtNanos = shutdownAtNanos; - } - - @Override - public String toString() { - return "ShutdownMessage [shutdownAtNanos=" + shutdownAtNanos + ", nodeId=" + nodeId + "]"; - } - -} http://git-wip-us.apache.org/repos/asf/incubator-gossip/blob/298b1ae3/src/main/java/org/apache/gossip/model/SignedPayload.java ---------------------------------------------------------------------- diff --git a/src/main/java/org/apache/gossip/model/SignedPayload.java b/src/main/java/org/apache/gossip/model/SignedPayload.java deleted file mode 100644 index 9ffbcf1..0000000 --- a/src/main/java/org/apache/gossip/model/SignedPayload.java +++ /dev/null @@ -1,36 +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.gossip.model; - -public class SignedPayload extends Base{ - private byte [] data; - private byte [] signature; - public byte[] getData() { - return data; - } - public void setData(byte[] data) { - this.data = data; - } - public byte[] getSignature() { - return signature; - } - public void setSignature(byte[] signature) { - this.signature = signature; - } - -} http://git-wip-us.apache.org/repos/asf/incubator-gossip/blob/298b1ae3/src/main/java/org/apache/gossip/secure/KeyTool.java ---------------------------------------------------------------------- diff --git a/src/main/java/org/apache/gossip/secure/KeyTool.java b/src/main/java/org/apache/gossip/secure/KeyTool.java deleted file mode 100644 index 69f4e72..0000000 --- a/src/main/java/org/apache/gossip/secure/KeyTool.java +++ /dev/null @@ -1,57 +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.gossip.secure; - -import java.io.File; -import java.io.FileOutputStream; -import java.io.IOException; -import java.security.KeyPair; -import java.security.KeyPairGenerator; -import java.security.NoSuchAlgorithmException; -import java.security.NoSuchProviderException; -import java.security.PrivateKey; -import java.security.PublicKey; -import java.security.SecureRandom; - -public class KeyTool { - - public static void generatePubandPrivateKeyFiles(String path, String id) - throws NoSuchAlgorithmException, NoSuchProviderException, IOException{ - SecureRandom r = new SecureRandom(); - KeyPairGenerator keyGen = KeyPairGenerator.getInstance("DSA", "SUN"); - keyGen.initialize(1024, r); - KeyPair pair = keyGen.generateKeyPair(); - PrivateKey priv = pair.getPrivate(); - PublicKey pub = pair.getPublic(); - { - FileOutputStream sigfos = new FileOutputStream(new File(path, id)); - sigfos.write(priv.getEncoded()); - sigfos.close(); - } - { - FileOutputStream sigfos = new FileOutputStream(new File(path, id + ".pub")); - sigfos.write(pub.getEncoded()); - sigfos.close(); - } - } - - public static void main (String [] args) throws - NoSuchAlgorithmException, NoSuchProviderException, IOException{ - generatePubandPrivateKeyFiles(args[0], args[1]); - } -} http://git-wip-us.apache.org/repos/asf/incubator-gossip/blob/298b1ae3/src/main/java/org/apache/gossip/udp/Trackable.java ---------------------------------------------------------------------- diff --git a/src/main/java/org/apache/gossip/udp/Trackable.java b/src/main/java/org/apache/gossip/udp/Trackable.java deleted file mode 100644 index 9ecc7f2..0000000 --- a/src/main/java/org/apache/gossip/udp/Trackable.java +++ /dev/null @@ -1,30 +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.gossip.udp; - -public interface Trackable { - - String getUriFrom(); - - void setUriFrom(String uriFrom); - - String getUuid(); - - void setUuid(String uuid); - -} http://git-wip-us.apache.org/repos/asf/incubator-gossip/blob/298b1ae3/src/main/java/org/apache/gossip/udp/UdpActiveGossipMessage.java ---------------------------------------------------------------------- diff --git a/src/main/java/org/apache/gossip/udp/UdpActiveGossipMessage.java b/src/main/java/org/apache/gossip/udp/UdpActiveGossipMessage.java deleted file mode 100644 index b6e8101..0000000 --- a/src/main/java/org/apache/gossip/udp/UdpActiveGossipMessage.java +++ /dev/null @@ -1,49 +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.gossip.udp; - -import org.apache.gossip.model.ActiveGossipMessage; - -public class UdpActiveGossipMessage extends ActiveGossipMessage implements Trackable { - - private String uriFrom; - private String uuid; - - public String getUriFrom() { - return uriFrom; - } - - public void setUriFrom(String uriFrom) { - this.uriFrom = uriFrom; - } - - public String getUuid() { - return uuid; - } - - public void setUuid(String uuid) { - this.uuid = uuid; - } - - @Override - public String toString() { - return "UdpActiveGossipMessage [uriFrom=" + uriFrom + ", uuid=" + uuid + ", getMembers()=" - + getMembers() + "]"; - } - -} http://git-wip-us.apache.org/repos/asf/incubator-gossip/blob/298b1ae3/src/main/java/org/apache/gossip/udp/UdpActiveGossipOk.java ---------------------------------------------------------------------- diff --git a/src/main/java/org/apache/gossip/udp/UdpActiveGossipOk.java b/src/main/java/org/apache/gossip/udp/UdpActiveGossipOk.java deleted file mode 100644 index b70bb69..0000000 --- a/src/main/java/org/apache/gossip/udp/UdpActiveGossipOk.java +++ /dev/null @@ -1,44 +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.gossip.udp; - -import org.apache.gossip.model.ActiveGossipOk; - -public class UdpActiveGossipOk extends ActiveGossipOk implements Trackable { - - - private String uriFrom; - private String uuid; - - public String getUriFrom() { - return uriFrom; - } - - public void setUriFrom(String uriFrom) { - this.uriFrom = uriFrom; - } - - public String getUuid() { - return uuid; - } - - public void setUuid(String uuid) { - this.uuid = uuid; - } - -} http://git-wip-us.apache.org/repos/asf/incubator-gossip/blob/298b1ae3/src/main/java/org/apache/gossip/udp/UdpNotAMemberFault.java ---------------------------------------------------------------------- diff --git a/src/main/java/org/apache/gossip/udp/UdpNotAMemberFault.java b/src/main/java/org/apache/gossip/udp/UdpNotAMemberFault.java deleted file mode 100644 index 7afcb87..0000000 --- a/src/main/java/org/apache/gossip/udp/UdpNotAMemberFault.java +++ /dev/null @@ -1,46 +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.gossip.udp; - -import org.apache.gossip.model.NotAMemberFault; - -public class UdpNotAMemberFault extends NotAMemberFault implements Trackable{ - - public UdpNotAMemberFault(){ - - } - private String uriFrom; - private String uuid; - - public String getUriFrom() { - return uriFrom; - } - - public void setUriFrom(String uriFrom) { - this.uriFrom = uriFrom; - } - - public String getUuid() { - return uuid; - } - - public void setUuid(String uuid) { - this.uuid = uuid; - } - -} http://git-wip-us.apache.org/repos/asf/incubator-gossip/blob/298b1ae3/src/main/java/org/apache/gossip/udp/UdpPerNodeDataMessage.java ---------------------------------------------------------------------- diff --git a/src/main/java/org/apache/gossip/udp/UdpPerNodeDataMessage.java b/src/main/java/org/apache/gossip/udp/UdpPerNodeDataMessage.java deleted file mode 100644 index 6eb170a..0000000 --- a/src/main/java/org/apache/gossip/udp/UdpPerNodeDataMessage.java +++ /dev/null @@ -1,48 +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.gossip.udp; - -import org.apache.gossip.model.PerNodeDataMessage; - -public class UdpPerNodeDataMessage extends PerNodeDataMessage implements Trackable { - - private String uriFrom; - private String uuid; - - public String getUriFrom() { - return uriFrom; - } - - public void setUriFrom(String uriFrom) { - this.uriFrom = uriFrom; - } - - public String getUuid() { - return uuid; - } - - public void setUuid(String uuid) { - this.uuid = uuid; - } - - @Override - public String toString() { - return "UdpGossipDataMessage [uriFrom=" + uriFrom + ", uuid=" + uuid + "]"; - } - -} http://git-wip-us.apache.org/repos/asf/incubator-gossip/blob/298b1ae3/src/main/java/org/apache/gossip/udp/UdpSharedDataMessage.java ---------------------------------------------------------------------- diff --git a/src/main/java/org/apache/gossip/udp/UdpSharedDataMessage.java b/src/main/java/org/apache/gossip/udp/UdpSharedDataMessage.java deleted file mode 100644 index 1658503..0000000 --- a/src/main/java/org/apache/gossip/udp/UdpSharedDataMessage.java +++ /dev/null @@ -1,50 +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.gossip.udp; - -import org.apache.gossip.model.SharedDataMessage; - -public class UdpSharedDataMessage extends SharedDataMessage implements Trackable { - - private String uriFrom; - private String uuid; - - public String getUriFrom() { - return uriFrom; - } - - public void setUriFrom(String uriFrom) { - this.uriFrom = uriFrom; - } - - public String getUuid() { - return uuid; - } - - public void setUuid(String uuid) { - this.uuid = uuid; - } - - @Override - public String toString() { - return "UdpSharedGossipDataMessage [uriFrom=" + uriFrom + ", uuid=" + uuid + ", getNodeId()=" - + getNodeId() + ", getKey()=" + getKey() + ", getPayload()=" + getPayload() - + ", getTimestamp()=" + getTimestamp() + ", getExpireAt()=" + getExpireAt() + "]"; - } - -} http://git-wip-us.apache.org/repos/asf/incubator-gossip/blob/298b1ae3/src/main/resources/log4j.properties ---------------------------------------------------------------------- diff --git a/src/main/resources/log4j.properties b/src/main/resources/log4j.properties deleted file mode 100644 index e2a60e1..0000000 --- a/src/main/resources/log4j.properties +++ /dev/null @@ -1,20 +0,0 @@ -# Licensed 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. - -log4j.rootLogger=INFO,stdout - -log4j.appender.stdout=org.apache.log4j.ConsoleAppender -log4j.appender.stdout.layout=org.apache.log4j.PatternLayout -log4j.appender.stdout.layout.ConversionPattern=%5p %d{HH:mm:ss,SSS} %m%n - -log4j.logger.io.teknek=DEBUG -log4j.logger.com.google.code.gossip=INFO http://git-wip-us.apache.org/repos/asf/incubator-gossip/blob/298b1ae3/src/test/java/org/apache/gossip/AbstractIntegrationBase.java ---------------------------------------------------------------------- diff --git a/src/test/java/org/apache/gossip/AbstractIntegrationBase.java b/src/test/java/org/apache/gossip/AbstractIntegrationBase.java deleted file mode 100644 index 896157f..0000000 --- a/src/test/java/org/apache/gossip/AbstractIntegrationBase.java +++ /dev/null @@ -1,50 +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.gossip; - -import java.util.ArrayList; -import java.util.List; - -import org.apache.gossip.manager.GossipManager; -import org.junit.After; -import org.junit.Before; - -public abstract class AbstractIntegrationBase { - - List <GossipManager> nodes = new ArrayList<GossipManager>(); - - public void register(GossipManager manager){ - nodes.add(manager); - } - - @Before - public void before(){ - nodes = new ArrayList<GossipManager>(); - } - - @After - public void after(){ - for (GossipManager node: nodes){ - if (node !=null){ - node.shutdown(); - } - } - } - -}
