Updated Branches: refs/heads/master a1dbda1ed -> 40da0060a
adding events to notifier Project: http://git-wip-us.apache.org/repos/asf/incubator-stratos/repo Commit: http://git-wip-us.apache.org/repos/asf/incubator-stratos/commit/40da0060 Tree: http://git-wip-us.apache.org/repos/asf/incubator-stratos/tree/40da0060 Diff: http://git-wip-us.apache.org/repos/asf/incubator-stratos/diff/40da0060 Branch: refs/heads/master Commit: 40da0060ae6ada9d0291aabfbdc6d8da8bf81dc0 Parents: a1dbda1 Author: rekathiru <[email protected]> Authored: Fri Jan 10 13:22:41 2014 +0530 Committer: rekathiru <[email protected]> Committed: Fri Jan 10 13:22:41 2014 +0530 ---------------------------------------------------------------------- .../notifier/InstanceCleanupClusterEvent.java | 38 ++++++++++++++++ .../instance/notifier/InstanceCleanupEvent.java | 47 -------------------- .../notifier/InstanceCleanupMemberEvent.java | 38 ++++++++++++++++ ...InstanceCleanupNotifierMessageProcessor.java | 6 +-- 4 files changed, 79 insertions(+), 50 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/40da0060/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/event/instance/notifier/InstanceCleanupClusterEvent.java ---------------------------------------------------------------------- diff --git a/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/event/instance/notifier/InstanceCleanupClusterEvent.java b/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/event/instance/notifier/InstanceCleanupClusterEvent.java new file mode 100644 index 0000000..a7d4f38 --- /dev/null +++ b/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/event/instance/notifier/InstanceCleanupClusterEvent.java @@ -0,0 +1,38 @@ +/* + * 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.stratos.messaging.event.instance.notifier; + +import java.io.Serializable; + +/** + * This event is fired by SM when unsubscribe from cartridge to notify all the instances + * for the termination. So that instance which receives this event will perform + * the clean up task before the actual termination. + */ +public class InstanceCleanupClusterEvent extends InstanceNotifierEvent implements Serializable { + private String clusterId; + + public InstanceCleanupClusterEvent(String clusterId) { + this.clusterId = clusterId; + } + + public String getClusterId() { + return clusterId; + } +} http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/40da0060/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/event/instance/notifier/InstanceCleanupEvent.java ---------------------------------------------------------------------- diff --git a/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/event/instance/notifier/InstanceCleanupEvent.java b/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/event/instance/notifier/InstanceCleanupEvent.java deleted file mode 100644 index 3a95724..0000000 --- a/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/event/instance/notifier/InstanceCleanupEvent.java +++ /dev/null @@ -1,47 +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.stratos.messaging.event.instance.notifier; - -import java.io.Serializable; - -/** - * This event is fired by SM when AS requests to notify an instance - * for the termination. So that instance which receives this event will perform - * the clean up task before the actual termination. - */ -public class InstanceCleanupEvent extends InstanceNotifierEvent implements Serializable { - private String clusterId; - private String memberId; - - public InstanceCleanupEvent(String memberId) { - this.memberId = memberId; - } - - public String getClusterId() { - return clusterId; - } - - public String getMemberId() { - return memberId; - } - - public void setClusterId(String clusterId) { - this.clusterId = clusterId; - } -} http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/40da0060/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/event/instance/notifier/InstanceCleanupMemberEvent.java ---------------------------------------------------------------------- diff --git a/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/event/instance/notifier/InstanceCleanupMemberEvent.java b/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/event/instance/notifier/InstanceCleanupMemberEvent.java new file mode 100644 index 0000000..f9656dd --- /dev/null +++ b/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/event/instance/notifier/InstanceCleanupMemberEvent.java @@ -0,0 +1,38 @@ +/* + * 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.stratos.messaging.event.instance.notifier; + +import java.io.Serializable; + +/** + * This event is fired by SM when AS requests to notify an instance + * for the termination. So that instance which receives this event will perform + * the clean up task before the actual termination. + */ +public class InstanceCleanupMemberEvent extends InstanceNotifierEvent implements Serializable { + private String memberId; + + public InstanceCleanupMemberEvent(String memberId) { + this.memberId = memberId; + } + + public String getMemberId() { + return memberId; + } +} http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/40da0060/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/message/processor/instance/notifier/InstanceCleanupNotifierMessageProcessor.java ---------------------------------------------------------------------- diff --git a/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/message/processor/instance/notifier/InstanceCleanupNotifierMessageProcessor.java b/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/message/processor/instance/notifier/InstanceCleanupNotifierMessageProcessor.java index 4d515c8..cc9f174 100644 --- a/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/message/processor/instance/notifier/InstanceCleanupNotifierMessageProcessor.java +++ b/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/message/processor/instance/notifier/InstanceCleanupNotifierMessageProcessor.java @@ -20,7 +20,7 @@ package org.apache.stratos.messaging.message.processor.instance.notifier; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; -import org.apache.stratos.messaging.event.instance.notifier.InstanceCleanupEvent; +import org.apache.stratos.messaging.event.instance.notifier.InstanceCleanupMemberEvent; import org.apache.stratos.messaging.message.processor.MessageProcessor; import org.apache.stratos.messaging.util.Util; @@ -35,9 +35,9 @@ public class InstanceCleanupNotifierMessageProcessor extends MessageProcessor { @Override public boolean process(String type, String message, Object object) { - if (InstanceCleanupEvent.class.getName().equals(type)) { + if (InstanceCleanupMemberEvent.class.getName().equals(type)) { // Parse complete message and build event - InstanceCleanupEvent event = (InstanceCleanupEvent) Util.jsonToObject(message, InstanceCleanupEvent.class); + InstanceCleanupMemberEvent event = (InstanceCleanupMemberEvent) Util.jsonToObject(message, InstanceCleanupMemberEvent.class); // Notify event listeners notifyEventListeners(event);
